_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  172|  13.7k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  173|  13.7k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  174|  13.7k|  size_t pos = 0;
  175|  13.7k|  const char32_t* start{utf32_output};
  176|   153k|  while (pos < len) {
  ------------------
  |  Branch (176:10): [True: 140k, False: 12.8k]
  ------------------
  177|       |    // try to convert the next block of 16 ASCII bytes
  178|   140k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (178:9): [True: 73.0k, False: 67.9k]
  ------------------
  179|       |                            // bytes, check that they are ascii
  180|  73.0k|      uint64_t v1;
  181|  73.0k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  182|  73.0k|      uint64_t v2;
  183|  73.0k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  184|  73.0k|      uint64_t v{v1 | v2};
  185|  73.0k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (185:11): [True: 7.82k, False: 65.2k]
  ------------------
  186|  7.82k|        size_t final_pos = pos + 16;
  187|   132k|        while (pos < final_pos) {
  ------------------
  |  Branch (187:16): [True: 125k, False: 7.82k]
  ------------------
  188|   125k|          *utf32_output++ = char32_t(buf[pos]);
  189|   125k|          pos++;
  190|   125k|        }
  191|  7.82k|        continue;
  192|  7.82k|      }
  193|  73.0k|    }
  194|   133k|    uint8_t leading_byte = data[pos];  // leading byte
  195|   133k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (195:9): [True: 70.3k, False: 62.7k]
  ------------------
  196|       |      // converting one ASCII byte !!!
  197|  70.3k|      *utf32_output++ = char32_t(leading_byte);
  198|  70.3k|      pos++;
  199|  70.3k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (199:16): [True: 18.7k, False: 44.0k]
  ------------------
  200|       |      // We have a two-byte UTF-8
  201|  18.7k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (201:11): [True: 44, False: 18.6k]
  ------------------
  202|     44|        return 0;
  203|     44|      }  // minimal bound checking
  204|  18.6k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (204:11): [True: 118, False: 18.5k]
  ------------------
  205|    118|        return 0;
  206|    118|      }
  207|       |      // range check
  208|  18.5k|      uint32_t code_point =
  209|  18.5k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  210|  18.5k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (210:11): [True: 13, False: 18.5k]
  |  Branch (210:32): [True: 0, False: 18.5k]
  ------------------
  211|     13|        return 0;
  212|     13|      }
  213|  18.5k|      *utf32_output++ = char32_t(code_point);
  214|  18.5k|      pos += 2;
  215|  44.0k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (215:16): [True: 41.8k, False: 2.18k]
  ------------------
  216|       |      // We have a three-byte UTF-8
  217|  41.8k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (217:11): [True: 34, False: 41.8k]
  ------------------
  218|     34|        return 0;
  219|     34|      }  // minimal bound checking
  220|       |
  221|  41.8k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (221:11): [True: 56, False: 41.7k]
  ------------------
  222|     56|        return 0;
  223|     56|      }
  224|  41.7k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (224:11): [True: 23, False: 41.7k]
  ------------------
  225|     23|        return 0;
  226|     23|      }
  227|       |      // range check
  228|  41.7k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  229|  41.7k|                            (data[pos + 1] & 0b00111111) << 6 |
  230|  41.7k|                            (data[pos + 2] & 0b00111111);
  231|  41.7k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (231:11): [True: 25, False: 41.7k]
  |  Branch (231:33): [True: 0, False: 41.7k]
  ------------------
  232|  41.7k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (232:12): [True: 23.6k, False: 18.0k]
  |  Branch (232:35): [True: 5, False: 23.6k]
  ------------------
  233|     30|        return 0;
  234|     30|      }
  235|  41.7k|      *utf32_output++ = char32_t(code_point);
  236|  41.7k|      pos += 3;
  237|  41.7k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (237:16): [True: 1.78k, False: 394]
  ------------------
  238|       |      // we have a 4-byte UTF-8 word.
  239|  1.78k|      if (pos + 3 >= len) {
  ------------------
  |  Branch (239:11): [True: 73, False: 1.71k]
  ------------------
  240|     73|        return 0;
  241|     73|      }  // minimal bound checking
  242|  1.71k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (242:11): [True: 64, False: 1.64k]
  ------------------
  243|     64|        return 0;
  244|     64|      }
  245|  1.64k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (245:11): [True: 13, False: 1.63k]
  ------------------
  246|     13|        return 0;
  247|     13|      }
  248|  1.63k|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (248:11): [True: 13, False: 1.62k]
  ------------------
  249|     13|        return 0;
  250|     13|      }
  251|       |
  252|       |      // range check
  253|  1.62k|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  254|  1.62k|                            (data[pos + 1] & 0b00111111) << 12 |
  255|  1.62k|                            (data[pos + 2] & 0b00111111) << 6 |
  256|  1.62k|                            (data[pos + 3] & 0b00111111);
  257|  1.62k|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (257:11): [True: 21, False: 1.60k]
  |  Branch (257:35): [True: 10, False: 1.59k]
  ------------------
  258|     31|        return 0;
  259|     31|      }
  260|  1.59k|      *utf32_output++ = char32_t(code_point);
  261|  1.59k|      pos += 4;
  262|  1.59k|    } else {
  263|    394|      return 0;
  264|    394|    }
  265|   133k|  }
  266|  12.8k|  return utf32_output - start;
  267|  13.7k|}
_ZN3ada4idna22utf8_length_from_utf32EPKDim:
  269|  9.64k|size_t utf8_length_from_utf32(const char32_t* buf, size_t len) {
  270|       |  // We are not BOM aware.
  271|  9.64k|  const uint32_t* p = reinterpret_cast<const uint32_t*>(buf);
  272|  9.64k|  size_t counter{0};
  273|   189k|  for (size_t i = 0; i != len; ++i) {
  ------------------
  |  Branch (273:22): [True: 179k, False: 9.64k]
  ------------------
  274|   179k|    ++counter;                                      // ASCII
  275|   179k|    counter += static_cast<size_t>(p[i] > 0x7F);    // two-byte
  276|   179k|    counter += static_cast<size_t>(p[i] > 0x7FF);   // three-byte
  277|   179k|    counter += static_cast<size_t>(p[i] > 0xFFFF);  // four-bytes
  278|   179k|  }
  279|  9.64k|  return counter;
  280|  9.64k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  282|  15.5k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  283|  15.5k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  284|  15.5k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|  15.5k|    return c > -65;
  288|  15.5k|  });
  289|  15.5k|}
_ZN3ada4idna13utf32_to_utf8EPKDimPc:
  291|  9.64k|size_t utf32_to_utf8(const char32_t* buf, size_t len, char* utf8_output) {
  292|  9.64k|  const uint32_t* data = reinterpret_cast<const uint32_t*>(buf);
  293|  9.64k|  size_t pos = 0;
  294|  9.64k|  const char* start{utf8_output};
  295|   161k|  while (pos < len) {
  ------------------
  |  Branch (295:10): [True: 152k, False: 9.64k]
  ------------------
  296|       |    // try to convert the next block of 2 ASCII characters
  297|   152k|    if (pos + 2 <= len) {  // if it is safe to read 8 more
  ------------------
  |  Branch (297:9): [True: 143k, False: 8.78k]
  ------------------
  298|       |                           // bytes, check that they are ascii
  299|   143k|      uint64_t v;
  300|   143k|      std::memcpy(&v, data + pos, sizeof(uint64_t));
  301|   143k|      if ((v & 0xFFFFFF80FFFFFF80) == 0) {
  ------------------
  |  Branch (301:11): [True: 27.5k, False: 115k]
  ------------------
  302|  27.5k|        *utf8_output++ = char(buf[pos]);
  303|  27.5k|        *utf8_output++ = char(buf[pos + 1]);
  304|  27.5k|        pos += 2;
  305|  27.5k|        continue;
  306|  27.5k|      }
  307|   143k|    }
  308|   124k|    uint32_t word = data[pos];
  309|   124k|    if ((word & 0xFFFFFF80) == 0) {
  ------------------
  |  Branch (309:9): [True: 19.9k, False: 104k]
  ------------------
  310|       |      // will generate one UTF-8 bytes
  311|  19.9k|      *utf8_output++ = char(word);
  312|  19.9k|      pos++;
  313|   104k|    } else if ((word & 0xFFFFF800) == 0) {
  ------------------
  |  Branch (313:16): [True: 78.5k, False: 26.1k]
  ------------------
  314|       |      // will generate two UTF-8 bytes
  315|       |      // we have 0b110XXXXX 0b10XXXXXX
  316|  78.5k|      *utf8_output++ = char((word >> 6) | 0b11000000);
  317|  78.5k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  318|  78.5k|      pos++;
  319|  78.5k|    } else if ((word & 0xFFFF0000) == 0) {
  ------------------
  |  Branch (319:16): [True: 22.7k, False: 3.44k]
  ------------------
  320|       |      // will generate three UTF-8 bytes
  321|       |      // we have 0b1110XXXX 0b10XXXXXX 0b10XXXXXX
  322|  22.7k|      if (word >= 0xD800 && word <= 0xDFFF) {
  ------------------
  |  Branch (322:11): [True: 6.04k, False: 16.7k]
  |  Branch (322:29): [True: 0, False: 6.04k]
  ------------------
  323|      0|        return 0;
  324|      0|      }
  325|  22.7k|      *utf8_output++ = char((word >> 12) | 0b11100000);
  326|  22.7k|      *utf8_output++ = char(((word >> 6) & 0b111111) | 0b10000000);
  327|  22.7k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  328|  22.7k|      pos++;
  329|  22.7k|    } else {
  330|       |      // will generate four UTF-8 bytes
  331|       |      // we have 0b11110XXX 0b10XXXXXX 0b10XXXXXX
  332|       |      // 0b10XXXXXX
  333|  3.44k|      if (word > 0x10FFFF) {
  ------------------
  |  Branch (333:11): [True: 0, False: 3.44k]
  ------------------
  334|      0|        return 0;
  335|      0|      }
  336|  3.44k|      *utf8_output++ = char((word >> 18) | 0b11110000);
  337|  3.44k|      *utf8_output++ = char(((word >> 12) & 0b111111) | 0b10000000);
  338|  3.44k|      *utf8_output++ = char(((word >> 6) & 0b111111) | 0b10000000);
  339|  3.44k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  340|  3.44k|      pos++;
  341|  3.44k|    }
  342|   124k|  }
  343|  9.64k|  return utf8_output - start;
  344|  9.64k|}
