zxc_compress.c:rapidhash_withSeed:
  487|  25.5k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|  25.5k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|  25.5k|}
zxc_compress.c:rapidhash_internal:
  244|  25.5k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|  25.5k|  const uint8_t *p=(const uint8_t *)key;
  246|  25.5k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|  25.5k|  uint64_t a=0, b=0;
  248|  25.5k|  size_t i = len;
  249|  25.5k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|  25.5k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 1.60k, False: 23.9k]
  |  |  ------------------
  ------------------
  250|  1.60k|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 1.55k, False: 43]
  ------------------
  251|  1.55k|      seed ^= len;
  252|  1.55k|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 1.45k, False: 107]
  ------------------
  253|  1.45k|        const uint8_t* plast = p + len - 8;
  254|  1.45k|        a = rapid_read64(p);
  255|  1.45k|        b = rapid_read64(plast);
  256|  1.45k|      } else {
  257|    107|        const uint8_t* plast = p + len - 4;
  258|    107|        a = rapid_read32(p);
  259|    107|        b = rapid_read32(plast);
  260|    107|      }
  261|  1.55k|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 43, False: 0]
  ------------------
  262|     43|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|     43|      b = p[len>>1];
  264|     43|    } else
  265|      0|      a = b = 0;
  266|  23.9k|  } else {
  267|  23.9k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 17.4k, False: 6.49k]
  ------------------
  268|  17.4k|      uint64_t see1 = seed, see2 = seed;
  269|  17.4k|      uint64_t see3 = seed, see4 = seed;
  270|  17.4k|      uint64_t see5 = seed, see6 = seed;
  271|  17.4k|#ifdef RAPIDHASH_COMPACT
  272|  4.17M|      do {
  273|  4.17M|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|  4.17M|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|  4.17M|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|  4.17M|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|  4.17M|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|  4.17M|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|  4.17M|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|  4.17M|        p += 112;
  281|  4.17M|        i -= 112;
  282|  4.17M|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 4.16M, False: 17.4k]
  ------------------
  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|  17.4k|      seed ^= see1;
  315|  17.4k|      see2 ^= see3;
  316|  17.4k|      see4 ^= see5;
  317|  17.4k|      seed ^= see6;
  318|  17.4k|      see2 ^= see4;
  319|  17.4k|      seed ^= see2;
  320|  17.4k|    }
  321|  23.9k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 21.4k, False: 2.50k]
  ------------------
  322|  21.4k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  21.4k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 15.9k, False: 5.45k]
  ------------------
  324|  15.9k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  15.9k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 11.6k, False: 4.31k]
  ------------------
  326|  11.6k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  11.6k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 8.61k, False: 3.04k]
  ------------------
  328|  8.61k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  8.61k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 5.65k, False: 2.95k]
  ------------------
  330|  5.65k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  5.65k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 2.66k, False: 2.99k]
  ------------------
  332|  2.66k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  2.66k|                      }
  334|  5.65k|                  }
  335|  8.61k|              }
  336|  11.6k|          }
  337|  15.9k|      }
  338|  21.4k|    }
  339|  23.9k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|  23.9k|  }
  341|  25.5k|  a ^= secret[1];
  342|  25.5k|  b ^= seed;
  343|  25.5k|  rapid_mum(&a, &b);
  344|  25.5k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|  25.5k|}
zxc_compress.c:rapid_mix:
  209|  29.3M|  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|  58.6M| 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|    214| 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|  29.3M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  29.3M| #if defined(__SIZEOF_INT128__)
  159|  29.3M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  29.3M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  29.3M|   #endif
  165|       | #elif defined(_MSC_VER) && (defined(_WIN64) || defined(_M_HYBRID_CHPE_ARM64))
  166|       |   #if defined(_M_X64)
  167|       |     #ifdef RAPIDHASH_PROTECTED
  168|       |     uint64_t a, b;
  169|       |     a=_umul128(*A,*B,&b);
  170|       |     *A^=a;  *B^=b;
  171|       |     #else
  172|       |     *A=_umul128(*A,*B,B);
  173|       |     #endif
  174|       |   #else
  175|       |     #ifdef RAPIDHASH_PROTECTED
  176|       |     uint64_t a, b;
  177|       |     b = __umulh(*A, *B);
  178|       |     a = *A * *B;
  179|       |     *A^=a;  *B^=b;
  180|       |     #else
  181|       |     uint64_t c = __umulh(*A, *B);
  182|       |     *A = *A * *B;
  183|       |     *B = c;
  184|       |     #endif
  185|       |   #endif
  186|       | #else
  187|       |   uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B;
  188|       |   uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl;
  189|       |   uint64_t lo=t+(rm1<<32); 
  190|       |   c+=lo<t; 
  191|       |   uint64_t hi=rh+(rm0>>32)+(rm1>>32)+c;
  192|       |   #ifdef RAPIDHASH_PROTECTED
  193|       |   *A^=lo;  *B^=hi;
  194|       |   #else
  195|       |   *A=lo;  *B=hi;
  196|       |   #endif
  197|       | #endif
  198|  29.3M| }
zxc_decompress.c:rapidhash_withSeed:
  487|  26.3k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_withSeed(const void *key, size_t len, uint64_t seed) RAPIDHASH_NOEXCEPT {
  488|  26.3k|  return rapidhash_internal(key, len, seed, rapid_secret);
  489|  26.3k|}
zxc_decompress.c:rapidhash_internal:
  244|  26.3k|RAPIDHASH_INLINE_CONSTEXPR uint64_t rapidhash_internal(const void *key, size_t len, uint64_t seed, const uint64_t* secret) RAPIDHASH_NOEXCEPT {
  245|  26.3k|  const uint8_t *p=(const uint8_t *)key;
  246|  26.3k|  seed ^= rapid_mix(seed ^ secret[2], secret[1]);
  247|  26.3k|  uint64_t a=0, b=0;
  248|  26.3k|  size_t i = len;
  249|  26.3k|  if (_likely_(len <= 16)) {
  ------------------
  |  |  107|  26.3k| # define _likely_(x)  __builtin_expect(x,1)
  |  |  ------------------
  |  |  |  Branch (107:24): [True: 1.05k, False: 25.2k]
  |  |  ------------------
  ------------------
  250|  1.05k|    if (len >= 4) {
  ------------------
  |  Branch (250:9): [True: 927, False: 132]
  ------------------
  251|    927|      seed ^= len;
  252|    927|      if (len >= 8) {
  ------------------
  |  Branch (252:11): [True: 860, False: 67]
  ------------------
  253|    860|        const uint8_t* plast = p + len - 8;
  254|    860|        a = rapid_read64(p);
  255|    860|        b = rapid_read64(plast);
  256|    860|      } else {
  257|     67|        const uint8_t* plast = p + len - 4;
  258|     67|        a = rapid_read32(p);
  259|     67|        b = rapid_read32(plast);
  260|     67|      }
  261|    927|    } else if (len > 0) {
  ------------------
  |  Branch (261:16): [True: 30, False: 102]
  ------------------
  262|     30|      a = (((uint64_t)p[0])<<45)|p[len-1];
  263|     30|      b = p[len>>1];
  264|     30|    } else
  265|    102|      a = b = 0;
  266|  25.2k|  } else {
  267|  25.2k|    if (len > 112) {
  ------------------
  |  Branch (267:9): [True: 20.7k, False: 4.57k]
  ------------------
  268|  20.7k|      uint64_t see1 = seed, see2 = seed;
  269|  20.7k|      uint64_t see3 = seed, see4 = seed;
  270|  20.7k|      uint64_t see5 = seed, see6 = seed;
  271|  20.7k|#ifdef RAPIDHASH_COMPACT
  272|  5.00M|      do {
  273|  5.00M|        seed = rapid_mix(rapid_read64(p) ^ secret[0], rapid_read64(p + 8) ^ seed);
  274|  5.00M|        see1 = rapid_mix(rapid_read64(p + 16) ^ secret[1], rapid_read64(p + 24) ^ see1);
  275|  5.00M|        see2 = rapid_mix(rapid_read64(p + 32) ^ secret[2], rapid_read64(p + 40) ^ see2);
  276|  5.00M|        see3 = rapid_mix(rapid_read64(p + 48) ^ secret[3], rapid_read64(p + 56) ^ see3);
  277|  5.00M|        see4 = rapid_mix(rapid_read64(p + 64) ^ secret[4], rapid_read64(p + 72) ^ see4);
  278|  5.00M|        see5 = rapid_mix(rapid_read64(p + 80) ^ secret[5], rapid_read64(p + 88) ^ see5);
  279|  5.00M|        see6 = rapid_mix(rapid_read64(p + 96) ^ secret[6], rapid_read64(p + 104) ^ see6);
  280|  5.00M|        p += 112;
  281|  5.00M|        i -= 112;
  282|  5.00M|      } while(i > 112);
  ------------------
  |  Branch (282:15): [True: 4.98M, False: 20.7k]
  ------------------
  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|  20.7k|      seed ^= see1;
  315|  20.7k|      see2 ^= see3;
  316|  20.7k|      see4 ^= see5;
  317|  20.7k|      seed ^= see6;
  318|  20.7k|      see2 ^= see4;
  319|  20.7k|      seed ^= see2;
  320|  20.7k|    }
  321|  25.2k|    if (i > 16) {
  ------------------
  |  Branch (321:9): [True: 22.2k, False: 3.02k]
  ------------------
  322|  22.2k|      seed = rapid_mix(rapid_read64(p) ^ secret[2], rapid_read64(p + 8) ^ seed);
  323|  22.2k|      if (i > 32) {
  ------------------
  |  Branch (323:11): [True: 17.6k, False: 4.66k]
  ------------------
  324|  17.6k|          seed = rapid_mix(rapid_read64(p + 16) ^ secret[2], rapid_read64(p + 24) ^ seed);
  325|  17.6k|          if (i > 48) {
  ------------------
  |  Branch (325:15): [True: 13.5k, False: 4.02k]
  ------------------
  326|  13.5k|              seed = rapid_mix(rapid_read64(p + 32) ^ secret[1], rapid_read64(p + 40) ^ seed);
  327|  13.5k|              if (i > 64) {
  ------------------
  |  Branch (327:19): [True: 10.0k, False: 3.54k]
  ------------------
  328|  10.0k|                  seed = rapid_mix(rapid_read64(p + 48) ^ secret[1], rapid_read64(p + 56) ^ seed);
  329|  10.0k|                  if (i > 80) {
  ------------------
  |  Branch (329:23): [True: 6.64k, False: 3.39k]
  ------------------
  330|  6.64k|                      seed = rapid_mix(rapid_read64(p + 64) ^ secret[2], rapid_read64(p + 72) ^ seed);
  331|  6.64k|                      if (i > 96) {
  ------------------
  |  Branch (331:27): [True: 3.16k, False: 3.47k]
  ------------------
  332|  3.16k|                          seed = rapid_mix(rapid_read64(p + 80) ^ secret[1], rapid_read64(p + 88) ^ seed);
  333|  3.16k|                      }
  334|  6.64k|                  }
  335|  10.0k|              }
  336|  13.5k|          }
  337|  17.6k|      }
  338|  22.2k|    }
  339|  25.2k|    a=rapid_read64(p+i-16) ^ i;  b=rapid_read64(p+i-8);
  340|  25.2k|  }
  341|  26.3k|  a ^= secret[1];
  342|  26.3k|  b ^= seed;
  343|  26.3k|  rapid_mum(&a, &b);
  344|  26.3k|  return rapid_mix(a ^ secret[7], b ^ secret[1] ^ i);
  345|  26.3k|}
zxc_decompress.c:rapid_mix:
  209|  35.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|  70.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|    134| 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|  35.2M| RAPIDHASH_INLINE_CONSTEXPR void rapid_mum(uint64_t *A, uint64_t *B) RAPIDHASH_NOEXCEPT {
  158|  35.2M| #if defined(__SIZEOF_INT128__)
  159|  35.2M|   __uint128_t r=*A; r*=*B;
  160|       |   #ifdef RAPIDHASH_PROTECTED
  161|       |   *A^=(uint64_t)r; *B^=(uint64_t)(r>>64);
  162|       |   #else
  163|  35.2M|   *A=(uint64_t)r; *B=(uint64_t)(r>>64);
  164|  35.2M|   #endif
  165|       | #elif defined(_MSC_VER) && (defined(_WIN64) || defined(_M_HYBRID_CHPE_ARM64))
  166|       |   #if defined(_M_X64)
  167|       |     #ifdef RAPIDHASH_PROTECTED
  168|       |     uint64_t a, b;
  169|       |     a=_umul128(*A,*B,&b);
  170|       |     *A^=a;  *B^=b;
  171|       |     #else
  172|       |     *A=_umul128(*A,*B,B);
  173|       |     #endif
  174|       |   #else
  175|       |     #ifdef RAPIDHASH_PROTECTED
  176|       |     uint64_t a, b;
  177|       |     b = __umulh(*A, *B);
  178|       |     a = *A * *B;
  179|       |     *A^=a;  *B^=b;
  180|       |     #else
  181|       |     uint64_t c = __umulh(*A, *B);
  182|       |     *A = *A * *B;
  183|       |     *B = c;
  184|       |     #endif
  185|       |   #endif
  186|       | #else
  187|       |   uint64_t ha=*A>>32, hb=*B>>32, la=(uint32_t)*A, lb=(uint32_t)*B;
  188|       |   uint64_t rh=ha*hb, rm0=ha*lb, rm1=hb*la, rl=la*lb, t=rl+(rm0<<32), c=t<rl;
  189|       |   uint64_t lo=t+(rm1<<32); 
  190|       |   c+=lo<t; 
  191|       |   uint64_t hi=rh+(rm0>>32)+(rm1>>32)+c;
  192|       |   #ifdef RAPIDHASH_PROTECTED
  193|       |   *A^=lo;  *B^=hi;
  194|       |   #else
  195|       |   *A=lo;  *B=hi;
  196|       |   #endif
  197|       | #endif
  198|  35.2M| }

zxc_cctx_init_in_workspace:
  243|  66.4k|                               const int defer_entropy_scratch) {
  244|  66.4k|    if (UNLIKELY(!ctx || !workspace || chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|   265k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  |  Branch (152:42): [True: 0, False: 66.4k]
  |  |  |  Branch (152:42): [True: 0, False: 66.4k]
  |  |  |  Branch (152:42): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  245|       |
  246|  66.4k|    const zxc_cctx_layout_t layout =
  247|  66.4k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy_scratch);
  248|  66.4k|    if (UNLIKELY(workspace_size < layout.total)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  66.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  249|       |
  250|  66.4k|    ZXC_MEMSET(ctx, 0, sizeof(zxc_cctx_t));
  ------------------
  |  |  173|  66.4k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  251|  66.4k|    ctx->checksum_enabled = checksum_enabled;
  252|  66.4k|    ctx->chunk_size = chunk_size;
  253|  66.4k|    const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  254|  66.4k|    ctx->offset_bits = offset_bits;
  255|  66.4k|    ctx->offset_mask = (uint32_t)((1ULL << offset_bits) - 1);
  256|  66.4k|    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|  66.4k|    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|  66.4k|    ctx->dict_size = dict_size;
  266|  66.4k|    if (dict_size > 0) {
  ------------------
  |  Branch (266:9): [True: 0, False: 66.4k]
  ------------------
  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|  66.4k|    if (mode == 0) {
  ------------------
  |  Branch (272:9): [True: 44.2k, False: 22.2k]
  ------------------
  273|  44.2k|        ctx->work_buf = mem + layout.off_work;
  274|  44.2k|        ctx->work_buf_cap = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  372|  44.2k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  44.2k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  44.2k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  44.2k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  44.2k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  44.2k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  44.2k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  44.2k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  275|  44.2k|        ctx->lit_buffer = mem + layout.off_lit_dctx;
  276|  44.2k|        ctx->lit_buffer_cap = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  44.2k|#define ZXC_PAD_SIZE 32
  ------------------
  277|  44.2k|        if (layout.sz_pivco_dctx) {
  ------------------
  |  Branch (277:13): [True: 0, False: 44.2k]
  ------------------
  278|      0|            ctx->tok_buffer = mem + layout.off_tok_dctx;
  279|      0|            ctx->tok_buffer_cap = layout.sz_tok_dctx;
  280|      0|            ctx->pivco_scratch = mem + layout.off_pivco_dctx;
  281|      0|            ctx->pivco_scratch_cap = layout.sz_pivco_dctx;
  282|      0|        }
  283|  44.2k|        return ZXC_OK;
  284|  44.2k|    }
  285|       |
  286|  22.2k|    ctx->hash_table = (uint32_t*)(mem + layout.off_hash_pos);
  287|  22.2k|    ctx->hash_tags = mem + layout.off_hash_tags;
  288|  22.2k|    ctx->chain_table = (uint16_t*)(mem + layout.off_chain);
  289|  22.2k|    ctx->buf_sequences = (uint32_t*)(mem + layout.off_seq_union);
  290|  22.2k|    ctx->buf_offsets = (uint16_t*)(mem + layout.off_seq_union);
  291|  22.2k|    ctx->buf_tokens = mem + layout.off_seq_union + layout.max_seq * sizeof(uint16_t);
  292|  22.2k|    ctx->buf_split = ctx->buf_tokens + layout.max_seq;
  293|  22.2k|    ctx->buf_split_hist = (zxc_spl_match_split_hist_t*)(void*)(mem + layout.off_split_hist);
  294|  22.2k|    ctx->buf_extras = mem + layout.off_extras;
  295|  22.2k|    ctx->literals = mem + layout.off_lit_cctx;
  296|  22.2k|    if (layout.sz_opt) {
  ------------------
  |  Branch (296:9): [True: 8.20k, False: 13.9k]
  ------------------
  297|  8.20k|        ctx->opt_scratch = mem + layout.off_opt;
  298|  8.20k|        ctx->opt_scratch_cap = layout.sz_opt;
  299|  8.20k|    }
  300|       |
  301|  22.2k|    ctx->compression_level = level;
  302|  22.2k|    ctx->epoch = 1;
  303|       |
  304|  22.2k|    ZXC_MEMSET(ctx->hash_table, 0, layout.sz_hash_pos);
  ------------------
  |  |  173|  22.2k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  305|  22.2k|    ZXC_MEMSET(ctx->hash_tags, 0, layout.sz_hash_tags);
  ------------------
  |  |  173|  22.2k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  306|  22.2k|    return ZXC_OK;
  307|  66.4k|}
zxc_dict_snap_size:
  311|  22.2k|size_t zxc_dict_snap_size(const size_t dict_size) {
  312|       |    // List positions are 16-bit.
  313|  22.2k|    if (dict_size < ZXC_LZ_MIN_MATCH_LEN || dict_size > ZXC_DICT_SIZE_MAX) return 0;
  ------------------
  |  |  586|  44.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
                  if (dict_size < ZXC_LZ_MIN_MATCH_LEN || dict_size > ZXC_DICT_SIZE_MAX) return 0;
  ------------------
  |  |   94|      0|#define ZXC_DICT_SIZE_MAX ((1U << 16) - 1U)
  ------------------
  |  Branch (313:9): [True: 22.2k, False: 0]
  |  Branch (313:45): [True: 0, False: 0]
  ------------------
  314|      0|    return ZXC_DICT_SNAP_HDR_SIZE + ZXC_DICT_SNAP_TABLES_SIZE + dict_size * sizeof(uint16_t) +
  ------------------
  |  |  309|      0|#define ZXC_DICT_SNAP_HDR_SIZE ((sizeof(zxc_dict_snap_t) + 7) & ~(size_t)7)
  ------------------
                  return ZXC_DICT_SNAP_HDR_SIZE + ZXC_DICT_SNAP_TABLES_SIZE + dict_size * sizeof(uint16_t) +
  ------------------
  |  | 2094|      0|#define ZXC_DICT_SNAP_TABLES_SIZE (ZXC_LZ_HASH_SIZE * (sizeof(uint32_t) + sizeof(uint8_t)))
  |  |  ------------------
  |  |  |  |  580|      0|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|      0|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  315|      0|           dict_size;
  316|  22.2k|}
zxc_cctx_init:
  344|  66.4k|                  const int level, const int checksum_enabled, const size_t dict_size) {
  345|       |    // Cleared first, so that zxc_cctx_free is safe after a failure.
  346|  66.4k|    ZXC_MEMSET(ctx, 0, sizeof(*ctx));
  ------------------
  |  |  173|  66.4k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  347|  66.4k|    if (UNLIKELY(chunk_size == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  66.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  348|       |    // Heap contexts defer the decode-side entropy scratch to the first entropy
  349|       |    // section; static workspaces must have it already, they may never allocate.
  350|  66.4k|    const int defer_entropy = (mode == 0);
  351|  66.4k|    const size_t total =
  352|  66.4k|        compute_cctx_layout(chunk_size, mode, level, dict_size, defer_entropy).total;
  353|  66.4k|    if (UNLIKELY(total == 0)) return ZXC_ERROR_NULL_INPUT;
  ------------------
  |  |  152|  66.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  354|       |
  355|  66.4k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  66.4k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  356|  66.4k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;
  ------------------
  |  |  152|  66.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  357|       |
  358|  66.4k|    const int rc = zxc_cctx_init_in_workspace(ctx, mem, total, chunk_size, mode, level,
  359|  66.4k|                                              checksum_enabled, dict_size, defer_entropy);
  360|  66.4k|    if (UNLIKELY(rc != ZXC_OK)) {
  ------------------
  |  |  152|  66.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 66.4k]
  |  |  ------------------
  ------------------
  361|       |        // LCOV_EXCL_START
  362|      0|        ZXC_ALIGNED_FREE(mem);
  ------------------
  |  |  137|      0|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  363|      0|        return rc;
  364|       |        // LCOV_EXCL_STOP
  365|      0|    }
  366|       |    // Library-owned buffer: record the allocation so zxc_cctx_free frees it.
  367|  66.4k|    ctx->memory_block = mem;
  368|       |    // Allocated with the workspace, so that blocks never allocate.
  369|  66.4k|    if (mode == 1) ctx->dict_snap = zxc_dict_snap_create(dict_size);
  ------------------
  |  Branch (369:9): [True: 22.2k, False: 44.2k]
  ------------------
  370|  66.4k|    return ZXC_OK;
  371|  66.4k|}
zxc_cctx_alloc_entropy_scratch:
  381|  4.86k|int zxc_cctx_alloc_entropy_scratch(zxc_cctx_t* ctx) {
  382|  4.86k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  146|  4.86k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 0, False: 4.86k]
  |  |  ------------------
  ------------------
  383|       |
  384|       |    // Sized for the block the context was carved for, not chunk_size: a reader
  385|       |    // over frames of several block sizes lowers chunk_size per block.
  386|  4.86k|    size_t sz_tok = 0;
  387|  4.86k|    size_t sz_pivco = 0;
  388|  4.86k|    zxc_dctx_entropy_sizes(ctx->work_buf_cap - ZXC_DECOMPRESS_TAIL_PAD, &sz_tok, &sz_pivco);
  ------------------
  |  |  372|  4.86k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  4.86k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  4.86k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  4.86k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  4.86k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  4.86k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  4.86k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  4.86k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  389|  4.86k|    const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  384|  4.86k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const size_t total = ZXC_ALIGN_CL(sz_tok) + ZXC_ALIGN_CL(sz_pivco);
  ------------------
  |  |  384|  4.86k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  390|       |
  391|  4.86k|    uint8_t* const mem = (uint8_t*)ZXC_ALIGNED_MALLOC(total, ZXC_CACHE_LINE_SIZE);
  ------------------
  |  |  134|  4.86k|#define ZXC_ALIGNED_MALLOC(size, alignment) zxc_aligned_malloc(size, alignment)
  ------------------
  392|  4.86k|    if (UNLIKELY(!mem)) return ZXC_ERROR_MEMORY;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|  4.86k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 4.86k]
  |  |  ------------------
  ------------------
  393|       |
  394|  4.86k|    ctx->entropy_block = mem;
  395|  4.86k|    ctx->tok_buffer = mem;
  396|  4.86k|    ctx->tok_buffer_cap = sz_tok;
  397|  4.86k|    ctx->pivco_scratch = mem + ZXC_ALIGN_CL(sz_tok);
  ------------------
  |  |  384|  4.86k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  4.86k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  4.86k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  398|  4.86k|    ctx->pivco_scratch_cap = sz_pivco;
  399|  4.86k|    return ZXC_OK;
  400|  4.86k|}
zxc_cctx_free:
  408|  66.4k|void zxc_cctx_free(zxc_cctx_t* ctx) {
  409|  66.4k|    if (ctx->memory_block) {
  ------------------
  |  Branch (409:9): [True: 66.4k, False: 0]
  ------------------
  410|  66.4k|        ZXC_ALIGNED_FREE(ctx->memory_block);
  ------------------
  |  |  137|  66.4k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  411|  66.4k|        ctx->memory_block = NULL;
  412|  66.4k|    }
  413|  66.4k|    if (ctx->entropy_block) {
  ------------------
  |  Branch (413:9): [True: 4.86k, False: 61.6k]
  ------------------
  414|  4.86k|        ZXC_ALIGNED_FREE(ctx->entropy_block);
  ------------------
  |  |  137|  4.86k|#define ZXC_ALIGNED_FREE(ptr) zxc_aligned_free(ptr)
  ------------------
  415|  4.86k|        ctx->entropy_block = NULL;
  416|  4.86k|    }
  417|  66.4k|    ZXC_FREE(ctx->dict_snap);
  ------------------
  |  |   86|  66.4k|#define ZXC_FREE(ptr) free(ptr)
  ------------------
  418|  66.4k|    ctx->dict_snap = NULL;
  419|  66.4k|    ctx->dict_buffer_gen = 0;
  420|       |
  421|  66.4k|    ctx->lit_buffer = NULL;
  422|  66.4k|    ctx->hash_table = NULL;
  423|  66.4k|    ctx->hash_tags = NULL;
  424|  66.4k|    ctx->chain_table = NULL;
  425|  66.4k|    ctx->buf_sequences = NULL;
  426|  66.4k|    ctx->buf_tokens = NULL;
  427|  66.4k|    ctx->buf_offsets = NULL;
  428|  66.4k|    ctx->buf_extras = NULL;
  429|  66.4k|    ctx->buf_split = NULL;
  430|  66.4k|    ctx->buf_split_hist = NULL;
  431|  66.4k|    ctx->literals = NULL;
  432|  66.4k|    ctx->work_buf = NULL;
  433|  66.4k|    ctx->tok_buffer = NULL;
  434|  66.4k|    ctx->pivco_scratch = NULL;
  435|  66.4k|    ctx->opt_scratch = NULL;
  436|  66.4k|    ctx->dict_buffer = NULL;
  437|  66.4k|    ctx->dict_huf = NULL;
  438|       |
  439|  66.4k|    ctx->epoch = 0;
  440|  66.4k|    ctx->lit_buffer_cap = 0;
  441|  66.4k|    ctx->work_buf_cap = 0;
  442|  66.4k|    ctx->tok_buffer_cap = 0;
  443|  66.4k|    ctx->pivco_scratch_cap = 0;
  444|  66.4k|    ctx->opt_scratch_cap = 0;
  445|  66.4k|    ctx->dict_buffer_cap = 0;
  446|  66.4k|    ctx->dict_size = 0;
  447|  66.4k|    ctx->dict_huf_tree_ok = 0;
  448|       |    ctx->lit_freq_acc = NULL;
  449|  66.4k|}
zxc_write_block_header:
  710|  47.9k|                           const zxc_block_header_t* RESTRICT bh) {
  711|  47.9k|    if (UNLIKELY(dst_capacity < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  47.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 47.9k]
  |  |  ------------------
  ------------------
  712|       |
  713|  47.9k|    dst[0] = bh->block_type;
  714|  47.9k|    dst[1] = 0;  // Flags not used currently
  715|  47.9k|    dst[2] = 0;  // Reserved
  716|  47.9k|    zxc_store_le32(dst + 3, bh->comp_size);
  717|  47.9k|    dst[7] = 0;               // Zero before hashing
  718|  47.9k|    dst[7] = zxc_hash8(dst);  // Checksum at the end
  719|       |
  720|  47.9k|    return ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  47.9k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  721|  47.9k|}
zxc_write_spl_header_and_desc:
  964|  28.8k|                                  const uint32_t tok_comp) {
  965|  28.8k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  966|  28.8k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  443|  28.8k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  967|       |
  968|  28.8k|    if (UNLIKELY(rem < needed)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  28.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 28.8k]
  |  |  ------------------
  ------------------
  969|       |
  970|  28.8k|    zxc_write_gnr_header(dst, gh);
  971|  28.8k|    uint8_t* p = dst + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  443|  28.8k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  972|       |
  973|  28.8k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (973:9): [True: 16.7k, False: 12.1k]
  ------------------
  974|  16.7k|        zxc_store_le32(p, lit_comp);
  975|  16.7k|        p += sizeof(uint32_t);
  976|  16.7k|    }
  977|  28.8k|    if (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) {
  ------------------
  |  Branch (977:9): [True: 6.39k, False: 22.4k]
  ------------------
  978|  6.39k|        zxc_store_le32(p, tok_comp);
  979|  6.39k|    }
  980|       |
  981|  28.8k|    return (int)needed;
  982|  28.8k|}
zxc_read_spl_header_and_desc:
  989|  42.4k|                                 uint32_t* RESTRICT tok_comp) {
  990|  42.4k|    if (UNLIKELY(len < ZXC_SPL_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  42.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 64, False: 42.4k]
  |  |  ------------------
  ------------------
  991|       |
  992|  42.4k|    zxc_read_gnr_header(src, gh);
  993|       |
  994|  42.4k|    const size_t desc_sz = zxc_spl_desc_size(gh->enc_lit, gh->enc_tok);
  995|  42.4k|    const size_t needed = ZXC_SPL_HEADER_BINARY_SIZE + desc_sz;
  ------------------
  |  |  443|  42.4k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  996|  42.4k|    if (UNLIKELY(len < needed)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  42.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 42.4k]
  |  |  ------------------
  ------------------
  997|       |
  998|  42.4k|    const uint8_t* p = src + ZXC_SPL_HEADER_BINARY_SIZE;
  ------------------
  |  |  443|  42.4k|#define ZXC_SPL_HEADER_BINARY_SIZE 12
  ------------------
  999|       |
 1000|  42.4k|    if (gh->enc_lit != ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (1000:9): [True: 26.3k, False: 16.0k]
  ------------------
 1001|  26.3k|        *lit_comp = zxc_le32(p);
 1002|  26.3k|        p += sizeof(uint32_t);
 1003|  26.3k|    } else {
 1004|  16.0k|        *lit_comp = gh->n_literals;
 1005|  16.0k|    }
 1006|  42.4k|    *tok_comp = (gh->enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? zxc_le32(p) : gh->n_sequences;
  ------------------
  |  Branch (1006:17): [True: 19.9k, False: 22.4k]
  ------------------
 1007|       |
 1008|  42.4k|    return (int)needed;
 1009|  42.4k|}
zxc_write_pak_header:
 1020|  8.55k|                         const zxc_gnr_header_t* RESTRICT gh) {
 1021|  8.55k|    if (UNLIKELY(rem < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  8.55k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.55k]
  |  |  ------------------
  ------------------
 1022|       |
 1023|  8.55k|    zxc_write_gnr_header(dst, gh);
 1024|  8.55k|    return ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  445|  8.55k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 1025|  8.55k|}
zxc_read_pak_header:
 1031|  10.3k|                        zxc_gnr_header_t* RESTRICT gh) {
 1032|  10.3k|    if (UNLIKELY(len < ZXC_PAK_HEADER_BINARY_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  10.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 10.3k]
  |  |  ------------------
  ------------------
 1033|       |
 1034|  10.3k|    zxc_read_gnr_header(src, gh);
 1035|  10.3k|    return ZXC_OK;
 1036|  10.3k|}
zxc_compress_block_bound:
 1070|  22.2k|size_t zxc_compress_block_bound(const size_t input_size) {
 1071|       |    // Mirrors the Block API contract: outside [1, ZXC_BLOCK_SIZE_MAX] the call
 1072|       |    // would fail anyway, so the bound is undefined and 0 says "unusable". The cap
 1073|       |    // also makes the addition below trivially overflow-free.
 1074|  22.2k|    if (UNLIKELY(input_size == 0 || input_size > ZXC_BLOCK_SIZE_MAX)) return 0;
  ------------------
  |  |  152|  44.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 22.2k]
  |  |  |  Branch (152:42): [True: 0, False: 22.2k]
  |  |  |  Branch (152:42): [True: 0, False: 22.2k]
  |  |  ------------------
  ------------------
 1075|       |    // Outer block header + payload (worst case: incompressible, raw bytes)
 1076|       |    // + inner format overhead + optional checksum.
 1077|  22.2k|    return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  439|  22.2k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                  return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  457|  22.2k|#define ZXC_BLOCK_FORMAT_OVERHEAD 68
  ------------------
                  return ZXC_BLOCK_HEADER_SIZE + input_size + ZXC_BLOCK_FORMAT_OVERHEAD + ZXC_BLOCK_CHECKSUM_SIZE;
  ------------------
  |  |  441|  22.2k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
 1078|  22.2k|}
zxc_max_level:
 1198|  22.2k|int zxc_max_level(void) { return ZXC_LEVEL_ULTRA; }
zxc_common.c:compute_cctx_layout:
  122|   132k|                                             const int defer_entropy_scratch) {
  123|   132k|    zxc_cctx_layout_t layout = {0};
  124|       |
  125|   132k|    const size_t max_seq = zxc_cctx_max_seq(chunk_size);
  126|       |
  127|   132k|    if (mode == 0) {
  ------------------
  |  Branch (127:9): [True: 88.5k, False: 44.4k]
  ------------------
  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|  88.5k|        const size_t sz_work = chunk_size + ZXC_DECOMPRESS_TAIL_PAD;
  ------------------
  |  |  372|  88.5k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  88.5k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  88.5k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  88.5k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  88.5k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  88.5k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  88.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 */
  |  |  ------------------
  |  |  |  |  342|  88.5k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  132|  88.5k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  88.5k|#define ZXC_PAD_SIZE 32
  ------------------
  133|       |
  134|  88.5k|        layout.off_work = layout.total;
  135|  88.5k|        layout.total += ZXC_ALIGN_CL(sz_work);
  ------------------
  |  |  384|  88.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  88.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  88.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  88.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  88.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|  88.5k|        layout.off_lit_dctx = layout.total;
  137|  88.5k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  384|  88.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  88.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  88.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  88.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  88.5k|#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|  88.5k|        if (!defer_entropy_scratch) {
  ------------------
  |  Branch (143:13): [True: 0, False: 88.5k]
  ------------------
  144|      0|            size_t sz_tok = 0;
  145|      0|            size_t sz_pivco = 0;
  146|      0|            zxc_dctx_entropy_sizes(chunk_size, &sz_tok, &sz_pivco);
  147|      0|            layout.sz_tok_dctx = sz_tok;
  148|      0|            layout.off_tok_dctx = layout.total;
  149|      0|            layout.total += ZXC_ALIGN_CL(layout.sz_tok_dctx);
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|      0|            layout.sz_pivco_dctx = sz_pivco;
  151|      0|            layout.off_pivco_dctx = layout.total;
  152|      0|            layout.total += ZXC_ALIGN_CL(layout.sz_pivco_dctx);
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|      0|        }
  154|  88.5k|    } else {
  155|       |        // Compress: 7 partitions + optional opt_scratch at level >= ZXC_LEVEL_DENSITY.
  156|  44.4k|        const uint32_t offset_bits = zxc_log2_u32((uint32_t)chunk_size);
  157|  44.4k|        layout.max_seq = max_seq;
  158|  44.4k|        layout.sz_hash_pos = ZXC_LZ_HASH_SIZE * sizeof(uint32_t);
  ------------------
  |  |  580|  44.4k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|  44.4k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  159|  44.4k|        layout.sz_hash_tags = ZXC_LZ_HASH_SIZE * sizeof(uint8_t);
  ------------------
  |  |  580|  44.4k|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  ------------------
  |  |  |  |  578|  44.4k|#define ZXC_LZ_HASH_BITS 15
  |  |  ------------------
  ------------------
  160|  44.4k|        const size_t sz_chain = ZXC_LZ_WINDOW_SIZE * sizeof(uint16_t);
  ------------------
  |  |  582|  44.4k|#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|  44.4k|        const size_t sz_seq_union = layout.max_seq * sizeof(uint32_t);
  164|  44.4k|        const size_t vbyte_len = (offset_bits + 6) / 7;
  165|  44.4k|        const size_t sz_extras = layout.max_seq * 2 * vbyte_len;
  166|  44.4k|        const size_t sz_lit = chunk_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  44.4k|#define ZXC_PAD_SIZE 32
  ------------------
  167|       |
  168|       |        // opt_scratch (level >= ZXC_LEVEL_DENSITY): the optimal parser's DP arrays,
  169|       |        // reused transiently by the code-length builder and its nudge, so sized to
  170|       |        // the larger demand. Keep in sync with zxc_estimate_cctx_memory() and its
  171|       |        // consumer in zxc_compress.c.
  172|  44.4k|        if (level >= ZXC_LEVEL_DENSITY) {
  ------------------
  |  Branch (172:13): [True: 16.4k, False: 27.9k]
  ------------------
  173|  16.4k|            size_t sz_dp;
  174|  16.4k|            size_t sz_pl;
  175|  16.4k|            size_t sz_po;
  176|  16.4k|            size_t sz_bm;
  177|  16.4k|            zxc_opt_dp_sizes(chunk_size, &sz_dp, &sz_pl, &sz_po, &sz_bm);
  178|  16.4k|            const size_t dp_needed = sz_dp + sz_pl + sz_po + sz_bm;
  179|  16.4k|            layout.sz_opt =
  180|  16.4k|                (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1119|  16.4k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1117|  16.4k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              (dp_needed > ZXC_HUF_NUDGE_SCRATCH_SIZE) ? dp_needed : ZXC_HUF_NUDGE_SCRATCH_SIZE;
  ------------------
  |  | 1119|  26.8k|#define ZXC_HUF_NUDGE_SCRATCH_SIZE (ZXC_HUF_NUDGE_SCRATCH_OFF + sizeof(zxc_huf_nudge_ws_t))
  |  |  ------------------
  |  |  |  | 1117|  10.3k|#define ZXC_HUF_NUDGE_SCRATCH_OFF ZXC_ALIGN_CL(ZXC_HUF_BUILD_SCRATCH_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  384|  10.3k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  10.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  10.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  382|  10.3k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  380|  10.3k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (180:17): [True: 6.02k, False: 10.3k]
  ------------------
  181|  16.4k|        }
  182|       |
  183|  44.4k|        layout.off_hash_pos = layout.total;
  184|  44.4k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_pos);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  185|  44.4k|        layout.off_hash_tags = layout.total;
  186|  44.4k|        layout.total += ZXC_ALIGN_CL(layout.sz_hash_tags);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  187|  44.4k|        layout.off_chain = layout.total;
  188|  44.4k|        layout.total += ZXC_ALIGN_CL(sz_chain);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  189|  44.4k|        layout.off_seq_union = layout.total;
  190|  44.4k|        layout.total += ZXC_ALIGN_CL(sz_seq_union);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|  44.4k|        layout.off_split_hist = layout.total;
  192|  44.4k|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_spl_match_split_hist_t));
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  44.4k|        layout.off_extras = layout.total;
  194|  44.4k|        layout.total += ZXC_ALIGN_CL(sz_extras);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  195|  44.4k|        layout.off_lit_cctx = layout.total;
  196|  44.4k|        layout.total += ZXC_ALIGN_CL(sz_lit);
  ------------------
  |  |  384|  44.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  44.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  44.4k|#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|  44.4k|        if (layout.sz_opt) {
  ------------------
  |  Branch (199:13): [True: 16.4k, False: 27.9k]
  ------------------
  200|  16.4k|            layout.off_opt = layout.total;
  201|  16.4k|            layout.total += ZXC_ALIGN_CL(layout.sz_opt);
  ------------------
  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|  16.4k|        }
  203|  44.4k|    }
  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|   132k|    if (dict_size > 0) {
  ------------------
  |  Branch (207:9): [True: 0, False: 132k]
  ------------------
  208|      0|        layout.sz_dict = (mode == 1) ? (chunk_size + ZXC_DECOMPRESS_TAIL_PAD)
  ------------------
  |  |  372|      0|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|      0|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|      0|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|      0|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      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 */
  |  |  ------------------
  |  |  |  |  342|      0|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (208:26): [True: 0, False: 0]
  ------------------
  209|      0|                                     : (dict_size + chunk_size + ZXC_DECOMPRESS_TAIL_PAD);
  ------------------
  |  |  372|      0|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|      0|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|      0|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|      0|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|      0|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|      0|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|      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 */
  |  |  ------------------
  |  |  |  |  342|      0|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  210|      0|        layout.off_dict = layout.total;
  211|      0|        layout.total += ZXC_ALIGN_CL(layout.sz_dict);
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|      0|        layout.off_dict_huf = layout.total;
  213|      0|        layout.total += ZXC_ALIGN_CL(sizeof(zxc_dict_huf_state_t));
  ------------------
  |  |  384|      0|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|      0|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|      0|    }
  215|   132k|    return layout;
  216|   132k|}
zxc_common.c:zxc_cctx_max_seq:
   74|   137k|static ZXC_ALWAYS_INLINE size_t zxc_cctx_max_seq(const size_t chunk_size) {
   75|   137k|    return chunk_size / ZXC_LZ_MIN_MATCH_LEN + 16;
  ------------------
  |  |  586|   137k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
   76|   137k|}
zxc_common.c:zxc_dict_snap_create:
  319|  22.2k|static zxc_dict_snap_t* zxc_dict_snap_create(const size_t dict_size) {
  320|  22.2k|    const size_t total = zxc_dict_snap_size(dict_size);
  321|  22.2k|    if (total == 0) return NULL;
  ------------------
  |  Branch (321:9): [True: 22.2k, False: 0]
  ------------------
  322|      0|    uint8_t* const mem = (uint8_t*)ZXC_MALLOC(total);
  ------------------
  |  |   68|      0|#define ZXC_MALLOC(size) malloc(size)
  ------------------
  323|      0|    if (UNLIKELY(!mem)) return NULL;  // LCOV_EXCL_LINE
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  324|      0|    zxc_dict_snap_t* const snap = (zxc_dict_snap_t*)mem;
  325|      0|    ZXC_MEMSET(snap, 0, sizeof(*snap));
  ------------------
  |  |  173|      0|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  326|      0|    snap->capacity = dict_size;
  327|      0|    snap->tables = mem + ZXC_DICT_SNAP_HDR_SIZE;
  ------------------
  |  |  309|      0|#define ZXC_DICT_SNAP_HDR_SIZE ((sizeof(zxc_dict_snap_t) + 7) & ~(size_t)7)
  ------------------
  328|      0|    snap->chain = (uint16_t*)(snap->tables + ZXC_DICT_SNAP_TABLES_SIZE);
  ------------------
  |  | 2094|      0|#define ZXC_DICT_SNAP_TABLES_SIZE (ZXC_LZ_HASH_SIZE * (sizeof(uint32_t) + sizeof(uint8_t)))
  |  |  ------------------
  |  |  |  |  580|      0|#define ZXC_LZ_HASH_SIZE (1U << ZXC_LZ_HASH_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  578|      0|#define ZXC_LZ_HASH_BITS 15
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  329|      0|    snap->dict = (uint8_t*)(snap->chain + dict_size);
  330|      0|    return snap;
  331|      0|}
zxc_common.c:zxc_dctx_entropy_sizes:
   86|  4.86k|                                   size_t* RESTRICT sz_pivco) {
   87|  4.86k|    *sz_tok = zxc_cctx_max_seq(chunk_size) + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  4.86k|#define ZXC_PAD_SIZE 32
  ------------------
   88|  4.86k|    *sz_pivco = chunk_size + ZXC_PIVCO_SCRATCH_PAD;
  ------------------
  |  | 1939|  4.86k|#define ZXC_PIVCO_SCRATCH_PAD 32
  ------------------
   89|  4.86k|}
zxc_common.c:zxc_spl_desc_size:
  948|  71.2k|static ZXC_ALWAYS_INLINE size_t zxc_spl_desc_size(const uint8_t enc_lit, const uint8_t enc_tok) {
  949|  71.2k|    return ((enc_lit != ZXC_SECTION_ENCODING_RAW) ? sizeof(uint32_t) : 0) +
  ------------------
  |  Branch (949:13): [True: 43.1k, False: 28.1k]
  ------------------
  950|  71.2k|           ((enc_tok == ZXC_SECTION_ENCODING_HUFFMAN) ? sizeof(uint32_t) : 0);
  ------------------
  |  Branch (950:13): [True: 26.3k, False: 44.9k]
  ------------------
  951|  71.2k|}
zxc_common.c:zxc_write_gnr_header:
  916|  37.4k|                                                   const zxc_gnr_header_t* RESTRICT gh) {
  917|  37.4k|    zxc_store_le32(dst, gh->n_sequences);
  918|  37.4k|    zxc_store_le32(dst + 4, gh->n_literals);
  919|       |
  920|  37.4k|    dst[8] = gh->enc_lit;
  921|  37.4k|    dst[9] = gh->enc_tok;
  922|  37.4k|    dst[10] = gh->enc_mlen;
  923|  37.4k|    dst[11] = gh->enc_off;
  924|  37.4k|}
zxc_common.c:zxc_read_gnr_header:
  933|  52.7k|                                                  zxc_gnr_header_t* RESTRICT gh) {
  934|  52.7k|    gh->n_sequences = zxc_le32(src);
  935|  52.7k|    gh->n_literals = zxc_le32(src + 4);
  936|  52.7k|    gh->enc_lit = src[8];
  937|  52.7k|    gh->enc_tok = src[9];
  938|  52.7k|    gh->enc_mlen = src[10];
  939|  52.7k|    gh->enc_off = src[11];
  940|  52.7k|}

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

zxc_decompress_chunk_wrapper_avx2:
 1700|  33.2k|                                 const uint64_t block_index) {
 1701|  33.2k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 0);
 1702|  33.2k|}
zxc_decompress_chunk_wrapper_safe_avx2:
 1747|  25.1k|                                      const size_t dst_cap, const uint64_t block_index) {
 1748|  25.1k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 1);
 1749|  25.1k|}
zxc_decompress.c:zxc_decompress_chunk_wrapper_body:
 1633|   116k|    const int safe) {
 1634|   116k|    if (UNLIKELY(src_sz < ZXC_BLOCK_HEADER_SIZE)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 116k]
  |  |  ------------------
  ------------------
 1635|   116k|    if (UNLIKELY(!zxc_block_header_ok(src))) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 67.7k, False: 49.1k]
  |  |  ------------------
  ------------------
 1636|       |
 1637|  49.1k|    const uint8_t type = src[0];
 1638|  49.1k|    const uint32_t comp_sz = zxc_le32(src + 3);
 1639|  49.1k|    const int has_checksum = ctx->checksum_enabled;
 1640|       |
 1641|       |    // A block never compresses past its own content size
 1642|  49.1k|    if (UNLIKELY((uint64_t)comp_sz > (uint64_t)ctx->chunk_size)) return ZXC_ERROR_BAD_BLOCK_SIZE;
  ------------------
  |  |  152|  49.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 142, False: 49.0k]
  |  |  ------------------
  ------------------
 1643|       |
 1644|       |    // Check bounds: Header + Body + Checksum(if any)
 1645|  49.0k|    const size_t expected_sz =
 1646|  49.0k|        (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  439|  49.0k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
                      (size_t)ZXC_BLOCK_HEADER_SIZE + comp_sz + (has_checksum ? ZXC_BLOCK_CHECKSUM_SIZE : 0);
  ------------------
  |  |  441|  32.7k|#define ZXC_BLOCK_CHECKSUM_SIZE 4
  ------------------
  |  Branch (1646:52): [True: 32.7k, False: 16.2k]
  ------------------
 1647|  49.0k|    if (UNLIKELY(src_sz < expected_sz)) return ZXC_ERROR_SRC_TOO_SMALL;
  ------------------
  |  |  152|  49.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 176, False: 48.8k]
  |  |  ------------------
  ------------------
 1648|       |
 1649|  48.8k|    const uint8_t* data = src + ZXC_BLOCK_HEADER_SIZE;
  ------------------
  |  |  439|  48.8k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
 1650|       |
 1651|  48.8k|    int decoded_sz = ZXC_ERROR_BAD_BLOCK_TYPE;
 1652|       |
 1653|  48.8k|    switch (type) {
 1654|  32.5k|        case ZXC_BLOCK_SPL:
  ------------------
  |  Branch (1654:9): [True: 32.5k, False: 16.3k]
  ------------------
 1655|  32.5k|            decoded_sz = safe       ? zxc_decode_block_spl_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1655:26): [True: 16.2k, False: 16.2k]
  ------------------
 1656|  32.5k|                         : has_dict ? zxc_decode_block_spl_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1656:28): [True: 0, False: 16.2k]
  ------------------
 1657|  16.2k|                                    : zxc_decode_block_spl(ctx, data, comp_sz, dst, dst_cap);
 1658|  32.5k|            break;
 1659|  10.3k|        case ZXC_BLOCK_PAK:
  ------------------
  |  Branch (1659:9): [True: 10.3k, False: 38.4k]
  ------------------
 1660|  10.3k|            decoded_sz = safe       ? zxc_decode_block_pak_safe(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1660:26): [True: 5.18k, False: 5.18k]
  ------------------
 1661|  10.3k|                         : has_dict ? zxc_decode_block_pak_dict(ctx, data, comp_sz, dst, dst_cap)
  ------------------
  |  Branch (1661:28): [True: 0, False: 5.18k]
  ------------------
 1662|  5.18k|                                    : zxc_decode_block_pak(ctx, data, comp_sz, dst, dst_cap);
 1663|  10.3k|            break;
 1664|  5.89k|        case ZXC_BLOCK_RAW:
  ------------------
  |  Branch (1664:9): [True: 5.89k, False: 42.9k]
  ------------------
 1665|       |            // For RAW blocks, comp_sz == raw_sz (uncompressed data stored as-is)
 1666|  5.89k|            if (UNLIKELY(comp_sz > dst_cap)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  5.89k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 5.89k]
  |  |  ------------------
  ------------------
 1667|  5.89k|            ZXC_MEMCPY(dst, data, comp_sz);
  ------------------
  |  |  168|  5.89k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1668|  5.89k|            decoded_sz = (int)comp_sz;
 1669|  5.89k|            break;
 1670|      4|        case ZXC_BLOCK_EOF:
  ------------------
  |  Branch (1670:9): [True: 4, False: 48.8k]
  ------------------
 1671|       |            // EOF should be handled by the dispatcher, not here
 1672|      4|            return ZXC_ERROR_CORRUPT_DATA;
 1673|     28|        default:
  ------------------
  |  Branch (1673:9): [True: 28, False: 48.7k]
  ------------------
 1674|     28|            return ZXC_ERROR_BAD_BLOCK_TYPE;
 1675|  48.8k|    }
 1676|       |
 1677|       |    // dst_cap includes the wild-copy margin: bound the block itself
 1678|  48.7k|    if (UNLIKELY(decoded_sz > 0 && (size_t)decoded_sz > ctx->chunk_size))
  ------------------
  |  |  152|  88.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 48.7k]
  |  |  |  Branch (152:42): [True: 39.7k, False: 9.01k]
  |  |  |  Branch (152:42): [True: 8, False: 39.7k]
  |  |  ------------------
  ------------------
 1679|      8|        return ZXC_ERROR_BAD_BLOCK_SIZE;
 1680|       |
 1681|  48.7k|    if (has_checksum && LIKELY(decoded_sz >= 0)) {
  ------------------
  |  |  146|  32.5k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 26.3k, False: 6.22k]
  |  |  ------------------
  ------------------
  |  Branch (1681:9): [True: 32.5k, False: 16.2k]
  ------------------
 1682|  26.3k|        const uint32_t stored = zxc_le32(data + comp_sz);
 1683|  26.3k|        if (UNLIKELY(stored !=
  ------------------
  |  |  152|  26.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.13k, False: 25.2k]
  |  |  ------------------
  ------------------
 1684|  26.3k|                     zxc_checksum(dst, (size_t)decoded_sz, block_index, ZXC_CHECKSUM_RAPIDHASH)))
 1685|  1.13k|            return ZXC_ERROR_BAD_CHECKSUM;
 1686|  26.3k|    }
 1687|       |
 1688|  47.6k|    return decoded_sz;
 1689|  48.7k|}
zxc_decompress.c:zxc_decode_block_spl_safe:
 1577|  16.2k|                                                  const size_t dst_capacity) {
 1578|  16.2k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 1, 0, 0);
 1579|  16.2k|}