_ZN3ada4idna9ascii_mapEPcm:
 5133|  12.5k|void ascii_map(char* input, size_t length) {
 5134|  12.5k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|  12.5k|    return 0x101010101010101ull * v;
 5136|  12.5k|  };
 5137|  12.5k|  uint64_t broadcast_80 = broadcast(0x80);
 5138|  12.5k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5139|  12.5k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5140|  12.5k|  size_t i = 0;
 5141|       |
 5142|  52.1k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5142:10): [True: 39.6k, False: 12.5k]
  ------------------
 5143|  39.6k|    uint64_t word{};
 5144|  39.6k|    std::memcpy(&word, input + i, sizeof(word));
 5145|  39.6k|    word ^=
 5146|  39.6k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|  39.6k|    std::memcpy(input + i, &word, sizeof(word));
 5148|  39.6k|  }
 5149|  12.5k|  if (i < length) {
  ------------------
  |  Branch (5149:7): [True: 6.57k, False: 5.97k]
  ------------------
 5150|  6.57k|    uint64_t word{};
 5151|  6.57k|    std::memcpy(&word, input + i, length - i);
 5152|  6.57k|    word ^=
 5153|  6.57k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5154|  6.57k|    std::memcpy(input + i, &word, length - i);
 5155|  6.57k|  }
 5156|  12.5k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5160|  16.2k|bool map(std::u32string_view input, std::u32string& out) {
 5161|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5162|  16.2k|  out.clear();
 5163|  16.2k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5163:7): [True: 0, False: 16.2k]
  ------------------
 5164|      0|    return false;
 5165|      0|  }
 5166|       |
 5167|       |  // Pass 1: validate and compute exact output length.
 5168|  16.2k|  size_t out_size = 0;
 5169|   239k|  for (char32_t x : input) {
  ------------------
  |  Branch (5169:19): [True: 239k, False: 15.0k]
  ------------------
 5170|   239k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5171|   239k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5171:9): [True: 1.19k, False: 237k]
  ------------------
 5172|  1.19k|      return false;
 5173|  1.19k|    }
 5174|   237k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5174:9): [True: 204k, False: 33.5k]
  ------------------
 5175|   204k|      ++out_size;
 5176|   204k|      continue;
 5177|   204k|    }
 5178|  33.5k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5178:9): [True: 0, False: 33.5k]
  ------------------
 5179|      0|      return false;
 5180|      0|    }
 5181|  33.5k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5182|  33.5k|  }
 5183|       |
 5184|       |  // Pass 2: write into a single allocation.
 5185|  15.0k|  out.resize(out_size);
 5186|  15.0k|  size_t w = 0;
 5187|   237k|  for (char32_t x : input) {
  ------------------
  |  Branch (5187:19): [True: 237k, False: 15.0k]
  ------------------
 5188|   237k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5189|   237k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5189:9): [True: 203k, False: 33.5k]
  ------------------
 5190|   203k|      out[w++] = x;
 5191|   203k|      continue;
 5192|   203k|    }
 5193|       |    // IGNORED or mapped (status already validated in pass 1).
 5194|  33.5k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5195|   371k|    while (*ptr != 0) {
  ------------------
  |  Branch (5195:12): [True: 338k, False: 33.5k]
  ------------------
 5196|   338k|      out[w++] = utf8_next(ptr);
 5197|   338k|    }
 5198|  33.5k|  }
 5199|  15.0k|  return true;
 5200|  16.2k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5202|  3.46k|std::u32string map(std::u32string_view input) {
 5203|  3.46k|  std::u32string answer;
 5204|  3.46k|  if (!map(input, answer)) {
  ------------------
  |  Branch (5204:7): [True: 220, False: 3.24k]
  ------------------
 5205|    220|    return {};
 5206|    220|  }
 5207|  3.24k|  return answer;
 5208|  3.46k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5293|    589|    const std::u32string_view input) noexcept {
 5294|    589|  bool decomposition_needed{false};
 5295|    589|  size_t additional_elements{0};
 5296|  4.14k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5296:35): [True: 4.14k, False: 589]
  ------------------
 5297|  4.14k|    size_t decomposition_length{0};
 5298|       |
 5299|  4.14k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5299:9): [True: 415, False: 3.73k]
  ------------------
 5300|    415|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5300:9): [True: 2, False: 413]
  ------------------
 5301|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5302|      2|      decomposition_length = 2;
 5303|      2|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5303:11): [True: 2, False: 0]
  ------------------
 5304|      2|        decomposition_length = 3;
 5305|      2|      }
 5306|  4.14k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5306:16): [True: 4.14k, False: 0]
  ------------------
 5307|  4.14k|      const uint8_t di = decomposition_index[current_character >> 8];
 5308|  4.14k|      const uint16_t* const decomposition =
 5309|  4.14k|          decomposition_block_row(di) + (current_character % 256);
 5310|  4.14k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5311|  4.14k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5311:11): [True: 489, False: 3.65k]
  |  Branch (5311:41): [True: 271, False: 218]
  ------------------
 5312|    271|        decomposition_length = 0;
 5313|    271|      }
 5314|  4.14k|    }
 5315|  4.14k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5315:9): [True: 220, False: 3.92k]
  ------------------
 5316|    220|      decomposition_needed = true;
 5317|    220|      additional_elements += decomposition_length - 1;
 5318|    220|    }
 5319|  4.14k|  }
 5320|    589|  return {decomposition_needed, additional_elements};
 5321|    589|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5323|     66|void decompose(std::u32string& input, size_t additional_elements) {
 5324|     66|  input.resize(input.size() + additional_elements);
 5325|     66|  for (size_t descending_idx = input.size(),
 5326|     66|              input_count = descending_idx - additional_elements;
 5327|  1.49k|       input_count--;) {
  ------------------
  |  Branch (5327:8): [True: 1.43k, False: 66]
  ------------------
 5328|  1.43k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5328:9): [True: 384, False: 1.04k]
  ------------------
 5329|    384|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5329:9): [True: 2, False: 382]
  ------------------
 5330|       |      // Hangul decomposition.
 5331|      2|      char32_t s_index = input[input_count] - hangul_sbase;
 5332|      2|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5332:11): [True: 2, False: 0]
  ------------------
 5333|      2|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5334|      2|      }
 5335|      2|      input[--descending_idx] =
 5336|      2|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5337|      2|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5338|  1.43k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5338:16): [True: 1.43k, False: 0]
  ------------------
 5339|  1.43k|      const uint16_t* decomposition =
 5340|  1.43k|          decomposition_block_row(
 5341|  1.43k|              decomposition_index[input[input_count] >> 8]) +
 5342|  1.43k|          (input[input_count] % 256);
 5343|  1.43k|      uint16_t decomposition_length =
 5344|  1.43k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5345|  1.43k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5345:11): [True: 489, False: 942]
  |  Branch (5345:39): [True: 271, False: 218]
  ------------------
 5346|    271|        decomposition_length = 0;
 5347|    271|      }
 5348|  1.43k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5348:11): [True: 218, False: 1.21k]
  ------------------
 5349|    218|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5350|    218|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5350:13): [True: 0, False: 218]
  ------------------
 5351|      0|          input[--descending_idx] = input[input_count];
 5352|    218|        } else {
 5353|    660|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5353:18): [True: 442, False: 218]
  ------------------
 5354|    442|            input[--descending_idx] =
 5355|    442|                decomposition_data[base + decomposition_length];
 5356|    442|          }
 5357|    218|        }
 5358|  1.21k|      } else {
 5359|  1.21k|        input[--descending_idx] = input[input_count];
 5360|  1.21k|      }
 5361|  1.43k|    } else {
 5362|      0|      input[--descending_idx] = input[input_count];
 5363|      0|    }
 5364|  1.43k|  }
 5365|     66|}
_ZN3ada4idna7get_cccEDi:
 5367|   640k|uint8_t get_ccc(char32_t c) noexcept {
 5368|   640k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5368:7): [True: 0, False: 640k]
  ------------------
 5369|      0|    return 0;
 5370|      0|  }
 5371|   640k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5372|   640k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5374|    589|void sort_marks(std::u32string& input) {
 5375|  4.37k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5375:24): [True: 3.78k, False: 589]
  ------------------
 5376|  3.78k|    uint8_t ccc = get_ccc(input[idx]);
 5377|  3.78k|    if (ccc == 0) {
  ------------------
  |  Branch (5377:9): [True: 1.90k, False: 1.87k]
  ------------------
 5378|  1.90k|      continue;
 5379|  1.90k|    }
 5380|  1.87k|    auto current_character = input[idx];
 5381|  1.87k|    size_t back_idx = idx;
 5382|  3.77k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5382:12): [True: 3.09k, False: 686]
  |  Branch (5382:29): [True: 1.90k, False: 1.19k]
  ------------------
 5383|  1.90k|      input[back_idx] = input[back_idx - 1];
 5384|  1.90k|      back_idx--;
 5385|  1.90k|    }
 5386|  1.87k|    input[back_idx] = current_character;
 5387|  1.87k|  }
 5388|    589|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5390|    589|void decompose_nfc(std::u32string& input) {
 5391|       |  /**
 5392|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5393|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5394|       |   */
 5395|    589|  auto [decomposition_needed, additional_elements] =
 5396|    589|      compute_decomposition_length(input);
 5397|    589|  if (decomposition_needed) {
  ------------------
  |  Branch (5397:7): [True: 66, False: 523]
  ------------------
 5398|     66|    decompose(input, additional_elements);
 5399|     66|  }
 5400|    589|  sort_marks(input);
 5401|    589|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5468|  14.3k|bool is_already_nfc(std::u32string_view input) noexcept {
 5469|  14.3k|  if (input.empty()) {
  ------------------
  |  Branch (5469:7): [True: 0, False: 14.3k]
  ------------------
 5470|      0|    return true;
 5471|      0|  }
 5472|  14.3k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5472:7): [True: 0, False: 14.3k]
  |  Branch (5472:30): [True: 0, False: 0]
  ------------------
 5473|      0|    return false;
 5474|      0|  }
 5475|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5476|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5477|   327k|  for (char32_t c : input) {
  ------------------
  |  Branch (5477:19): [True: 327k, False: 14.3k]
  ------------------
 5478|   327k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5478:9): [True: 56, False: 327k]
  ------------------
 5479|     56|      return false;
 5480|     56|    }
 5481|   327k|  }
 5482|       |  // 2) Combining marks already in canonical order.
 5483|  14.3k|  uint8_t prev_ccc = 0;
 5484|   325k|  for (char32_t c : input) {
  ------------------
  |  Branch (5484:19): [True: 325k, False: 13.8k]
  ------------------
 5485|   325k|    uint8_t ccc = get_ccc(c);
 5486|   325k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5486:9): [True: 7.79k, False: 317k]
  |  Branch (5486:21): [True: 459, False: 7.34k]
  ------------------
 5487|    459|      return false;
 5488|    459|    }
 5489|   324k|    prev_ccc = ccc;
 5490|   324k|  }
 5491|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5492|  13.8k|  return !would_compose(input);
 5493|  14.3k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5495|    589|void compose(std::u32string& input) {
 5496|       |  /**
 5497|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5498|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5499|       |   */
 5500|    589|  size_t input_count{0};
 5501|    589|  size_t composition_count{0};
 5502|  3.05k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5502:10): [True: 2.46k, False: 589]
  ------------------
 5503|  2.46k|    input[composition_count] = input[input_count];
 5504|  2.46k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5504:9): [True: 640, False: 1.82k]
  ------------------
 5505|    640|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5505:9): [True: 45, False: 595]
  ------------------
 5506|     45|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5506:11): [True: 39, False: 6]
  ------------------
 5507|     39|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5507:11): [True: 21, False: 18]
  ------------------
 5508|     21|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5508:11): [True: 19, False: 2]
  ------------------
 5509|     19|        input[composition_count] =
 5510|     19|            hangul_sbase +
 5511|     19|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5512|     19|             input[input_count + 1] - hangul_vbase) *
 5513|     19|                hangul_tcount;
 5514|     19|        input_count++;
 5515|     19|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5515:13): [True: 16, False: 3]
  ------------------
 5516|     16|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5516:13): [True: 2, False: 14]
  ------------------
 5517|      2|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5517:13): [True: 2, False: 0]
  ------------------
 5518|      2|          input[composition_count] += input[++input_count] - hangul_tbase;
 5519|      2|        }
 5520|     19|      }
 5521|  2.41k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5521:16): [True: 368, False: 2.04k]
  ------------------
 5522|    368|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5522:16): [True: 0, False: 368]
  ------------------
 5523|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5523:11): [True: 0, False: 0]
  ------------------
 5524|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5524:11): [True: 0, False: 0]
  ------------------
 5525|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5525:11): [True: 0, False: 0]
  ------------------
 5526|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5526:11): [True: 0, False: 0]
  ------------------
 5527|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5528|      0|      }
 5529|  2.41k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5529:16): [True: 2.41k, False: 0]
  ------------------
 5530|  2.41k|      const uint16_t* composition =
 5531|  2.41k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5532|  2.41k|          (input[input_count] % 256);
 5533|  2.41k|      size_t initial_composition_count = composition_count;
 5534|  4.30k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5534:39): [True: 3.72k, False: 580]
  ------------------
 5535|  3.72k|           input_count++) {
 5536|  3.72k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5537|       |
 5538|  3.72k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5538:13): [True: 1.42k, False: 2.30k]
  |  Branch (5538:49): [True: 1.06k, False: 353]
  ------------------
 5539|  1.06k|          int left = composition[0];
 5540|  1.06k|          int right = composition[1];
 5541|  1.06k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5541:15): [True: 0, False: 1.06k]
  |  Branch (5541:27): [True: 0, False: 1.06k]
  ------------------
 5542|  1.06k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5542:15): [True: 0, False: 1.06k]
  ------------------
 5543|      0|            break;
 5544|      0|          }
 5545|  3.01k|          while (left + 2 < right) {
  ------------------
  |  Branch (5545:18): [True: 1.94k, False: 1.06k]
  ------------------
 5546|  1.94k|            int middle = left + (((right - left) >> 1) & ~1);
 5547|  1.94k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5547:17): [True: 823, False: 1.12k]
  ------------------
 5548|  1.94k|                input[input_count + 1]) {
 5549|    823|              left = middle;
 5550|    823|            }
 5551|  1.94k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5551:17): [True: 1.34k, False: 597]
  ------------------
 5552|  1.94k|                input[input_count + 1]) {
 5553|  1.34k|              right = middle;
 5554|  1.34k|            }
 5555|  1.94k|          }
 5556|  1.06k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5556:15): [True: 1.06k, False: 0]
  ------------------
 5557|  1.06k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5557:15): [True: 284, False: 783]
  ------------------
 5558|  1.06k|                  input[input_count + 1]) {
 5559|    284|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5560|    284|            input[initial_composition_count] = composed;
 5561|    284|            composition =
 5562|    284|                composition_block_row(composition_index[composed >> 8]) +
 5563|    284|                (composed % 256);
 5564|    284|            continue;
 5565|    284|          }
 5566|  1.06k|        }
 5567|       |
 5568|  3.44k|        if (ccc == 0) {
  ------------------
  |  Branch (5568:13): [True: 1.83k, False: 1.60k]
  ------------------
 5569|  1.83k|          break;
 5570|  1.83k|        }
 5571|  1.60k|        previous_ccc = ccc;
 5572|  1.60k|        input[++composition_count] = input[input_count + 1];
 5573|  1.60k|      }
 5574|  2.41k|    }
 5575|  2.46k|  }
 5576|       |
 5577|    589|  if (composition_count < input_count) {
  ------------------
  |  Branch (5577:7): [True: 132, False: 457]
  ------------------
 5578|    132|    input.resize(composition_count);
 5579|    132|  }
 5580|    589|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5582|  11.8k|bool normalize(std::u32string& input) {
 5583|       |  /**
 5584|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5585|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5586|       |   */
 5587|  11.8k|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5587:7): [True: 0, False: 11.8k]
  |  Branch (5587:27): [True: 0, False: 11.8k]
  ------------------
 5588|  11.8k|      composition_index == nullptr) {
  ------------------
  |  Branch (5588:7): [True: 0, False: 11.8k]
  ------------------
 5589|      0|    return false;
 5590|      0|  }
 5591|  11.8k|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5591:7): [True: 11.2k, False: 589]
  ------------------
 5592|  11.2k|    return true;
 5593|  11.2k|  }
 5594|    589|  decompose_nfc(input);
 5595|    589|  compose(input);
 5596|    589|  return true;
 5597|  11.8k|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5657|  24.9k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5658|  24.9k|  int32_t written_out{0};
 5659|  24.9k|  out.reserve(out.size() + input.size());
 5660|  24.9k|  uint32_t n = initial_n;
 5661|  24.9k|  int32_t i = 0;
 5662|  24.9k|  int32_t bias = initial_bias;
 5663|       |  // grab ascii content
 5664|  24.9k|  size_t end_of_ascii = input.find_last_of('-');
 5665|  24.9k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5665:7): [True: 4.90k, False: 19.9k]
  ------------------
 5666|  55.6k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5666:20): [True: 55.6k, False: 4.59k]
  ------------------
 5667|  55.6k|      if (c >= 0x80) {
  ------------------
  |  Branch (5667:11): [True: 312, False: 55.3k]
  ------------------
 5668|    312|        return false;
 5669|    312|      }
 5670|  55.3k|      out.push_back(c);
 5671|  55.3k|      written_out++;
 5672|  55.3k|    }
 5673|  4.59k|    input.remove_prefix(end_of_ascii + 1);
 5674|  4.59k|  }
 5675|   150k|  while (!input.empty()) {
  ------------------
  |  Branch (5675:10): [True: 129k, False: 20.7k]
  ------------------
 5676|   129k|    int32_t oldi = i;
 5677|   129k|    int32_t w = 1;
 5678|   176k|    for (int32_t k = base;; k += base) {
 5679|   176k|      if (input.empty()) {
  ------------------
  |  Branch (5679:11): [True: 337, False: 176k]
  ------------------
 5680|    337|        return false;
 5681|    337|      }
 5682|   176k|      uint8_t code_point = input.front();
 5683|   176k|      input.remove_prefix(1);
 5684|   176k|      int32_t digit = char_to_digit_value(code_point);
 5685|   176k|      if (digit < 0) {
  ------------------
  |  Branch (5685:11): [True: 3.29k, False: 173k]
  ------------------
 5686|  3.29k|        return false;
 5687|  3.29k|      }
 5688|   173k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5688:11): [True: 127, False: 173k]
  ------------------
 5689|    127|        return false;
 5690|    127|      }
 5691|   173k|      i = i + digit * w;
 5692|   173k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5692:19): [True: 29.2k, False: 143k]
  |  Branch (5692:38): [True: 136k, False: 7.63k]
  ------------------
 5693|   173k|      if (digit < t) {
  ------------------
  |  Branch (5693:11): [True: 126k, False: 47.0k]
  ------------------
 5694|   126k|        break;
 5695|   126k|      }
 5696|  47.0k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5696:11): [True: 0, False: 47.0k]
  ------------------
 5697|      0|        return false;
 5698|      0|      }
 5699|  47.0k|      w = w * (base - t);
 5700|  47.0k|    }
 5701|   126k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5702|   126k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5702:9): [True: 127, False: 126k]
  ------------------
 5703|    127|      return false;
 5704|    127|    }
 5705|   126k|    n = n + i / (written_out + 1);
 5706|   126k|    i = i % (written_out + 1);
 5707|   126k|    if (n < 0x80) {
  ------------------
  |  Branch (5707:9): [True: 0, False: 126k]
  ------------------
 5708|      0|      return false;
 5709|      0|    }
 5710|   126k|    out.insert(out.begin() + i, n);
 5711|   126k|    written_out++;
 5712|   126k|    ++i;
 5713|   126k|  }
 5714|       |  // See https://github.com/whatwg/url/issues/803
 5715|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5716|  20.7k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5716:7): [True: 3.77k, False: 16.9k]
  |  Branch (5716:26): [True: 859, False: 2.92k]
  |  Branch (5716:44): [True: 500, False: 359]
  |  Branch (5716:62): [True: 362, False: 138]
  ------------------
 5717|    362|      out[3] == U'-') {
  ------------------
  |  Branch (5717:7): [True: 237, False: 125]
  ------------------
 5718|    237|    return false;
 5719|    237|  }
 5720|  20.4k|  return true;
 5721|  20.7k|}
_ZN3ada4idna15verify_punycodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 5723|  4.25k|bool verify_punycode(std::string_view input) {
 5724|       |  // Track only the first 4 decoded code points to check for the "xn--" prefix.
 5725|       |  // This avoids heap allocation while still detecting double-encoded ACE
 5726|       |  // labels.
 5727|  4.25k|  uint32_t first4[4]{};
 5728|  4.25k|  size_t written_out{0};
 5729|  4.25k|  uint32_t n = initial_n;
 5730|  4.25k|  int32_t i = 0;
 5731|  4.25k|  int32_t bias = initial_bias;
 5732|       |  // grab ascii content
 5733|  4.25k|  size_t end_of_ascii = input.find_last_of('-');
 5734|  4.25k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5734:7): [True: 1.25k, False: 2.99k]
  ------------------
 5735|  24.4k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5735:20): [True: 24.4k, False: 979]
  ------------------
 5736|  24.4k|      if (c >= 0x80) {
  ------------------
  |  Branch (5736:11): [True: 277, False: 24.1k]
  ------------------
 5737|    277|        return false;
 5738|    277|      }
 5739|  24.1k|      if (written_out < 4) {
  ------------------
  |  Branch (5739:11): [True: 3.60k, False: 20.5k]
  ------------------
 5740|  3.60k|        first4[written_out] = c;
 5741|  3.60k|      }
 5742|  24.1k|      written_out++;
 5743|  24.1k|    }
 5744|    979|    input.remove_prefix(end_of_ascii + 1);
 5745|    979|  }
 5746|  12.9k|  while (!input.empty()) {
  ------------------
  |  Branch (5746:10): [True: 11.5k, False: 1.41k]
  ------------------
 5747|  11.5k|    int32_t oldi = i;
 5748|  11.5k|    int32_t w = 1;
 5749|  16.9k|    for (int32_t k = base;; k += base) {
 5750|  16.9k|      if (input.empty()) {
  ------------------
  |  Branch (5750:11): [True: 99, False: 16.8k]
  ------------------
 5751|     99|        return false;
 5752|     99|      }
 5753|  16.8k|      uint8_t code_point = input.front();
 5754|  16.8k|      input.remove_prefix(1);
 5755|  16.8k|      int32_t digit = char_to_digit_value(code_point);
 5756|  16.8k|      if (digit < 0) {
  ------------------
  |  Branch (5756:11): [True: 2.41k, False: 14.4k]
  ------------------
 5757|  2.41k|        return false;
 5758|  2.41k|      }
 5759|  14.4k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5759:11): [True: 17, False: 14.4k]
  ------------------
 5760|     17|        return false;
 5761|     17|      }
 5762|  14.4k|      i = i + digit * w;
 5763|  14.4k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5763:19): [True: 3.39k, False: 11.0k]
  |  Branch (5763:38): [True: 10.4k, False: 590]
  ------------------
 5764|  14.4k|      if (digit < t) {
  ------------------
  |  Branch (5764:11): [True: 9.04k, False: 5.38k]
  ------------------
 5765|  9.04k|        break;
 5766|  9.04k|      }
 5767|  5.38k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5767:11): [True: 0, False: 5.38k]
  ------------------
 5768|      0|        return false;
 5769|      0|      }
 5770|  5.38k|      w = w * (base - t);
 5771|  5.38k|    }
 5772|  9.04k|    bias = adapt(i - oldi, int32_t(written_out + 1), oldi == 0);
 5773|  9.04k|    if (i / (written_out + 1) > 0x7fffffff - n) {
  ------------------
  |  Branch (5773:9): [True: 32, False: 9.01k]
  ------------------
 5774|     32|      return false;
 5775|     32|    }
 5776|  9.01k|    n = n + i / int32_t(written_out + 1);
 5777|  9.01k|    i = i % int32_t(written_out + 1);
 5778|  9.01k|    if (n < 0x80) {
  ------------------
  |  Branch (5778:9): [True: 0, False: 9.01k]
  ------------------
 5779|      0|      return false;
 5780|      0|    }
 5781|       |    // Simulate insert at position i, maintaining only the first 4 slots.
 5782|  9.01k|    size_t insert_pos = size_t(i);
 5783|  9.01k|    if (insert_pos < 4) {
  ------------------
  |  Branch (5783:9): [True: 2.19k, False: 6.82k]
  ------------------
 5784|  6.08k|      for (size_t j = 3; j > insert_pos; j--) {
  ------------------
  |  Branch (5784:26): [True: 3.89k, False: 2.19k]
  ------------------
 5785|  3.89k|        first4[j] = first4[j - 1];
 5786|  3.89k|      }
 5787|  2.19k|      first4[insert_pos] = n;
 5788|  2.19k|    }
 5789|  9.01k|    written_out++;
 5790|  9.01k|    ++i;
 5791|  9.01k|  }
 5792|       |  // See https://github.com/whatwg/url/issues/803
 5793|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5794|  1.41k|  if (written_out >= 4 && first4[0] == U'x' && first4[1] == U'n' &&
  ------------------
  |  Branch (5794:7): [True: 666, False: 745]
  |  Branch (5794:27): [True: 402, False: 264]
  |  Branch (5794:48): [True: 299, False: 103]
  ------------------
 5795|    299|      first4[2] == U'-' && first4[3] == U'-') {
  ------------------
  |  Branch (5795:7): [True: 224, False: 75]
  |  Branch (5795:28): [True: 155, False: 69]
  ------------------
 5796|    155|    return false;
 5797|    155|  }
 5798|  1.25k|  return true;
 5799|  1.41k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5801|  6.05k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5802|  6.05k|  out.reserve(input.size() + out.size());
 5803|  6.05k|  uint32_t n = initial_n;
 5804|  6.05k|  int32_t d = 0;
 5805|  6.05k|  int32_t bias = initial_bias;
 5806|  6.05k|  size_t h = 0;
 5807|       |  // first push the ascii content
 5808|   123k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5808:19): [True: 123k, False: 5.89k]
  ------------------
 5809|   123k|    if (c < 0x80) {
  ------------------
  |  Branch (5809:9): [True: 27.7k, False: 95.9k]
  ------------------
 5810|  27.7k|      ++h;
 5811|  27.7k|      out.push_back(char(c));
 5812|  27.7k|    }
 5813|   123k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5813:9): [True: 145, False: 123k]
  |  Branch (5813:26): [True: 938, False: 122k]
  |  Branch (5813:41): [True: 16, False: 922]
  ------------------
 5814|    161|      return false;
 5815|    161|    }
 5816|   123k|  }
 5817|  5.89k|  size_t b = h;
 5818|  5.89k|  if (b > 0) {
  ------------------
  |  Branch (5818:7): [True: 2.66k, False: 3.22k]
  ------------------
 5819|  2.66k|    out.push_back('-');
 5820|  2.66k|  }
 5821|  22.8k|  while (h < input.size()) {
  ------------------
  |  Branch (5821:10): [True: 16.9k, False: 5.89k]
  ------------------
 5822|  16.9k|    uint32_t m = 0x10FFFF;
 5823|  1.34M|    for (auto code_point : input) {
  ------------------
  |  Branch (5823:26): [True: 1.34M, False: 16.9k]
  ------------------
 5824|  1.34M|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5824:11): [True: 517k, False: 825k]
  |  Branch (5824:30): [True: 28.6k, False: 488k]
  ------------------
 5825|  1.34M|    }
 5826|       |
 5827|  16.9k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5827:9): [True: 0, False: 16.9k]
  ------------------
 5828|      0|      return false;
 5829|      0|    }
 5830|  16.9k|    d = d + int32_t((m - n) * (h + 1));
 5831|  16.9k|    n = m;
 5832|  1.34M|    for (auto c : input) {
  ------------------
  |  Branch (5832:17): [True: 1.34M, False: 16.9k]
  ------------------
 5833|  1.34M|      if (c < n) {
  ------------------
  |  Branch (5833:11): [True: 825k, False: 517k]
  ------------------
 5834|   825k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5834:13): [True: 0, False: 825k]
  ------------------
 5835|      0|          return false;
 5836|      0|        }
 5837|   825k|        ++d;
 5838|   825k|      }
 5839|  1.34M|      if (c == n) {
  ------------------
  |  Branch (5839:11): [True: 95.7k, False: 1.24M]
  ------------------
 5840|  95.7k|        int32_t q = d;
 5841|   124k|        for (int32_t k = base;; k += base) {
 5842|   124k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5842:23): [True: 14.5k, False: 110k]
  |  Branch (5842:42): [True: 103k, False: 6.25k]
  ------------------
 5843|       |
 5844|   124k|          if (q < t) {
  ------------------
  |  Branch (5844:15): [True: 95.7k, False: 28.8k]
  ------------------
 5845|  95.7k|            break;
 5846|  95.7k|          }
 5847|  28.8k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5848|  28.8k|          q = (q - t) / (base - t);
 5849|  28.8k|        }
 5850|  95.7k|        out.push_back(digit_to_char(q));
 5851|  95.7k|        bias = adapt(d, int32_t(h + 1), h == b);
 5852|  95.7k|        d = 0;
 5853|  95.7k|        ++h;
 5854|  95.7k|      }
 5855|  1.34M|    }
 5856|  16.9k|    ++d;
 5857|  16.9k|    ++n;
 5858|  16.9k|  }
 5859|  5.89k|  return true;
 5860|  5.89k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  14.8k|bool is_label_valid(const std::u32string_view label) {
 5945|  14.8k|  if (label.empty()) {
  ------------------
  |  Branch (5945:7): [True: 0, False: 14.8k]
  ------------------
 5946|      0|    return true;
 5947|      0|  }
 5948|  14.8k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5948:7): [True: 0, False: 14.8k]
  |  Branch (5948:27): [True: 0, False: 14.8k]
  |  Branch (5948:58): [True: 0, False: 14.8k]
  ------------------
 5949|  14.8k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5949:7): [True: 0, False: 14.8k]
  |  Branch (5949:31): [True: 0, False: 14.8k]
  ------------------
 5950|      0|    return false;
 5951|      0|  }
 5952|       |
 5953|       |  ///////////////
 5954|       |  // We have a normalization step which ensures that we are in NFC.
 5955|       |  // If we receive punycode, we normalize and check that the normalized
 5956|       |  // version matches the original.
 5957|       |  // --------------------------------------
 5958|       |  // The label must be in Unicode Normalization Form NFC.
 5959|       |
 5960|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5961|       |  // ---------------------------------------
 5962|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5963|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5964|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5965|       |
 5966|       |  // This is not necessary because we segment the
 5967|       |  // labels by '.'.
 5968|       |  // ---------------------------------------
 5969|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5970|       |  // if (label.find('.') != std::string_view::npos) return false;
 5971|       |
 5972|       |  // The label must not begin with a combining mark.
 5973|       |  // Range membership via lower_bound on range end.
 5974|  14.8k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5975|  14.8k|                                               combining_range_count};
 5976|  14.8k|  const auto comb_it = std::ranges::lower_bound(
 5977|  14.8k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5978|  14.8k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5978:7): [True: 14.7k, False: 104]
  |  Branch (5978:7): [True: 217, False: 14.5k]
  |  Branch (5978:37): [True: 217, False: 14.4k]
  ------------------
 5979|    217|    return false;
 5980|    217|  }
 5981|       |  // We verify this next step as part of the mapping:
 5982|       |  // ---------------------------------------------
 5983|       |  // Each code point in the label must only have certain status values
 5984|       |  // according to Section 5, IDNA Mapping Table:
 5985|       |  // - For Transitional Processing, each value must be valid.
 5986|       |  // - For Nontransitional Processing, each value must be either valid or
 5987|       |  // deviation.
 5988|       |
 5989|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 5990|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 5991|       |  // Applications (IDNA) [IDNA2008].
 5992|  14.5k|  constexpr static uint32_t virama[] = {
 5993|  14.5k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 5994|  14.5k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 5995|  14.5k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 5996|  14.5k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 5997|  14.5k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 5998|  14.5k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 5999|  14.5k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6000|  14.5k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6001|  14.5k|  constexpr static uint32_t R[] = {
 6002|  14.5k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6003|  14.5k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6004|  14.5k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6005|  14.5k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6006|  14.5k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6007|  14.5k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6008|  14.5k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6009|  14.5k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6010|  14.5k|  constexpr static uint32_t L[] = {0xa872};
 6011|  14.5k|  constexpr static uint32_t D[] = {
 6012|  14.5k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6013|  14.5k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6014|  14.5k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6015|  14.5k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6016|  14.5k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6017|  14.5k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6018|  14.5k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6019|  14.5k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6020|  14.5k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6021|  14.5k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6022|  14.5k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6023|  14.5k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6024|  14.5k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6025|  14.5k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6026|  14.5k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6027|  14.5k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6028|  14.5k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6029|  14.5k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6030|  14.5k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6031|  14.5k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6032|  14.5k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6033|  14.5k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6034|  14.5k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6035|  14.5k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6036|  14.5k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6037|  14.5k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6038|  14.5k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6039|  14.5k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6040|  14.5k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6041|  14.5k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6042|  14.5k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6043|  14.5k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6044|  14.5k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6045|  14.5k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6046|  14.5k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6047|  14.5k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6048|  14.5k|      0xa870, 0xa871};
 6049|       |
 6050|   137k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6050:22): [True: 125k, False: 12.0k]
  ------------------
 6051|   125k|    uint32_t c = label[i];
 6052|   125k|    if (c == 0x200c) {
  ------------------
  |  Branch (6052:9): [True: 1.91k, False: 123k]
  ------------------
 6053|  1.91k|      if (i > 0) {
  ------------------
  |  Branch (6053:11): [True: 1.81k, False: 103]
  ------------------
 6054|  1.81k|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6054:13): [True: 199, False: 1.61k]
  ------------------
 6055|    199|          return true;
 6056|    199|        }
 6057|  1.81k|      }
 6058|  1.71k|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6058:11): [True: 103, False: 1.61k]
  |  Branch (6058:23): [True: 204, False: 1.41k]
  ------------------
 6059|    307|        return false;
 6060|    307|      }
 6061|       |      // we go backward looking for L or D
 6062|  1.41k|      auto is_l_or_d = [](uint32_t code) {
 6063|  1.41k|        return std::ranges::binary_search(L, code) ||
 6064|  1.41k|               std::ranges::binary_search(D, code);
 6065|  1.41k|      };
 6066|  1.41k|      auto is_r_or_d = [](uint32_t code) {
 6067|  1.41k|        return std::ranges::binary_search(R, code) ||
 6068|  1.41k|               std::ranges::binary_search(D, code);
 6069|  1.41k|      };
 6070|  1.41k|      std::u32string_view before = label.substr(0, i);
 6071|  1.41k|      std::u32string_view after = label.substr(i + 1);
 6072|  1.41k|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6072:14): [True: 1.27k, False: 139]
  ------------------
 6073|  1.41k|              before.end()) &&
 6074|  1.27k|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6074:14): [True: 1.07k, False: 199]
  ------------------
 6075|  1.27k|              after.end());
 6076|   123k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6076:16): [True: 646, False: 122k]
  ------------------
 6077|    646|      if (i > 0) {
  ------------------
  |  Branch (6077:11): [True: 552, False: 94]
  ------------------
 6078|    552|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6078:13): [True: 312, False: 240]
  ------------------
 6079|    312|          return true;
 6080|    312|        }
 6081|    552|      }
 6082|    334|      return false;
 6083|    646|    }
 6084|   125k|  }
 6085|       |
 6086|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6087|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6088|       |  // Section 2.
 6089|       |
 6090|       |  // The following rule, consisting of six conditions, applies to labels
 6091|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6092|       |  // described in Section 3.  All of the conditions must be satisfied for
 6093|       |  // the rule to be satisfied.
 6094|       |  //
 6095|       |  //  1.  The first character must be a character with Bidi property L, R,
 6096|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6097|       |  //     has the L property, it is an LTR label.
 6098|       |  //
 6099|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6100|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6101|       |  //
 6102|       |  //   3.  In an RTL label, the end of the label must be a character with
 6103|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6104|       |  //       characters with Bidi property NSM.
 6105|       |  //
 6106|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6107|       |  //       vice versa.
 6108|       |  //
 6109|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6110|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6111|       |  //
 6112|       |  //   6.  In an LTR label, the end of the label must be a character with
 6113|       |  //       Bidi property L or EN, followed by zero or more characters with
 6114|       |  //       Bidi property NSM.
 6115|       |
 6116|  12.0k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6117|  12.0k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6117:7): [True: 0, False: 12.0k]
  ------------------
 6118|      0|    return false;
 6119|      0|  }
 6120|       |
 6121|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6122|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6123|       |  // domain names.
 6124|  12.0k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6124:7): [True: 2.94k, False: 9.08k]
  ------------------
 6125|       |    // The first character must be a character with Bidi property L, R,
 6126|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6127|       |    // has the L property, it is an LTR label.
 6128|       |
 6129|  2.94k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6129:9): [True: 420, False: 2.52k]
  ------------------
 6130|       |      // Eval as LTR
 6131|       |
 6132|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6133|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6134|  3.23k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6134:26): [True: 3.23k, False: 0]
  ------------------
 6135|  3.23k|        const direction d = find_direction(label[i]);
 6136|  3.23k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6136:15): [True: 976, False: 2.25k]
  |  Branch (6136:36): [True: 289, False: 1.96k]
  |  Branch (6136:58): [True: 216, False: 1.75k]
  ------------------
 6137|  1.75k|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6137:15): [True: 220, False: 1.53k]
  |  Branch (6137:37): [True: 234, False: 1.29k]
  |  Branch (6137:59): [True: 215, False: 1.08k]
  ------------------
 6138|  1.08k|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6138:15): [True: 394, False: 687]
  |  Branch (6138:37): [True: 267, False: 420]
  ------------------
 6139|    420|          return false;
 6140|    420|        }
 6141|  3.23k|      }
 6142|       |
 6143|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6144|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6144:13): [True: 0, False: 0]
  |  Branch (6144:41): [True: 0, False: 0]
  ------------------
 6145|      0|        return false;
 6146|      0|      }
 6147|       |
 6148|      0|      return true;
 6149|       |
 6150|  2.52k|    } else {
 6151|       |      // Eval as RTL
 6152|       |
 6153|       |      // The first character must be R or AL; a leading AN (or any other
 6154|       |      // direction) does not start a valid RTL label.
 6155|  2.52k|      const direction first_dir = find_direction(label[0]);
 6156|  2.52k|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6156:11): [True: 1.64k, False: 885]
  |  Branch (6156:40): [True: 226, False: 1.41k]
  ------------------
 6157|    226|        return false;
 6158|    226|      }
 6159|       |
 6160|  2.30k|      bool has_an = false;
 6161|  2.30k|      bool has_en = false;
 6162|  8.48k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6162:26): [True: 6.68k, False: 1.80k]
  ------------------
 6163|  6.68k|        const direction d = find_direction(label[i]);
 6164|       |
 6165|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6166|       |        // versa.
 6167|  6.68k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6167:14): [True: 590, False: 6.09k]
  |  Branch (6167:37): [True: 590, False: 0]
  |  Branch (6167:56): [True: 98, False: 492]
  ------------------
 6168|  6.58k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6168:14): [True: 429, False: 6.16k]
  |  Branch (6168:37): [True: 429, False: 0]
  |  Branch (6168:56): [True: 96, False: 333]
  ------------------
 6169|    194|          return false;
 6170|    194|        }
 6171|       |
 6172|  6.49k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6172:15): [True: 1.54k, False: 4.95k]
  |  Branch (6172:36): [True: 2.92k, False: 2.02k]
  |  Branch (6172:58): [True: 333, False: 1.69k]
  ------------------
 6173|  1.69k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6173:15): [True: 492, False: 1.20k]
  |  Branch (6173:37): [True: 244, False: 959]
  |  Branch (6173:59): [True: 159, False: 800]
  ------------------
 6174|    800|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6174:15): [True: 139, False: 661]
  |  Branch (6174:37): [True: 152, False: 509]
  |  Branch (6174:59): [True: 192, False: 317]
  ------------------
 6175|    317|              d == direction::NSM)) {
  ------------------
  |  Branch (6175:15): [True: 137, False: 180]
  ------------------
 6176|    180|          return false;
 6177|    180|        }
 6178|       |
 6179|  6.31k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6179:13): [True: 1.92k, False: 4.38k]
  ------------------
 6180|  1.92k|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6180:15): [True: 611, False: 1.31k]
  |  Branch (6180:36): [True: 813, False: 502]
  |  Branch (6180:58): [True: 144, False: 358]
  ------------------
 6181|    358|              d == direction::EN)) {
  ------------------
  |  Branch (6181:15): [True: 234, False: 124]
  ------------------
 6182|    124|          return false;
 6183|    124|        }
 6184|  6.31k|      }
 6185|       |
 6186|  1.80k|      return true;
 6187|  2.30k|    }
 6188|  2.94k|  }
 6189|       |
 6190|  9.08k|  return true;
 6191|  12.0k|}