zxc_decompress.c:zxc_decode_block_spl_impl:
  835|  42.4k|                                                       const int has_dict, const int tok_entropy) {
  836|  42.4k|    zxc_gnr_header_t gh;
  837|       |
  838|       |    // Constant 0 when !has_dict, so `d_floor` folds to `dst`.
  839|  42.4k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (839:30): [True: 0, False: 42.4k]
  ------------------
  840|  42.4k|    uint32_t lit_comp;
  841|  42.4k|    uint32_t tok_comp;
  842|       |
  843|  42.4k|    const int hdr_sz = zxc_read_spl_header_and_desc(src, src_size, &gh, &lit_comp, &tok_comp);
  844|  42.4k|    if (UNLIKELY(hdr_sz < 0)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|  42.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 72, False: 42.4k]
  |  |  ------------------
  ------------------
  845|       |
  846|       |    // Only 0 and 1 are defined widths.
  847|  42.4k|    if (UNLIKELY(gh.enc_off > 1)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  42.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 88, False: 42.3k]
  |  |  ------------------
  ------------------
  848|       |
  849|       |    // Entropy-coded tokens (level 7): tail-call the dedicated instantiation
  850|       |    // before any section work - it restarts from the header, so only the parse
  851|       |    // above is duplicated. Flags are constant per instantiation, so exactly one
  852|       |    // call survives and t_ptr keeps a single provenance below.
  853|  42.3k|    if (!tok_entropy && UNLIKELY(gh.enc_tok == ZXC_SECTION_ENCODING_HUFFMAN)) {
  ------------------
  |  |  152|  32.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 9.95k, False: 22.4k]
  |  |  ------------------
  ------------------
  |  Branch (853:9): [True: 32.3k, False: 9.95k]
  ------------------
  854|  9.95k|        if (safe) return zxc_decode_block_spl_entropy_safe(ctx, src, src_size, dst, dst_capacity);
  ------------------
  |  Branch (854:13): [True: 4.97k, False: 4.97k]
  ------------------
  855|  4.97k|        if (has_dict)
  ------------------
  |  Branch (855:13): [True: 0, False: 4.97k]
  ------------------
  856|      0|            return zxc_decode_block_spl_entropy_dict(ctx, src, src_size, dst, dst_capacity);
  857|  4.97k|        return zxc_decode_block_spl_entropy(ctx, src, src_size, dst, dst_capacity);
  858|  4.97k|    }
  859|       |
  860|  32.3k|    const uint8_t* p_data = src + (size_t)hdr_sz;
  861|  32.3k|    const uint8_t* p_curr = p_data;
  862|       |
  863|       |    // --- Literal Stream Setup ---
  864|  32.3k|    const uint8_t* l_ptr;
  865|  32.3k|    const uint8_t* l_end;
  866|  32.3k|    uint8_t* rle_buf = NULL;
  867|       |
  868|  32.3k|    size_t lit_stream_size = lit_comp;
  869|       |    // Decoded size of an encoded literal section (RAW ignores it).
  870|  32.3k|    const size_t required_size = gh.n_literals;
  871|       |
  872|  32.3k|    if (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN ||
  ------------------
  |  Branch (872:9): [True: 7.08k, False: 25.2k]
  ------------------
  873|  25.2k|        gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN_DICT) {
  ------------------
  |  Branch (873:9): [True: 636, False: 24.6k]
  ------------------
  874|  7.71k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  7.71k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 256, False: 7.46k]
  |  |  ------------------
  ------------------
  875|    256|            return ZXC_ERROR_CORRUPT_DATA;
  876|  7.46k|        if (required_size == 0) {
  ------------------
  |  Branch (876:13): [True: 468, False: 6.99k]
  ------------------
  877|    468|            l_ptr = p_curr;
  878|    468|            l_end = p_curr;
  879|  6.99k|        } else {
  880|  6.99k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  152|  13.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 382, False: 6.61k]
  |  |  |  Branch (152:42): [True: 382, False: 6.61k]
  |  |  |  Branch (152:42): [True: 0, False: 6.61k]
  |  |  ------------------
  ------------------
  881|    382|                return ZXC_ERROR_DST_TOO_SMALL;
  882|  6.61k|            const int rc =
  883|  6.61k|                (gh.enc_lit == ZXC_SECTION_ENCODING_HUFFMAN)
  ------------------
  |  Branch (883:17): [True: 6.57k, False: 34]
  ------------------
  884|  6.61k|                    ? zxc_decode_lit_pivco(ctx, p_curr, lit_stream_size, required_size)
  885|  6.61k|                    : zxc_decode_lit_pivco_dict(ctx, p_curr, lit_stream_size, required_size);
  886|  6.61k|            if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  6.61k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 182, False: 6.43k]
  |  |  ------------------
  ------------------
  887|  6.43k|            l_ptr = ctx->lit_buffer;
  888|  6.43k|            l_end = ctx->lit_buffer + required_size;
  889|  6.43k|        }
  890|  24.6k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RLE) {
  ------------------
  |  Branch (890:16): [True: 10.1k, False: 14.4k]
  ------------------
  891|  10.1k|        if (required_size > 0) {
  ------------------
  |  Branch (891:13): [True: 9.79k, False: 356]
  ------------------
  892|  9.79k|            if (UNLIKELY(required_size > dst_capacity || required_size > SIZE_MAX - ZXC_PAD_SIZE))
  ------------------
  |  |  152|  19.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 380, False: 9.41k]
  |  |  |  Branch (152:42): [True: 380, False: 9.41k]
  |  |  |  Branch (152:42): [True: 0, False: 9.41k]
  |  |  ------------------
  ------------------
  893|    380|                return ZXC_ERROR_DST_TOO_SMALL;
  894|  9.41k|            const size_t alloc_size = required_size + ZXC_PAD_SIZE;
  ------------------
  |  |  342|  9.41k|#define ZXC_PAD_SIZE 32
  ------------------
  895|       |
  896|       |            // lit_buffer is pre-allocated to chunk_size + ZXC_PAD_SIZE by
  897|       |            // zxc_cctx_init (mode == 0).
  898|  9.41k|            if (UNLIKELY(ctx->lit_buffer_cap < alloc_size)) return ZXC_ERROR_DST_TOO_SMALL;
  ------------------
  |  |  152|  9.41k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 9.40k]
  |  |  ------------------
  ------------------
  899|       |
  900|  9.40k|            rle_buf = ctx->lit_buffer;
  901|  9.40k|            if (UNLIKELY(!rle_buf || lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  18.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 364, False: 9.04k]
  |  |  |  Branch (152:42): [True: 0, False: 9.40k]
  |  |  |  Branch (152:42): [True: 364, False: 9.04k]
  |  |  ------------------
  ------------------
  902|    364|                return ZXC_ERROR_CORRUPT_DATA;
  903|       |
  904|  9.04k|            const uint8_t* r_ptr = p_curr;
  905|  9.04k|            const uint8_t* r_end = r_ptr + lit_stream_size;
  906|  9.04k|            uint8_t* w_ptr = rle_buf;
  907|  9.04k|            const uint8_t* const w_end = rle_buf + required_size;
  908|       |
  909|  1.08M|            while (r_ptr < r_end && w_ptr < w_end) {
  ------------------
  |  Branch (909:20): [True: 1.07M, False: 8.86k]
  |  Branch (909:37): [True: 1.07M, False: 4]
  ------------------
  910|  1.07M|                uint8_t token = *r_ptr++;
  911|  1.07M|                if (LIKELY(!(token & ZXC_LIT_RLE_FLAG))) {
  ------------------
  |  |  146|  1.07M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 590k, False: 487k]
  |  |  ------------------
  ------------------
  912|       |                    // Raw copy (most common path): 32-byte wild copies (zxc_copy32 width)
  913|       |                    // token is 7-bit (0-127), so len is 1-128 bytes
  914|   590k|                    const uint32_t len = (uint32_t)token + 1;
  915|   590k|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr + len > r_end))
  ------------------
  |  |  152|  1.18M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 116, False: 590k]
  |  |  |  Branch (152:42): [True: 16, False: 590k]
  |  |  |  Branch (152:42): [True: 100, False: 590k]
  |  |  ------------------
  ------------------
  916|    116|                        return ZXC_ERROR_CORRUPT_DATA;
  917|       |
  918|       |                    // Destination has ZXC_PAD_SIZE bytes of safe overrun space.
  919|       |                    // Source may not - check before wild copy.
  920|       |                    // Fast path: source holds a full zxc_copy32 read (most common)
  921|   590k|                    if (LIKELY(r_ptr + 32 <= r_end)) {
  ------------------
  |  |  146|   590k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 579k, False: 11.2k]
  |  |  ------------------
  ------------------
  922|       |                        // Single copy covers len <= 32 (most tokens)
  923|   579k|                        zxc_copy32(w_ptr, r_ptr);
  924|       |
  925|   579k|                        if (UNLIKELY(len > 32)) {
  ------------------
  |  |  152|   579k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 266k, False: 313k]
  |  |  ------------------
  ------------------
  926|       |                            // Unroll: max len=128, so max 4 copies total. The last
  927|       |                            // copy is placed to end exactly on len, overlapping the
  928|       |                            // previous one - unconditional stores beat branches here.
  929|   266k|                            if (len <= 64) {
  ------------------
  |  Branch (929:33): [True: 71.4k, False: 194k]
  ------------------
  930|  71.4k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  931|   194k|                            } else if (len <= 96) {
  ------------------
  |  Branch (931:40): [True: 32.5k, False: 162k]
  ------------------
  932|  32.5k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  933|  32.5k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  934|   162k|                            } else {
  935|   162k|                                zxc_copy32(w_ptr + 32, r_ptr + 32);
  936|   162k|                                zxc_copy32(w_ptr + 64, r_ptr + 64);
  937|   162k|                                zxc_copy32(w_ptr + len - 32, r_ptr + len - 32);
  938|   162k|                            }
  939|   266k|                        }
  940|   579k|                    } else {
  941|       |                        // Near end of source: safe copy (rare cold path)
  942|  11.2k|                        ZXC_MEMCPY(w_ptr, r_ptr, len);
  ------------------
  |  |  168|  11.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  943|  11.2k|                    }
  944|       |
  945|   590k|                    w_ptr += len;
  946|   590k|                    r_ptr += len;
  947|   590k|                } else {
  948|       |                    // RLE run: fill with single byte
  949|   487k|                    const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  557|   487k|#define ZXC_LIT_LEN_MASK (ZXC_LIT_RLE_FLAG - 1)
  |  |  ------------------
  |  |  |  |  555|   487k|#define ZXC_LIT_RLE_FLAG 0x80U
  |  |  ------------------
  ------------------
                                  const uint32_t len = (token & ZXC_LIT_LEN_MASK) + ZXC_LIT_RLE_RUN_MIN;
  ------------------
  |  |  561|   487k|#define ZXC_LIT_RLE_RUN_MIN 4U
  ------------------
  950|   487k|                    if (UNLIKELY(w_ptr + len > w_end || r_ptr >= r_end))
  ------------------
  |  |  152|   975k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 60, False: 487k]
  |  |  |  Branch (152:42): [True: 44, False: 487k]
  |  |  |  Branch (152:42): [True: 16, False: 487k]
  |  |  ------------------
  ------------------
  951|     60|                        return ZXC_ERROR_CORRUPT_DATA;
  952|   487k|                    ZXC_MEMSET(w_ptr, *r_ptr++, len);
  ------------------
  |  |  173|   487k|#define ZXC_MEMSET(dst, val, n) __builtin_memset(dst, val, n)
  ------------------
  953|   487k|                    w_ptr += len;
  954|   487k|                }
  955|  1.07M|            }
  956|  8.86k|            if (UNLIKELY(w_ptr != w_end || r_ptr != r_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  17.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 116, False: 8.75k]
  |  |  |  Branch (152:42): [True: 112, False: 8.75k]
  |  |  |  Branch (152:42): [True: 4, False: 8.75k]
  |  |  ------------------
  ------------------
  957|  8.75k|            l_ptr = rle_buf;
  958|  8.75k|            l_end = rle_buf + required_size;
  959|  8.75k|        } else {
  960|    356|            if (UNLIKELY(lit_stream_size != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|    356|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 332, False: 24]
  |  |  ------------------
  ------------------
  961|     24|            l_ptr = p_curr;
  962|     24|            l_end = p_curr;
  963|     24|        }
  964|  14.4k|    } else if (gh.enc_lit == ZXC_SECTION_ENCODING_RAW) {
  ------------------
  |  Branch (964:16): [True: 14.4k, False: 88]
  ------------------
  965|  14.4k|        if (UNLIKELY(lit_stream_size > (size_t)(src + src_size - p_curr)))
  ------------------
  |  |  152|  14.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 260, False: 14.1k]
  |  |  ------------------
  ------------------
  966|    260|            return ZXC_ERROR_CORRUPT_DATA;
  967|  14.1k|        l_ptr = p_curr;
  968|  14.1k|        l_end = p_curr + lit_stream_size;
  969|  14.1k|    } else {
  970|     88|        return ZXC_ERROR_CORRUPT_DATA;
  971|     88|    }
  972|       |
  973|  29.8k|    p_curr += lit_stream_size;
  974|       |
  975|       |    // --- Stream Pointers & Validation ---
  976|       |    // Only the literal and token sizes are on the wire; offsets follow from the
  977|       |    // sequence count and width, and extras take the payload residue.
  978|  29.8k|    const size_t sz_tokens = tok_comp;
  979|  29.8k|    const uint64_t sz_offsets = SPL_OFF8 ? (uint64_t)gh.n_sequences : (uint64_t)gh.n_sequences * 2;
  ------------------
  |  |  577|  29.8k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 11.2k, False: 18.5k]
  |  |  ------------------
  ------------------
  980|       |
  981|  29.8k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
  982|  29.8k|    const uint64_t consumed = (uint64_t)lit_stream_size + (uint64_t)sz_tokens + sz_offsets;
  983|  29.8k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  29.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 536, False: 29.2k]
  |  |  ------------------
  ------------------
  984|  29.2k|    const size_t sz_extras = payload_avail - (size_t)consumed; /* slack padding included */
  985|       |
  986|       |    // RAW literals point into the caller's buffer and the wild copy overshoots,
  987|       |    // so it needs ZXC_BLOCK_LIT_SLACK readable bytes behind it. v7 staged short
  988|       |    // streams into a padded scratch here; v8 rejects instead. No underflow:
  989|       |    // lit_stream_size <= consumed <= payload_avail.
  990|  29.2k|    if (UNLIKELY(payload_avail - lit_stream_size < ZXC_BLOCK_LIT_SLACK))
  ------------------
  |  |  152|  29.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 32, False: 29.2k]
  |  |  ------------------
  ------------------
  991|     32|        return ZXC_ERROR_CORRUPT_DATA;
  992|       |
  993|       |    // Offsets/extras follow the on-disk token SECTION; sz_tokens is its size
  994|       |    // (== n_sequences when RAW, the Huffman payload size when enc_tok set).
  995|  29.2k|    const uint8_t* o_ptr = p_curr + sz_tokens;
  996|  29.2k|    const uint8_t* e_ptr = o_ptr + (size_t)sz_offsets;
  997|  29.2k|    const uint8_t* const e_end = e_ptr + sz_extras;
  998|       |
  999|  29.2k|    const uint8_t* RESTRICT t_ptr;
 1000|  29.2k|    if (!tok_entropy) {
  ------------------
  |  Branch (1000:9): [True: 20.9k, False: 8.35k]
  ------------------
 1001|       |        // enc_tok == 2 was re-routed right after the header parse; any other
 1002|       |        // value would have mis-sized the section descriptors above.
 1003|  20.9k|        if (UNLIKELY(gh.enc_tok != 0)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  20.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 12, False: 20.8k]
  |  |  ------------------
  ------------------
 1004|  20.8k|        t_ptr = p_curr;
 1005|  20.8k|    } else {
 1006|  8.35k|        if (UNLIKELY(gh.enc_tok != ZXC_SECTION_ENCODING_HUFFMAN)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  8.35k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.35k]
  |  |  ------------------
  ------------------
 1007|  8.35k|        const int rc = zxc_decode_tok_pivco(ctx, p_curr, sz_tokens, gh.n_sequences);
 1008|  8.35k|        if (UNLIKELY(rc != ZXC_OK)) return rc;
  ------------------
  |  |  152|  8.35k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 156, False: 8.19k]
  |  |  ------------------
  ------------------
 1009|  8.19k|        t_ptr = ctx->tok_buffer;
 1010|  8.19k|    }
 1011|       |
 1012|  29.0k|    uint8_t* d_ptr = dst;
 1013|  29.0k|    const uint8_t* const d_end = dst + dst_capacity;
 1014|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
 1015|  29.0k|    const uint8_t* const d_floor = dst - dict_size;
 1016|       |    // 4x loop margin: four sequences without a varint, the wild-copy overshoot, 4 of safety.
 1017|  29.0k|    const size_t d_margin_4x = 4 * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE + 4;
  ------------------
  |  |  674|  29.0k|#define ZXC_SPL_MAX_INLINE_OUT_PER_SEQ ((ZXC_TOKEN_LL_MASK - 1U) + ZXC_SPL_MAX_INLINE_ML) /* 33 */
  |  |  ------------------
  |  |  |  |  522|  29.0k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  518|  29.0k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_SPL_MAX_INLINE_OUT_PER_SEQ ((ZXC_TOKEN_LL_MASK - 1U) + ZXC_SPL_MAX_INLINE_ML) /* 33 */
  |  |  ------------------
  |  |  |  |  683|  29.0k|#define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  677|  29.0k|#define ZXC_SPL_INLINE_ML_CODE (ZXC_TOKEN_ML_MASK - 1U) /* 14 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  29.0k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  520|  29.0k|#define ZXC_TOKEN_ML_BITS 4
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define ZXC_SPL_MAX_INLINE_ML (ZXC_SPL_INLINE_ML_CODE + ZXC_LZ_MIN_MATCH_LEN) /* 19 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  29.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const size_t d_margin_4x = 4 * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE + 4;
  ------------------
  |  |  342|  29.0k|#define ZXC_PAD_SIZE 32
  ------------------
 1018|  29.0k|    const uint8_t* const d_end_safe = (dst_capacity > d_margin_4x) ? d_end - d_margin_4x : dst;
  ------------------
  |  Branch (1018:39): [True: 27.0k, False: 2.06k]
  ------------------
 1019|       |
 1020|       |    // Literal margin for the 4x loops: without a varint, ll <= 14 per sequence,
 1021|       |    // so 4 * 14 = 56. Past that margin only the cold varint path checks l_ptr.
 1022|  29.0k|    const size_t spl_sz_lit = (size_t)(l_end - l_ptr);
 1023|  29.0k|    const size_t spl_margin_4x = 4 * (ZXC_TOKEN_LL_MASK - 1);  // 56
  ------------------
  |  |  522|  29.0k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  29.0k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
 1024|  29.0k|    const size_t spl_margin_1x = ZXC_TOKEN_LL_MASK - 1;        // 14
  ------------------
  |  |  522|  29.0k|#define ZXC_TOKEN_LL_MASK ((1U << ZXC_TOKEN_LIT_BITS) - 1)
  |  |  ------------------
  |  |  |  |  518|  29.0k|#define ZXC_TOKEN_LIT_BITS 4
  |  |  ------------------
  ------------------
 1025|  29.0k|    const uint8_t* const l_end_safe_4x =
 1026|  29.0k|        (spl_sz_lit > spl_margin_4x) ? l_end - spl_margin_4x : l_ptr;
  ------------------
  |  Branch (1026:9): [True: 24.1k, False: 4.95k]
  ------------------
 1027|  29.0k|    const uint8_t* const l_end_safe_1x =
 1028|  29.0k|        (spl_sz_lit > spl_margin_1x) ? l_end - spl_margin_1x : l_ptr;
  ------------------
  |  Branch (1028:9): [True: 26.7k, False: 2.37k]
  ------------------
 1029|       |
 1030|  29.0k|    uint32_t n_seq = gh.n_sequences;
 1031|       |
 1032|       |    // Offsets only need checking until the output is wider than the widest offset
 1033|       |    // the format can encode (256 for 1-byte offsets, 65536 for 2-byte); past that
 1034|       |    // none can reach below d_floor. A dictionary counts as already written, so a
 1035|       |    // large one puts d_bounds at dst and skips the SAFE loop.
 1036|  29.0k|    const size_t off_span = SPL_OFF8 ? (1U << 8) : (1U << 16);
  ------------------
  |  |  577|  29.0k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 11.2k, False: 17.8k]
  |  |  ------------------
  ------------------
 1037|  29.0k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (1037:25): [True: 0, False: 29.0k]
  ------------------
 1038|  29.0k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (1038:37): [True: 13.4k, False: 15.6k]
  ------------------
 1039|       |
 1040|       |    // --- SAFE Loop: offset validation until d_bounds (4x unroll) ---
 1041|  29.0k|    if (safe) {
  ------------------
  |  Branch (1041:9): [True: 14.5k, False: 14.5k]
  ------------------
 1042|       |        // SAFE variant: save per-batch state so overflow can rollback.
 1043|  1.41M|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1043:16): [True: 1.41M, False: 2.81k]
  |  Branch (1043:30): [True: 1.41M, False: 2.93k]
  |  Branch (1043:52): [True: 1.40M, False: 2.72k]
  |  Branch (1043:77): [True: 1.40M, False: 3.99k]
  ------------------
 1044|  1.40M|            const uint8_t* const t_save = t_ptr;
 1045|  1.40M|            const uint8_t* const o_save = o_ptr;
 1046|  1.40M|            const uint8_t* const e_save = e_ptr;
 1047|  1.40M|            uint8_t* const d_save = d_ptr;
 1048|  1.40M|            const uint8_t* const l_save = l_ptr;
 1049|  1.40M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  ------------------
  |  |  639|  1.40M|    do {                                                                                           \
  |  |  640|  1.40M|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|  1.40M|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|  1.40M|        uint64_t offs;                                                                             \
  |  |  643|  1.40M|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|  1.40M|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 6.06k, False: 1.39M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|  6.06k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|  6.06k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|  6.06k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|  6.06k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|  1.39M|        } else {                                                                                   \
  |  |  649|  1.39M|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|  1.39M|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|  1.39M|        }                                                                                          \
  |  |  652|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 145k, False: 1.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   145k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   145k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   145k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   145k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   145k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   145k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   291k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 238, False: 145k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 106, False: 145k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 132, False: 145k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   145k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   145k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   145k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   145k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   145k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.25M|        } else {                                                                                \
  |  |  |  |  609|  1.25M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.25M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.25M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 207k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   207k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   207k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   207k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 152, False: 207k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   207k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   207k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   207k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   207k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   207k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   207k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|   207k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   207k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   207k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 24, False: 207k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   207k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   207k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   207k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 207k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 64, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|  1.40M|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|  1.40M|                       DECODE, ON_FAIL);                                                           \
  |  |  656|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 143k, False: 1.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   143k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   143k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   143k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   143k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   143k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   143k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   286k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 247, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 86, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 161, False: 143k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   143k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   143k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   143k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   143k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   143k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.25M|        } else {                                                                                \
  |  |  |  |  609|  1.25M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.25M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.25M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 208k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   208k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   208k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   208k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 138, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   208k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   208k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   208k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   208k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   208k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   208k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|   208k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   208k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   208k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 6, False: 208k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   208k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   208k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   208k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 208k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|  1.40M|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 143k, False: 1.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   143k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   143k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   143k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   143k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   143k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   143k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   286k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 319, False: 142k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 94, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 225, False: 142k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   143k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   143k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   143k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   143k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   143k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.25M|        } else {                                                                                \
  |  |  |  |  609|  1.25M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.25M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.25M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 207k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   207k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   207k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   207k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 186, False: 207k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   207k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   207k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   207k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   207k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   207k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   207k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|   207k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   207k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   207k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 6, False: 207k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   207k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   207k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   207k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 207k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|  1.40M|                       DECODE, ON_FAIL);                                                           \
  |  |  662|  1.40M|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 142k, False: 1.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   142k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   142k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   142k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   142k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   142k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   142k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   285k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 273, False: 142k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 98, False: 142k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 175, False: 142k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   142k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   142k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   142k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   142k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   142k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.25M|        } else {                                                                                \
  |  |  |  |  609|  1.25M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.25M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.25M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 208k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   208k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   208k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   208k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 351, False: 207k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   208k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   208k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   208k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   208k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   207k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   207k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|   207k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   207k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   207k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 18, False: 207k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   207k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   207k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   207k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 207k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1049|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 10, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|  1.40M|        n_seq -= 4;                                                                                \
  |  |  665|  1.40M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 1.40M]
  |  |  ------------------
  ------------------
 1050|  1.40M|            continue;
 1051|       |
 1052|  1.40M|        rollback_safe_4x:
 1053|  1.90k|            t_ptr = t_save;
 1054|  1.90k|            o_ptr = o_save;
 1055|  1.90k|            e_ptr = e_save;
 1056|  1.90k|            d_ptr = d_save;
 1057|  1.90k|            l_ptr = l_save;
 1058|  1.90k|            break;
 1059|  1.40M|        }
 1060|  14.5k|    } else {
 1061|  1.41M|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1061:16): [True: 1.41M, False: 4.99k]
  |  Branch (1061:30): [True: 1.41M, False: 8]
  |  Branch (1061:52): [True: 1.40M, False: 4.51k]
  |  Branch (1061:77): [True: 1.40M, False: 4.10k]
  ------------------
 1062|  1.40M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  639|  1.40M|    do {                                                                                           \
  |  |  640|  1.40M|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|  1.40M|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|  1.40M|        uint64_t offs;                                                                             \
  |  |  643|  1.40M|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|  1.40M|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 6.99k, False: 1.39M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|  6.99k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|  6.99k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|  6.99k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|  6.99k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|  1.39M|        } else {                                                                                   \
  |  |  649|  1.39M|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|  1.39M|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|  1.39M|        }                                                                                          \
  |  |  652|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 146k, False: 1.25M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   146k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   146k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   146k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   146k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   146k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   146k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   292k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 106, False: 146k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 106, False: 146k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 146k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   146k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   146k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   146k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   146k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   146k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.25M|        } else {                                                                                \
  |  |  |  |  609|  1.25M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.25M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.25M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 207k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   207k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   207k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   207k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 86, False: 207k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   207k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   207k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   207k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   207k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   207k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   207k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   207k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   207k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   207k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   207k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 28, False: 207k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   207k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   207k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   207k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 207k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 64, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|  1.40M|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|  1.40M|                       DECODE, ON_FAIL);                                                           \
  |  |  656|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 143k, False: 1.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   143k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   143k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   143k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   143k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   143k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   143k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   287k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 92, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 92, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 143k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   143k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   143k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   143k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   143k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   143k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.26M|        } else {                                                                                \
  |  |  |  |  609|  1.26M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.26M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.26M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 208k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   208k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   208k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   208k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 74, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   208k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   208k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   208k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   208k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   208k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   208k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   208k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   208k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   208k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 6, False: 208k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   208k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   208k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   208k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 208k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 22, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|  1.40M|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|  1.40M|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 143k, False: 1.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   143k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   143k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   143k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   143k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   143k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   143k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   287k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 94, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 94, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 143k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   143k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   143k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   143k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   143k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   143k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.26M|        } else {                                                                                \
  |  |  |  |  609|  1.26M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.26M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.26M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 208k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   208k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   208k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   208k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 82, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   208k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   208k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   208k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   208k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   208k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   208k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   208k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   208k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   208k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 8, False: 208k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   208k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   208k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   208k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 208k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|  1.40M|                       DECODE, ON_FAIL);                                                           \
  |  |  662|  1.40M|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|  1.40M|    do {                                                                                        \
  |  |  |  |  594|  1.40M|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|  1.40M|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|  1.40M|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 143k, False: 1.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|   143k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|   143k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|   143k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|   143k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|   143k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|   143k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   286k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 102, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 102, False: 143k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 143k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|   143k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|   143k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|   143k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|   143k|                ON_FAIL;                                                                        \
  |  |  |  |  607|   143k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|  1.26M|        } else {                                                                                \
  |  |  |  |  609|  1.26M|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|  1.26M|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|  1.26M|        }                                                                                       \
  |  |  |  |  612|  1.40M|        l_ptr += ll;                                                                            \
  |  |  |  |  613|  1.40M|        d_ptr += ll;                                                                            \
  |  |  |  |  614|  1.40M|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.40M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 208k, False: 1.19M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|   208k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|   208k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|   208k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 102, False: 208k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|   208k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|   208k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|   208k|                ON_FAIL;                                                                        \
  |  |  |  |  621|   208k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   208k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|   208k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|   208k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   208k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   208k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   208k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 208k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   208k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   208k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   208k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 208k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|  1.19M|        } else {                                                                                \
  |  |  |  |  624|  1.19M|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|  1.19M|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  1.19M|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|  1.19M|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1062|  1.19M|            DECODE_SPL_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|  1.19M|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|  1.19M|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|  1.19M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 12, False: 1.19M]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|  1.19M|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|  1.19M|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|  1.19M|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 1.19M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|  1.19M|        }                                                                                       \
  |  |  |  |  628|  1.40M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 1.40M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|  1.40M|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|  1.40M|        n_seq -= 4;                                                                                \
  |  |  665|  1.40M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 1.40M]
  |  |  ------------------
  ------------------
 1063|  1.40M|        }
 1064|  14.5k|    }
 1065|       |
 1066|       |    // --- FAST Loop: After threshold, no offset validation needed (4x unroll) ---
 1067|  28.0k|    if (safe) {
  ------------------
  |  Branch (1067:9): [True: 14.3k, False: 13.6k]
  ------------------
 1068|   294k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1068:16): [True: 290k, False: 3.93k]
  |  Branch (1068:30): [True: 286k, False: 4.22k]
  |  Branch (1068:52): [True: 282k, False: 3.53k]
  ------------------
 1069|   282k|            const uint8_t* const t_save = t_ptr;
 1070|   282k|            const uint8_t* const o_save = o_ptr;
 1071|   282k|            const uint8_t* const e_save = e_ptr;
 1072|   282k|            uint8_t* const d_save = d_ptr;
 1073|   282k|            const uint8_t* const l_save = l_ptr;
 1074|   282k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  ------------------
  |  |  639|   282k|    do {                                                                                           \
  |  |  640|   282k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|   282k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|   282k|        uint64_t offs;                                                                             \
  |  |  643|   282k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|   282k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 15.4k, False: 267k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|  15.4k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|  15.4k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|  15.4k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|  15.4k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|   267k|        } else {                                                                                   \
  |  |  649|   267k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|   267k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|   267k|        }                                                                                          \
  |  |  652|   282k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|   282k|    do {                                                                                        \
  |  |  |  |  594|   282k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   282k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   282k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   282k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 44.3k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  44.3k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  44.3k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  44.3k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  44.3k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  44.3k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  44.3k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  88.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 389, False: 43.9k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 134, False: 44.2k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 255, False: 43.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  44.3k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  44.3k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  44.3k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  44.3k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  44.3k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   238k|        } else {                                                                                \
  |  |  |  |  609|   238k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   238k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   238k|        }                                                                                       \
  |  |  |  |  612|   282k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   282k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   282k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   282k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 48.0k, False: 234k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  48.0k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  48.0k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  48.0k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  48.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 222, False: 47.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  48.0k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  48.0k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  48.0k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  48.0k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.8k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|  47.8k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.8k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.8k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.8k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.8k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   234k|        } else {                                                                                \
  |  |  |  |  624|   234k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   234k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   234k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   234k|        }                                                                                       \
  |  |  |  |  628|   282k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 282k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|   282k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|   282k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|   282k|                       DECODE, ON_FAIL);                                                           \
  |  |  656|   282k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|   282k|    do {                                                                                        \
  |  |  |  |  594|   282k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   282k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   282k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   282k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 44.1k, False: 237k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  44.1k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  44.1k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  44.1k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  44.1k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  44.1k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  44.1k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  88.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 379, False: 43.8k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 120, False: 44.0k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 259, False: 43.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  44.1k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  44.1k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  44.1k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  44.1k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  44.1k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   237k|        } else {                                                                                \
  |  |  |  |  609|   237k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   237k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   237k|        }                                                                                       \
  |  |  |  |  612|   282k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.9k, False: 233k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.9k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.9k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.9k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 217, False: 47.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.9k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.9k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.9k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.9k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.7k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.7k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|  47.7k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.7k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.7k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.7k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.7k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   233k|        } else {                                                                                \
  |  |  |  |  624|   233k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   233k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   233k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   233k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|   233k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   233k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   233k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   233k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   233k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 233k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   233k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 281k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|   282k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|   282k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|   282k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|   281k|    do {                                                                                        \
  |  |  |  |  594|   281k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   281k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   281k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.9k, False: 237k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.9k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.9k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.9k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.9k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.9k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.9k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 427, False: 43.5k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 124, False: 43.8k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 303, False: 43.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.9k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.9k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.9k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.9k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.9k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   237k|        } else {                                                                                \
  |  |  |  |  609|   237k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   237k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   237k|        }                                                                                       \
  |  |  |  |  612|   281k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.6k, False: 233k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.6k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.6k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.6k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 267, False: 47.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.6k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.6k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.6k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.6k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.3k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|  47.3k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.3k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.3k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.3k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.3k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   233k|        } else {                                                                                \
  |  |  |  |  624|   233k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   233k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   233k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   233k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|   233k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   233k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   233k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   233k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   233k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 233k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   233k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 280k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|   281k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|   281k|                       DECODE, ON_FAIL);                                                           \
  |  |  662|   281k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|   280k|    do {                                                                                        \
  |  |  |  |  594|   280k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   280k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   280k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   280k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.9k, False: 236k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.9k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.9k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.9k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.9k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.9k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.9k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 353, False: 43.5k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 130, False: 43.7k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 223, False: 43.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.9k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.9k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.9k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.9k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.9k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   236k|        } else {                                                                                \
  |  |  |  |  609|   236k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   236k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   236k|        }                                                                                       \
  |  |  |  |  612|   280k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   280k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   280k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   280k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.8k, False: 232k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.8k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.8k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.8k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 429, False: 47.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.8k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.8k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.8k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.8k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.4k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|  47.4k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.4k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.4k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.4k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.4k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   232k|        } else {                                                                                \
  |  |  |  |  624|   232k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   232k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   232k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   232k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1074|   232k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   232k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   232k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   232k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   232k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 232k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   232k|        }                                                                                       \
  |  |  |  |  628|   280k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 280k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|   280k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|   280k|        n_seq -= 4;                                                                                \
  |  |  665|   280k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 280k]
  |  |  ------------------
  ------------------
 1075|   280k|            continue;
 1076|       |
 1077|   280k|        rollback_fast_4x:
 1078|  2.68k|            t_ptr = t_save;
 1079|  2.68k|            o_ptr = o_save;
 1080|  2.68k|            e_ptr = e_save;
 1081|  2.68k|            d_ptr = d_save;
 1082|  2.68k|            l_ptr = l_save;
 1083|  2.68k|            break;
 1084|   282k|        }
 1085|  14.3k|    } else {
 1086|   295k|        while (n_seq >= 4 && d_ptr < d_end_safe && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1086:16): [True: 287k, False: 7.24k]
  |  Branch (1086:30): [True: 287k, False: 10]
  |  Branch (1086:52): [True: 281k, False: 6.07k]
  ------------------
 1087|   281k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  ------------------
  |  |  639|   281k|    do {                                                                                           \
  |  |  640|   281k|        uint32_t tokens = zxc_le32(t_ptr);                                                         \
  |  |  641|   281k|        t_ptr += sizeof(uint32_t);                                                                 \
  |  |  642|   281k|        uint64_t offs;                                                                             \
  |  |  643|   281k|        if (SPL_OFF8) {                                                                            \
  |  |  ------------------
  |  |  |  |  577|   281k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (577:18): [True: 15.3k, False: 266k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  644|  15.3k|            uint64_t x = zxc_le32(o_ptr);                                                          \
  |  |  645|  15.3k|            o_ptr += sizeof(uint32_t);                                                             \
  |  |  646|  15.3k|            x = (x | (x << 16)) & 0x0000FFFF0000FFFFULL;                                           \
  |  |  647|  15.3k|            offs = (x | (x << 8)) & 0x00FF00FF00FF00FFULL;                                         \
  |  |  648|   266k|        } else {                                                                                   \
  |  |  649|   266k|            offs = zxc_le64(o_ptr);                                                                \
  |  |  650|   266k|            o_ptr += sizeof(uint64_t);                                                             \
  |  |  651|   266k|        }                                                                                          \
  |  |  652|   281k|        DECODE_SPL_SEQ((tokens & 0x0F0) >> 4, (tokens & 0x00F),                                    \
  |  |  ------------------
  |  |  |  |  593|   281k|    do {                                                                                        \
  |  |  |  |  594|   281k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   281k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   281k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.6k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.6k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.6k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.6k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.6k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.6k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.6k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 28, False: 43.6k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 28, False: 43.6k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 43.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.6k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.6k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.6k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.6k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.6k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   238k|        } else {                                                                                \
  |  |  |  |  609|   238k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   238k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   238k|        }                                                                                       \
  |  |  |  |  612|   281k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.4k, False: 234k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.4k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.4k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.4k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 38, False: 47.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.4k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.4k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.4k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.4k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.3k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.3k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  47.3k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.3k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.3k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.3k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.3k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.3k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   234k|        } else {                                                                                \
  |  |  |  |  624|   234k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   234k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   234k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   234k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 281k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  653|   281k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs & 0xFFFF),                             \
  |  |  654|   281k|                       ((tokens >> 12) & 0xF) + ((tokens >> 20) & 0xF) + (tokens >> 28), 3U,       \
  |  |  655|   281k|                       DECODE, ON_FAIL);                                                           \
  |  |  656|   281k|        DECODE_SPL_SEQ((tokens & 0x0F000) >> 12, (tokens & 0x00F00) >> 8,                          \
  |  |  ------------------
  |  |  |  |  593|   281k|    do {                                                                                        \
  |  |  |  |  594|   281k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   281k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   281k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.6k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.6k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.6k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.6k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.6k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.6k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.6k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 34, False: 43.6k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 34, False: 43.6k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 43.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.6k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.6k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.6k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.6k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.6k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   238k|        } else {                                                                                \
  |  |  |  |  609|   238k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   238k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   238k|        }                                                                                       \
  |  |  |  |  612|   281k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.4k, False: 234k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.4k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.4k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.4k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 36, False: 47.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.4k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.4k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.4k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.4k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.4k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.4k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  47.4k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.4k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.4k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.4k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.4k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   234k|        } else {                                                                                \
  |  |  |  |  624|   234k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   234k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   234k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   234k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 281k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  657|   281k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 16) & 0xFFFF),                     \
  |  |  658|   281k|                       ((tokens >> 20) & 0xF) + (tokens >> 28), 2U, DECODE, ON_FAIL);              \
  |  |  659|   281k|        DECODE_SPL_SEQ((tokens & 0x0F00000) >> 20, (tokens & 0x00F0000) >> 16,                     \
  |  |  ------------------
  |  |  |  |  593|   281k|    do {                                                                                        \
  |  |  |  |  594|   281k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   281k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   281k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.5k, False: 238k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.5k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.5k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.5k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.5k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.5k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.5k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 30, False: 43.4k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 30, False: 43.4k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 43.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.5k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.5k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.5k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.5k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.5k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   238k|        } else {                                                                                \
  |  |  |  |  609|   238k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   238k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   238k|        }                                                                                       \
  |  |  |  |  612|   281k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.2k, False: 234k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.2k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.2k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.2k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 56, False: 47.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.2k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.2k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.2k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.2k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.1k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.1k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  47.1k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.1k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.1k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.1k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.1k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   234k|        } else {                                                                                \
  |  |  |  |  624|   234k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   234k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   234k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   234k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 281k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  660|   281k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)((offs >> 32) & 0xFFFF), (tokens >> 28), 1U, \
  |  |  661|   281k|                       DECODE, ON_FAIL);                                                           \
  |  |  662|   281k|        DECODE_SPL_SEQ((tokens >> 28), (tokens >> 24) & 0x0F,                                      \
  |  |  ------------------
  |  |  |  |  593|   281k|    do {                                                                                        \
  |  |  |  |  594|   281k|        uint64_t ll = (LL);                                                                     \
  |  |  |  |  595|   281k|        uint64_t ml = (ML);                                                                     \
  |  |  |  |  596|   281k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 43.7k, False: 237k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  597|  43.7k|            ll += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  598|  43.7k|            const uint64_t reserve = (RESERVE);                                                 \
  |  |  |  |  599|  43.7k|            /* An extended ll eats the batch's destination budget, so reserve                   \
  |  |  |  |  600|  43.7k|             * this sequence's match and the remaining ones too. ml is still                    \
  |  |  |  |  601|  43.7k|             * the raw nibble here; an escaped one re-checks itself below. */                   \
  |  |  |  |  602|  43.7k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  87.4k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 32, False: 43.7k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 32, False: 43.7k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 43.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  603|  43.7k|                         ll + ml + ZXC_LZ_MIN_MATCH_LEN +                                       \
  |  |  |  |  604|  43.7k|                                 (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE >      \
  |  |  |  |  605|  43.7k|                             (size_t)(d_end - d_ptr)))                                          \
  |  |  |  |  606|  43.7k|                ON_FAIL;                                                                        \
  |  |  |  |  607|  43.7k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                         \
  |  |  |  |  608|   237k|        } else {                                                                                \
  |  |  |  |  609|   237k|            /* ll <= 14 here, so one 16-byte store covers it. */                                \
  |  |  |  |  610|   237k|            zxc_copy16(d_ptr, l_ptr);                                                           \
  |  |  |  |  611|   237k|        }                                                                                       \
  |  |  |  |  612|   281k|        l_ptr += ll;                                                                            \
  |  |  |  |  613|   281k|        d_ptr += ll;                                                                            \
  |  |  |  |  614|   281k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) {                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   281k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 47.6k, False: 234k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  615|  47.6k|            ml += zxc_read_varint(&e_ptr, e_end);                                               \
  |  |  |  |  616|  47.6k|            /* d_ptr already carries the literals, hence no `ll +` term here. */                \
  |  |  |  |  617|  47.6k|            if (UNLIKELY(ml + ZXC_LZ_MIN_MATCH_LEN + (N_REM) * ZXC_SPL_MAX_INLINE_OUT_PER_SEQ + \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  47.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 42, False: 47.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  618|  47.6k|                             ZXC_PAD_SIZE >                                                     \
  |  |  |  |  619|  47.6k|                         (size_t)(d_end - d_ptr)))                                              \
  |  |  |  |  620|  47.6k|                ON_FAIL;                                                                        \
  |  |  |  |  621|  47.6k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  47.5k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  622|  47.5k|            DECODE(ml, OFF, zxc_decode_copy_match);                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|  47.5k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  47.5k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  47.5k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  47.5k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  47.5k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 47.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  623|   234k|        } else {                                                                                \
  |  |  |  |  624|   234k|            /* Inline nibble: ml <= ZXC_SPL_MAX_INLINE_ML, so no length ladder. */              \
  |  |  |  |  625|   234k|            ml += ZXC_LZ_MIN_MATCH_LEN;                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   234k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  626|   234k|            DECODE(ml, OFF, zxc_decode_copy_match_short);                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1087|   234k|            DECODE_SPL_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|   234k|    do {                                 \
  |  |  |  |  |  |  |  |  562|   234k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|   234k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|   234k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 234k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  627|   234k|        }                                                                                       \
  |  |  |  |  628|   281k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (628:14): [Folded, False: 281k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  663|   281k|                       ZXC_LZ_OFFSET_BIAS + (uint32_t)(offs >> 48), 0, 0U, DECODE, ON_FAIL);       \
  |  |  664|   281k|        n_seq -= 4;                                                                                \
  |  |  665|   281k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (665:14): [Folded, False: 281k]
  |  |  ------------------
  ------------------
 1088|   281k|        }
 1089|  13.6k|    }
 1090|       |
 1091|       |    // --- Remaining 1 sequence (Fast Path) ---
 1092|   174k|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1092:12): [True: 166k, False: 7.53k]
  |  Branch (1092:25): [True: 156k, False: 9.88k]
  |  Branch (1092:47): [True: 148k, False: 8.18k]
  ------------------
 1093|       |        // Save pointers before reading (in case we need to fall back to Safe Path)
 1094|   148k|        const uint8_t* t_save = t_ptr;
 1095|   148k|        const uint8_t* o_save = o_ptr;
 1096|   148k|        const uint8_t* e_save = e_ptr;
 1097|       |
 1098|   148k|        uint8_t token = *t_ptr++;
 1099|   148k|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  518|   148k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1100|   148k|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|   148k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|   148k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1101|   148k|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   148k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1102|   148k|        if (SPL_OFF8) {
  ------------------
  |  |  577|   148k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 22.2k, False: 126k]
  |  |  ------------------
  ------------------
 1103|  22.2k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1104|   126k|        } else {
 1105|   126k|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1106|   126k|            o_ptr += sizeof(uint16_t);
 1107|   126k|        }
 1108|       |
 1109|   148k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  152|   148k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8.81k, False: 139k]
  |  |  ------------------
  ------------------
 1110|  8.81k|            ll += zxc_read_varint(&e_ptr, e_end);
 1111|  8.81k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  8.81k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 628, False: 8.19k]
  |  |  ------------------
  ------------------
 1112|  8.81k|        }
 1113|   148k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|   148k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 53.9k, False: 94.0k]
  |  |  ------------------
  ------------------
 1114|   148k|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   148k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1115|       |
 1116|       |        // Check bounds before wild copies - if too close to end, fall back to Safe Path
 1117|   148k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr))) {
  ------------------
  |  |  152|   148k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.36k, False: 146k]
  |  |  ------------------
  ------------------
 1118|  1.36k|            t_ptr = t_save;
 1119|  1.36k|            o_ptr = o_save;
 1120|  1.36k|            e_ptr = e_save;
 1121|  1.36k|            break;
 1122|  1.36k|        }
 1123|       |
 1124|       |        // Unlike the 4x batch the copy cannot sit in the varint branch's else -
 1125|       |        // the rollback above must run first - so re-test ll instead. Exact:
 1126|       |        // the escape leaves ll >= ZXC_TOKEN_LL_MASK.
 1127|   146k|        if (LIKELY(ll < ZXC_TOKEN_LL_MASK)) {
  ------------------
  |  |  146|   146k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 139k, False: 7.43k]
  |  |  ------------------
  ------------------
 1128|   139k|            zxc_copy16(d_ptr, l_ptr);
 1129|   139k|        } else {
 1130|  7.43k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1131|  7.43k|        }
 1132|   146k|        l_ptr += ll;
 1133|   146k|        d_ptr += ll;
 1134|       |
 1135|   146k|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  152|   256k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 114, False: 146k]
  |  |  |  Branch (152:42): [True: 109k, False: 36.9k]
  |  |  |  Branch (152:42): [True: 114, False: 109k]
  |  |  ------------------
  ------------------
 1136|    114|            return ZXC_ERROR_BAD_OFFSET;
 1137|       |
 1138|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1139|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1140|   146k|        zxc_decode_copy_match_spl(d_ptr, offset, ml);
 1141|   146k|        d_ptr += ml;
 1142|   146k|        n_seq--;
 1143|   146k|    }
 1144|       |
 1145|       |    // --- Safe Path for Remaining Sequences ---
 1146|   142k|    while (n_seq > 0) {
  ------------------
  |  Branch (1146:12): [True: 116k, False: 25.5k]
  ------------------
 1147|   116k|        uint8_t token = *t_ptr++;
 1148|   116k|        uint64_t ll = token >> ZXC_TOKEN_LIT_BITS;
  ------------------
  |  |  518|   116k|#define ZXC_TOKEN_LIT_BITS 4
  ------------------
 1149|   116k|        uint64_t ml = token & ZXC_TOKEN_ML_MASK;
  ------------------
  |  |  524|   116k|#define ZXC_TOKEN_ML_MASK ((1U << ZXC_TOKEN_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  520|   116k|#define ZXC_TOKEN_ML_BITS 4
  |  |  ------------------
  ------------------
 1150|   116k|        uint32_t offset = ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   116k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1151|   116k|        if (SPL_OFF8) {
  ------------------
  |  |  577|   116k|#define SPL_OFF8 (gh.enc_off == 1)
  |  |  ------------------
  |  |  |  Branch (577:18): [True: 32.1k, False: 84.6k]
  |  |  ------------------
  ------------------
 1152|  32.1k|            offset += *o_ptr++;  // 1-byte offset (biased)
 1153|  84.6k|        } else {
 1154|  84.6k|            offset += zxc_le16(o_ptr);  // 2-byte offset (biased)
 1155|  84.6k|            o_ptr += sizeof(uint16_t);
 1156|  84.6k|        }
 1157|       |
 1158|   116k|        if (UNLIKELY(ll == ZXC_TOKEN_LL_MASK)) ll += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 7.37k, False: 109k]
  |  |  ------------------
  ------------------
 1159|   116k|        if (UNLIKELY(ml == ZXC_TOKEN_ML_MASK)) ml += zxc_read_varint(&e_ptr, e_end);
  ------------------
  |  |  152|   116k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 26.7k, False: 90.1k]
  |  |  ------------------
  ------------------
 1160|   116k|        ml += ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   116k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1161|       |
 1162|   116k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|   232k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.32k, False: 115k]
  |  |  |  Branch (152:42): [True: 1.01k, False: 115k]
  |  |  |  Branch (152:42): [True: 310, False: 115k]
  |  |  ------------------
  ------------------
 1163|  1.32k|            return ZXC_ERROR_OVERFLOW;
 1164|   115k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|   115k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1165|   115k|        l_ptr += ll;
 1166|   115k|        d_ptr += ll;
 1167|       |
 1168|   115k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|   115k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 70, False: 115k]
  |  |  ------------------
  ------------------
 1169|   115k|        const uint8_t* match_src = d_ptr - offset;
 1170|       |
 1171|   115k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1172|   115k|        d_ptr += ml;
 1173|   115k|        n_seq--;
 1174|   115k|    }
 1175|       |
 1176|       |    // --- Trailing Literals ---
 1177|       |    // Copy remaining literals from source stream (literal exhaustion)
 1178|  25.5k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  25.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 25.5k]
  |  |  ------------------
  ------------------
 1179|  25.5k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  25.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 25.5k]
  |  |  ------------------
  ------------------
 1180|       |
 1181|  25.5k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1182|  25.5k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  25.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 6, False: 25.5k]
  |  |  ------------------
  ------------------
 1183|  25.5k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  168|  25.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1184|  25.5k|    d_ptr += remaining_literals;
 1185|       |
 1186|  25.5k|    return (int)(d_ptr - dst);
 1187|  25.5k|}