_ZN3ada4idna36contains_forbidden_domain_code_pointENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6318|  4.25k|bool contains_forbidden_domain_code_point(std::string_view view) {
 6319|  4.25k|  return std::ranges::any_of(view, is_forbidden_domain_code_point);
 6320|  4.25k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6348|  11.0k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6349|  11.0k|  out.clear();
 6350|  11.0k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6350:7): [True: 0, False: 11.0k]
  ------------------
 6351|      0|    return false;
 6352|      0|  }
 6353|  11.0k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6353:7): [True: 8.29k, False: 2.77k]
  ------------------
 6354|  8.29k|    from_ascii_to_ascii(ut8_string, out);
 6355|  8.29k|    return true;
 6356|  8.29k|  }
 6357|       |
 6358|       |#ifdef ADA_USE_SIMDUTF
 6359|       |  size_t utf32_length =
 6360|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6361|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6362|       |    return false;
 6363|       |  }
 6364|       |  std::u32string working(utf32_length, U'\0');
 6365|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6366|       |      ut8_string.data(), ut8_string.size(), working.data());
 6367|       |#else
 6368|  2.77k|  size_t utf32_length =
 6369|  2.77k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6370|  2.77k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6370:7): [True: 26, False: 2.75k]
  |  Branch (6370:28): [True: 26, False: 0]
  ------------------
 6371|     26|    return false;
 6372|     26|  }
 6373|  2.75k|  std::u32string working(utf32_length, U'\0');
 6374|  2.75k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6375|  2.75k|      ut8_string.data(), ut8_string.size(), working.data());
 6376|  2.75k|#endif
 6377|  2.75k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6377:7): [True: 330, False: 2.42k]
  |  Branch (6377:35): [True: 0, False: 2.42k]
  ------------------
 6378|    330|    return false;
 6379|    330|  }
 6380|  2.42k|  working.resize(actual_utf32_length);
 6381|       |
 6382|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6383|  2.42k|  std::u32string mapped;
 6384|  2.42k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6384:7): [True: 230, False: 2.19k]
  ------------------
 6385|    230|    return false;
 6386|    230|  }
 6387|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6388|  2.19k|  working.clear();
 6389|       |
 6390|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6391|  2.19k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6391:7): [True: 1.88k, False: 307]
  |  Branch (6391:28): [True: 19, False: 1.86k]
  ------------------
 6392|     19|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6392:9): [True: 0, False: 19]
  ------------------
 6393|      0|      return false;
 6394|      0|    }
 6395|     19|  }
 6396|       |
 6397|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6398|  2.19k|  out.reserve(mapped.size() + 8);
 6399|       |
 6400|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6401|  2.19k|  const char32_t* p = mapped.data();
 6402|  2.19k|  const char32_t* const end = p + mapped.size();
 6403|  2.19k|  std::u32string post_map;
 6404|       |
 6405|  9.49k|  while (p < end) {
  ------------------
  |  Branch (6405:10): [True: 8.01k, False: 1.48k]
  ------------------
 6406|  8.01k|    const char32_t* label_begin = p;
 6407|   149k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6407:12): [True: 147k, False: 2.02k]
  |  Branch (6407:23): [True: 141k, False: 5.98k]
  ------------------
 6408|   141k|      ++p;
 6409|   141k|    }
 6410|  8.01k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6411|  8.01k|    std::u32string_view label_view(label_begin, label_size);
 6412|  8.01k|    const bool is_last_label = (p == end);
 6413|  8.01k|    if (p < end) {
  ------------------
  |  Branch (6413:9): [True: 5.98k, False: 2.02k]
  ------------------
 6414|  5.98k|      ++p;  // skip dot
 6415|  5.98k|    }
 6416|       |
 6417|  8.01k|    if (label_size == 0) {
  ------------------
  |  Branch (6417:9): [True: 801, False: 7.21k]
  ------------------
 6418|       |      // empty label
 6419|  7.21k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6419:16): [True: 801, False: 6.41k]
  ------------------
 6420|  11.7k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6420:23): [True: 11.7k, False: 781]
  ------------------
 6421|  11.7k|        if (c >= 0x80) {
  ------------------
  |  Branch (6421:13): [True: 20, False: 11.6k]
  ------------------
 6422|     20|          out.clear();
 6423|     20|          return false;
 6424|     20|        }
 6425|  11.7k|      }
 6426|    781|      append_ascii_label(out, label_view);
 6427|    781|      std::string_view puny_segment_ascii(
 6428|    781|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6429|    781|      working.clear();
 6430|    781|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6430:11): [True: 14, False: 767]
  ------------------
 6431|     14|        out.clear();
 6432|     14|        return false;
 6433|     14|      }
 6434|    767|      if (is_ascii(working)) {
  ------------------
  |  Branch (6434:11): [True: 41, False: 726]
  ------------------
 6435|     41|        out.clear();
 6436|     41|        return false;
 6437|     41|      }
 6438|    726|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6438:11): [True: 42, False: 684]
  |  Branch (6438:49): [True: 71, False: 613]
  ------------------
 6439|    113|        out.clear();
 6440|    113|        return false;
 6441|    113|      }
 6442|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6443|    613|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6443:11): [True: 613, False: 0]
  |  Branch (6443:34): [True: 32, False: 581]
  ------------------
 6444|     32|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6444:13): [True: 0, False: 32]
  |  Branch (6444:37): [True: 32, False: 0]
  ------------------
 6445|     32|          out.clear();
 6446|     32|          return false;
 6447|     32|        }
 6448|     32|      }
 6449|    581|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6449:11): [True: 0, False: 581]
  |  Branch (6449:31): [True: 4, False: 577]
  ------------------
 6450|      4|        out.clear();
 6451|      4|        return false;
 6452|      4|      }
 6453|  6.41k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6453:16): [True: 619, False: 5.79k]
  ------------------
 6454|    619|      append_ascii_label(out, label_view);
 6455|  5.79k|    } else {
 6456|  5.79k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6456:11): [True: 483, False: 5.30k]
  ------------------
 6457|    483|        out.clear();
 6458|    483|        return false;
 6459|    483|      }
 6460|  5.30k|      out.append("xn--");
 6461|  5.30k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6461:11): [True: 0, False: 5.30k]
  ------------------
 6462|      0|        out.clear();
 6463|      0|        return false;
 6464|      0|      }
 6465|  5.30k|    }
 6466|  7.30k|    if (!is_last_label) {
  ------------------
  |  Branch (6466:9): [True: 5.94k, False: 1.36k]
  ------------------
 6467|  5.94k|      out.push_back('.');
 6468|  5.94k|    }
 6469|  7.30k|  }
 6470|  1.48k|  return true;
 6471|  2.19k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6473|  11.0k|std::string to_ascii(std::string_view ut8_string) {
 6474|  11.0k|  std::string out;
 6475|  11.0k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6475:7): [True: 1.29k, False: 9.78k]
  ------------------
 6476|  1.29k|    return {};
 6477|  1.29k|  }
 6478|  9.78k|  return out;
 6479|  11.0k|}
_ZN3ada4idna10to_unicodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6547|  10.5k|[[nodiscard]] bool to_unicode(std::string_view input, std::string& output) {
 6548|  10.5k|  output.clear();
 6549|  10.5k|  if (input.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6549:7): [True: 0, False: 10.5k]
  ------------------
 6550|      0|    return false;
 6551|      0|  }
 6552|  10.5k|  output.reserve(input.size());
 6553|       |
 6554|  10.5k|  size_t label_start = 0;
 6555|  10.5k|  std::u32string tmp_buffer;
 6556|  10.5k|  std::u32string post_map;
 6557|  43.2k|  while (label_start < input.size()) {
  ------------------
  |  Branch (6557:10): [True: 32.7k, False: 10.5k]
  ------------------
 6558|  32.7k|    size_t loc_dot = input.find('.', label_start);
 6559|  32.7k|    bool is_last_label = (loc_dot == std::string_view::npos);
 6560|  32.7k|    size_t label_size =
 6561|  32.7k|        is_last_label ? input.size() - label_start : loc_dot - label_start;
  ------------------
  |  Branch (6561:9): [True: 9.63k, False: 23.1k]
  ------------------
 6562|  32.7k|    auto label_view = std::string_view(input.data() + label_start, label_size);
 6563|       |
 6564|  32.7k|    if (label_view.starts_with("xn--") && ada::idna::is_ascii(label_view)) {
  ------------------
  |  Branch (6564:9): [True: 11.7k, False: 20.9k]
  |  Branch (6564:43): [True: 11.3k, False: 456]
  ------------------
 6565|  11.3k|      label_view.remove_prefix(4);
 6566|  11.3k|      tmp_buffer.clear();
 6567|  11.3k|      if (ada::idna::punycode_to_utf32(label_view, tmp_buffer)) {
  ------------------
  |  Branch (6567:11): [True: 10.2k, False: 1.08k]
  ------------------
 6568|       |        // Per UTS #46, the decoded label must be re-validated. Reject decodings
 6569|       |        // that are pure ASCII (xn-- encoding of an ASCII-only label), or whose
 6570|       |        // mapping/normalization is not stable, or that fail label validity.
 6571|  10.2k|        bool accept_decoded = true;
 6572|  10.2k|        if (ada::idna::is_ascii(tmp_buffer)) {
  ------------------
  |  Branch (6572:13): [True: 579, False: 9.66k]
  ------------------
 6573|    579|          accept_decoded = false;
 6574|  9.66k|        } else {
 6575|  9.66k|          post_map.clear();
 6576|  9.66k|          if (!ada::idna::map(tmp_buffer, post_map) || post_map != tmp_buffer) {
  ------------------
  |  Branch (6576:15): [True: 702, False: 8.96k]
  |  Branch (6576:56): [True: 599, False: 8.36k]
  ------------------
 6577|  1.30k|            accept_decoded = false;
 6578|  8.36k|          } else if (!ada::idna::normalize(post_map) ||
  ------------------
  |  Branch (6578:22): [True: 0, False: 8.36k]
  ------------------
 6579|  8.36k|                     post_map != tmp_buffer || post_map.empty() ||
  ------------------
  |  Branch (6579:22): [True: 474, False: 7.89k]
  |  Branch (6579:48): [True: 0, False: 7.89k]
  ------------------
 6580|  7.89k|                     !ada::idna::is_label_valid(post_map)) {
  ------------------
  |  Branch (6580:22): [True: 1.72k, False: 6.17k]
  ------------------
 6581|  2.19k|            accept_decoded = false;
 6582|  2.19k|          }
 6583|  9.66k|        }
 6584|       |
 6585|  10.2k|        if (accept_decoded) {
  ------------------
  |  Branch (6585:13): [True: 6.17k, False: 4.07k]
  ------------------
 6586|       |#ifdef ADA_USE_SIMDUTF
 6587|       |          auto utf8_size = simdutf::utf8_length_from_utf32(tmp_buffer.data(),
 6588|       |                                                           tmp_buffer.size());
 6589|       |          size_t old_size = output.size();
 6590|       |          output.resize(old_size + utf8_size);
 6591|       |          size_t written = simdutf::convert_utf32_to_utf8(
 6592|       |              tmp_buffer.data(), tmp_buffer.size(), output.data() + old_size);
 6593|       |          if (written != utf8_size) {
 6594|       |            output.resize(old_size);
 6595|       |            output.append(
 6596|       |                std::string_view(input.data() + label_start, label_size));
 6597|       |          }
 6598|       |#else
 6599|  6.17k|          auto utf8_size = ada::idna::utf8_length_from_utf32(tmp_buffer.data(),
 6600|  6.17k|                                                             tmp_buffer.size());
 6601|  6.17k|          size_t old_size = output.size();
 6602|  6.17k|          output.resize(old_size + utf8_size);
 6603|  6.17k|          size_t written = ada::idna::utf32_to_utf8(
 6604|  6.17k|              tmp_buffer.data(), tmp_buffer.size(), output.data() + old_size);
 6605|  6.17k|          if (written != utf8_size) {
  ------------------
  |  Branch (6605:15): [True: 0, False: 6.17k]
  ------------------
 6606|      0|            output.resize(old_size);
 6607|      0|            output.append(
 6608|      0|                std::string_view(input.data() + label_start, label_size));
 6609|      0|          }
 6610|  6.17k|#endif
 6611|  6.17k|        } else {
 6612|       |          // ToUnicode never fails. If any step fails, return the original
 6613|       |          // input sequence for the label.
 6614|  4.07k|          output.append(
 6615|  4.07k|              std::string_view(input.data() + label_start, label_size));
 6616|  4.07k|        }
 6617|  10.2k|      } else {
 6618|  1.08k|        output.append(std::string_view(input.data() + label_start, label_size));
 6619|  1.08k|      }
 6620|  21.4k|    } else {
 6621|  21.4k|      output.append(label_view);
 6622|  21.4k|    }
 6623|       |
 6624|  32.7k|    if (!is_last_label) {
  ------------------
  |  Branch (6624:9): [True: 23.1k, False: 9.63k]
  ------------------
 6625|  23.1k|      output.push_back('.');
 6626|  23.1k|    }
 6627|       |
 6628|  32.7k|    label_start += label_size + 1;
 6629|  32.7k|  }
 6630|       |
 6631|  10.5k|  return true;
 6632|  10.5k|}
_ZN3ada4idna10to_unicodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6634|  10.5k|std::string to_unicode(std::string_view input) {
 6635|  10.5k|  std::string output;
 6636|  10.5k|  if (!to_unicode(input, output)) {
  ------------------
  |  Branch (6636:7): [True: 0, False: 10.5k]
  ------------------
 6637|       |    // Over-limit input: return original (ToUnicode never fails in the sense of
 6638|       |    // producing no answer for valid-length inputs).
 6639|      0|    return std::string(input);
 6640|      0|  }
 6641|  10.5k|  return output;
 6642|  10.5k|}
idna.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  284|   415k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|   415k|    return c > -65;
  288|   415k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  490|      2|inline Huff make_fixed_litlen_huff() {
  491|      2|  Huff h;
  492|      2|  uint8_t lens[288];
  493|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  494|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (494:19): [True: 288, False: 2]
  ------------------
  495|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (495:21): [True: 224, False: 2]
  ------------------
  496|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (496:21): [True: 48, False: 2]
  ------------------
  497|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (497:21): [True: 16, False: 2]
  ------------------
  498|      2|  h.build(lens, 288);
  499|      2|  return h;
  500|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  439|     16|  bool build(const uint8_t* lens, int n) {
  440|     16|    std::memset(counts, 0, sizeof(counts));
  441|     16|    std::memset(first_code, 0, sizeof(first_code));
  442|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  443|     16|    nsymbols = n;
  444|     16|    max_bits = 0;
  445|  1.98k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (445:21): [True: 1.96k, False: 16]
  ------------------
  446|  1.96k|      lengths[i] = lens[i];
  447|  1.96k|      if (lens[i]) {
  ------------------
  |  Branch (447:11): [True: 1.91k, False: 49]
  ------------------
  448|  1.91k|        counts[lens[i]]++;
  449|  1.91k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (449:13): [True: 46, False: 1.87k]
  ------------------
  450|  1.91k|      }
  451|  1.96k|    }
  452|       |    // Canonical first code for each bit length (RFC 1951).
  453|     16|    int code = 0;
  454|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (454:24): [True: 240, False: 16]
  ------------------
  455|    240|      code = (code + counts[bits - 1]) << 1;
  456|    240|      first_code[bits] = code;
  457|    240|    }
  458|     16|    int idx = 0;
  459|    158|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (459:24): [True: 142, False: 16]
  ------------------
  460|    142|      base_idx[bits] = idx;
  461|       |      // assign symbols in symbol order for codes of this length
  462|  21.6k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (462:25): [True: 21.5k, False: 142]
  ------------------
  463|  21.5k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (463:13): [True: 1.91k, False: 19.6k]
  ------------------
  464|  1.91k|          symbols[idx++] = static_cast<int16_t>(sym);
  465|  1.91k|        }
  466|  21.5k|      }
  467|    142|    }
  468|     16|    return true;
  469|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  502|      2|inline Huff make_fixed_dist_huff() {
  503|      2|  Huff h;
  504|      2|  uint8_t lens[32];
  505|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (505:19): [True: 64, False: 2]
  ------------------
  506|      2|  h.build(lens, 32);
  507|      2|  return h;
  508|      2|}
idna.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5134|  37.6k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|  37.6k|    return 0x101010101010101ull * v;
 5136|  37.6k|  };