zxc_decompress.c:zxc_decode_block_spl_entropy_safe:
 1474|  4.97k|                                                          const size_t dst_capacity) {
 1475|  4.97k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 1, 0, 1);
 1476|  4.97k|}
zxc_decompress.c:zxc_decode_block_spl_entropy:
 1456|  4.97k|                                                     const size_t dst_capacity) {
 1457|  4.97k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 1);
 1458|  4.97k|}
zxc_decompress.c:zxc_decode_lit_pivco:
  745|  6.57k|                                                      const size_t required_size) {
  746|  6.57k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  747|  6.57k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  152|  6.57k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 6.57k]
  |  |  ------------------
  ------------------
  748|  6.57k|    if (UNLIKELY(ctx->lit_buffer_cap < required_size + ZXC_PAD_SIZE ||
  ------------------
  |  |  152|  13.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 16, False: 6.56k]
  |  |  |  Branch (152:42): [True: 16, False: 6.56k]
  |  |  |  Branch (152:42): [True: 0, False: 6.56k]
  |  |  ------------------
  ------------------
  749|  6.57k|                 ctx->pivco_scratch_cap < required_size + ZXC_PIVCO_SCRATCH_PAD))
  750|     16|        return ZXC_ERROR_DST_TOO_SMALL;
  751|  6.56k|    return zxc_huf_decode_section(payload, psize, ctx->lit_buffer, required_size,
  ------------------
  |  |   33|  6.56k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   25|  6.56k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   24|  6.56k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  752|  6.56k|                                  ctx->pivco_scratch);
  753|  6.57k|}
zxc_decompress.c:zxc_ensure_entropy_scratch:
  737|  14.9k|static ZXC_NOINLINE ZXC_COLD int zxc_ensure_entropy_scratch(const zxc_cctx_t* RESTRICT ctx) {
  738|  14.9k|    if (LIKELY(ctx->pivco_scratch)) return ZXC_OK;
  ------------------
  |  |  146|  14.9k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 10.0k, False: 4.86k]
  |  |  ------------------
  ------------------
  739|  4.86k|    return zxc_cctx_alloc_entropy_scratch((zxc_cctx_t*)(uintptr_t)ctx);
  740|  14.9k|}