_ZN3ada4idna13ensure_tablesEv:
 4885|  42.9k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4886|  42.9k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4887|  42.9k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4887:7): [True: 42.9k, False: 1]
  ------------------
 4888|  42.9k|    return true;
 4889|  42.9k|  }
 4890|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4890:7): [True: 0, False: 1]
  ------------------
 4891|      0|    return false;
 4892|      0|  }
 4893|       |
 4894|      1|  uint8_t expected = kTablesUninit;
 4895|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4895:7): [True: 1, False: 0]
  ------------------
 4896|      1|                                                std::memory_order_acq_rel,
 4897|      1|                                                std::memory_order_acquire)) {
 4898|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4899|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4899:9): [True: 0, False: 1]
  ------------------
 4900|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4901|      0|      return false;
 4902|      0|    }
 4903|       |
 4904|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4905|      1|                                          table_blob::compressed_size, buffer,
 4906|      1|                                          table_blob::uncompressed_size);
 4907|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4907:9): [True: 0, False: 1]
  ------------------
 4908|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4908:9): [True: 0, False: 1]
  ------------------
 4909|      0|      delete[] buffer;
 4910|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4911|      0|      return false;
 4912|      0|    }
 4913|       |
 4914|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4915|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4916|       |
 4917|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|      1|      return buffer + off;
 4919|      1|    };
 4920|       |
 4921|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4922|       |    // acquire on tables_init_state and then observe these writes.
 4923|      1|    idna_stage1 =
 4924|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4925|      1|    idna_stage2 =
 4926|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4927|      1|    idna_bool_blocks =
 4928|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4929|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4930|       |
 4931|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4932|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_decomposition_block));
 4934|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4935|      1|        at(table_blob::off_decomposition_data));
 4936|      1|    ccc_index = at(table_blob::off_ccc_index);
 4937|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4938|      1|    composition_index = at(table_blob::off_composition_index);
 4939|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4940|      1|        at(table_blob::off_composition_block));
 4941|      1|    composition_data =
 4942|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4943|       |
 4944|      1|    id_continue =
 4945|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4946|      1|    id_start =
 4947|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4948|       |
 4949|      1|    dir_start =
 4950|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4951|      1|    dir_final =
 4952|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4953|      1|    dir_value = at(table_blob::off_dir_value);
 4954|      1|    combining_ranges =
 4955|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4956|       |
 4957|      1|    tables_buffer = buffer;
 4958|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4959|      1|    return true;
 4960|      1|  }
 4961|       |
 4962|       |  // Another thread owns init (or finished between our loads).
 4963|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4963:28): [True: 0, False: 0]
  ------------------
 4964|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4965|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4965:9): [True: 0, False: 0]
  ------------------
 4966|      0|      return true;
 4967|      0|    }
 4968|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4968:9): [True: 0, False: 0]
  ------------------
 4969|      0|      return false;
 4970|      0|    }
 4971|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4972|      0|    defined(_M_IX86)
 4973|      0|#if defined(__GNUC__) || defined(__clang__)
 4974|      0|    __builtin_ia32_pause();
 4975|      0|#endif
 4976|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4977|       |#if defined(__GNUC__) || defined(__clang__)
 4978|       |    asm volatile("yield" ::: "memory");
 4979|       |#endif
 4980|       |#endif
 4981|      0|  }
 4982|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4983|      0|  return false;
 4984|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  535|      1|                          size_t dst_cap) {
  536|      1|  BitReader br(src, src_len);
  537|      1|  size_t out = 0;
  538|      4|  for (;;) {
  539|      4|    uint32_t bfinal = br.get(1);
  540|      4|    uint32_t btype = br.get(2);
  541|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (541:9): [True: 0, False: 4]
  |  Branch (541:33): [True: 0, False: 4]
  ------------------
  542|      4|    if (btype == 0) {
  ------------------
  |  Branch (542:9): [True: 0, False: 4]
  ------------------
  543|       |      // stored
  544|      0|      br.align_byte();
  545|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // read 16+16 from bit buffer awkwardly - use byte path
  547|       |      // Align: bits is multiple of 8
  548|       |      // Get len from remaining bits then bytes
  549|      0|      uint32_t len = br.get(16);
  550|      0|      uint32_t nlen = br.get(16);
  551|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  |  Branch (551:32): [True: 0, False: 0]
  ------------------
  552|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|       |      // After get, may have bits in acc from previous - for stored, should be
  554|       |      // byte aligned Copy len bytes from p
  555|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (555:11): [True: 0, False: 0]
  ------------------
  556|       |        // leftover bits should be 0 if aligned
  557|      0|      }
  558|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (558:11): [True: 0, False: 0]
  ------------------
  559|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (559:11): [True: 0, False: 0]
  ------------------
  560|      0|      std::memcpy(dst + out, br.p, len);
  561|      0|      br.p += len;
  562|      0|      out += len;
  563|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (563:16): [True: 0, False: 4]
  |  Branch (563:30): [True: 4, False: 0]
  ------------------
  564|      4|      Huff lit, dist;
  565|      4|      if (btype == 1) {
  ------------------
  |  Branch (565:11): [True: 0, False: 4]
  ------------------
  566|       |        // use fixed via functions
  567|      4|      } else {
  568|       |        // dynamic
  569|      4|        uint32_t hlit = br.get(5);
  570|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (570:13): [True: 0, False: 4]
  ------------------
  571|      4|        hlit += 257;
  572|      4|        uint32_t hdist = br.get(5);
  573|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (573:13): [True: 0, False: 4]
  ------------------
  574|      4|        hdist += 1;
  575|      4|        uint32_t hclen = br.get(4);
  576|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:13): [True: 0, False: 4]
  ------------------
  577|      4|        hclen += 4;
  578|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  579|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  580|      4|        uint8_t clen[19]{};
  581|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (581:30): [True: 65, False: 4]
  ------------------
  582|     65|          uint32_t v = br.get(3);
  583|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 65]
  ------------------
  584|     65|          clen[order[i]] = uint8_t(v);
  585|     65|        }
  586|      4|        Huff cl;
  587|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (587:13): [True: 0, False: 4]
  ------------------
  588|      4|        uint8_t lens[288 + 32]{};
  589|      4|        uint32_t n = hlit + hdist;
  590|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (590:30): [True: 1.08k, False: 4]
  ------------------
  591|  1.08k|          int sym = cl.decode(br);
  592|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (592:15): [True: 0, False: 1.08k]
  ------------------
  593|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (593:15): [True: 1.03k, False: 49]
  ------------------
  594|  1.03k|            lens[i++] = uint8_t(sym);
  595|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (595:22): [True: 49, False: 0]
  ------------------
  596|     49|            uint32_t rep = br.get(2);
  597|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 49]
  ------------------
  598|     49|            rep += 3;
  599|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (599:17): [True: 0, False: 49]
  ------------------
  600|     49|            uint8_t v = lens[i - 1];
  601|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (601:20): [True: 214, False: 49]
  ------------------
  602|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (602:22): [True: 0, False: 0]
  ------------------
  603|      0|            uint32_t rep = br.get(3);
  604|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|            rep += 3;
  606|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (606:20): [True: 0, False: 0]
  ------------------
  607|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (607:22): [True: 0, False: 0]
  ------------------
  608|      0|            uint32_t rep = br.get(7);
  609|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|            rep += 11;
  611|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (611:20): [True: 0, False: 0]
  ------------------
  612|      0|          } else
  613|      0|            return 0;
  614|  1.08k|        }
  615|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 4]
  ------------------
  616|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (616:13): [True: 0, False: 4]
  ------------------
  617|      4|      }
  618|  52.2k|      for (;;) {
  619|  52.2k|        int sym;
  620|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (620:13): [True: 0, False: 52.2k]
  ------------------
  621|      0|          sym = fixed_litlen(br);
  622|  52.2k|        else
  623|  52.2k|          sym = lit.decode(br);
  624|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (624:13): [True: 0, False: 52.2k]
  ------------------
  625|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (625:13): [True: 37.2k, False: 14.9k]
  ------------------
  626|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (626:15): [True: 0, False: 37.2k]
  ------------------
  627|  37.2k|          dst[out++] = uint8_t(sym);
  628|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (628:20): [True: 4, False: 14.9k]
  ------------------
  629|      4|          break;
  630|  14.9k|        } else {
  631|  14.9k|          int len_code = sym - 257;
  632|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (632:15): [True: 0, False: 14.9k]
  |  Branch (632:31): [True: 0, False: 14.9k]
  ------------------
  633|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  634|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (634:15): [True: 2.03k, False: 12.9k]
  |  Branch (634:38): [True: 0, False: 2.03k]
  ------------------
  635|  14.9k|          uint32_t length =
  636|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (636:37): [True: 2.03k, False: 12.9k]
  ------------------
  637|  14.9k|          int dsym;
  638|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (638:15): [True: 0, False: 14.9k]
  ------------------
  639|      0|            dsym = fixed_dist(br);
  640|  14.9k|          else
  641|  14.9k|            dsym = dist.decode(br);
  642|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (642:15): [True: 0, False: 14.9k]
  |  Branch (642:27): [True: 0, False: 14.9k]
  ------------------
  643|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  644|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (644:15): [True: 9.97k, False: 5.01k]
  |  Branch (644:35): [True: 0, False: 9.97k]
  ------------------
  645|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (645:50): [True: 9.97k, False: 5.01k]
  ------------------
  646|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (646:15): [True: 0, False: 14.9k]
  |  Branch (646:33): [True: 0, False: 14.9k]
  ------------------
  647|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (647:32): [True: 187k, False: 14.9k]
  ------------------
  648|   187k|            dst[out] = dst[out - distance];
  649|   187k|            out++;
  650|   187k|          }
  651|  14.9k|        }
  652|  52.2k|      }
  653|      4|    } else {
  654|      0|      return 0;  // reserved
  655|      0|    }
  656|      4|    if (bfinal) break;
  ------------------
  |  Branch (656:9): [True: 1, False: 3]
  ------------------
  657|      4|  }
  658|      1|  return out;
  659|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  402|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  412|   457k|  uint32_t get(int n) {
  413|   457k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (413:9): [True: 0, False: 457k]
  ------------------
  414|   457k|    uint32_t v = acc & ((1u << n) - 1);
  415|   457k|    acc >>= n;
  416|   457k|    bits -= n;
  417|   457k|    return v;
  418|   457k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  404|   457k|  bool ensure(int n) {
  405|   520k|    while (bits < n) {
  ------------------
  |  Branch (405:12): [True: 62.3k, False: 457k]
  ------------------
  406|  62.3k|      if (p >= end) return false;
  ------------------
  |  Branch (406:11): [True: 0, False: 62.3k]
  ------------------
  407|  62.3k|      acc |= uint32_t(*p++) << bits;
  408|  62.3k|      bits += 8;
  409|  62.3k|    }
  410|   457k|    return true;
  411|   457k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  471|  68.3k|  int decode(BitReader& br) const {
  472|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (472:9): [True: 0, False: 68.3k]
  ------------------
  473|  68.3k|    int code = 0;
  474|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (474:23): [True: 427k, False: 0]
  ------------------
  475|   427k|      uint32_t b = br.get(1);
  476|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (476:11): [True: 0, False: 427k]
  ------------------
  477|   427k|      code = (code << 1) | int(b);
  478|   427k|      int first = first_code[len];
  479|   427k|      int cnt = counts[len];
  480|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (480:11): [True: 263k, False: 164k]
  |  Branch (480:18): [True: 68.3k, False: 195k]
  ------------------
  481|  68.3k|        return symbols[base_idx[len] + (code - first)];
  482|  68.3k|      }
  483|   427k|    }
  484|      0|    return -1;
  485|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4868|      1|                                         size_t len) noexcept {
 4869|      1|  uint32_t c = 0xFFFFFFFFu;
 4870|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4870:22): [True: 224k, False: 1]
  ------------------
 4871|   224k|    c ^= data[i];
 4872|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4872:21): [True: 1.79M, False: 224k]
  ------------------
 4873|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4874|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4875|  1.79M|    }
 4876|   224k|  }
 4877|      1|  return ~c;
 4878|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4691|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4692|      1|  if constexpr (std::endian::native == std::endian::little) {
 4693|      1|    (void)buffer;
 4694|      1|    return;
 4695|      1|  }
 4696|      0|  auto u16 = [&](size_t off, size_t count) {
 4697|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4698|      1|  };
 4699|      1|  auto u32 = [&](size_t off, size_t count) {
 4700|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4701|      1|  };
 4702|      1|  auto u64 = [&](size_t off, size_t count) {
 4703|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4704|      1|  };
 4705|       |
 4706|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4707|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4708|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4709|      1|  u16(table_blob::off_decomposition_block,
 4710|      1|      table_blob::count_decomposition_block);
 4711|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4712|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4713|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4714|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4715|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4716|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4717|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4718|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4719|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4917|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|     18|      return buffer + off;
 4919|     18|    };
idna.cc:_ZN3ada4idnaL11idna_lookupEj:
 5072|   476k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5073|   476k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5073:7): [True: 474k, False: 2.49k]
  ------------------
 5074|   474k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5075|   474k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5075:9): [True: 203k, False: 270k]
  ------------------
 5076|   203k|      uint32_t bit_idx =
 5077|   203k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5078|   203k|          (cp & IDNA_BLOCK_MASK);
 5079|   203k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5080|   203k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5080:14): [True: 203k, False: 101]
  ------------------
 5081|   203k|    }
 5082|   270k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5083|   474k|  }
 5084|       |
 5085|  2.49k|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5085:7): [True: 2.34k, False: 149]
  |  Branch (5085:40): [True: 1.73k, False: 616]
  ------------------
 5086|  1.73k|    return IDNA_IGNORED;
 5087|  1.73k|  }
 5088|       |
 5089|    765|  return IDNA_DISALLOWED;
 5090|  2.49k|}
idna.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5115|  33.5k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5116|  33.5k|  size_t n = 0;
 5117|   371k|  while (*ptr != 0) {
  ------------------
  |  Branch (5117:10): [True: 338k, False: 33.5k]
  ------------------
 5118|   338k|    ++n;
 5119|   338k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5119:9): [True: 67.8k, False: 270k]
  ------------------
 5120|  67.8k|      ++ptr;
 5121|   270k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5121:16): [True: 256k, False: 13.8k]
  ------------------
 5122|   256k|      ptr += 2;
 5123|   256k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5123:16): [True: 13.2k, False: 557]
  ------------------
 5124|  13.2k|      ptr += 3;
 5125|  13.2k|    } else {
 5126|    557|      ptr += 4;
 5127|    557|    }
 5128|   338k|  }
 5129|  33.5k|  return n;
 5130|  33.5k|}
idna.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5093|   338k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5094|   338k|  uint8_t b0 = *ptr++;
 5095|   338k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5095:7): [True: 67.8k, False: 270k]
  ------------------
 5096|   270k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5096:7): [True: 256k, False: 13.7k]
  ------------------
 5097|   256k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5098|   256k|    cp |= (*ptr++ & 0x3Fu);
 5099|   256k|    return static_cast<char32_t>(cp);
 5100|   256k|  }
 5101|  13.7k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5101:7): [True: 13.2k, False: 554]
  ------------------
 5102|  13.2k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5103|  13.2k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5104|  13.2k|    cp |= (*ptr++ & 0x3Fu);
 5105|  13.2k|    return static_cast<char32_t>(cp);
 5106|  13.2k|  }
 5107|    554|  uint32_t cp = (b0 & 0x07u) << 18;
 5108|    554|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5109|    554|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5110|    554|  cp |= (*ptr++ & 0x3Fu);
 5111|    554|  return static_cast<char32_t>(cp);
 5112|  13.7k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4989|   327k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4990|   327k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 327k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|   327k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4994|   327k|}
_ZN3ada4idna13ccc_block_rowEh:
 4996|   640k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4997|   640k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 640k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|   640k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5001|   640k|}
_ZN3ada4idna16tables_are_readyEv:
 4880|  14.3k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4881|  14.3k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4882|  14.3k|}
idna.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5272|   327k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5273|   327k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5273:7): [True: 15.3k, False: 311k]
  ------------------
 5274|  15.3k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5274:7): [True: 5.29k, False: 10.0k]
  ------------------
 5275|       |    // Hangul precomposed syllables are NFC.
 5276|  5.29k|    return 0;
 5277|  5.29k|  }
 5278|   321k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5278:7): [True: 0, False: 321k]
  ------------------
 5279|      0|    return 0;
 5280|      0|  }
 5281|   321k|  const uint8_t di = decomposition_index[current_character >> 8];
 5282|   321k|  const uint16_t* const decomposition =
 5283|   321k|      decomposition_block_row(di) + (current_character % 256);
 5284|   321k|  size_t decomposition_length =
 5285|   321k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5286|   321k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5286:7): [True: 14.2k, False: 307k]
  |  Branch (5286:37): [True: 8.79k, False: 5.50k]
  ------------------
 5287|  8.79k|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5288|  8.79k|  }
 5289|   321k|  return decomposition_length;
 5290|   321k|}
idna.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5404|  13.8k|static bool would_compose(std::u32string_view input) noexcept {
 5405|   330k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5405:32): [True: 317k, False: 13.7k]
  ------------------
 5406|   317k|    const char32_t current = input[input_count];
 5407|   317k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5407:9): [True: 37.7k, False: 279k]
  |  Branch (5407:36): [True: 903, False: 36.8k]
  ------------------
 5408|    903|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5408:11): [True: 666, False: 237]
  ------------------
 5409|    666|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5409:11): [True: 191, False: 475]
  ------------------
 5410|    191|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5410:11): [True: 17, False: 174]
  ------------------
 5411|     17|        return true;
 5412|     17|      }
 5413|    886|      ++input_count;
 5414|    886|      continue;
 5415|    903|    }
 5416|   316k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5416:9): [True: 14.9k, False: 301k]
  |  Branch (5416:36): [True: 5.29k, False: 9.61k]
  ------------------
 5417|  5.29k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5417:11): [True: 4.08k, False: 1.21k]
  ------------------
 5418|  4.08k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5418:11): [True: 3.79k, False: 294]
  ------------------
 5419|  3.79k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5419:11): [True: 3.43k, False: 358]
  ------------------
 5420|  3.43k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5420:11): [True: 0, False: 3.43k]
  ------------------
 5421|      0|        return true;
 5422|      0|      }
 5423|  5.29k|      ++input_count;
 5424|  5.29k|      continue;
 5425|  5.29k|    }
 5426|   311k|    if (current < 0x110000) {
  ------------------
  |  Branch (5426:9): [True: 311k, False: 0]
  ------------------
 5427|   311k|      const uint16_t* composition =
 5428|   311k|          composition_block_row(composition_index[current >> 8]) +
 5429|   311k|          (current % 256);
 5430|   311k|      int32_t previous_ccc = -1;
 5431|   311k|      size_t j = input_count;
 5432|   317k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5432:14): [True: 304k, False: 12.9k]
  ------------------
 5433|   304k|        uint8_t ccc = get_ccc(input[j + 1]);
 5434|   304k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5434:13): [True: 69.2k, False: 235k]
  |  Branch (5434:49): [True: 68.5k, False: 639]
  ------------------
 5435|  68.5k|          int left = composition[0];
 5436|  68.5k|          int right = composition[1];
 5437|  68.5k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5437:15): [True: 0, False: 68.5k]
  |  Branch (5437:27): [True: 0, False: 68.5k]
  ------------------
 5438|  68.5k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5438:15): [True: 0, False: 68.5k]
  ------------------
 5439|      0|            break;
 5440|      0|          }
 5441|   165k|          while (left + 2 < right) {
  ------------------
  |  Branch (5441:18): [True: 97.2k, False: 68.5k]
  ------------------
 5442|  97.2k|            int middle = left + (((right - left) >> 1) & ~1);
 5443|  97.2k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5443:17): [True: 5.18k, False: 92.0k]
  ------------------
 5444|  5.18k|              left = middle;
 5445|  5.18k|            }
 5446|  97.2k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5446:17): [True: 92.1k, False: 5.08k]
  ------------------
 5447|  92.1k|              right = middle;
 5448|  92.1k|            }
 5449|  97.2k|          }
 5450|  68.5k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5450:15): [True: 68.5k, False: 0]
  ------------------
 5451|  68.5k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5451:15): [True: 108, False: 68.4k]
  ------------------
 5452|    108|            return true;
 5453|    108|          }
 5454|  68.5k|        }
 5455|   304k|        if (ccc == 0) {
  ------------------
  |  Branch (5455:13): [True: 297k, False: 6.43k]
  ------------------
 5456|   297k|          break;
 5457|   297k|        }
 5458|  6.43k|        previous_ccc = ccc;
 5459|  6.43k|      }
 5460|   310k|      input_count = j + 1;
 5461|   310k|      continue;
 5462|   311k|    }
 5463|      0|    ++input_count;
 5464|      0|  }
 5465|  13.7k|  return false;
 5466|  13.8k|}
_ZN3ada4idna21composition_block_rowEh:
 5003|   313k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5004|   313k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5004:7): [True: 0, False: 313k]
  ------------------
 5005|      0|    bi = 0;
 5006|      0|  }
 5007|   313k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5008|   313k|}
idna.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5632|   193k|static constexpr int32_t char_to_digit_value(char value) {
 5633|   193k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5633:7): [True: 158k, False: 35.3k]
  |  Branch (5633:23): [True: 158k, False: 190]
  ------------------
 5634|  35.4k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5634:7): [True: 30.9k, False: 4.54k]
  |  Branch (5634:23): [True: 29.7k, False: 1.16k]
  ------------------
 5635|  5.70k|  return -1;
 5636|  35.4k|}
idna.cc:_ZN3ada4idnaL5adaptEiib:
 5642|   231k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5643|   231k|  if (firsttime) {
  ------------------
  |  Branch (5643:7): [True: 18.6k, False: 212k]
  ------------------
 5644|  18.6k|    d = d / damp;
 5645|   212k|  } else {
 5646|   212k|    d = d / 2;
 5647|   212k|  }
 5648|   231k|  d += d / n;
 5649|   231k|  int32_t k = 0;
 5650|   247k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5650:10): [True: 16.8k, False: 231k]
  ------------------
 5651|  16.8k|    d /= base - tmin;
 5652|  16.8k|    k += base;
 5653|  16.8k|  }
 5654|   231k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5655|   231k|}
idna.cc:_ZN3ada4idnaL13digit_to_charEi:
 5638|   124k|static constexpr char digit_to_char(int32_t digit) {
 5639|   124k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5639:10): [True: 109k, False: 15.0k]
  ------------------
 5640|   124k|}
idna.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5977|   127k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
idna.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6062|  2.64k|      auto is_l_or_d = [](uint32_t code) {
 6063|  2.64k|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6063:16): [True: 49, False: 2.59k]
  ------------------
 6064|  2.59k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6064:16): [True: 1.22k, False: 1.37k]
  ------------------
 6065|  2.64k|      };
idna.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6066|  3.29k|      auto is_r_or_d = [](uint32_t code) {
 6067|  3.29k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6067:16): [True: 407, False: 2.88k]
  ------------------
 6068|  2.88k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6068:16): [True: 665, False: 2.22k]
  ------------------
 6069|  3.29k|      };
idna.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5924|  12.0k|    const std::u32string_view label) noexcept {
 5925|  16.2k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5925:52): [True: 16.2k, False: 0]
  ------------------
 5926|  16.2k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5926:9): [True: 12.0k, False: 4.19k]
  ------------------
 5927|       |
 5928|      0|  return std::u32string_view::npos;
 5929|  12.0k|}
idna.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5933|  12.0k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5934|  12.0k|  const size_t mask =
 5935|  12.0k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5936|       |
 5937|  12.0k|  size_t directions = 0;
 5938|  81.0k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5938:22): [True: 68.9k, False: 12.0k]
  ------------------
 5939|  68.9k|    directions |= 1u << find_direction(label[i]);
 5940|  68.9k|  }
 5941|  12.0k|  return (directions & mask) != 0;
 5942|  12.0k|}
idna.cc:_ZN3ada4idnaL14find_directionEj:
 5905|   100k|inline static direction find_direction(uint32_t code_point) noexcept {
 5906|       |  // Binary search on dir_final (sorted upper bounds).
 5907|   100k|  size_t lo = 0, hi = dir_table_count;
 5908|  1.15M|  while (lo < hi) {
  ------------------
  |  Branch (5908:10): [True: 1.05M, False: 100k]
  ------------------
 5909|  1.05M|    size_t mid = lo + (hi - lo) / 2;
 5910|  1.05M|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5910:9): [True: 423k, False: 629k]
  ------------------
 5911|   423k|      lo = mid + 1;
 5912|   629k|    } else {
 5913|   629k|      hi = mid;
 5914|   629k|    }
 5915|  1.05M|  }
 5916|   100k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5916:7): [True: 1.05k, False: 99.5k]
  ------------------
 5917|  1.05k|    return direction::NONE;
 5918|  1.05k|  }
 5919|  99.5k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5919:10): [True: 96.7k, False: 2.77k]
  ------------------
 5920|  99.5k|                                     : direction::NONE;
 5921|   100k|}
_ZN3ada4idna30is_forbidden_domain_code_pointEc:
 6314|  39.7k|inline bool is_forbidden_domain_code_point(const char c) noexcept {
 6315|  39.7k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 6316|  39.7k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6290|  27.1k|bool constexpr is_ascii(std::string_view view) {
 6291|   533k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6291:18): [True: 533k, False: 21.3k]
  ------------------
 6292|   533k|    if (c >= 0x80) {
  ------------------
  |  Branch (6292:9): [True: 5.72k, False: 527k]
  ------------------
 6293|  5.72k|      return false;
 6294|  5.72k|    }
 6295|   533k|  }
 6296|  21.3k|  return true;
 6297|  27.1k|}
idna.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6327|  8.29k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6328|  8.29k|  out.assign(ut8_string);
 6329|  8.29k|  ascii_map(out.data(), out.size());
 6330|  8.29k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6281|  20.2k|bool constexpr is_ascii(std::u32string_view view) {
 6282|  49.0k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6282:19): [True: 49.0k, False: 1.54k]
  ------------------
 6283|  49.0k|    if (c >= 0x80) {
  ------------------
  |  Branch (6283:9): [True: 18.6k, False: 30.3k]
  ------------------
 6284|  18.6k|      return false;
 6285|  18.6k|    }
 6286|  49.0k|  }
 6287|  1.54k|  return true;
 6288|  20.2k|}
idna.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6343|  7.21k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6344|  7.21k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6344:10): [True: 2.81k, False: 4.39k]
  |  Branch (6344:31): [True: 1.28k, False: 1.53k]
  |  Branch (6344:51): [True: 950, False: 332]
  ------------------
 6345|    950|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6345:10): [True: 893, False: 57]
  |  Branch (6345:30): [True: 801, False: 92]
  ------------------
 6346|  7.21k|}
idna.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6333|  1.40k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6334|  1.40k|  const size_t old = out.size();
 6335|  1.40k|  out.resize(old + label.size());
 6336|  1.40k|  char* dest = out.data() + old;
 6337|  14.0k|  for (char32_t c : label) {
  ------------------
  |  Branch (6337:19): [True: 14.0k, False: 1.40k]
  ------------------
 6338|  14.0k|    *dest++ = static_cast<char>(c);
 6339|  14.0k|  }
 6340|  1.40k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  112|  4.47k|    std::string_view input) noexcept {
  113|  4.47k|  if (input.empty()) return false;
  ------------------
  |  Branch (113:7): [True: 3.84k, False: 635]
  ------------------
  114|    635|  if (input.back() == '.') {
  ------------------
  |  Branch (114:7): [True: 94, False: 541]
  ------------------
  115|     94|    if (input.size() > 254) return false;
  ------------------
  |  Branch (115:9): [True: 11, False: 83]
  ------------------
  116|    541|  } else if (input.size() > 253)
  ------------------
  |  Branch (116:14): [True: 111, False: 430]
  ------------------
  117|    111|    return false;
  118|       |
  119|    513|  size_t start = 0;
  120|  1.71k|  while (start < input.size()) {
  ------------------
  |  Branch (120:10): [True: 1.28k, False: 429]
  ------------------
  121|  1.28k|    auto dot_location = input.find('.', start);
  122|       |    // If not found, it's likely the end of the domain
  123|  1.28k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (123:9): [True: 414, False: 874]
  ------------------
  124|       |
  125|  1.28k|    auto label_size = dot_location - start;
  126|  1.28k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (126:9): [True: 47, False: 1.24k]
  |  Branch (126:28): [True: 37, False: 1.20k]
  ------------------
  127|       |
  128|  1.20k|    start = dot_location + 1;
  129|  1.20k|  }
  130|       |
  131|    429|  return true;
  132|    513|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5678|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}