zxc_decompress.c:zxc_decode_lit_pivco_dict:
  766|     34|                                                           const size_t required_size) {
  767|     34|    if (UNLIKELY(!ctx->dict_huf_tree_ok)) return ZXC_ERROR_DICT_REQUIRED;
  ------------------
  |  |  152|     34|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 34, False: 0]
  |  |  ------------------
  ------------------
  768|      0|    const int arc = zxc_ensure_entropy_scratch(ctx);
  769|      0|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  770|      0|    if (UNLIKELY(ctx->lit_buffer_cap < required_size + ZXC_PAD_SIZE ||
  ------------------
  |  |  152|      0|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  771|      0|                 ctx->pivco_scratch_cap < required_size + ZXC_PIVCO_SCRATCH_PAD))
  772|      0|        return ZXC_ERROR_DST_TOO_SMALL;
  773|      0|    return zxc_huf_decode_section_dict(payload, psize, ctx->lit_buffer, required_size,
  ------------------
  |  |   34|      0|#define zxc_huf_decode_section_dict ZXC_CAT(zxc_huf_decode_section_dict, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   25|      0|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   24|      0|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|      0|                                       &ctx->dict_huf->tree, ctx->pivco_scratch);
  775|      0|}
zxc_decompress.c:zxc_decode_tok_pivco:
  780|  8.35k|                                                      const size_t psize, const size_t n_tok) {
  781|  8.35k|    const int arc = zxc_ensure_entropy_scratch(ctx);
  782|  8.35k|    if (UNLIKELY(arc != ZXC_OK)) return arc;
  ------------------
  |  |  152|  8.35k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.35k]
  |  |  ------------------
  ------------------
  783|  8.35k|    if (UNLIKELY(n_tok + ZXC_PAD_SIZE > ctx->tok_buffer_cap ||
  ------------------
  |  |  152|  16.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.35k]
  |  |  |  Branch (152:42): [True: 0, False: 8.35k]
  |  |  |  Branch (152:42): [True: 0, False: 8.35k]
  |  |  ------------------
  ------------------
  784|  8.35k|                 n_tok + ZXC_PIVCO_SCRATCH_PAD > ctx->pivco_scratch_cap))
  785|      0|        return ZXC_ERROR_DST_TOO_SMALL;
  786|  8.35k|    return zxc_huf_decode_section(payload, psize, ctx->tok_buffer, n_tok, ctx->pivco_scratch);
  ------------------
  |  |   33|  8.35k|#define zxc_huf_decode_section ZXC_CAT(zxc_huf_decode_section, ZXC_FUNCTION_SUFFIX)
  |  |  ------------------
  |  |  |  |   25|  8.35k|#define ZXC_CAT(x, y) ZXC_CAT_IMPL(x, y)
  |  |  |  |  ------------------
  |  |  |  |  |  |   24|  8.35k|#define ZXC_CAT_IMPL(x, y) x##y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  787|  8.35k|}
zxc_decompress.c:zxc_decode_copy_literals:
  426|  4.96M|                                                       const uint64_t ll) {
  427|  4.96M|    zxc_wild_copy32(dst, src, ll);
  428|  4.96M|}
zxc_decompress.c:zxc_wild_copy32:
  393|  9.36M|static ZXC_ALWAYS_INLINE void zxc_wild_copy32(uint8_t* dst, const uint8_t* src, const size_t len) {
  394|  9.36M|    zxc_copy32(dst, src);
  395|  9.36M|    if (UNLIKELY(len > 32)) {
  ------------------
  |  |  152|  9.36M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 2.54M, False: 6.81M]
  |  |  ------------------
  ------------------
  396|  2.54M|        size_t rem = len - 32;
  397|  2.54M|        dst += 32;
  398|  2.54M|        src += 32;
  399|  19.1M|        while (rem > 32) {
  ------------------
  |  Branch (399:16): [True: 16.5M, False: 2.54M]
  ------------------
  400|  16.5M|            zxc_copy32(dst, src);
  401|  16.5M|            dst += 32;
  402|  16.5M|            src += 32;
  403|  16.5M|            rem -= 32;
  404|  16.5M|        }
  405|  2.54M|        zxc_copy32(dst, src);
  406|  2.54M|    }
  407|  9.36M|}
zxc_decompress.c:zxc_decode_copy_match:
  454|  5.55M|                                                    const uint64_t ml) {
  455|  5.55M|    const uint8_t* match_src = d_ptr - off;
  456|  5.55M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  146|  5.55M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 4.39M, False: 1.16M]
  |  |  ------------------
  ------------------
  457|  4.39M|        zxc_wild_copy32(d_ptr, match_src, ml);
  458|  4.39M|    } else if (off == 1) {
  ------------------
  |  Branch (458:16): [True: 416k, False: 746k]
  ------------------
  459|   416k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  460|   746k|    } else {
  461|   746k|        zxc_decode_copy_overlap_run32(d_ptr, off, ml);
  462|   746k|    }
  463|  5.55M|}
zxc_decompress.c:zxc_decode_fill_run:
  331|   804k|                                                  const uint64_t ml) {
  332|   804k|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  333|   804k|    const __m256i v = _mm256_set1_epi8((char)byte);
  334|   804k|    _mm256_storeu_si256((__m256i*)dst, v);
  335|   804k|    if (UNLIKELY(ml > 32)) {
  ------------------
  |  |  152|   804k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 269k, False: 534k]
  |  |  ------------------
  ------------------
  336|   269k|        uint8_t* p = dst;
  337|   269k|        const uint8_t* const last = dst + ml - 32;
  338|  3.70M|        do {
  339|  3.70M|            p += 32;
  340|  3.70M|            _mm256_storeu_si256((__m256i*)p, v);
  341|  3.70M|        } while (p < last);
  ------------------
  |  Branch (341:18): [True: 3.43M, False: 269k]
  ------------------
  342|   269k|    }
  343|       |#elif defined(ZXC_USE_SSE2)
  344|       |    const __m128i v = _mm_set1_epi8((char)byte);
  345|       |    _mm_storeu_si128((__m128i*)dst, v);
  346|       |    _mm_storeu_si128((__m128i*)(dst + 16), v);
  347|       |    if (UNLIKELY(ml > 32)) {
  348|       |        uint8_t* p = dst;
  349|       |        const uint8_t* const last = dst + ml - 32;
  350|       |        do {
  351|       |            p += 32;
  352|       |            _mm_storeu_si128((__m128i*)p, v);
  353|       |            _mm_storeu_si128((__m128i*)(p + 16), v);
  354|       |        } while (p < last);
  355|       |    }
  356|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
  357|       |    const uint8x16_t v = vdupq_n_u8(byte);
  358|       |    vst1q_u8(dst, v);
  359|       |    vst1q_u8(dst + 16, v);
  360|       |    if (UNLIKELY(ml > 32)) {
  361|       |        uint8_t* p = dst;
  362|       |        const uint8_t* const last = dst + ml - 32;
  363|       |        do {
  364|       |            p += 32;
  365|       |            vst1q_u8(p, v);
  366|       |            vst1q_u8(p + 16, v);
  367|       |        } while (p < last);
  368|       |    }
  369|       |#else
  370|       |    ZXC_MEMSET(dst, byte, ml);
  371|       |#endif
  372|   804k|}
zxc_decompress.c:zxc_decode_copy_overlap_run32:
  152|   254k|                                                            const uint64_t ml) {
  153|   254k|    const size_t stride = zxc_overlap_strides32[off];
  154|   254k|    size_t copied = 0;
  155|       |    // MSan keeps the shadow of the bytes a shuffle loads but never selects.
  156|   254k|    ZXC_MSAN_UNPOISON(dst, 32 - off);
  ------------------
  |  |  268|   254k|#define ZXC_MSAN_UNPOISON(p, n) ((void)0)
  ------------------
  157|       |#if defined(ZXC_USE_NEON64)
  158|       |    uint8x16x2_t tbl;
  159|       |    tbl.val[0] = vld1q_u8(dst - off);
  160|       |    tbl.val[1] = vld1q_u8(dst - off + 16);
  161|       |    const uint8x16_t pat_lo = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off]));
  162|       |    const uint8x16_t pat_hi = vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16));
  163|       |    do {
  164|       |        vst1q_u8(dst + copied, pat_lo);
  165|       |        vst1q_u8(dst + copied + 16, pat_hi);
  166|       |        copied += stride;
  167|       |    } while (copied < ml);
  168|       |
  169|       |#elif defined(ZXC_USE_NEON32)
  170|       |    // VTBL reaches 8 bytes per lookup from a 4-register (32-byte) table, so the
  171|       |    // pattern takes four lookups instead of NEON64's two.
  172|       |    uint8x8x4_t tbl;
  173|       |    tbl.val[0] = vld1_u8(dst - off);
  174|       |    tbl.val[1] = vld1_u8(dst - off + 8);
  175|       |    tbl.val[2] = vld1_u8(dst - off + 16);
  176|       |    tbl.val[3] = vld1_u8(dst - off + 24);
  177|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  178|       |    const uint8x8_t p0 = vtbl4_u8(tbl, vld1_u8(m));
  179|       |    const uint8x8_t p1 = vtbl4_u8(tbl, vld1_u8(m + 8));
  180|       |    const uint8x8_t p2 = vtbl4_u8(tbl, vld1_u8(m + 16));
  181|       |    const uint8x8_t p3 = vtbl4_u8(tbl, vld1_u8(m + 24));
  182|       |    do {
  183|       |        vst1_u8(dst + copied, p0);
  184|       |        vst1_u8(dst + copied + 8, p1);
  185|       |        vst1_u8(dst + copied + 16, p2);
  186|       |        vst1_u8(dst + copied + 24, p3);
  187|       |        copied += stride;
  188|       |    } while (copied < ml);
  189|       |
  190|       |#elif defined(ZXC_USE_AVX512) && defined(__AVX512VBMI__) && defined(__AVX512VL__)
  191|       |    // vpermb indexes all 32 bytes, so the table needs no emulation.
  192|       |    const __m256i pat =
  193|       |        _mm256_permutexvar_epi8(_mm256_load_si256((const __m256i*)zxc_overlap_masks32[off]),
  194|       |                                _mm256_loadu_si256((const __m256i*)(dst - off)));
  195|       |    do {
  196|       |        _mm256_storeu_si256((__m256i*)(dst + copied), pat);
  197|       |        copied += stride;
  198|       |    } while (copied < ml);
  199|       |
  200|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  201|       |    // pshufb only reaches 16 bytes per lane, so the 32-byte table is emulated:
  202|       |    // shuffle both halves, then pick per byte on bit 4 of the index.
  203|   254k|    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  204|   254k|    const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  205|   254k|    const __m128i sixteen = _mm_set1_epi8(16);
  206|   254k|    const __m128i m_lo = _mm_load_si128((const __m128i*)zxc_overlap_masks32[off]);
  207|   254k|    const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  208|   254k|    const __m128i pat_lo =
  209|   254k|        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_lo),
  210|   254k|                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_lo, sixteen)), _mm_slli_epi16(m_lo, 3));
  211|   254k|    const __m128i pat_hi =
  212|   254k|        _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  213|   254k|                        _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, sixteen)), _mm_slli_epi16(m_hi, 3));
  214|   527k|    do {
  215|   527k|        _mm_storeu_si128((__m128i*)(dst + copied), pat_lo);
  216|   527k|        _mm_storeu_si128((__m128i*)(dst + copied + 16), pat_hi);
  217|   527k|        copied += stride;
  218|   527k|    } while (copied < ml);
  ------------------
  |  Branch (218:14): [True: 272k, False: 254k]
  ------------------
  219|       |
  220|       |#else
  221|       |    // SSE2 (no PSHUFB) and non-SIMD tiers: build the 32-byte pattern with a
  222|       |    // wrap counter (no per-byte modulo), then store it as two 16-byte halves.
  223|       |    const uint8_t* src = dst - off;
  224|       |    uint8_t pat[32];
  225|       |    uint32_t k = 0;
  226|       |    for (size_t i = 0; i < 32; i++) {
  227|       |        pat[i] = src[k];
  228|       |        if (++k == off) k = 0;
  229|       |    }
  230|       |    do {
  231|       |        zxc_copy16(dst + copied, pat);
  232|       |        zxc_copy16(dst + copied + 16, pat + 16);
  233|       |        copied += stride;
  234|       |    } while (copied < ml);
  235|       |#endif
  236|   254k|}
zxc_decompress.c:zxc_decode_copy_match_short:
  481|  11.5M|                                                          const uint32_t off, const uint64_t ml) {
  482|  11.5M|    const uint8_t* match_src = d_ptr - off;
  483|  11.5M|    if (LIKELY(off >= 32)) {
  ------------------
  |  |  146|  11.5M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 9.96M, False: 1.56M]
  |  |  ------------------
  ------------------
  484|  9.96M|        zxc_copy32(d_ptr, match_src);
  485|  9.96M|    } else if (off == 1) {
  ------------------
  |  Branch (485:16): [True: 387k, False: 1.17M]
  ------------------
  486|   387k|        zxc_decode_fill_run(d_ptr, match_src[0], ml);
  487|  1.17M|    } else {
  488|  1.17M|        zxc_decode_copy_overlap_short(d_ptr, off, ml);
  489|  1.17M|    }
  490|  11.5M|}
zxc_decompress.c:zxc_decode_copy_overlap_short:
  259|   567k|                                                            const uint64_t ml) {
  260|   567k|    ZXC_MSAN_UNPOISON(dst, ml > 16 ? 32 - off : (off < 16 ? 16 - off : 0));
  ------------------
  |  |  268|   567k|#define ZXC_MSAN_UNPOISON(p, n) ((void)0)
  ------------------
  261|       |#if defined(ZXC_USE_NEON64)
  262|       |    const uint8x16_t s0 = vld1q_u8(dst - off);
  263|       |    vst1q_u8(dst, vqtbl1q_u8(s0, vld1q_u8(zxc_overlap_masks32[off])));
  264|       |    if (UNLIKELY(ml > 16)) {
  265|       |        uint8x16x2_t tbl;
  266|       |        tbl.val[0] = s0;
  267|       |        tbl.val[1] = vld1q_u8(dst - off + 16);
  268|       |        vst1q_u8(dst + 16, vqtbl2q_u8(tbl, vld1q_u8(zxc_overlap_masks32[off] + 16)));
  269|       |    }
  270|       |
  271|       |#elif defined(ZXC_USE_NEON32)
  272|       |    uint8x8x2_t lo_tbl;
  273|       |    lo_tbl.val[0] = vld1_u8(dst - off);
  274|       |    lo_tbl.val[1] = vld1_u8(dst - off + 8);
  275|       |    const uint8_t* const m = zxc_overlap_masks32[off];
  276|       |    vst1_u8(dst, vtbl2_u8(lo_tbl, vld1_u8(m)));
  277|       |    vst1_u8(dst + 8, vtbl2_u8(lo_tbl, vld1_u8(m + 8)));
  278|       |    if (UNLIKELY(ml > 16)) {
  279|       |        uint8x8x4_t tbl;
  280|       |        tbl.val[0] = lo_tbl.val[0];
  281|       |        tbl.val[1] = lo_tbl.val[1];
  282|       |        tbl.val[2] = vld1_u8(dst - off + 16);
  283|       |        tbl.val[3] = vld1_u8(dst - off + 24);
  284|       |        vst1_u8(dst + 16, vtbl4_u8(tbl, vld1_u8(m + 16)));
  285|       |        vst1_u8(dst + 24, vtbl4_u8(tbl, vld1_u8(m + 24)));
  286|       |    }
  287|       |
  288|       |#elif defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
  289|       |    // pshufb reaches 16 bytes, so only the upper half needs two tables: shuffle
  290|       |    // both and pick per byte on bit 4 of the index.
  291|   567k|    const __m128i t0 = _mm_loadu_si128((const __m128i*)(dst - off));
  292|   567k|    _mm_storeu_si128(
  293|   567k|        (__m128i*)dst,
  294|   567k|        _mm_shuffle_epi8(t0, _mm_load_si128((const __m128i*)zxc_overlap_masks32[off])));
  295|   567k|    if (UNLIKELY(ml > 16)) {
  ------------------
  |  |  152|   567k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 27.3k, False: 540k]
  |  |  ------------------
  ------------------
  296|  27.3k|        const __m128i t1 = _mm_loadu_si128((const __m128i*)(dst - off + 16));
  297|  27.3k|        const __m128i m_hi = _mm_load_si128((const __m128i*)(zxc_overlap_masks32[off] + 16));
  298|  27.3k|        _mm_storeu_si128(
  299|  27.3k|            (__m128i*)(dst + 16),
  300|  27.3k|            _mm_blendv_epi8(_mm_shuffle_epi8(t0, m_hi),
  301|  27.3k|                            _mm_shuffle_epi8(t1, _mm_sub_epi8(m_hi, _mm_set1_epi8(16))),
  302|  27.3k|                            _mm_slli_epi16(m_hi, 3)));
  303|  27.3k|    }
  304|       |
  305|       |#else
  306|       |    const uint8_t* src = dst - off;
  307|       |    const size_t n = (ml > 16) ? 32 : 16;
  308|       |    uint32_t k = 0;
  309|       |    for (size_t i = 0; i < n; i++) {
  310|       |        dst[i] = src[k];
  311|       |        if (++k == off) k = 0;
  312|       |    }
  313|       |#endif
  314|   567k|}
zxc_decompress.c:zxc_decode_copy_match_spl:
  503|   146k|                                                        const uint64_t ml) {
  504|   146k|    if (LIKELY(ml <= ZXC_SPL_MAX_INLINE_ML)) {
  ------------------
  |  |  146|   146k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 93.6k, False: 52.9k]
  |  |  ------------------
  ------------------
  505|  93.6k|        zxc_decode_copy_match_short(d_ptr, off, ml);
  506|  93.6k|    } else {
  507|  52.9k|        zxc_decode_copy_match(d_ptr, off, ml);
  508|  52.9k|    }
  509|   146k|}
zxc_decompress.c:zxc_decode_copy_match_exact:
  528|   168k|                                                     const size_t off, const size_t ml) {
  529|   168k|    if (off >= ml) {
  ------------------
  |  Branch (529:9): [True: 139k, False: 28.1k]
  ------------------
  530|   139k|        ZXC_MEMCPY(d_ptr, match_src, ml);
  ------------------
  |  |  168|   139k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  531|   139k|    } else if (ml < 16) {
  ------------------
  |  Branch (531:16): [True: 12.4k, False: 15.6k]
  ------------------
  532|   113k|        for (size_t i = 0; i < ml; i++) d_ptr[i] = match_src[i];
  ------------------
  |  Branch (532:28): [True: 100k, False: 12.4k]
  ------------------
  533|  15.6k|    } else {
  534|  15.6k|        size_t n = off;
  535|  15.6k|        ZXC_MEMCPY(d_ptr, match_src, n);
  ------------------
  |  |  168|  15.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  536|  73.1k|        while (n <= ml - n) {
  ------------------
  |  Branch (536:16): [True: 57.5k, False: 15.6k]
  ------------------
  537|  57.5k|            ZXC_MEMCPY(d_ptr + n, d_ptr, n);
  ------------------
  |  |  168|  57.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  538|  57.5k|            n <<= 1;
  539|  57.5k|        }
  540|  15.6k|        ZXC_MEMCPY(d_ptr + n, d_ptr, ml - n);
  ------------------
  |  |  168|  15.6k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
  541|  15.6k|    }
  542|   168k|}
zxc_decompress.c:zxc_decode_block_spl:
 1493|  16.2k|                                const size_t dst_capacity) {
 1494|  16.2k|    return zxc_decode_block_spl_impl(ctx, src, src_size, dst, dst_capacity, 0, 0, 0);
 1495|  16.2k|}
zxc_decompress.c:zxc_decode_block_pak_safe:
 1598|  5.18k|                                                  const size_t dst_capacity) {
 1599|  5.18k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 1, 0);
 1600|  5.18k|}