LLVMFuzzerTestOneInput:
    9|  4.25k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   10|  4.25k|  FuzzedDataProvider fdp(data, size);
   11|  4.25k|  std::string source = fdp.ConsumeRandomLengthString(256);
   12|  4.25k|  std::string source2 = fdp.ConsumeRandomLengthString(64);
   13|       |
   14|       |  /**
   15|       |   * High-level IDNA API
   16|       |   */
   17|  4.25k|  std::string ascii_result = ada::idna::to_ascii(source);
   18|  4.25k|  std::string unicode_result = ada::idna::to_unicode(source);
   19|       |
   20|       |  // Avoid dead-code elimination
   21|  4.25k|  volatile size_t length = 0;
   22|  4.25k|  length += ascii_result.size();
   23|  4.25k|  length += unicode_result.size();
   24|       |
   25|       |  /**
   26|       |   * Round-trip property: to_unicode(to_ascii(x)) should not crash.
   27|       |   * We don't assert equality because IDNA may normalize/reject inputs.
   28|       |   */
   29|  4.25k|  if (!ascii_result.empty()) {
  ------------------
  |  Branch (29:7): [True: 2.57k, False: 1.67k]
  ------------------
   30|  2.57k|    std::string roundtrip = ada::idna::to_unicode(ascii_result);
   31|  2.57k|    length += roundtrip.size();
   32|  2.57k|  }
   33|       |
   34|       |  /**
   35|       |   * Punycode functions
   36|       |   */
   37|  4.25k|  {
   38|  4.25k|    std::u32string utf32_out;
   39|       |    // punycode_to_utf32: source can be any string (it's a punycode label)
   40|  4.25k|    bool punycode_ok = ada::idna::punycode_to_utf32(source, utf32_out);
   41|  4.25k|    length += utf32_out.size();
   42|       |
   43|       |    // verify_punycode: checks if source is valid punycode
   44|  4.25k|    volatile bool is_valid_punycode = ada::idna::verify_punycode(source);
   45|  4.25k|    (void)is_valid_punycode;
   46|       |
   47|       |    // utf32_to_punycode: round-trip if punycode_to_utf32 succeeded
   48|  4.25k|    if (punycode_ok && !utf32_out.empty()) {
  ------------------
  |  Branch (48:9): [True: 1.25k, False: 2.99k]
  |  Branch (48:24): [True: 702, False: 554]
  ------------------
   49|    702|      std::string punycode_back;
   50|    702|      volatile bool encode_ok =
   51|    702|          ada::idna::utf32_to_punycode(utf32_out, punycode_back);
   52|    702|      length += punycode_back.size();
   53|    702|      (void)encode_ok;
   54|    702|    }
   55|  4.25k|  }
   56|       |
   57|       |  /**
   58|       |   * Unicode transcoding
   59|       |   */
   60|  4.25k|  {
   61|       |    // UTF-8 to UTF-32 conversion
   62|  4.25k|    size_t utf32_len =
   63|  4.25k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
   64|  4.25k|    if (utf32_len > 0 && utf32_len < 1024) {
  ------------------
  |  Branch (64:9): [True: 3.67k, False: 572]
  |  Branch (64:26): [True: 3.67k, False: 0]
  ------------------
   65|  3.67k|      std::vector<char32_t> utf32_buf(utf32_len + 1, 0);
   66|  3.67k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
   67|  3.67k|                                               utf32_buf.data());
   68|  3.67k|      length += actual;
   69|       |
   70|       |      // UTF-32 to UTF-8 round-trip
   71|  3.67k|      if (actual > 0) {
  ------------------
  |  Branch (71:11): [True: 3.47k, False: 202]
  ------------------
   72|  3.47k|        size_t utf8_len =
   73|  3.47k|            ada::idna::utf8_length_from_utf32(utf32_buf.data(), actual);
   74|  3.47k|        if (utf8_len > 0 && utf8_len < 4096) {
  ------------------
  |  Branch (74:13): [True: 3.47k, False: 0]
  |  Branch (74:29): [True: 3.47k, False: 0]
  ------------------
   75|  3.47k|          std::string utf8_back(utf8_len, '\0');
   76|  3.47k|          size_t written = ada::idna::utf32_to_utf8(utf32_buf.data(), actual,
   77|  3.47k|                                                    utf8_back.data());
   78|  3.47k|          length += written;
   79|  3.47k|        }
   80|  3.47k|      }
   81|  3.67k|    }
   82|  4.25k|  }
   83|       |
   84|       |  /**
   85|       |   * IDNA label validation
   86|       |   */
   87|  4.25k|  {
   88|       |    // is_label_valid requires a UTF-32 string
   89|  4.25k|    std::u32string utf32_label;
   90|  4.25k|    bool ok = ada::idna::punycode_to_utf32(source2, utf32_label);
   91|  4.25k|    if (ok && !utf32_label.empty()) {
  ------------------
  |  Branch (91:9): [True: 4.08k, False: 167]
  |  Branch (91:15): [True: 189, False: 3.89k]
  ------------------
   92|    189|      volatile bool label_valid = ada::idna::is_label_valid(utf32_label);
   93|    189|      (void)label_valid;
   94|    189|    }
   95|       |
   96|       |    // Also test is_label_valid with direct ASCII-to-UTF32 conversion
   97|  4.25k|    std::u32string ascii_label(source2.begin(), source2.end());
   98|  4.25k|    if (!ascii_label.empty()) {
  ------------------
  |  Branch (98:9): [True: 357, False: 3.89k]
  ------------------
   99|    357|      volatile bool ascii_label_valid = ada::idna::is_label_valid(ascii_label);
  100|    357|      (void)ascii_label_valid;
  101|    357|    }
  102|  4.25k|  }
  103|       |
  104|       |  /**
  105|       |   * IDNA mapping
  106|       |   */
  107|  4.25k|  {
  108|       |    // ASCII mapping: just lowercases ASCII characters
  109|  4.25k|    std::string ascii_copy = source;
  110|  4.25k|    ada::idna::ascii_map(ascii_copy.data(), ascii_copy.size());
  111|  4.25k|    length += ascii_copy.size();
  112|       |
  113|       |    // Unicode mapping: maps UTF-32 characters according to IDNA
  114|  4.25k|    size_t utf32_len =
  115|  4.25k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
  116|  4.25k|    if (utf32_len > 0 && utf32_len < 256) {
  ------------------
  |  Branch (116:9): [True: 3.67k, False: 572]
  |  Branch (116:26): [True: 3.65k, False: 24]
  ------------------
  117|  3.65k|      std::u32string utf32_input(utf32_len, 0);
  118|  3.65k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
  119|  3.65k|                                               utf32_input.data());
  120|  3.65k|      if (actual > 0) {
  ------------------
  |  Branch (120:11): [True: 3.46k, False: 187]
  ------------------
  121|  3.46k|        utf32_input.resize(actual);
  122|  3.46k|        std::u32string mapped = ada::idna::map(utf32_input);
  123|  3.46k|        length += mapped.size();
  124|  3.46k|      }
  125|  3.65k|    }
  126|  4.25k|  }
  127|       |
  128|       |  /**
  129|       |   * Domain code point validation
  130|       |   */
  131|  4.25k|  {
  132|  4.25k|    volatile bool has_forbidden =
  133|  4.25k|        ada::idna::contains_forbidden_domain_code_point(source);
  134|  4.25k|    (void)has_forbidden;
  135|       |
  136|       |    // is_ascii checks
  137|  4.25k|    volatile bool is_ascii_str =
  138|  4.25k|        ada::idna::is_ascii(std::string_view(source.data(), source.size()));
  139|  4.25k|    (void)is_ascii_str;
  140|  4.25k|  }
  141|       |
  142|       |  /**
  143|       |   * Normalization
  144|       |   */
  145|  4.25k|  {
  146|  4.25k|    size_t utf32_len =
  147|  4.25k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
  148|  4.25k|    if (utf32_len > 0 && utf32_len < 256) {
  ------------------
  |  Branch (148:9): [True: 3.67k, False: 572]
  |  Branch (148:26): [True: 3.65k, False: 24]
  ------------------
  149|  3.65k|      std::u32string utf32_input(utf32_len, 0);
  150|  3.65k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
  151|  3.65k|                                               utf32_input.data());
  152|  3.65k|      if (actual > 0) {
  ------------------
  |  Branch (152:11): [True: 3.46k, False: 187]
  ------------------
  153|  3.46k|        utf32_input.resize(actual);
  154|  3.46k|        ada::idna::normalize(utf32_input);
  155|  3.46k|        length += utf32_input.size();
  156|  3.46k|      }
  157|  3.65k|    }
  158|  4.25k|  }
  159|       |
  160|       |  /**
  161|       |   * IDNA stability property.
  162|       |   *
  163|       |   * Applying to_ascii twice must be idempotent: if to_ascii(x) produces a
  164|       |   * non-empty result, then to_ascii(to_ascii(x)) must equal to_ascii(x).
  165|       |   * A correctly normalised ACE label is already its own fixed point.
  166|       |   *
  167|       |   * We allow the second call to return an empty string only if the first
  168|       |   * result was itself not a valid IDNA domain (some implementations return
  169|       |   * empty on failure). If the first result is non-empty and looks like a
  170|       |   * valid domain the second application must match.
  171|       |   */
  172|  4.25k|  {
  173|  4.25k|    if (!ascii_result.empty()) {
  ------------------
  |  Branch (173:9): [True: 2.57k, False: 1.67k]
  ------------------
  174|  2.57k|      std::string ascii_result2 = ada::idna::to_ascii(ascii_result);
  175|  2.57k|      if (!ascii_result2.empty() && ascii_result2 != ascii_result) {
  ------------------
  |  Branch (175:11): [True: 2.57k, False: 0]
  |  Branch (175:37): [True: 0, False: 2.57k]
  ------------------
  176|      0|        printf(
  177|      0|            "IDNA to_ascii not idempotent!\n"
  178|      0|            "  input:   %s\n  first:   %s\n  second:  %s\n",
  179|      0|            source.c_str(), ascii_result.c_str(), ascii_result2.c_str());
  180|      0|        abort();
  181|      0|      }
  182|  2.57k|    }
  183|  4.25k|  }
  184|       |
  185|       |  /**
  186|       |   * to_unicode stability.
  187|       |   *
  188|       |   * Applying to_unicode twice should also be idempotent: once a domain is in
  189|       |   * its Unicode presentation form, converting again should give the same
  190|       |   * result.
  191|       |   */
  192|  4.25k|  {
  193|  4.25k|    if (!unicode_result.empty()) {
  ------------------
  |  Branch (193:9): [True: 3.70k, False: 551]
  ------------------
  194|  3.70k|      std::string unicode_result2 = ada::idna::to_unicode(unicode_result);
  195|  3.70k|      if (!unicode_result2.empty() && unicode_result2 != unicode_result) {
  ------------------
  |  Branch (195:11): [True: 3.70k, False: 0]
  |  Branch (195:39): [True: 0, False: 3.70k]
  ------------------
  196|      0|        printf(
  197|      0|            "IDNA to_unicode not idempotent!\n"
  198|      0|            "  input:   %s\n  first:   %s\n  second:  %s\n",
  199|      0|            source.c_str(), unicode_result.c_str(), unicode_result2.c_str());
  200|      0|        abort();
  201|      0|      }
  202|  3.70k|    }
  203|  4.25k|  }
  204|       |
  205|       |  /**
  206|       |   * Long domain names near the DNS length limit (253 characters).
  207|       |   *
  208|       |   * The IDNA and DNS-length checking code has special handling for domains
  209|       |   * close to or exceeding 253/255 characters and 63-character labels. Feed
  210|       |   * the fuzzer inputs of a controlled length to maximise coverage of those
  211|       |   * boundary checks.
  212|       |   */
  213|  4.25k|  {
  214|  4.25k|    std::string long_domain = fdp.ConsumeRandomLengthString(270);
  215|  4.25k|    std::string long_ascii = ada::idna::to_ascii(long_domain);
  216|  4.25k|    length += long_ascii.size();
  217|       |
  218|       |    // verify_dns_length on the long input (already called for `source` above,
  219|       |    // but we want to exercise the boundary cases separately).
  220|  4.25k|    volatile bool long_dns_ok = ada::checkers::verify_dns_length(long_domain);
  221|  4.25k|    (void)long_dns_ok;
  222|       |
  223|  4.25k|    if (!long_ascii.empty()) {
  ------------------
  |  Branch (223:9): [True: 224, False: 4.02k]
  ------------------
  224|    224|      volatile bool long_ascii_dns_ok =
  225|    224|          ada::checkers::verify_dns_length(long_ascii);
  226|    224|      (void)long_ascii_dns_ok;
  227|    224|    }
  228|  4.25k|  }
  229|       |
  230|       |  /**
  231|       |   * Punycode round-trip on arbitrary binary blobs.
  232|       |   *
  233|       |   * Feed random bytes directly into punycode_to_utf32, then if that succeeds
  234|       |   * encode the result back with utf32_to_punycode and verify the round-trip.
  235|       |   */
  236|  4.25k|  {
  237|  4.25k|    std::string blob = fdp.ConsumeRandomLengthString(128);
  238|  4.25k|    std::u32string decoded;
  239|  4.25k|    bool ok = ada::idna::punycode_to_utf32(blob, decoded);
  240|  4.25k|    if (ok && !decoded.empty()) {
  ------------------
  |  Branch (240:9): [True: 4.07k, False: 173]
  |  Branch (240:15): [True: 41, False: 4.03k]
  ------------------
  241|     41|      std::string reencoded;
  242|     41|      bool enc_ok = ada::idna::utf32_to_punycode(decoded, reencoded);
  243|     41|      (void)enc_ok;
  244|     41|      length += reencoded.size();
  245|       |
  246|       |      // Re-decode the re-encoded form; it must match the first decoded form.
  247|     41|      if (enc_ok && !reencoded.empty()) {
  ------------------
  |  Branch (247:11): [True: 38, False: 3]
  |  Branch (247:21): [True: 38, False: 0]
  ------------------
  248|     38|        std::u32string redecoded;
  249|     38|        bool redec_ok = ada::idna::punycode_to_utf32(reencoded, redecoded);
  250|     38|        if (redec_ok && redecoded != decoded) {
  ------------------
  |  Branch (250:13): [True: 38, False: 0]
  |  Branch (250:25): [True: 0, False: 38]
  ------------------
  251|      0|          printf("Punycode round-trip mismatch!\n");
  252|      0|          abort();
  253|      0|        }
  254|     38|      }
  255|     41|    }
  256|  4.25k|  }
  257|       |
  258|  4.25k|  return 0;
  259|  4.25k|}