zxc_decompress.c:zxc_decode_block_pak_impl:
 1213|  10.3k|                                                       const int has_dict) {
 1214|  10.3k|    zxc_gnr_header_t gh;
 1215|       |
 1216|       |    // 0 when !has_dict (safe path) -> folds `d_floor` to `dst`.
 1217|  10.3k|    const size_t dict_size = has_dict ? ctx->dict_size : 0;
  ------------------
  |  Branch (1217:30): [True: 0, False: 10.3k]
  ------------------
 1218|       |
 1219|  10.3k|    if (UNLIKELY(zxc_read_pak_header(src, src_size, &gh) != ZXC_OK)) return ZXC_ERROR_BAD_HEADER;
  ------------------
  |  |  152|  10.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 10.3k]
  |  |  ------------------
  ------------------
 1220|  10.3k|    if (UNLIKELY(gh.enc_lit != ZXC_SECTION_ENCODING_RAW || gh.enc_tok != 0))
  ------------------
  |  |  152|  20.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 48, False: 10.3k]
  |  |  |  Branch (152:42): [True: 36, False: 10.3k]
  |  |  |  Branch (152:42): [True: 12, False: 10.3k]
  |  |  ------------------
  ------------------
 1221|     48|        return ZXC_ERROR_CORRUPT_DATA;
 1222|       |
 1223|  10.3k|    const uint8_t* const p_data = src + ZXC_PAK_HEADER_BINARY_SIZE;
  ------------------
  |  |  445|  10.3k|#define ZXC_PAK_HEADER_BINARY_SIZE 12
  ------------------
 1224|  10.3k|    const uint8_t* p_curr = p_data;
 1225|       |
 1226|       |    // --- Stream Pointers & Validation ---
 1227|       |    // PAK carries no section descriptors: literals are always RAW, the sequence
 1228|       |    // stream is four bytes per sequence, and extras run to the payload end.
 1229|  10.3k|    const size_t sz_lit = gh.n_literals;
 1230|  10.3k|    const uint64_t sz_seqs = (uint64_t)gh.n_sequences * sizeof(uint32_t);
 1231|       |
 1232|  10.3k|    const size_t payload_avail = (size_t)(src + src_size - p_data);
 1233|  10.3k|    const uint64_t consumed = (uint64_t)sz_lit + sz_seqs;
 1234|  10.3k|    if (UNLIKELY(consumed > (uint64_t)payload_avail)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  10.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 208, False: 10.1k]
  |  |  ------------------
  ------------------
 1235|  10.1k|    const size_t sz_exts = payload_avail - (size_t)consumed; /* slack padding included */
 1236|       |
 1237|       |    // PAK literals are always RAW, so the slack is always load-bearing here.
 1238|       |    // No underflow: sz_lit <= consumed <= payload_avail.
 1239|  10.1k|    if (UNLIKELY(payload_avail - sz_lit < ZXC_BLOCK_LIT_SLACK)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  10.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 8, False: 10.0k]
  |  |  ------------------
  ------------------
 1240|       |
 1241|  10.0k|    const uint8_t* l_ptr = p_curr;
 1242|  10.0k|    const uint8_t* l_end = l_ptr + sz_lit;
 1243|  10.0k|    p_curr += sz_lit;
 1244|       |
 1245|  10.0k|    const uint8_t* seq_ptr = p_curr;
 1246|  10.0k|    const uint8_t* extras_ptr = p_curr + (size_t)sz_seqs;
 1247|  10.0k|    const uint8_t* const extras_end = extras_ptr + sz_exts;
 1248|       |
 1249|  10.0k|    uint8_t* d_ptr = dst;
 1250|  10.0k|    const uint8_t* const d_end = dst + dst_capacity;
 1251|       |    // Lowest address a match may reach: the dictionary prefix if any, else dst.
 1252|  10.0k|    const uint8_t* const d_floor = dst - dict_size;
 1253|  10.0k|    const uint8_t* const d_end_safe =
 1254|  10.0k|        (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  342|  10.0k|#define ZXC_PAD_SIZE 32
  ------------------
                      (dst_capacity > ZXC_PAD_SIZE * 4) ? d_end - (ZXC_PAD_SIZE * 4) : dst;  // 128
  ------------------
  |  |  342|  9.64k|#define ZXC_PAD_SIZE 32
  ------------------
  |  Branch (1254:9): [True: 9.64k, False: 455]
  ------------------
 1255|       |    // 4x loop margin: four sequences of inline output (ll <= 254, ml <= 254 + 5,
 1256|       |    // longer ones escape and check themselves) plus the wild-copy overshoot:
 1257|       |    // 4 x 513 + 32 = 2084, all of ZXC_DECOMPRESS_TAIL_PAD.
 1258|  10.0k|    const uint8_t* const d_end_fast =
 1259|  10.0k|        (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  372|  10.0k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  10.0k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  10.0k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  10.0k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  10.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  10.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  10.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  10.0k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
                      (dst_capacity > ZXC_DECOMPRESS_TAIL_PAD) ? d_end - ZXC_DECOMPRESS_TAIL_PAD : dst;
  ------------------
  |  |  372|  8.56k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  8.56k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  8.56k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  8.56k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  8.56k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  8.56k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  8.56k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  8.56k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  |  Branch (1259:9): [True: 8.56k, False: 1.53k]
  ------------------
 1260|       |
 1261|       |    // Literal margin for the PAK loops: without a varint, ll <= 254 per sequence,
 1262|       |    // so 4 * 254 = 1016. Past that only the cold varint path checks l_ptr.
 1263|  10.0k|    const size_t pak_margin_4x = 4 * (ZXC_SEQ_LL_MASK - 1);  // 1016
  ------------------
  |  |  539|  10.0k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  10.0k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1264|  10.0k|    const size_t pak_margin_1x = ZXC_SEQ_LL_MASK - 1;        // 254
  ------------------
  |  |  539|  10.0k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  ------------------
  |  |  |  |  533|  10.0k|#define ZXC_SEQ_LL_BITS 8
  |  |  ------------------
  ------------------
 1265|  10.0k|    const uint8_t* const l_end_safe_4x = (sz_lit > pak_margin_4x) ? l_end - pak_margin_4x : l_ptr;
  ------------------
  |  Branch (1265:42): [True: 7.30k, False: 2.79k]
  ------------------
 1266|  10.0k|    const uint8_t* const l_end_safe_1x = (sz_lit > pak_margin_1x) ? l_end - pak_margin_1x : l_ptr;
  ------------------
  |  Branch (1266:42): [True: 7.70k, False: 2.39k]
  ------------------
 1267|       |
 1268|  10.0k|    uint32_t n_seq = gh.n_sequences;
 1269|       |
 1270|       |    // Same handover as SPL, but the PAK offset is inline in the sequence word and
 1271|       |    // always 16 bits -- enc_off is not a width here, so the span is fixed.
 1272|  10.0k|    const size_t off_span = 1U << 16;
 1273|  10.0k|    const size_t span = (dict_size >= off_span) ? 0 : off_span - dict_size;
  ------------------
  |  Branch (1273:25): [True: 0, False: 10.0k]
  ------------------
 1274|  10.0k|    const uint8_t* const d_bounds = (span >= dst_capacity) ? d_end : dst + span;
  ------------------
  |  Branch (1274:37): [True: 6.31k, False: 3.77k]
  ------------------
 1275|       |
 1276|       |    // --- SAFE loop: validate offsets until d_bounds (4x unroll) ---
 1277|  10.0k|    if (safe) {
  ------------------
  |  Branch (1277:9): [True: 5.04k, False: 5.04k]
  ------------------
 1278|       |        // SAFE variant: save per-batch state so an OVERFLOW can rollback and
 1279|       |        // hand over to the 1x loop / Safe Path. Wild writes already committed
 1280|       |        // are deterministically overwritten when the 1x loop replays.
 1281|   344k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1281:16): [True: 343k, False: 722]
  |  Branch (1281:30): [True: 341k, False: 2.09k]
  |  Branch (1281:52): [True: 341k, False: 608]
  |  Branch (1281:77): [True: 340k, False: 1.11k]
  ------------------
 1282|   340k|            const uint8_t* const t_save = seq_ptr;
 1283|   340k|            const uint8_t* const e_save = extras_ptr;
 1284|   340k|            uint8_t* const d_save = d_ptr;
 1285|   340k|            const uint8_t* const l_save = l_ptr;
 1286|   340k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  ------------------
  |  |  706|   340k|    do {                                                                                        \
  |  |  707|   340k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|   340k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|   340k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|   340k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|   340k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|   340k|        PREFETCH;                                                                               \
  |  |  713|   340k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|   340k|    do {                                                                                     \
  |  |  |  |  674|   340k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   340k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   340k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   340k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   340k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   340k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   340k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   340k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   340k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   340k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   340k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   340k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   340k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.26k, False: 335k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.26k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.26k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.26k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.26k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.48k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 92, False: 4.16k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 36, False: 4.22k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 56, False: 4.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.26k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.26k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.26k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.26k|        }                                                                                    \
  |  |  |  |  686|   340k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.2k, False: 329k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.2k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.2k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 49, False: 10.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.2k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.2k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.2k|        }                                                                                    \
  |  |  |  |  692|   339k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   339k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   339k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   339k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   339k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   339k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   339k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   339k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|   339k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   339k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   339k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 50, False: 339k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   339k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   339k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   339k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 339k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   339k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 339k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|   340k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|   340k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|   340k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|   339k|    do {                                                                                     \
  |  |  |  |  674|   339k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   339k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   339k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   339k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   339k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   339k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   339k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   339k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.00k, False: 335k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.00k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.00k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.00k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.00k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  7.98k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 60, False: 3.94k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 20, False: 3.98k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 40, False: 3.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.00k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.00k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.00k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.00k|        }                                                                                    \
  |  |  |  |  686|   339k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.5k, False: 329k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.5k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.5k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 28, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.5k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.5k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.5k|        }                                                                                    \
  |  |  |  |  692|   339k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   339k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   339k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   339k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   339k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   339k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   339k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   339k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|   339k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   339k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   339k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 32, False: 339k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   339k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   339k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   339k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 339k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   339k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 339k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|   339k|                       ON_FAIL);                                                                \
  |  |  718|   339k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|   339k|    do {                                                                                     \
  |  |  |  |  674|   339k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   339k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   339k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   339k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   339k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   339k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   339k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   339k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 3.88k, False: 335k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  3.88k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  3.88k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  3.88k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  3.88k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  7.75k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 58, False: 3.83k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 20, False: 3.86k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 38, False: 3.83k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  3.88k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  3.88k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  3.88k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  3.88k|        }                                                                                    \
  |  |  |  |  686|   339k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.0k, False: 329k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.0k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.0k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 25, False: 10.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.0k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.0k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.0k|        }                                                                                    \
  |  |  |  |  692|   339k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   339k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   339k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   339k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   339k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   339k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   339k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   339k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|   339k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   339k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   339k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 48, False: 339k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   339k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   339k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   339k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 339k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   339k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 339k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|   339k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|   339k|    do {                                                                                     \
  |  |  |  |  674|   339k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   339k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   339k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   339k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   339k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   339k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   339k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   339k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   339k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.04k, False: 335k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.04k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.04k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.04k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.04k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.06k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 36, False: 4.00k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 26, False: 4.01k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 10, False: 4.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.04k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.04k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.04k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.04k|        }                                                                                    \
  |  |  |  |  686|   339k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.5k, False: 329k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.5k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.5k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 12, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.5k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.5k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.5k|        }                                                                                    \
  |  |  |  |  692|   339k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   339k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   339k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   339k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   339k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   339k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   339k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   339k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   339k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1286|   339k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, goto rollback_safe_4x, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   339k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   339k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   339k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 24, False: 339k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   339k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   339k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   339k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 339k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   339k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 339k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|   339k|        n_seq -= 4;                                                                             \
  |  |  721|   339k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 339k]
  |  |  ------------------
  ------------------
 1287|   339k|            continue;
 1288|       |
 1289|   339k|        rollback_safe_4x:
 1290|    360|            seq_ptr = t_save;
 1291|    360|            extras_ptr = e_save;
 1292|    360|            d_ptr = d_save;
 1293|    360|            l_ptr = l_save;
 1294|    360|            break;
 1295|   340k|        }
 1296|  5.04k|    } else {
 1297|   349k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x && d_ptr < d_bounds) {
  ------------------
  |  Branch (1297:16): [True: 348k, False: 1.32k]
  |  Branch (1297:30): [True: 347k, False: 8]
  |  Branch (1297:52): [True: 345k, False: 2.09k]
  |  Branch (1297:77): [True: 344k, False: 1.27k]
  ------------------
 1298|   344k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  ------------------
  |  |  706|   344k|    do {                                                                                        \
  |  |  707|   344k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|   344k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|   344k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|   344k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|   344k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|   344k|        PREFETCH;                                                                               \
  |  |  713|   344k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|   344k|    do {                                                                                     \
  |  |  |  |  674|   344k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   344k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   344k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   344k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   344k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   344k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   344k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   344k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.51k, False: 340k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.51k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.51k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.51k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.51k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.99k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 36, False: 4.48k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 36, False: 4.48k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 4.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.51k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.51k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.51k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.51k|        }                                                                                    \
  |  |  |  |  686|   344k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.2k, False: 334k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.2k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.2k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 30, False: 10.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.2k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.2k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.2k|        }                                                                                    \
  |  |  |  |  692|   344k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   344k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   344k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   344k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   344k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   344k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   344k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   344k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   344k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   344k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   344k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 50, False: 344k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   344k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   344k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   344k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 344k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   344k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 344k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|   344k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|   344k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|   344k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|   344k|    do {                                                                                     \
  |  |  |  |  674|   344k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   344k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   344k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   344k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   344k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   344k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   344k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   344k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.20k, False: 340k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.20k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.20k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.20k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.20k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.38k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 4.18k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 20, False: 4.18k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 4.18k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.20k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.20k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.20k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.20k|        }                                                                                    \
  |  |  |  |  686|   344k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.5k, False: 333k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.5k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.5k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 22, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.5k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.5k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.5k|        }                                                                                    \
  |  |  |  |  692|   344k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   344k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   344k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   344k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   344k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   344k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   344k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   344k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   344k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   344k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   344k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 32, False: 344k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   344k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   344k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   344k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 344k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   344k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 344k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|   344k|                       ON_FAIL);                                                                \
  |  |  718|   344k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|   344k|    do {                                                                                     \
  |  |  |  |  674|   344k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   344k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   344k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   344k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   344k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   344k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   344k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   344k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.11k, False: 340k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.11k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.11k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.11k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.11k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.20k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 20, False: 4.09k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 20, False: 4.09k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 4.09k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.11k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.11k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.11k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.11k|        }                                                                                    \
  |  |  |  |  686|   344k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.0k, False: 334k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.0k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.0k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 16, False: 10.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.0k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.0k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.0k|        }                                                                                    \
  |  |  |  |  692|   344k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   344k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   344k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   344k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   344k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   344k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   344k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   344k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   344k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   344k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   344k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 50, False: 344k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   344k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   344k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   344k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 344k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   344k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 344k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|   344k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|   344k|    do {                                                                                     \
  |  |  |  |  674|   344k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|   344k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|   344k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|   344k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|   344k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|   344k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|   344k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|   344k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|   344k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 4.27k, False: 340k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  4.27k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  4.27k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  4.27k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  4.27k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  8.53k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 26, False: 4.25k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 26, False: 4.25k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 4.25k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  4.27k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  4.27k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  4.27k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  4.27k|        }                                                                                    \
  |  |  |  |  686|   344k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10.5k, False: 333k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  10.5k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  10.5k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  10.5k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  10.5k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  10.5k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  10.5k|        }                                                                                    \
  |  |  |  |  692|   344k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|   344k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|   344k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|   344k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|   344k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|   344k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|   344k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|   344k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|   344k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1298|   344k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_SAFE, return ZXC_ERROR_OVERFLOW, (void)0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  552|   344k|    do {                                                                              \
  |  |  |  |  |  |  |  |  553|   344k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  152|   344k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (152:21): [True: 24, False: 344k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  554|   344k|        COPY(d_ptr, off, ml);                                                         \
  |  |  |  |  |  |  |  |  555|   344k|        d_ptr += ml;                                                                  \
  |  |  |  |  |  |  |  |  556|   344k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (556:14): [Folded, False: 344k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|   344k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 344k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|   344k|        n_seq -= 4;                                                                             \
  |  |  721|   344k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 344k]
  |  |  ------------------
  ------------------
 1299|   344k|        }
 1300|  5.04k|    }
 1301|       |
 1302|       |    // --- SAFE Loop tail: remaining sequences with offset validation (1x) ---
 1303|   174k|    while (n_seq > 0 && d_ptr < d_end_safe && d_ptr < d_bounds) {
  ------------------
  |  Branch (1303:12): [True: 170k, False: 3.85k]
  |  Branch (1303:25): [True: 168k, False: 1.94k]
  |  Branch (1303:47): [True: 165k, False: 3.10k]
  ------------------
 1304|   165k|        uint32_t seq = zxc_le32(seq_ptr);
 1305|   165k|        seq_ptr += sizeof(uint32_t);
 1306|       |
 1307|   165k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|   165k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|   165k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|   165k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1308|   165k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   165k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 3.00k, False: 162k]
  |  |  ------------------
  ------------------
 1309|       |
 1310|   165k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|   165k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|   165k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|   165k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|   165k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1311|   165k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|   165k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1312|   165k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|   165k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 9.80k, False: 155k]
  |  |  ------------------
  ------------------
 1313|       |
 1314|   165k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|   165k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|   165k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|   165k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1315|       |
 1316|       |        // Strict bounds check: sequence must fit, AND wild copies must not overshoot
 1317|       |        // Check both destination (d_ptr) and source literal stream (l_ptr)
 1318|   165k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  152|   330k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 20.7k, False: 145k]
  |  |  |  Branch (152:42): [True: 868, False: 164k]
  |  |  |  Branch (152:42): [True: 19.9k, False: 145k]
  |  |  ------------------
  ------------------
 1319|   165k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1320|       |            // Fallback to exact copy (slow but safe)
 1321|  20.7k|            if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|  41.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 560, False: 20.2k]
  |  |  |  Branch (152:42): [True: 384, False: 20.4k]
  |  |  |  Branch (152:42): [True: 176, False: 20.2k]
  |  |  ------------------
  ------------------
 1322|    560|                return ZXC_ERROR_OVERFLOW;
 1323|  20.2k|            ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|  20.2k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1324|  20.2k|            l_ptr += ll;
 1325|  20.2k|            d_ptr += ll;
 1326|       |
 1327|  20.2k|            if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|  20.2k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 36, False: 20.1k]
  |  |  ------------------
  ------------------
 1328|  20.1k|            const uint8_t* match_src = d_ptr - offset;
 1329|       |
 1330|  20.1k|            zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1331|  20.1k|            d_ptr += ml;
 1332|   145k|        } else {
 1333|   145k|            zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1334|   145k|            l_ptr += ll;
 1335|   145k|            d_ptr += ll;
 1336|   145k|            DECODE_MATCH_SAFE(ml, offset, zxc_decode_copy_match);
  ------------------
  |  |  552|   145k|    do {                                                                              \
  |  |  553|   145k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < (off))) return ZXC_ERROR_BAD_OFFSET; \
  |  |  ------------------
  |  |  |  |  152|   145k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (152:21): [True: 112, False: 144k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  554|   145k|        COPY(d_ptr, off, ml);                                                         \
  |  |  555|   144k|        d_ptr += ml;                                                                  \
  |  |  556|   144k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (556:14): [Folded, False: 144k]
  |  |  ------------------
  ------------------
 1337|   145k|        }
 1338|   165k|        n_seq--;
 1339|   165k|    }
 1340|       |
 1341|       |    // --- FAST Loop: After threshold, check large margin to avoid individual bounds checks ---
 1342|  8.90k|    if (safe) {
  ------------------
  |  Branch (1342:9): [True: 4.45k, False: 4.44k]
  ------------------
 1343|  66.3k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1343:16): [True: 64.0k, False: 2.35k]
  |  Branch (1343:30): [True: 62.3k, False: 1.65k]
  |  Branch (1343:52): [True: 62.1k, False: 231]
  ------------------
 1344|  62.1k|            const uint8_t* const t_save = seq_ptr;
 1345|  62.1k|            const uint8_t* const e_save = extras_ptr;
 1346|  62.1k|            uint8_t* const d_save = d_ptr;
 1347|  62.1k|            const uint8_t* const l_save = l_ptr;
 1348|  62.1k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  ------------------
  |  |  706|  62.1k|    do {                                                                                        \
  |  |  707|  62.1k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|  62.1k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|  62.1k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|  62.1k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|  62.1k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|  62.1k|        PREFETCH;                                                                               \
  |  |  713|  62.1k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|  62.1k|    do {                                                                                     \
  |  |  |  |  674|  62.1k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  62.1k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.1k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.1k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  62.1k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  62.1k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.1k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  62.1k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.1k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  62.1k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  62.1k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  62.1k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.1k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.47k, False: 60.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.47k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.47k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.47k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.47k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.94k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 40, False: 1.43k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 14, False: 1.46k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 26, False: 1.43k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.47k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.47k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.47k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.47k|        }                                                                                    \
  |  |  |  |  686|  62.1k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.41k, False: 60.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.41k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.41k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.41k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 25, False: 1.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.41k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.41k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.41k|        }                                                                                    \
  |  |  |  |  692|  62.0k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  62.0k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  62.0k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  62.0k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  62.0k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  62.0k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  62.0k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  62.0k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|  62.0k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  62.0k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  62.0k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  62.0k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  62.0k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 62.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  62.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 62.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|  62.1k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|  62.1k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|  62.1k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|  62.0k|    do {                                                                                     \
  |  |  |  |  674|  62.0k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  62.0k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  62.0k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  62.0k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  62.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  62.0k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  62.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  62.0k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.37k, False: 60.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.37k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.37k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.37k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.37k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.72k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 39, False: 1.33k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 14, False: 1.35k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 25, False: 1.33k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.37k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.37k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.37k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.37k|        }                                                                                    \
  |  |  |  |  686|  62.0k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.48k, False: 60.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.48k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.48k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.48k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 22, False: 1.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.48k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.48k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.48k|        }                                                                                    \
  |  |  |  |  692|  62.0k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  62.0k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  62.0k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  62.0k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  62.0k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  62.0k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  62.0k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  62.0k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|  62.0k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  62.0k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  62.0k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  62.0k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  62.0k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 62.0k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  62.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 62.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|  62.0k|                       ON_FAIL);                                                                \
  |  |  718|  62.0k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|  62.0k|    do {                                                                                     \
  |  |  |  |  674|  62.0k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  62.0k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  62.0k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  62.0k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  62.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  62.0k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  62.0k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  62.0k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  62.0k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  62.0k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  62.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.38k, False: 60.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.38k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.38k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.38k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.38k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.77k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 26, False: 1.36k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 8, False: 1.38k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18, False: 1.36k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.38k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.38k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.38k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.38k|        }                                                                                    \
  |  |  |  |  686|  62.0k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  61.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.32k, False: 60.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.32k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.32k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.32k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 10, False: 1.31k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.32k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.32k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.32k|        }                                                                                    \
  |  |  |  |  692|  61.9k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  61.9k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  61.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  61.9k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  61.9k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  61.9k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  61.9k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  61.9k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  61.9k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|  61.9k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  61.9k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  61.9k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  61.9k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  61.9k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 61.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  61.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 61.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|  62.0k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|  61.9k|    do {                                                                                     \
  |  |  |  |  674|  61.9k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  61.9k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  61.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  61.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  61.9k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  61.9k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  61.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  61.9k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  61.9k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  61.9k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  61.9k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  61.9k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  61.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.49k, False: 60.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.49k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.49k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.49k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.49k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.97k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 23, False: 1.47k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18, False: 1.47k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 5, False: 1.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.49k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.49k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.49k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.49k|        }                                                                                    \
  |  |  |  |  686|  61.9k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  61.9k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.54k, False: 60.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.54k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.54k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.54k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 36, False: 1.50k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.54k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.54k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.54k|        }                                                                                    \
  |  |  |  |  692|  61.9k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  61.9k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  61.9k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  61.9k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  61.9k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  61.9k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  61.9k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  61.9k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  61.9k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1348|  61.9k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, goto rollback_fast_4x,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  61.9k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  61.9k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  61.9k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  61.9k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 61.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  61.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 61.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|  61.9k|        n_seq -= 4;                                                                             \
  |  |  721|  61.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 61.9k]
  |  |  ------------------
  ------------------
 1349|  62.1k|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1350|  61.9k|            continue;
 1351|       |
 1352|  61.9k|        rollback_fast_4x:
 1353|    221|            seq_ptr = t_save;
 1354|    221|            extras_ptr = e_save;
 1355|    221|            d_ptr = d_save;
 1356|    221|            l_ptr = l_save;
 1357|    221|            break;
 1358|  62.1k|        }
 1359|  4.45k|    } else {
 1360|  70.2k|        while (n_seq >= 4 && d_ptr < d_end_fast && l_ptr < l_end_safe_4x) {
  ------------------
  |  Branch (1360:16): [True: 66.8k, False: 3.30k]
  |  Branch (1360:30): [True: 66.8k, False: 6]
  |  Branch (1360:52): [True: 65.8k, False: 1.00k]
  ------------------
 1361|  65.8k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  ------------------
  |  |  706|  65.8k|    do {                                                                                        \
  |  |  707|  65.8k|        uint32_t s1 = zxc_le32(seq_ptr);                                                        \
  |  |  708|  65.8k|        uint32_t s2 = zxc_le32(seq_ptr + sizeof(uint32_t));                                     \
  |  |  709|  65.8k|        uint32_t s3 = zxc_le32(seq_ptr + 2 * sizeof(uint32_t));                                 \
  |  |  710|  65.8k|        uint32_t s4 = zxc_le32(seq_ptr + 3 * sizeof(uint32_t));                                 \
  |  |  711|  65.8k|        seq_ptr += 4 * sizeof(uint32_t);                                                        \
  |  |  712|  65.8k|        PREFETCH;                                                                               \
  |  |  713|  65.8k|        DECODE_PAK_SEQ(                                                                         \
  |  |  ------------------
  |  |  |  |  673|  65.8k|    do {                                                                                     \
  |  |  |  |  674|  65.8k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  65.8k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  65.8k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  65.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  65.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  65.8k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  65.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  65.8k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.58k, False: 64.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.58k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.58k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.58k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.58k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.15k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 14, False: 1.56k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 14, False: 1.56k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 1.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.58k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.58k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.58k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.58k|        }                                                                                    \
  |  |  |  |  686|  65.8k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.42k, False: 64.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.42k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.42k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.42k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 16, False: 1.40k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.42k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.42k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.42k|        }                                                                                    \
  |  |  |  |  692|  65.8k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  65.8k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  65.8k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  65.8k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  65.8k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  65.8k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  65.8k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  65.8k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|  65.8k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  65.8k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  65.8k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  65.8k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  65.8k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 65.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  65.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 65.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  714|  65.8k|            s1, (s2 >> ZXC_SEQ_LL_SHIFT) + (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), \
  |  |  715|  65.8k|            3U, DECODE, ON_FAIL);                                                               \
  |  |  716|  65.8k|        DECODE_PAK_SEQ(s2, (s3 >> ZXC_SEQ_LL_SHIFT) + (s4 >> ZXC_SEQ_LL_SHIFT), 2U, DECODE,     \
  |  |  ------------------
  |  |  |  |  673|  65.8k|    do {                                                                                     \
  |  |  |  |  674|  65.8k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  65.8k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  65.8k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  65.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  65.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  65.8k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  65.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  65.8k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.48k, False: 64.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.48k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.48k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.48k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.48k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  2.96k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 14, False: 1.47k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 14, False: 1.47k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 1.47k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.48k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.48k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.48k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.48k|        }                                                                                    \
  |  |  |  |  686|  65.8k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.50k, False: 64.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.50k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.50k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.50k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 18, False: 1.48k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.50k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.50k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.50k|        }                                                                                    \
  |  |  |  |  692|  65.8k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  65.8k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  65.8k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  65.8k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  65.8k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  65.8k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  65.8k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  65.8k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|  65.8k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  65.8k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  65.8k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  65.8k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  65.8k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 65.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  65.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 65.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  717|  65.8k|                       ON_FAIL);                                                                \
  |  |  718|  65.8k|        DECODE_PAK_SEQ(s3, (s4 >> ZXC_SEQ_LL_SHIFT), 1U, DECODE, ON_FAIL);                      \
  |  |  ------------------
  |  |  |  |  673|  65.8k|    do {                                                                                     \
  |  |  |  |  674|  65.8k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  65.8k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  65.8k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  65.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  65.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  65.8k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  65.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  65.8k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.53k, False: 64.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.53k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.53k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.53k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.53k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.05k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 8, False: 1.52k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 8, False: 1.52k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 1.52k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.53k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.53k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.53k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.53k|        }                                                                                    \
  |  |  |  |  686|  65.8k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.34k, False: 64.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.34k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.34k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.34k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 6, False: 1.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.34k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.34k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.34k|        }                                                                                    \
  |  |  |  |  692|  65.8k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  65.8k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  65.8k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  65.8k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  65.8k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  65.8k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  65.8k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  65.8k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|  65.8k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  65.8k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  65.8k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  65.8k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  65.8k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 65.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  65.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 65.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  719|  65.8k|        DECODE_PAK_SEQ(s4, 0, 0U, DECODE, ON_FAIL);                                             \
  |  |  ------------------
  |  |  |  |  673|  65.8k|    do {                                                                                     \
  |  |  |  |  674|  65.8k|        uint64_t ll = (S) >> ZXC_SEQ_LL_SHIFT;                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  545|  65.8k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  675|  65.8k|        const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  547|  65.8k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.8k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t mb = ((S) >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  65.8k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  65.8k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  676|  65.8k|        uint64_t ml = mb + ZXC_LZ_MIN_MATCH_LEN;                                             \
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  65.8k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  |  |  677|  65.8k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.8k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.64k, False: 64.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  678|  1.64k|            ll += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  679|  1.64k|            const uint64_t reserve = (RESERVE);                                              \
  |  |  |  |  680|  1.64k|            /* Same reservation as the SPL twin; PAK's inline ml reaches 259. */             \
  |  |  |  |  681|  1.64k|            if (UNLIKELY(ll + reserve > (size_t)(l_end - l_ptr) ||                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  3.27k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 18, False: 1.62k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 18, False: 1.62k]
  |  |  |  |  |  |  |  Branch (152:42): [True: 0, False: 1.62k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  682|  1.64k|                         ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  683|  1.64k|                             (size_t)(d_end - d_ptr)))                                       \
  |  |  |  |  684|  1.64k|                ON_FAIL;                                                                     \
  |  |  |  |  685|  1.64k|        }                                                                                    \
  |  |  |  |  686|  65.8k|        if (UNLIKELY(mb == ZXC_SEQ_ML_MASK)) {                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  65.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 1.55k, False: 64.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  687|  1.55k|            ml += zxc_read_varint(&extras_ptr, extras_end);                                  \
  |  |  |  |  688|  1.55k|            if (UNLIKELY(ll + ml + (N_REM) * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE > \
  |  |  |  |  ------------------
  |  |  |  |  |  |  152|  1.55k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:21): [True: 36, False: 1.51k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  689|  1.55k|                         (size_t)(d_end - d_ptr)))                                           \
  |  |  |  |  690|  1.55k|                ON_FAIL;                                                                     \
  |  |  |  |  691|  1.55k|        }                                                                                    \
  |  |  |  |  692|  65.7k|        const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  543|  65.7k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  537|  65.7k|#define ZXC_SEQ_OFF_BITS 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                       const uint32_t off = ((S) & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;                  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  724|  65.7k|#define ZXC_LZ_OFFSET_BIAS 1
  |  |  |  |  ------------------
  |  |  |  |  693|  65.7k|        /* PAK keeps the ladder: its inline ll reaches 254. */                               \
  |  |  |  |  694|  65.7k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);                                          \
  |  |  |  |  695|  65.7k|        l_ptr += ll;                                                                         \
  |  |  |  |  696|  65.7k|        d_ptr += ll;                                                                         \
  |  |  |  |  697|  65.7k|        DECODE(ml, off, zxc_decode_copy_match);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1361|  65.7k|            DECODE_PAK_BATCH_4X(DECODE_MATCH_FAST, return ZXC_ERROR_OVERFLOW,
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  561|  65.7k|    do {                                 \
  |  |  |  |  |  |  |  |  562|  65.7k|        COPY(d_ptr, off, ml);            \
  |  |  |  |  |  |  |  |  563|  65.7k|        d_ptr += ml;                     \
  |  |  |  |  |  |  |  |  564|  65.7k|    } while (0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (564:14): [Folded, False: 65.7k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  698|  65.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (698:14): [Folded, False: 65.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  720|  65.8k|        n_seq -= 4;                                                                             \
  |  |  721|  65.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (721:14): [Folded, False: 65.7k]
  |  |  ------------------
  ------------------
 1362|  65.8k|                                ZXC_PREFETCH_READ(l_ptr + ZXC_CACHE_LINE_SIZE));
 1363|  65.8k|        }
 1364|  4.44k|    }
 1365|       |
 1366|       |    // --- Remaining 1 sequence (Fast Path) ---
 1367|  76.8k|    while (n_seq > 0 && d_ptr < d_end_safe && l_ptr < l_end_safe_1x) {
  ------------------
  |  Branch (1367:12): [True: 72.5k, False: 4.28k]
  |  Branch (1367:25): [True: 70.4k, False: 2.05k]
  |  Branch (1367:47): [True: 68.7k, False: 1.77k]
  ------------------
 1368|       |        // Save state for fallback
 1369|  68.7k|        const uint8_t* seq_save = seq_ptr;
 1370|  68.7k|        const uint8_t* ext_save = extras_ptr;
 1371|       |
 1372|  68.7k|        const uint32_t seq = zxc_le32(seq_ptr);
 1373|  68.7k|        seq_ptr += sizeof(uint32_t);
 1374|       |
 1375|  68.7k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|  68.7k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|  68.7k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|  68.7k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1376|  68.7k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) {
  ------------------
  |  |  152|  68.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 1.91k, False: 66.8k]
  |  |  ------------------
  ------------------
 1377|  1.91k|            ll += zxc_read_varint(&extras_ptr, extras_end);
 1378|  1.91k|            if (UNLIKELY(ll > (size_t)(l_end - l_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  1.91k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 84, False: 1.83k]
  |  |  ------------------
  ------------------
 1379|  1.91k|        }
 1380|       |
 1381|  68.6k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|  68.6k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|  68.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|  68.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|  68.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1382|  68.6k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  68.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1383|  68.6k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|  68.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 3.30k, False: 65.3k]
  |  |  ------------------
  ------------------
 1384|       |
 1385|       |        // Strict bounds checks (including wild copy overrun safety)
 1386|  68.6k|        if (UNLIKELY(ll + ml + ZXC_PAD_SIZE > (size_t)(d_end - d_ptr) ||
  ------------------
  |  |  152|   136k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 574, False: 68.0k]
  |  |  |  Branch (152:42): [True: 281, False: 68.3k]
  |  |  |  Branch (152:42): [True: 293, False: 68.0k]
  |  |  ------------------
  ------------------
 1387|  68.6k|                     ll + ZXC_PAD_SIZE > (size_t)(l_end - l_ptr))) {
 1388|    574|            seq_ptr = seq_save;
 1389|    574|            extras_ptr = ext_save;
 1390|    574|            break;
 1391|    574|        }
 1392|  68.0k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|  68.0k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|  68.0k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|  68.0k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1393|       |
 1394|  68.0k|        zxc_decode_copy_literals(d_ptr, l_ptr, ll);
 1395|  68.0k|        l_ptr += ll;
 1396|  68.0k|        d_ptr += ll;
 1397|       |
 1398|  68.0k|        if (UNLIKELY(d_ptr < d_bounds && (size_t)(d_ptr - d_floor) < offset))
  ------------------
  |  |  152|  68.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 68.0k]
  |  |  |  Branch (152:42): [True: 0, False: 68.0k]
  |  |  |  Branch (152:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1399|      0|            return ZXC_ERROR_BAD_OFFSET;
 1400|       |
 1401|       |        // The loop entry check guarantees ll + ml + ZXC_PAD_SIZE bytes of
 1402|       |        // headroom, so the wild-copy ladder (incl. overlap/fill runs) is safe.
 1403|  68.0k|        zxc_decode_copy_match(d_ptr, offset, ml);
 1404|  68.0k|        d_ptr += ml;
 1405|  68.0k|        n_seq--;
 1406|  68.0k|    }
 1407|       |
 1408|       |    // --- Safe Path for Remaining Sequences ---
 1409|  41.0k|    while (n_seq > 0) {
  ------------------
  |  Branch (1409:12): [True: 32.6k, False: 8.44k]
  ------------------
 1410|  32.6k|        uint32_t seq = zxc_le32(seq_ptr);
 1411|  32.6k|        seq_ptr += sizeof(uint32_t);
 1412|       |
 1413|  32.6k|        uint64_t ll = seq >> ZXC_SEQ_LL_SHIFT;
  ------------------
  |  |  545|  32.6k|#define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  535|  32.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  |  |               #define ZXC_SEQ_LL_SHIFT (ZXC_SEQ_ML_BITS + ZXC_SEQ_OFF_BITS)
  |  |  ------------------
  |  |  |  |  537|  32.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
 1414|  32.6k|        if (UNLIKELY(ll == ZXC_SEQ_LL_MASK)) ll += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 588, False: 32.0k]
  |  |  ------------------
  ------------------
 1415|       |
 1416|  32.6k|        uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  547|  32.6k|#define ZXC_SEQ_ML_SHIFT ZXC_SEQ_OFF_BITS
  |  |  ------------------
  |  |  |  |  537|  32.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t m_bits = (seq >> ZXC_SEQ_ML_SHIFT) & ZXC_SEQ_ML_MASK;
  ------------------
  |  |  541|  32.6k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  ------------------
  |  |  |  |  535|  32.6k|#define ZXC_SEQ_ML_BITS 8
  |  |  ------------------
  ------------------
 1417|  32.6k|        uint64_t ml = m_bits + ZXC_LZ_MIN_MATCH_LEN;
  ------------------
  |  |  586|  32.6k|#define ZXC_LZ_MIN_MATCH_LEN 5
  ------------------
 1418|  32.6k|        if (UNLIKELY(m_bits == ZXC_SEQ_ML_MASK)) ml += zxc_read_varint(&extras_ptr, extras_end);
  ------------------
  |  |  152|  32.6k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 3.36k, False: 29.2k]
  |  |  ------------------
  ------------------
 1419|  32.6k|        uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  543|  32.6k|#define ZXC_SEQ_OFF_MASK ((1U << ZXC_SEQ_OFF_BITS) - 1)
  |  |  ------------------
  |  |  |  |  537|  32.6k|#define ZXC_SEQ_OFF_BITS 16
  |  |  ------------------
  ------------------
                      uint32_t offset = (seq & ZXC_SEQ_OFF_MASK) + ZXC_LZ_OFFSET_BIAS;
  ------------------
  |  |  724|  32.6k|#define ZXC_LZ_OFFSET_BIAS 1
  ------------------
 1420|       |
 1421|  32.6k|        if (UNLIKELY(ll + ml > (size_t)(d_end - d_ptr) || ll > (size_t)(l_end - l_ptr)))
  ------------------
  |  |  152|  65.0k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 228, False: 32.3k]
  |  |  |  Branch (152:42): [True: 190, False: 32.4k]
  |  |  |  Branch (152:42): [True: 38, False: 32.3k]
  |  |  ------------------
  ------------------
 1422|    228|            return ZXC_ERROR_OVERFLOW;
 1423|  32.3k|        ZXC_MEMCPY(d_ptr, l_ptr, ll);
  ------------------
  |  |  168|  32.3k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1424|  32.3k|        l_ptr += ll;
 1425|  32.3k|        d_ptr += ll;
 1426|       |
 1427|  32.3k|        if (UNLIKELY((size_t)(d_ptr - d_floor) < offset)) return ZXC_ERROR_BAD_OFFSET;
  ------------------
  |  |  152|  32.3k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 12, False: 32.3k]
  |  |  ------------------
  ------------------
 1428|  32.3k|        const uint8_t* match_src = d_ptr - offset;
 1429|       |
 1430|  32.3k|        zxc_decode_copy_match_exact(d_ptr, match_src, offset, ml);
 1431|  32.3k|        d_ptr += ml;
 1432|  32.3k|        n_seq--;
 1433|  32.3k|    }
 1434|       |
 1435|       |    // --- Trailing Literals ---
 1436|       |    // Copy remaining literals from source stream (literal exhaustion)
 1437|  8.44k|    if (UNLIKELY(l_ptr > l_end)) return ZXC_ERROR_CORRUPT_DATA;
  ------------------
  |  |  152|  8.44k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.44k]
  |  |  ------------------
  ------------------
 1438|  8.44k|    if (UNLIKELY(d_ptr > d_end)) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  8.44k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.44k]
  |  |  ------------------
  ------------------
 1439|       |
 1440|  8.44k|    const size_t remaining_literals = (size_t)(l_end - l_ptr);
 1441|  8.44k|    if (UNLIKELY(remaining_literals > (size_t)(d_end - d_ptr))) return ZXC_ERROR_OVERFLOW;
  ------------------
  |  |  152|  8.44k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 8.44k]
  |  |  ------------------
  ------------------
 1442|  8.44k|    ZXC_MEMCPY(d_ptr, l_ptr, remaining_literals);
  ------------------
  |  |  168|  8.44k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1443|  8.44k|    d_ptr += remaining_literals;
 1444|       |
 1445|  8.44k|    return (int)(d_ptr - dst);
 1446|  8.44k|}
zxc_decompress.c:zxc_decode_block_pak:
 1511|  5.18k|                                const size_t dst_capacity) {
 1512|  5.18k|    return zxc_decode_block_pak_impl(ctx, src, src_size, dst, dst_capacity, 0, 0);
 1513|  5.18k|}
zxc_decompress_chunk_wrapper_default:
 1700|  33.1k|                                 const uint64_t block_index) {
 1701|  33.1k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 0);
 1702|  33.1k|}
zxc_decompress_chunk_wrapper_safe_default:
 1747|  25.3k|                                      const size_t dst_cap, const uint64_t block_index) {
 1748|  25.3k|    return zxc_decompress_chunk_wrapper_body(ctx, src, src_sz, dst, dst_cap, block_index, 0, 1);
 1749|  25.3k|}

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

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

fuzz_variants.c:zxc_block_size_ceil:
 1159|  22.2k|static ZXC_ALWAYS_INLINE size_t zxc_block_size_ceil(const size_t v) {
 1160|  22.2k|    uint64_t x = (uint64_t)v - 1;
 1161|  22.2k|    x |= x >> 1;
 1162|  22.2k|    x |= x >> 2;
 1163|  22.2k|    x |= x >> 4;
 1164|  22.2k|    x |= x >> 8;
 1165|  22.2k|    x |= x >> 16;
 1166|  22.2k|    x |= x >> 32;
 1167|  22.2k|    x++;
 1168|  22.2k|    const size_t bs = (size_t)x;
 1169|  22.2k|    return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|  22.2k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  22.2k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
                  return (bs < ZXC_BLOCK_SIZE_MIN) ? ZXC_BLOCK_SIZE_MIN : bs;
  ------------------
  |  |   73|  12.8k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  12.8k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
  |  Branch (1169:12): [True: 12.8k, False: 9.37k]
  ------------------
 1170|  22.2k|}
zxc_compress.c:zxc_store_le32:
 1485|  25.5k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1486|       |#ifdef ZXC_BIG_ENDIAN
 1487|       |    const uint32_t s = ZXC_BSWAP32(v);
 1488|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1489|       |#else
 1490|  25.5k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|  25.5k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1491|  25.5k|#endif
 1492|  25.5k|}
zxc_compress.c:zxc_checksum:
 1732|  25.5k|                                               const uint64_t seed, const uint8_t hash_method) {
 1733|  25.5k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1734|  25.5k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1735|       |
 1736|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1737|  25.5k|}
zxc_compress.c:zxc_get_lz77_params:
 1249|  74.8k|static ZXC_ALWAYS_INLINE zxc_lz77_params_t zxc_get_lz77_params(const int level) {
 1250|       |    // The distance floor stops at level 5: the slow levels keep every distance.
 1251|       |    // Default match splitting at levels 3-5 only: 1-2 are PAK; favor_decode_speed
 1252|       |    // also reaches 6-7.
 1253|       |    // search_depth, sufficient_len, use_lazy, lazy_attempts, lazy_len_threshold, step_base,
 1254|       |    // step_shift, min_offset, split_max
 1255|  74.8k|    static const zxc_lz77_params_t table[7] = {
 1256|  74.8k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // fallback
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1257|  74.8k|        {3, 16, 0, 0, 0, 4, 4, ZXC_LZ_MINDIST, 0},        // level 1
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1258|  74.8k|        {3, 18, 0, 0, 0, 3, 6, ZXC_LZ_MINDIST, 0},        // level 2
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1259|  74.8k|        {3, 16, 1, 4, 128, 1, 4, ZXC_LZ_MINDIST, 33},     // level 3
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1260|  74.8k|        {3, 18, 1, 4, 128, 1, 5, ZXC_LZ_MINDIST, 24},     // level 4
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1261|  74.8k|        {64, 256, 1, 16, 128, 1, 8, ZXC_LZ_MINDIST, 23},  // level 5
  ------------------
  |  |  745|  74.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1262|  74.8k|        {64, 256, 0, 0, 0, 1, 8, 1, 0}                    // level 6
 1263|  74.8k|    };
 1264|  74.8k|    return (level >= ZXC_LEVEL_ULTRA)
  ------------------
  |  Branch (1264:12): [True: 20.7k, False: 54.0k]
  ------------------
 1265|  74.8k|               ? (zxc_lz77_params_t){128, 256, 0, 0, 0, 1, 8, 1, 0}
 1266|  74.8k|               : table[level < ZXC_LEVEL_FASTEST ? ZXC_LEVEL_FASTEST : level];
  ------------------
  |  Branch (1266:24): [True: 0, False: 54.0k]
  ------------------
 1267|  74.8k|}
zxc_compress.c:zxc_block_is_short_dist_bound:
 1408|  23.8k|                                                           const size_t size) {
 1409|  23.8k|    const size_t d_max = ZXC_LZ_MINDIST;
  ------------------
  |  |  745|  23.8k|#define ZXC_LZ_MINDIST 32
  ------------------
 1410|       |    // Too small to sample, and too small to gain: keep every distance.
 1411|  23.8k|    if (size < d_max + sizeof(uint32_t)) return 1;
  ------------------
  |  Branch (1411:9): [True: 5.29k, False: 18.5k]
  ------------------
 1412|       |
 1413|  18.5k|    size_t want = size / ZXC_LZ_MINDIST_PROBE_PER_KB;
  ------------------
  |  |  752|  18.5k|#define ZXC_LZ_MINDIST_PROBE_PER_KB 1024
  ------------------
 1414|  18.5k|    if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  753|  18.5k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
                  if (want < ZXC_LZ_MINDIST_PROBE_MIN) want = ZXC_LZ_MINDIST_PROBE_MIN;
  ------------------
  |  |  753|  13.6k|#define ZXC_LZ_MINDIST_PROBE_MIN 16
  ------------------
  |  Branch (1414:9): [True: 13.6k, False: 4.90k]
  ------------------
 1415|  18.5k|    if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  754|  18.5k|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
                  if (want > ZXC_LZ_MINDIST_PROBE_MAX) want = ZXC_LZ_MINDIST_PROBE_MAX;
  ------------------
  |  |  754|  2.86k|#define ZXC_LZ_MINDIST_PROBE_MAX 64
  ------------------
  |  Branch (1415:9): [True: 2.86k, False: 15.6k]
  ------------------
 1416|  18.5k|    size_t stride = size / want;
 1417|  18.5k|    if (stride < d_max) stride = d_max;
  ------------------
  |  Branch (1417:9): [True: 8.61k, False: 9.89k]
  ------------------
 1418|       |
 1419|  18.5k|    const size_t planned = (size - sizeof(uint32_t) - d_max) / stride + 1;
 1420|  18.5k|    const size_t bar = (size_t)ZXC_LZ_MINDIST_MAX_SHORT_PCT * planned;
  ------------------
  |  |  762|  18.5k|#define ZXC_LZ_MINDIST_MAX_SHORT_PCT 20
  ------------------
 1421|       |
 1422|  18.5k|    size_t samples = 0;
 1423|  18.5k|    size_t hits = 0;
 1424|   221k|    for (size_t i = d_max; i + sizeof(uint32_t) <= size; i += stride) {
  ------------------
  |  Branch (1424:28): [True: 221k, False: 0]
  ------------------
 1425|   221k|        const uint32_t cur = zxc_le32(blk + i);
 1426|   221k|        samples++;
 1427|  4.99M|        for (size_t d = 1; d < d_max; d++) {
  ------------------
  |  Branch (1427:28): [True: 4.84M, False: 147k]
  ------------------
 1428|  4.84M|            if (zxc_le32(blk + i - d) == cur) {
  ------------------
  |  Branch (1428:17): [True: 74.5k, False: 4.76M]
  ------------------
 1429|  74.5k|                hits++;
 1430|  74.5k|                break;
 1431|  74.5k|            }
 1432|  4.84M|        }
 1433|   221k|        if (hits * 100U > bar) return 1;                           // can only rise
  ------------------
  |  Branch (1433:13): [True: 13.9k, False: 207k]
  ------------------
 1434|   207k|        if ((hits + (planned - samples)) * 100U <= bar) return 0;  // out of reach
  ------------------
  |  Branch (1434:13): [True: 4.53k, False: 203k]
  ------------------
 1435|   207k|    }
 1436|      0|    return hits * 100U > bar;
 1437|  18.5k|}
zxc_compress.c:zxc_le32:
 1385|  12.2G|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|  12.2G|    uint32_t v;
 1387|  12.2G|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  12.2G|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|  12.2G|    return v;
 1392|  12.2G|#endif
 1393|  12.2G|}
zxc_compress.c:zxc_le64:
 1448|  1.83G|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|  1.83G|    uint64_t v;
 1450|  1.83G|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  1.83G|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|  1.83G|    return v;
 1455|  1.83G|#endif
 1456|  1.83G|}
zxc_compress.c:zxc_ctz64:
 1677|   332M|static ZXC_ALWAYS_INLINE int zxc_ctz64(const uint64_t x) {
 1678|   332M|    if (x == 0) return 64;
  ------------------
  |  Branch (1678:9): [True: 0, False: 332M]
  ------------------
 1679|   332M|#if defined(__GNUC__) || defined(__clang__)
 1680|   332M|    return __builtin_ctzll(x);
 1681|       |#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
 1682|       |    unsigned long r;
 1683|       |    _BitScanForward64(&r, x);
 1684|       |    return (int)r;
 1685|       |#elif defined(_MSC_VER)
 1686|       |    // Use two 32-bit scans to avoid fragile 64-bit De Bruijn multiplication.
 1687|       |    unsigned long r;
 1688|       |    const uint32_t lo = (uint32_t)x;
 1689|       |    if (_BitScanForward(&r, lo)) return (int)r;
 1690|       |    _BitScanForward(&r, (uint32_t)(x >> 32));
 1691|       |    return 32 + (int)r;
 1692|       |#else
 1693|       |    return zxc_ctz64_debruijn(x);
 1694|       |#endif
 1695|   332M|}
zxc_compress.c:zxc_ctz32:
 1655|  5.79M|static ZXC_ALWAYS_INLINE int zxc_ctz32(const uint32_t x) {
 1656|  5.79M|    if (x == 0) return 32;
  ------------------
  |  Branch (1656:9): [True: 1.36k, False: 5.79M]
  ------------------
 1657|  5.79M|#if defined(__GNUC__) || defined(__clang__)
 1658|  5.79M|    return __builtin_ctz(x);
 1659|       |#elif defined(_MSC_VER)
 1660|       |    unsigned long r;
 1661|       |    _BitScanForward(&r, x);
 1662|       |    return (int)r;
 1663|       |#else
 1664|       |    return zxc_ctz32_debruijn(x);
 1665|       |#endif
 1666|  5.79M|}
zxc_compress.c:zxc_copy32:
 1602|  3.34M|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1603|  3.34M|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1604|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1605|  3.34M|    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1606|       |#elif defined(ZXC_USE_SSE2)
 1607|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1608|       |    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1609|       |    _mm_storeu_si128((__m128i*)dst, a);
 1610|       |    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1611|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1612|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1613|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1614|       |    vst1q_u8((uint8_t*)dst, a);
 1615|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1616|       |#elif defined(__riscv_misaligned_fast) && !defined(__riscv_vector)
 1617|       |    uint8_t a[16], b[16];
 1618|       |    ZXC_MEMCPY(a, src, 16);
 1619|       |    ZXC_MEMCPY(b, (const uint8_t*)src + 16, 16);
 1620|       |    ZXC_MEMCPY(dst, a, 16);
 1621|       |    ZXC_MEMCPY((uint8_t*)dst + 16, b, 16);
 1622|       |#else
 1623|       |    ZXC_MEMCPY(dst, src, 32);
 1624|       |#endif
 1625|  3.34M|}
zxc_compress.c:zxc_opt_dp_sizes:
 1129|  13.5k|                                               size_t* RESTRICT sz_bm) {
 1130|  13.5k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  384|  13.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1131|  13.5k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  13.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1132|  13.5k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  13.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1133|  13.5k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  384|  13.5k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  13.5k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  13.5k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|  13.5k|}
zxc_compress.c:zxc_read_varint:
  630|   277k|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  631|   277k|    const uint8_t* p = *ptr;
  632|   277k|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  152|   277k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 277k]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|       |
  634|   277k|    const uint32_t b0 = p[0];
  635|       |
  636|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  637|   277k|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  146|   277k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 253k, False: 24.3k]
  |  |  ------------------
  ------------------
  638|   253k|        *ptr = p + 1;
  639|   253k|        return b0;
  640|   253k|    }
  641|       |
  642|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  643|  24.3k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  146|  24.3k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 23.7k, False: 632]
  |  |  ------------------
  ------------------
  644|  23.7k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  152|  23.7k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 23.7k]
  |  |  ------------------
  ------------------
  645|      0|            *ptr = end;
  646|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|      0|        }
  648|  23.7k|        *ptr = p + 2;
  649|  23.7k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  650|  23.7k|    }
  651|       |
  652|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  653|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  654|       |    // strictly below block_size_max = 2^21.
  655|    632|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  146|    632|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 632, False: 0]
  |  |  ------------------
  ------------------
  656|    632|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  152|    632|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 0, False: 632]
  |  |  ------------------
  ------------------
  657|      0|            *ptr = end;
  658|      0|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  659|      0|        }
  660|    632|        *ptr = p + 3;
  661|    632|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  662|    632|    }
  663|       |
  664|       |    // extra encoding: out-of-spec for the current format, reject.
  665|      0|    *ptr = end;
  666|      0|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|      0|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|      0|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      0|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|    632|}
zxc_compress.c:zxc_ss_prem_rle_q8:
  965|  28.8k|static inline int zxc_ss_prem_rle_q8(const int level) {
  966|  28.8k|    return (level >= ZXC_LEVEL_DENSITY) ? 1 : (256 >> ZXC_RLE_MARGIN_SHIFT);
  ------------------
  |  |  892|  15.2k|#define ZXC_RLE_MARGIN_SHIFT 5
  ------------------
  |  Branch (966:12): [True: 13.6k, False: 15.2k]
  ------------------
  967|  28.8k|}
zxc_compress.c:zxc_huf_enc_max_code_len:
 1051|  34.4k|static inline int zxc_huf_enc_max_code_len(const int level) {
 1052|  34.4k|    return (level >= ZXC_LEVEL_ULTRA) ? ZXC_HUF_MAX_CODE_LEN_ULTRA : ZXC_HUF_MAX_CODE_LEN_DENSITY;
  ------------------
  |  |  826|  31.5k|#define ZXC_HUF_MAX_CODE_LEN_ULTRA 11
  ------------------
                  return (level >= ZXC_LEVEL_ULTRA) ? ZXC_HUF_MAX_CODE_LEN_ULTRA : ZXC_HUF_MAX_CODE_LEN_DENSITY;
  ------------------
  |  |  831|  2.88k|#define ZXC_HUF_MAX_CODE_LEN_DENSITY 8
  ------------------
  |  Branch (1052:12): [True: 31.5k, False: 2.88k]
  ------------------
 1053|  34.4k|}
zxc_compress.c:zxc_ss_prem_huf_q8:
  984|  17.2k|static inline int zxc_ss_prem_huf_q8(const int level) {
  985|  17.2k|    return (level >= ZXC_LEVEL_DENSITY) ? 4 : (256 >> ZXC_HUF_MARGIN_SHIFT);
  ------------------
  |  |  896|      0|#define ZXC_HUF_MARGIN_SHIFT 5
  ------------------
  |  Branch (985:12): [True: 17.2k, False: 0]
  ------------------
  986|  17.2k|}
zxc_decompress.c:zxc_block_header_ok:
 1537|   116k|static ZXC_ALWAYS_INLINE int zxc_block_header_ok(const uint8_t* p) {
 1538|   116k|    uint8_t temp[ZXC_BLOCK_HEADER_SIZE];
 1539|   116k|    ZXC_MEMCPY(temp, p, ZXC_BLOCK_HEADER_SIZE);
  ------------------
  |  |  168|   116k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1540|   116k|    temp[7] = 0;  // The checksum covers the header with its own byte zeroed
 1541|   116k|    return p[7] == zxc_hash8(temp) && (p[1] | p[2]) == 0;
  ------------------
  |  Branch (1541:12): [True: 49.7k, False: 67.1k]
  |  Branch (1541:39): [True: 49.1k, False: 584]
  ------------------
 1542|   116k|}
zxc_decompress.c:zxc_hash8:
 1524|   116k|static ZXC_ALWAYS_INLINE uint8_t zxc_hash8(const uint8_t* p) {
 1525|   116k|    const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   116k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|   116k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1526|       |
 1527|   116k|    return (uint8_t)(h >> 56);
 1528|   116k|}
zxc_decompress.c:zxc_le64:
 1448|  3.44M|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|  3.44M|    uint64_t v;
 1450|  3.44M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  3.44M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|  3.44M|    return v;
 1455|  3.44M|#endif
 1456|  3.44M|}
zxc_decompress.c:zxc_le32:
 1385|  7.01M|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|  7.01M|    uint32_t v;
 1387|  7.01M|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  7.01M|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|  7.01M|    return v;
 1392|  7.01M|#endif
 1393|  7.01M|}
zxc_decompress.c:zxc_copy32:
 1602|  39.6M|static ZXC_ALWAYS_INLINE void zxc_copy32(void* dst, const void* src) {
 1603|  39.6M|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512)
 1604|       |    // AVX2/AVX512: Single 256-bit (32 byte) unaligned load/store
 1605|  39.6M|    _mm256_storeu_si256((__m256i*)dst, _mm256_loadu_si256((const __m256i*)src));
 1606|       |#elif defined(ZXC_USE_SSE2)
 1607|       |    const __m128i a = _mm_loadu_si128((const __m128i*)src);
 1608|       |    const __m128i b = _mm_loadu_si128((const __m128i*)((const uint8_t*)src + 16));
 1609|       |    _mm_storeu_si128((__m128i*)dst, a);
 1610|       |    _mm_storeu_si128((__m128i*)((uint8_t*)dst + 16), b);
 1611|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1612|       |    const uint8x16_t a = vld1q_u8((const uint8_t*)src);
 1613|       |    const uint8x16_t b = vld1q_u8((const uint8_t*)src + 16);
 1614|       |    vst1q_u8((uint8_t*)dst, a);
 1615|       |    vst1q_u8((uint8_t*)dst + 16, b);
 1616|       |#elif defined(__riscv_misaligned_fast) && !defined(__riscv_vector)
 1617|       |    uint8_t a[16], b[16];
 1618|       |    ZXC_MEMCPY(a, src, 16);
 1619|       |    ZXC_MEMCPY(b, (const uint8_t*)src + 16, 16);
 1620|       |    ZXC_MEMCPY(dst, a, 16);
 1621|       |    ZXC_MEMCPY((uint8_t*)dst + 16, b, 16);
 1622|       |#else
 1623|       |    ZXC_MEMCPY(dst, src, 32);
 1624|       |#endif
 1625|  39.6M|}
zxc_decompress.c:zxc_read_varint:
  630|  3.80M|static ZXC_ALWAYS_INLINE uint32_t zxc_read_varint(const uint8_t** ptr, const uint8_t* end) {
  631|  3.80M|    const uint8_t* p = *ptr;
  632|  3.80M|    if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  152|  3.80M|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 768, False: 3.80M]
  |  |  ------------------
  ------------------
                  if (UNLIKELY(p >= end)) return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|    768|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|    768|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|    768|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|       |
  634|  3.80M|    const uint32_t b0 = p[0];
  635|       |
  636|       |    // 1 Byte: 0xxxxxxx (7 bits) -> val < 128 (2^7)
  637|  3.80M|    if (LIKELY(b0 < 0x80)) {
  ------------------
  |  |  146|  3.80M|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 3.22M, False: 579k]
  |  |  ------------------
  ------------------
  638|  3.22M|        *ptr = p + 1;
  639|  3.22M|        return b0;
  640|  3.22M|    }
  641|       |
  642|       |    // 2 Bytes: 10xxxxxx xxxxxxxx (14 bits) -> val < 16384 (2^14)
  643|   579k|    if (LIKELY(b0 < 0xC0)) {
  ------------------
  |  |  146|   579k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 570k, False: 9.44k]
  |  |  ------------------
  ------------------
  644|   570k|        if (UNLIKELY(p + 1 >= end)) {
  ------------------
  |  |  152|   570k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 260, False: 569k]
  |  |  ------------------
  ------------------
  645|    260|            *ptr = end;
  646|    260|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|    260|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|    260|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|    260|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|    260|        }
  648|   569k|        *ptr = p + 2;
  649|   569k|        return (b0 & 0x3F) | ((uint32_t)p[1] << 6);
  650|   570k|    }
  651|       |
  652|       |    // 3 Bytes: 110xxxxx xxxxxxxx xxxxxxxx (21 bits) -> val < 2^21. The longest
  653|       |    // a legitimate varint can be: values are (ll - MASK) or (ml - MASK), always
  654|       |    // strictly below block_size_max = 2^21.
  655|  9.44k|    if (LIKELY(b0 < 0xE0)) {
  ------------------
  |  |  146|  9.44k|#define LIKELY(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (146:19): [True: 8.36k, False: 1.08k]
  |  |  ------------------
  ------------------
  656|  8.36k|        if (UNLIKELY(p + 2 >= end)) {
  ------------------
  |  |  152|  8.36k|#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
  |  |  ------------------
  |  |  |  Branch (152:21): [True: 282, False: 8.07k]
  |  |  ------------------
  ------------------
  657|    282|            *ptr = end;
  658|    282|            return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|    282|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|    282|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|    282|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  659|    282|        }
  660|  8.07k|        *ptr = p + 3;
  661|  8.07k|        return (b0 & 0x1F) | ((uint32_t)p[1] << 5) | ((uint32_t)p[2] << 13);
  662|  8.36k|    }
  663|       |
  664|       |    // extra encoding: out-of-spec for the current format, reject.
  665|  1.08k|    *ptr = end;
  666|  1.08k|    return ZXC_VARINT_INVALID;
  ------------------
  |  |  597|  1.08k|#define ZXC_VARINT_INVALID (2U * ZXC_BLOCK_SIZE_MAX)
  |  |  ------------------
  |  |  |  |   75|  1.08k|#define ZXC_BLOCK_SIZE_MAX (1U << ZXC_BLOCK_SIZE_MAX_LOG2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|  1.08k|#define ZXC_BLOCK_SIZE_MAX_LOG2 21
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  667|  9.44k|}
zxc_decompress.c:zxc_copy16:
 1582|  13.6M|static ZXC_ALWAYS_INLINE void zxc_copy16(void* dst, const void* src) {
 1583|  13.6M|#if defined(ZXC_USE_AVX2) || defined(ZXC_USE_AVX512) || defined(ZXC_USE_SSE2)
 1584|       |    // x86 SSE2/AVX2/AVX512: Single 128-bit unaligned load/store
 1585|  13.6M|    _mm_storeu_si128((__m128i*)dst, _mm_loadu_si128((const __m128i*)src));
 1586|       |#elif defined(ZXC_USE_NEON64) || defined(ZXC_USE_NEON32)
 1587|       |    vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src));
 1588|       |#else
 1589|       |    ZXC_MEMCPY(dst, src, 16);
 1590|       |#endif
 1591|  13.6M|}
zxc_decompress.c:zxc_le16:
 1366|   211k|static ZXC_ALWAYS_INLINE uint16_t zxc_le16(const void* p) {
 1367|   211k|    uint16_t v;
 1368|   211k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|   211k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1369|       |#ifdef ZXC_BIG_ENDIAN
 1370|       |    return ZXC_BSWAP16(v);
 1371|       |#else
 1372|   211k|    return v;
 1373|   211k|#endif
 1374|   211k|}
zxc_decompress.c:zxc_checksum:
 1732|  26.3k|                                               const uint64_t seed, const uint8_t hash_method) {
 1733|  26.3k|    (void)hash_method; /* single algorithm for now; extend when adding more */
 1734|  26.3k|    const uint64_t hash = rapidhash_withSeed(input, len, seed);
 1735|       |
 1736|       |    return (uint32_t)(hash ^ (hash >> (sizeof(uint32_t) * CHAR_BIT)));
 1737|  26.3k|}
zxc_huffman.c:zxc_log2_u32:
 1145|   976M|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1146|       |#ifdef _MSC_VER
 1147|       |    unsigned long index;
 1148|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1149|       |#else
 1150|   976M|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1150:12): [True: 0, False: 976M]
  ------------------
 1151|   976M|#endif
 1152|   976M|}
zxc_common.c:zxc_opt_dp_sizes:
 1129|  16.4k|                                               size_t* RESTRICT sz_bm) {
 1130|  16.4k|    *sz_dp = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint32_t));
  ------------------
  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1131|  16.4k|    *sz_pl = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1132|  16.4k|    *sz_po = ZXC_ALIGN_CL((chunk_size + 1) * sizeof(uint16_t));
  ------------------
  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1133|  16.4k|    *sz_bm = ZXC_ALIGN_CL(ZXC_BITMAP_WORDS(chunk_size + 1) * sizeof(uint64_t));
  ------------------
  |  |  384|  16.4k|#define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_ALIGN_CL(x) (((x) + ZXC_ALIGNMENT_MASK) & ~(size_t)ZXC_ALIGNMENT_MASK)
  |  |  ------------------
  |  |  |  |  382|  16.4k|#define ZXC_ALIGNMENT_MASK ((size_t)ZXC_CACHE_LINE_SIZE - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|  16.4k|#define ZXC_CACHE_LINE_SIZE 64
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1134|  16.4k|}
zxc_common.c:zxc_log2_u32:
 1145|   110k|static ZXC_ALWAYS_INLINE uint32_t zxc_log2_u32(const uint32_t v) {
 1146|       |#ifdef _MSC_VER
 1147|       |    unsigned long index;
 1148|       |    return (v == 0) ? 0 : (_BitScanReverse(&index, v) ? index : 0);
 1149|       |#else
 1150|   110k|    return (v == 0) ? 0 : (uint32_t)(31 - __builtin_clz(v));
  ------------------
  |  Branch (1150:12): [True: 0, False: 110k]
  ------------------
 1151|   110k|#endif
 1152|   110k|}
zxc_common.c:zxc_store_le32:
 1485|   145k|static ZXC_ALWAYS_INLINE void zxc_store_le32(void* p, const uint32_t v) {
 1486|       |#ifdef ZXC_BIG_ENDIAN
 1487|       |    const uint32_t s = ZXC_BSWAP32(v);
 1488|       |    ZXC_MEMCPY(p, &s, sizeof(s));
 1489|       |#else
 1490|   145k|    ZXC_MEMCPY(p, &v, sizeof(v));
  ------------------
  |  |  168|   145k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1491|   145k|#endif
 1492|   145k|}
zxc_common.c:zxc_le32:
 1385|   151k|static ZXC_ALWAYS_INLINE uint32_t zxc_le32(const void* p) {
 1386|   151k|    uint32_t v;
 1387|   151k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|   151k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1388|       |#ifdef ZXC_BIG_ENDIAN
 1389|       |    return ZXC_BSWAP32(v);
 1390|       |#else
 1391|   151k|    return v;
 1392|   151k|#endif
 1393|   151k|}
zxc_common.c:zxc_le64:
 1448|  47.9k|static ZXC_ALWAYS_INLINE uint64_t zxc_le64(const void* p) {
 1449|  47.9k|    uint64_t v;
 1450|  47.9k|    ZXC_MEMCPY(&v, p, sizeof(v));
  ------------------
  |  |  168|  47.9k|#define ZXC_MEMCPY(dst, src, n) __builtin_memcpy(dst, src, n)
  ------------------
 1451|       |#ifdef ZXC_BIG_ENDIAN
 1452|       |    return ZXC_BSWAP64(v);
 1453|       |#else
 1454|  47.9k|    return v;
 1455|  47.9k|#endif
 1456|  47.9k|}
zxc_common.c:zxc_hash8:
 1524|  47.9k|static ZXC_ALWAYS_INLINE uint8_t zxc_hash8(const uint8_t* p) {
 1525|  47.9k|    const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|  47.9k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
                  const uint64_t h = (zxc_le64(p) ^ ZXC_HASH_GOLDEN64) * ZXC_HASH_GOLDEN64;
  ------------------
  |  |  797|  47.9k|#define ZXC_HASH_GOLDEN64 0x9E3779B97F4A7C15ULL
  ------------------
 1526|       |
 1527|  47.9k|    return (uint8_t)(h >> 56);
 1528|  47.9k|}

LLVMFuzzerInitialize:
   80|      2|int LLVMFuzzerInitialize(int* argc, char*** argv) {
   81|      2|    (void)argc;
   82|      2|    (void)argv;
   83|      2|#if defined(FUZZ_X86_VARIANTS)
   84|      2|    __builtin_cpu_init();
   85|      2|    unsigned a = 0, b = 0, c = 0, d = 0;
   86|      2|    const int lzcnt = __get_cpuid(0x80000001U, &a, &b, &c, &d) && ((c >> 5) & 1U);
  ------------------
  |  Branch (86:23): [True: 2, False: 0]
  |  Branch (86:67): [True: 2, False: 0]
  ------------------
   87|      2|    const int bmi = lzcnt && __builtin_cpu_supports("bmi") && __builtin_cpu_supports("bmi2");
  ------------------
  |  Branch (87:21): [True: 2, False: 0]
  |  Branch (87:30): [True: 2, False: 0]
  |  Branch (87:63): [True: 2, False: 0]
  ------------------
   88|      2|    if (bmi && __builtin_cpu_supports("avx2")) {
  ------------------
  |  Branch (88:9): [True: 2, False: 0]
  |  Branch (88:16): [True: 2, False: 0]
  ------------------
   89|      2|        const variant_t v = VARIANT(_avx2);
  ------------------
  |  |   71|      2|    {zxc_compress_chunk_wrapper##sfx, zxc_decompress_chunk_wrapper##sfx, \
  |  |   72|      2|     zxc_decompress_chunk_wrapper_safe##sfx}
  ------------------
   90|      2|        g_variants[g_n_variants++] = v;
   91|      2|    }
   92|      2|    if (bmi && __builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512bw") &&
  ------------------
  |  Branch (92:9): [True: 2, False: 0]
  |  Branch (92:16): [True: 0, False: 2]
  |  Branch (92:53): [True: 0, False: 0]
  ------------------
   93|      0|        __builtin_cpu_supports("avx512vl") && __builtin_cpu_supports("avx512vbmi") &&
  ------------------
  |  Branch (93:9): [True: 0, False: 0]
  |  Branch (93:47): [True: 0, False: 0]
  ------------------
   94|      0|        __builtin_cpu_supports("avx512vbmi2")) {
  ------------------
  |  Branch (94:9): [True: 0, False: 0]
  ------------------
   95|      0|        const variant_t v = VARIANT(_avx512);
  ------------------
  |  |   71|      0|    {zxc_compress_chunk_wrapper##sfx, zxc_decompress_chunk_wrapper##sfx, \
  |  |   72|      0|     zxc_decompress_chunk_wrapper_safe##sfx}
  ------------------
   96|      0|        g_variants[g_n_variants++] = v;
   97|      0|    }
   98|      2|#endif
   99|      2|    return 0;
  100|      2|}
LLVMFuzzerTestOneInput:
  198|  22.2k|int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  199|  22.2k|    if (size < FUZZ_VARIANTS_CTRL || size > FUZZ_VARIANTS_MAX_INPUT) return 0;
  ------------------
  |  |   40|  44.4k|#define FUZZ_VARIANTS_CTRL 3                /* control bytes consumed below */
  ------------------
                  if (size < FUZZ_VARIANTS_CTRL || size > FUZZ_VARIANTS_MAX_INPUT) return 0;
  ------------------
  |  |   39|  22.2k|#define FUZZ_VARIANTS_MAX_INPUT (256 << 10) /* 256 KiB of fuzzer bytes */
  ------------------
  |  Branch (199:9): [True: 2, False: 22.2k]
  |  Branch (199:38): [True: 1, False: 22.2k]
  ------------------
  200|       |
  201|  22.2k|    const int level = (int)(data[0] % (unsigned)zxc_max_level()) + 1;
  202|  22.2k|    const int checksum = data[1] & 1;
  203|  22.2k|    const size_t block_size = (size_t)ZXC_BLOCK_SIZE_MIN << ((data[1] >> 1) % 7U); /* 4K..256K */
  ------------------
  |  |   73|  22.2k|#define ZXC_BLOCK_SIZE_MIN (1U << ZXC_BLOCK_SIZE_MIN_LOG2)
  |  |  ------------------
  |  |  |  |   67|  22.2k|#define ZXC_BLOCK_SIZE_MIN_LOG2 12
  |  |  ------------------
  ------------------
  204|  22.2k|    const variant_t* const enc = &g_variants[(data[2] & 15U) % g_n_variants];
  205|  22.2k|    const variant_t* const dec = &g_variants[(data[2] >> 4) % g_n_variants];
  206|  22.2k|    data += FUZZ_VARIANTS_CTRL;
  ------------------
  |  |   40|  22.2k|#define FUZZ_VARIANTS_CTRL 3                /* control bytes consumed below */
  ------------------
  207|  22.2k|    size -= FUZZ_VARIANTS_CTRL;
  ------------------
  |  |   40|  22.2k|#define FUZZ_VARIANTS_CTRL 3                /* control bytes consumed below */
  ------------------
  208|       |
  209|  22.2k|    decode_untrusted(data, size, block_size, checksum);
  210|  22.2k|    if (size > 0) roundtrip(data, size, level, checksum, enc, dec);
  ------------------
  |  Branch (210:9): [True: 22.2k, False: 1]
  ------------------
  211|  22.2k|    return 0;
  212|  22.2k|}
fuzz_variants.c:decode_untrusted:
  112|  22.2k|                             const int checksum) {
  113|  22.2k|    if (len < ZXC_BLOCK_HEADER_SIZE) return;
  ------------------
  |  |  439|  22.2k|#define ZXC_BLOCK_HEADER_SIZE 8
  ------------------
  |  Branch (113:9): [True: 117, False: 22.0k]
  ------------------
  114|  22.0k|    zxc_cctx_t ctx;
  115|  22.0k|    if (zxc_cctx_init(&ctx, block_size, 0, 0, checksum, 0) != ZXC_OK) return;
  ------------------
  |  Branch (115:9): [True: 0, False: 22.0k]
  ------------------
  116|       |
  117|  22.0k|    uint8_t* ref = NULL;
  118|  22.0k|    int ref_n = -1;
  119|       |    /* First variant's verdict per decoder; error codes may differ. */
  120|  22.0k|    int accepted[2] = {0, 0};
  121|  22.0k|    int have_verdict[2] = {0, 0};
  122|  66.2k|    for (size_t i = 0; i < g_n_variants; i++) {
  ------------------
  |  Branch (122:24): [True: 44.1k, False: 22.0k]
  ------------------
  123|       |        /* The strict decoder is not the RAW path: the block API routes around it. */
  124|   122k|        for (int safe = 0; safe < (src[0] == ZXC_BLOCK_RAW ? 1 : 2); safe++) {
  ------------------
  |  Branch (124:28): [True: 78.2k, False: 44.1k]
  |  Branch (124:36): [True: 20.0k, False: 102k]
  ------------------
  125|  78.2k|            uint8_t* out = NULL;
  126|  78.2k|            const int n = safe ? decode(g_variants[i].decode_safe, &ctx, src, len, block_size, &out)
  ------------------
  |  Branch (126:27): [True: 34.1k, False: 44.1k]
  ------------------
  127|  78.2k|                               : decode(g_variants[i].decode, &ctx, src, len,
  128|  44.1k|                                        block_size + ZXC_DECOMPRESS_TAIL_PAD, &out);
  ------------------
  |  |  372|  44.1k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  44.1k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  44.1k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  44.1k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  44.1k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  44.1k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  44.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 */
  |  |  ------------------
  |  |  |  |  342|  44.1k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  129|  78.2k|            if (!out) continue; /* allocation failed */
  ------------------
  |  Branch (129:17): [True: 0, False: 78.2k]
  ------------------
  130|  78.2k|            if (have_verdict[safe]) {
  ------------------
  |  Branch (130:17): [True: 39.1k, False: 39.1k]
  ------------------
  131|  39.1k|                assert((n > 0) == accepted[safe]);
  ------------------
  |  Branch (131:17): [True: 0, False: 39.1k]
  |  Branch (131:17): [True: 39.1k, False: 0]
  ------------------
  132|  39.1k|            } else {
  133|  39.1k|                accepted[safe] = n > 0;
  134|  39.1k|                have_verdict[safe] = 1;
  135|  39.1k|            }
  136|  78.2k|            if (n > 0 && ref_n > 0) {
  ------------------
  |  Branch (136:17): [True: 156, False: 78.1k]
  |  Branch (136:26): [True: 114, False: 42]
  ------------------
  137|    114|                assert(n == ref_n);
  ------------------
  |  Branch (137:17): [True: 0, False: 114]
  |  Branch (137:17): [True: 114, False: 0]
  ------------------
  138|    114|                assert(memcmp(out, ref, (size_t)n) == 0);
  ------------------
  |  Branch (138:17): [True: 0, False: 114]
  |  Branch (138:17): [True: 114, False: 0]
  ------------------
  139|    114|            }
  140|  78.2k|            if (n > 0 && ref_n <= 0) {
  ------------------
  |  Branch (140:17): [True: 156, False: 78.1k]
  |  Branch (140:26): [True: 42, False: 114]
  ------------------
  141|     42|                ref = out;
  142|     42|                ref_n = n;
  143|  78.2k|            } else {
  144|  78.2k|                free(out);
  145|  78.2k|            }
  146|  78.2k|        }
  147|  44.1k|    }
  148|  22.0k|    free(ref);
  149|  22.0k|    zxc_cctx_free(&ctx);
  150|  22.0k|}
fuzz_variants.c:decode:
  104|   116k|                  const size_t cap, uint8_t** out) {
  105|   116k|    *out = (uint8_t*)malloc(cap);
  106|   116k|    if (!*out) return ZXC_ERROR_MEMORY;
  ------------------
  |  Branch (106:9): [True: 0, False: 116k]
  ------------------
  107|   116k|    return fn(ctx, src, len, *out, cap, 0);
  108|   116k|}
fuzz_variants.c:roundtrip:
  155|  22.2k|                      const variant_t* enc, const variant_t* dec) {
  156|  22.2k|    const size_t block_size = zxc_block_size_ceil(size);
  157|  22.2k|    const size_t bound = (size_t)zxc_compress_block_bound(size);
  158|  22.2k|    zxc_cctx_t cctx, dctx;
  159|  22.2k|    if (zxc_cctx_init(&cctx, block_size, 1, level, checksum, 0) != ZXC_OK) return;
  ------------------
  |  Branch (159:9): [True: 0, False: 22.2k]
  ------------------
  160|  22.2k|    if (zxc_cctx_init(&dctx, block_size, 0, 0, checksum, 0) != ZXC_OK) {
  ------------------
  |  Branch (160:9): [True: 0, False: 22.2k]
  ------------------
  161|      0|        zxc_cctx_free(&cctx);
  162|      0|        return;
  163|      0|    }
  164|  22.2k|    uint8_t* const comp = (uint8_t*)malloc(bound);
  165|  22.2k|    uint8_t* const comp_ref = (uint8_t*)malloc(bound);
  166|  22.2k|    if (comp && comp_ref) {
  ------------------
  |  Branch (166:9): [True: 22.2k, False: 0]
  |  Branch (166:17): [True: 22.2k, False: 0]
  ------------------
  167|  22.2k|        const int c = enc->encode(&cctx, data, size, comp, bound, 0);
  168|  22.2k|        assert(c > 0);
  ------------------
  |  Branch (168:9): [True: 0, False: 22.2k]
  |  Branch (168:9): [True: 22.2k, False: 0]
  ------------------
  169|  22.2k|        if (enc != &g_variants[0]) {
  ------------------
  |  Branch (169:13): [True: 15.2k, False: 6.98k]
  ------------------
  170|  15.2k|            const int c_ref = g_variants[0].encode(&cctx, data, size, comp_ref, bound, 0);
  171|  15.2k|            assert(c_ref == c);
  ------------------
  |  Branch (171:13): [True: 0, False: 15.2k]
  |  Branch (171:13): [True: 15.2k, False: 0]
  ------------------
  172|  15.2k|            assert(memcmp(comp, comp_ref, (size_t)c) == 0);
  ------------------
  |  Branch (172:13): [True: 0, False: 15.2k]
  |  Branch (172:13): [True: 15.2k, False: 0]
  ------------------
  173|  15.2k|        }
  174|       |
  175|  22.2k|        uint8_t* out = NULL;
  176|  22.2k|        int n =
  177|  22.2k|            decode(dec->decode, &dctx, comp, (size_t)c, block_size + ZXC_DECOMPRESS_TAIL_PAD, &out);
  ------------------
  |  |  372|  22.2k|#define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  722|  22.2k|    ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  539|  22.2k|#define ZXC_SEQ_LL_MASK ((1U << ZXC_SEQ_LL_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  533|  22.2k|#define ZXC_SEQ_LL_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  541|  22.2k|#define ZXC_SEQ_ML_MASK ((1U << ZXC_SEQ_ML_BITS) - 1)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  535|  22.2k|#define ZXC_SEQ_ML_BITS 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   ((ZXC_SEQ_LL_MASK - 1U) + (ZXC_SEQ_ML_MASK - 1U) + ZXC_LZ_MIN_MATCH_LEN) /* 513 */
  |  |  |  |  ------------------
  |  |  |  |  |  |  586|  22.2k|#define ZXC_LZ_MIN_MATCH_LEN 5
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ZXC_DECOMPRESS_TAIL_PAD (4 * ZXC_PAK_MAX_INLINE_OUT_PER_SEQ + ZXC_PAD_SIZE) /* 2084 */
  |  |  ------------------
  |  |  |  |  342|  22.2k|#define ZXC_PAD_SIZE 32
  |  |  ------------------
  ------------------
  178|  22.2k|        if (out) {
  ------------------
  |  Branch (178:13): [True: 22.2k, False: 0]
  ------------------
  179|  22.2k|            assert(n == (int)size);
  ------------------
  |  Branch (179:13): [True: 0, False: 22.2k]
  |  Branch (179:13): [True: 22.2k, False: 0]
  ------------------
  180|  22.2k|            assert(memcmp(out, data, size) == 0);
  ------------------
  |  Branch (180:13): [True: 0, False: 22.2k]
  |  Branch (180:13): [True: 22.2k, False: 0]
  ------------------
  181|  22.2k|            free(out);
  182|  22.2k|        }
  183|  22.2k|        if (comp[0] != ZXC_BLOCK_RAW) {
  ------------------
  |  Branch (183:13): [True: 16.3k, False: 5.81k]
  ------------------
  184|  16.3k|            n = decode(dec->decode_safe, &dctx, comp, (size_t)c, size, &out);
  185|  16.3k|            if (out) {
  ------------------
  |  Branch (185:17): [True: 16.3k, False: 0]
  ------------------
  186|  16.3k|                assert(n == (int)size);
  ------------------
  |  Branch (186:17): [True: 0, False: 16.3k]
  |  Branch (186:17): [True: 16.3k, False: 0]
  ------------------
  187|  16.3k|                assert(memcmp(out, data, size) == 0);
  ------------------
  |  Branch (187:17): [True: 0, False: 16.3k]
  |  Branch (187:17): [True: 16.3k, False: 0]
  ------------------
  188|  16.3k|                free(out);
  189|  16.3k|            }
  190|  16.3k|        }
  191|  22.2k|    }
  192|  22.2k|    free(comp);
  193|  22.2k|    free(comp_ref);
  194|  22.2k|    zxc_cctx_free(&dctx);
  195|  22.2k|    zxc_cctx_free(&cctx);
  196|  22.2k|}

