_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  162|  19.6k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  163|  19.6k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  164|  19.6k|  size_t pos = 0;
  165|  19.6k|  const char32_t* start{utf32_output};
  166|   165k|  while (pos < len) {
  ------------------
  |  Branch (166:10): [True: 149k, False: 15.8k]
  ------------------
  167|       |    // try to convert the next block of 16 ASCII bytes
  168|   149k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (168:9): [True: 69.7k, False: 79.3k]
  ------------------
  169|       |                            // bytes, check that they are ascii
  170|  69.7k|      uint64_t v1;
  171|  69.7k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  172|  69.7k|      uint64_t v2;
  173|  69.7k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  174|  69.7k|      uint64_t v{v1 | v2};
  175|  69.7k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (175:11): [True: 11.0k, False: 58.6k]
  ------------------
  176|  11.0k|        size_t final_pos = pos + 16;
  177|   188k|        while (pos < final_pos) {
  ------------------
  |  Branch (177:16): [True: 177k, False: 11.0k]
  ------------------
  178|   177k|          *utf32_output++ = char32_t(buf[pos]);
  179|   177k|          pos++;
  180|   177k|        }
  181|  11.0k|        continue;
  182|  11.0k|      }
  183|  69.7k|    }
  184|   138k|    uint8_t leading_byte = data[pos];  // leading byte
  185|   138k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (185:9): [True: 73.6k, False: 64.4k]
  ------------------
  186|       |      // converting one ASCII byte !!!
  187|  73.6k|      *utf32_output++ = char32_t(leading_byte);
  188|  73.6k|      pos++;
  189|  73.6k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (189:16): [True: 18.9k, False: 45.4k]
  ------------------
  190|       |      // We have a two-byte UTF-8
  191|  18.9k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (191:11): [True: 364, False: 18.5k]
  ------------------
  192|    364|        return 0;
  193|    364|      }  // minimal bound checking
  194|  18.5k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (194:11): [True: 455, False: 18.1k]
  ------------------
  195|    455|        return 0;
  196|    455|      }
  197|       |      // range check
  198|  18.1k|      uint32_t code_point =
  199|  18.1k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  200|  18.1k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (200:11): [True: 87, False: 18.0k]
  |  Branch (200:32): [True: 0, False: 18.0k]
  ------------------
  201|     87|        return 0;
  202|     87|      }
  203|  18.0k|      *utf32_output++ = char32_t(code_point);
  204|  18.0k|      pos += 2;
  205|  45.4k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (205:16): [True: 38.1k, False: 7.31k]
  ------------------
  206|       |      // We have a three-byte UTF-8
  207|  38.1k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (207:11): [True: 491, False: 37.6k]
  ------------------
  208|    491|        return 0;
  209|    491|      }  // minimal bound checking
  210|       |
  211|  37.6k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (211:11): [True: 367, False: 37.2k]
  ------------------
  212|    367|        return 0;
  213|    367|      }
  214|  37.2k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (214:11): [True: 83, False: 37.2k]
  ------------------
  215|     83|        return 0;
  216|     83|      }
  217|       |      // range check
  218|  37.2k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  219|  37.2k|                            (data[pos + 1] & 0b00111111) << 6 |
  220|  37.2k|                            (data[pos + 2] & 0b00111111);
  221|  37.2k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (221:11): [True: 220, False: 36.9k]
  |  Branch (221:33): [True: 0, False: 36.9k]
  ------------------
  222|  36.9k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (222:12): [True: 8.38k, False: 28.6k]
  |  Branch (222:35): [True: 66, False: 8.31k]
  ------------------
  223|    286|        return 0;
  224|    286|      }
  225|  36.9k|      *utf32_output++ = char32_t(code_point);
  226|  36.9k|      pos += 3;
  227|  36.9k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (227:16): [True: 6.56k, False: 754]
  ------------------
  228|       |      // we have a 4-byte UTF-8 word.
  229|  6.56k|      if (pos + 3 >= len) {
  ------------------
  |  Branch (229:11): [True: 397, False: 6.16k]
  ------------------
  230|    397|        return 0;
  231|    397|      }  // minimal bound checking
  232|  6.16k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (232:11): [True: 128, False: 6.03k]
  ------------------
  233|    128|        return 0;
  234|    128|      }
  235|  6.03k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (235:11): [True: 92, False: 5.94k]
  ------------------
  236|     92|        return 0;
  237|     92|      }
  238|  5.94k|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (238:11): [True: 82, False: 5.86k]
  ------------------
  239|     82|        return 0;
  240|     82|      }
  241|       |
  242|       |      // range check
  243|  5.86k|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  244|  5.86k|                            (data[pos + 1] & 0b00111111) << 12 |
  245|  5.86k|                            (data[pos + 2] & 0b00111111) << 6 |
  246|  5.86k|                            (data[pos + 3] & 0b00111111);
  247|  5.86k|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (247:11): [True: 92, False: 5.76k]
  |  Branch (247:35): [True: 70, False: 5.69k]
  ------------------
  248|    162|        return 0;
  249|    162|      }
  250|  5.69k|      *utf32_output++ = char32_t(code_point);
  251|  5.69k|      pos += 4;
  252|  5.69k|    } else {
  253|    754|      return 0;
  254|    754|    }
  255|   138k|  }
  256|  15.8k|  return utf32_output - start;
  257|  19.6k|}
_ZN3ada4idna22utf8_length_from_utf32EPKDim:
  259|  10.0k|size_t utf8_length_from_utf32(const char32_t* buf, size_t len) {
  260|       |  // We are not BOM aware.
  261|  10.0k|  const uint32_t* p = reinterpret_cast<const uint32_t*>(buf);
  262|  10.0k|  size_t counter{0};
  263|   136k|  for (size_t i = 0; i != len; ++i) {
  ------------------
  |  Branch (263:22): [True: 126k, False: 10.0k]
  ------------------
  264|   126k|    ++counter;                                      // ASCII
  265|   126k|    counter += static_cast<size_t>(p[i] > 0x7F);    // two-byte
  266|   126k|    counter += static_cast<size_t>(p[i] > 0x7FF);   // three-byte
  267|   126k|    counter += static_cast<size_t>(p[i] > 0xFFFF);  // four-bytes
  268|   126k|  }
  269|  10.0k|  return counter;
  270|  10.0k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  272|  16.6k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  273|  16.6k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  274|  16.6k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|  16.6k|    return c > -65;
  278|  16.6k|  });
  279|  16.6k|}
_ZN3ada4idna13utf32_to_utf8EPKDimPc:
  281|  10.0k|size_t utf32_to_utf8(const char32_t* buf, size_t len, char* utf8_output) {
  282|  10.0k|  const uint32_t* data = reinterpret_cast<const uint32_t*>(buf);
  283|  10.0k|  size_t pos = 0;
  284|  10.0k|  const char* start{utf8_output};
  285|   100k|  while (pos < len) {
  ------------------
  |  Branch (285:10): [True: 90.6k, False: 10.0k]
  ------------------
  286|       |    // try to convert the next block of 2 ASCII characters
  287|  90.6k|    if (pos + 2 <= len) {  // if it is safe to read 8 more
  ------------------
  |  Branch (287:9): [True: 81.6k, False: 9.00k]
  ------------------
  288|       |                           // bytes, check that they are ascii
  289|  81.6k|      uint64_t v;
  290|  81.6k|      std::memcpy(&v, data + pos, sizeof(uint64_t));
  291|  81.6k|      if ((v & 0xFFFFFF80FFFFFF80) == 0) {
  ------------------
  |  Branch (291:11): [True: 36.1k, False: 45.5k]
  ------------------
  292|  36.1k|        *utf8_output++ = char(buf[pos]);
  293|  36.1k|        *utf8_output++ = char(buf[pos + 1]);
  294|  36.1k|        pos += 2;
  295|  36.1k|        continue;
  296|  36.1k|      }
  297|  81.6k|    }
  298|  54.5k|    uint32_t word = data[pos];
  299|  54.5k|    if ((word & 0xFFFFFF80) == 0) {
  ------------------
  |  Branch (299:9): [True: 6.72k, False: 47.7k]
  ------------------
  300|       |      // will generate one UTF-8 bytes
  301|  6.72k|      *utf8_output++ = char(word);
  302|  6.72k|      pos++;
  303|  47.7k|    } else if ((word & 0xFFFFF800) == 0) {
  ------------------
  |  Branch (303:16): [True: 9.92k, False: 37.8k]
  ------------------
  304|       |      // will generate two UTF-8 bytes
  305|       |      // we have 0b110XXXXX 0b10XXXXXX
  306|  9.92k|      *utf8_output++ = char((word >> 6) | 0b11000000);
  307|  9.92k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  308|  9.92k|      pos++;
  309|  37.8k|    } else if ((word & 0xFFFF0000) == 0) {
  ------------------
  |  Branch (309:16): [True: 30.7k, False: 7.10k]
  ------------------
  310|       |      // will generate three UTF-8 bytes
  311|       |      // we have 0b1110XXXX 0b10XXXXXX 0b10XXXXXX
  312|  30.7k|      if (word >= 0xD800 && word <= 0xDFFF) {
  ------------------
  |  Branch (312:11): [True: 1.63k, False: 29.1k]
  |  Branch (312:29): [True: 0, False: 1.63k]
  ------------------
  313|      0|        return 0;
  314|      0|      }
  315|  30.7k|      *utf8_output++ = char((word >> 12) | 0b11100000);
  316|  30.7k|      *utf8_output++ = char(((word >> 6) & 0b111111) | 0b10000000);
  317|  30.7k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  318|  30.7k|      pos++;
  319|  30.7k|    } else {
  320|       |      // will generate four UTF-8 bytes
  321|       |      // we have 0b11110XXX 0b10XXXXXX 0b10XXXXXX
  322|       |      // 0b10XXXXXX
  323|  7.10k|      if (word > 0x10FFFF) {
  ------------------
  |  Branch (323:11): [True: 0, False: 7.10k]
  ------------------
  324|      0|        return 0;
  325|      0|      }
  326|  7.10k|      *utf8_output++ = char((word >> 18) | 0b11110000);
  327|  7.10k|      *utf8_output++ = char(((word >> 12) & 0b111111) | 0b10000000);
  328|  7.10k|      *utf8_output++ = char(((word >> 6) & 0b111111) | 0b10000000);
  329|  7.10k|      *utf8_output++ = char((word & 0b111111) | 0b10000000);
  330|  7.10k|      pos++;
  331|  7.10k|    }
  332|  54.5k|  }
  333|  10.0k|  return utf8_output - start;
  334|  10.0k|}
_ZN3ada4idna9ascii_mapEPcm:
 5259|  13.4k|void ascii_map(char* input, size_t length) {
 5260|  13.4k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|  13.4k|    return 0x101010101010101ull * v;
 5262|  13.4k|  };
 5263|  13.4k|  uint64_t broadcast_80 = broadcast(0x80);
 5264|  13.4k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5265|  13.4k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5266|  13.4k|  size_t i = 0;
 5267|       |
 5268|  48.2k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5268:10): [True: 34.7k, False: 13.4k]
  ------------------
 5269|  34.7k|    uint64_t word{};
 5270|  34.7k|    std::memcpy(&word, input + i, sizeof(word));
 5271|  34.7k|    word ^=
 5272|  34.7k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5273|  34.7k|    std::memcpy(input + i, &word, sizeof(word));
 5274|  34.7k|  }
 5275|  13.4k|  if (i < length) {
  ------------------
  |  Branch (5275:7): [True: 7.23k, False: 6.25k]
  ------------------
 5276|  7.23k|    uint64_t word{};
 5277|  7.23k|    std::memcpy(&word, input + i, length - i);
 5278|  7.23k|    word ^=
 5279|  7.23k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5280|  7.23k|    std::memcpy(input + i, &word, length - i);
 5281|  7.23k|  }
 5282|  13.4k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5286|  21.6k|bool map(std::u32string_view input, std::u32string& out) {
 5287|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5288|  21.6k|  out.clear();
 5289|  21.6k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5289:7): [True: 0, False: 21.6k]
  ------------------
 5290|      0|    return false;
 5291|      0|  }
 5292|       |
 5293|       |  // Pass 1: validate and compute exact output length.
 5294|  21.6k|  size_t out_size = 0;
 5295|   204k|  for (char32_t x : input) {
  ------------------
  |  Branch (5295:19): [True: 204k, False: 19.5k]
  ------------------
 5296|   204k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5297|   204k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5297:9): [True: 2.08k, False: 202k]
  ------------------
 5298|  2.08k|      return false;
 5299|  2.08k|    }
 5300|   202k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5300:9): [True: 167k, False: 34.9k]
  ------------------
 5301|   167k|      ++out_size;
 5302|   167k|      continue;
 5303|   167k|    }
 5304|  34.9k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5304:9): [True: 0, False: 34.9k]
  ------------------
 5305|      0|      return false;
 5306|      0|    }
 5307|  34.9k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5308|  34.9k|  }
 5309|       |
 5310|       |  // Pass 2: write into a single allocation.
 5311|  19.5k|  out.resize(out_size);
 5312|  19.5k|  size_t w = 0;
 5313|   201k|  for (char32_t x : input) {
  ------------------
  |  Branch (5313:19): [True: 201k, False: 19.5k]
  ------------------
 5314|   201k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5315|   201k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5315:9): [True: 166k, False: 34.5k]
  ------------------
 5316|   166k|      out[w++] = x;
 5317|   166k|      continue;
 5318|   166k|    }
 5319|       |    // IGNORED or mapped (status already validated in pass 1).
 5320|  34.5k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5321|   293k|    while (*ptr != 0) {
  ------------------
  |  Branch (5321:12): [True: 259k, False: 34.5k]
  ------------------
 5322|   259k|      out[w++] = utf8_next(ptr);
 5323|   259k|    }
 5324|  34.5k|  }
 5325|  19.5k|  return true;
 5326|  21.6k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5328|  3.68k|std::u32string map(std::u32string_view input) {
 5329|  3.68k|  std::u32string answer;
 5330|  3.68k|  if (!map(input, answer)) {
  ------------------
  |  Branch (5330:7): [True: 319, False: 3.36k]
  ------------------
 5331|    319|    return {};
 5332|    319|  }
 5333|  3.36k|  return answer;
 5334|  3.68k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5420|  3.82k|    const std::u32string_view input) noexcept {
 5421|  3.82k|  bool decomposition_needed{false};
 5422|  3.82k|  size_t additional_elements{0};
 5423|  30.4k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5423:35): [True: 30.4k, False: 3.82k]
  ------------------
 5424|  30.4k|    size_t decomposition_length{0};
 5425|       |
 5426|  30.4k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5426:9): [True: 5.12k, False: 25.3k]
  ------------------
 5427|  5.12k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5427:9): [True: 2.01k, False: 3.10k]
  ------------------
 5428|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5429|  2.01k|      decomposition_length = 2;
 5430|  2.01k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5430:11): [True: 988, False: 1.02k]
  ------------------
 5431|    988|        decomposition_length = 3;
 5432|    988|      }
 5433|  28.4k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5433:16): [True: 28.4k, False: 0]
  ------------------
 5434|  28.4k|      const uint8_t di = decomposition_index[current_character >> 8];
 5435|  28.4k|      const uint16_t* const decomposition =
 5436|  28.4k|          decomposition_block_row(di) + (current_character % 256);
 5437|  28.4k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5438|  28.4k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5438:11): [True: 5.52k, False: 22.9k]
  |  Branch (5438:41): [True: 919, False: 4.60k]
  ------------------
 5439|    919|        decomposition_length = 0;
 5440|    919|      }
 5441|  28.4k|    }
 5442|  30.4k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5442:9): [True: 6.61k, False: 23.8k]
  ------------------
 5443|  6.61k|      decomposition_needed = true;
 5444|  6.61k|      additional_elements += decomposition_length - 1;
 5445|  6.61k|    }
 5446|  30.4k|  }
 5447|  3.82k|  return {decomposition_needed, additional_elements};
 5448|  3.82k|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5450|  2.20k|void decompose(std::u32string& input, size_t additional_elements) {
 5451|  2.20k|  input.resize(input.size() + additional_elements);
 5452|  2.20k|  for (size_t descending_idx = input.size(),
 5453|  2.20k|              input_count = descending_idx - additional_elements;
 5454|  23.9k|       input_count--;) {
  ------------------
  |  Branch (5454:8): [True: 21.7k, False: 2.20k]
  ------------------
 5455|  21.7k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5455:9): [True: 4.99k, False: 16.7k]
  ------------------
 5456|  4.99k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5456:9): [True: 2.01k, False: 2.97k]
  ------------------
 5457|       |      // Hangul decomposition.
 5458|  2.01k|      char32_t s_index = input[input_count] - hangul_sbase;
 5459|  2.01k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5459:11): [True: 988, False: 1.02k]
  ------------------
 5460|    988|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5461|    988|      }
 5462|  2.01k|      input[--descending_idx] =
 5463|  2.01k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5464|  2.01k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5465|  19.7k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5465:16): [True: 19.7k, False: 0]
  ------------------
 5466|  19.7k|      const uint16_t* decomposition =
 5467|  19.7k|          decomposition_block_row(
 5468|  19.7k|              decomposition_index[input[input_count] >> 8]) +
 5469|  19.7k|          (input[input_count] % 256);
 5470|  19.7k|      uint16_t decomposition_length =
 5471|  19.7k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5472|  19.7k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5472:11): [True: 5.44k, False: 14.2k]
  |  Branch (5472:39): [True: 844, False: 4.60k]
  ------------------
 5473|    844|        decomposition_length = 0;
 5474|    844|      }
 5475|  19.7k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5475:11): [True: 4.60k, False: 15.1k]
  ------------------
 5476|  4.60k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5477|  4.60k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5477:13): [True: 0, False: 4.60k]
  ------------------
 5478|      0|          input[--descending_idx] = input[input_count];
 5479|  4.60k|        } else {
 5480|  14.9k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5480:18): [True: 10.3k, False: 4.60k]
  ------------------
 5481|  10.3k|            input[--descending_idx] =
 5482|  10.3k|                decomposition_data[base + decomposition_length];
 5483|  10.3k|          }
 5484|  4.60k|        }
 5485|  15.1k|      } else {
 5486|  15.1k|        input[--descending_idx] = input[input_count];
 5487|  15.1k|      }
 5488|  19.7k|    } else {
 5489|      0|      input[--descending_idx] = input[input_count];
 5490|      0|    }
 5491|  21.7k|  }
 5492|  2.20k|}
_ZN3ada4idna7get_cccEDi:
 5494|   315k|uint8_t get_ccc(char32_t c) noexcept {
 5495|   315k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5495:7): [True: 18, False: 315k]
  ------------------
 5496|     18|    return 0;
 5497|     18|  }
 5498|   315k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5499|   315k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5501|  3.82k|void sort_marks(std::u32string& input) {
 5502|  39.2k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5502:24): [True: 35.4k, False: 3.82k]
  ------------------
 5503|  35.4k|    uint8_t ccc = get_ccc(input[idx]);
 5504|  35.4k|    if (ccc == 0) {
  ------------------
  |  Branch (5504:9): [True: 26.4k, False: 8.97k]
  ------------------
 5505|  26.4k|      continue;
 5506|  26.4k|    }
 5507|  8.97k|    auto current_character = input[idx];
 5508|  8.97k|    size_t back_idx = idx;
 5509|  14.1k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5509:12): [True: 12.6k, False: 1.53k]
  |  Branch (5509:29): [True: 5.17k, False: 7.44k]
  ------------------
 5510|  5.17k|      input[back_idx] = input[back_idx - 1];
 5511|  5.17k|      back_idx--;
 5512|  5.17k|    }
 5513|  8.97k|    input[back_idx] = current_character;
 5514|  8.97k|  }
 5515|  3.82k|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5517|  3.82k|void decompose_nfc(std::u32string& input) {
 5518|       |  /**
 5519|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5520|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5521|       |   */
 5522|  3.82k|  auto [decomposition_needed, additional_elements] =
 5523|  3.82k|      compute_decomposition_length(input);
 5524|  3.82k|  if (decomposition_needed) {
  ------------------
  |  Branch (5524:7): [True: 2.20k, False: 1.62k]
  ------------------
 5525|  2.20k|    decompose(input, additional_elements);
 5526|  2.20k|  }
 5527|  3.82k|  sort_marks(input);
 5528|  3.82k|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5688|  18.8k|bool is_already_nfc(std::u32string_view input) noexcept {
 5689|  18.8k|  if (input.empty()) {
  ------------------
  |  Branch (5689:7): [True: 0, False: 18.8k]
  ------------------
 5690|      0|    return true;
 5691|      0|  }
 5692|  18.8k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5692:7): [True: 0, False: 18.8k]
  |  Branch (5692:30): [True: 0, False: 0]
  ------------------
 5693|      0|    return false;
 5694|      0|  }
 5695|  18.8k|  uint8_t last_ccc = 0;
 5696|  18.8k|  bool maybe = false;
 5697|   232k|  for (char32_t c : input) {
  ------------------
  |  Branch (5697:19): [True: 232k, False: 16.9k]
  ------------------
 5698|   232k|    if (c < nfc_qc_first_non_starter) {
  ------------------
  |  Branch (5698:9): [True: 115k, False: 117k]
  ------------------
 5699|   115k|      last_ccc = 0;
 5700|   115k|      continue;
 5701|   115k|    }
 5702|   117k|    const uint8_t ccc = get_ccc(c);
 5703|   117k|    if (ccc != 0 && last_ccc > ccc) {
  ------------------
  |  Branch (5703:9): [True: 11.8k, False: 105k]
  |  Branch (5703:21): [True: 1.29k, False: 10.5k]
  ------------------
 5704|  1.29k|      return false;
 5705|  1.29k|    }
 5706|   115k|    const nfc_quick_check check = get_nfc_quick_check(c);
 5707|   115k|    if (check == nfc_quick_check::no) {
  ------------------
  |  Branch (5707:9): [True: 587, False: 115k]
  ------------------
 5708|    587|      return false;
 5709|    587|    }
 5710|   115k|    maybe = maybe || check == nfc_quick_check::maybe;
  ------------------
  |  Branch (5710:13): [True: 24.5k, False: 90.6k]
  |  Branch (5710:22): [True: 4.12k, False: 86.5k]
  ------------------
 5711|   115k|    last_ccc = ccc;
 5712|   115k|  }
 5713|  16.9k|  return !maybe || maybe_is_nfc(input);
  ------------------
  |  Branch (5713:10): [True: 12.9k, False: 4.06k]
  |  Branch (5713:20): [True: 1.77k, False: 2.28k]
  ------------------
 5714|  18.8k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5716|  3.82k|void compose(std::u32string& input) {
 5717|       |  /**
 5718|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5719|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5720|       |   */
 5721|  3.82k|  size_t input_count{0};
 5722|  3.82k|  size_t composition_count{0};
 5723|  28.1k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5723:10): [True: 24.3k, False: 3.82k]
  ------------------
 5724|  24.3k|    input[composition_count] = input[input_count];
 5725|  24.3k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5725:9): [True: 8.61k, False: 15.7k]
  ------------------
 5726|  8.61k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5726:9): [True: 3.74k, False: 4.86k]
  ------------------
 5727|  3.74k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5727:11): [True: 3.63k, False: 115]
  ------------------
 5728|  3.63k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5728:11): [True: 2.86k, False: 767]
  ------------------
 5729|  2.86k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5729:11): [True: 2.51k, False: 349]
  ------------------
 5730|  2.51k|        input[composition_count] =
 5731|  2.51k|            hangul_sbase +
 5732|  2.51k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5733|  2.51k|             input[input_count + 1] - hangul_vbase) *
 5734|  2.51k|                hangul_tcount;
 5735|  2.51k|        input_count++;
 5736|  2.51k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5736:13): [True: 2.25k, False: 259]
  ------------------
 5737|  2.25k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5737:13): [True: 1.45k, False: 799]
  ------------------
 5738|  1.45k|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5738:13): [True: 1.22k, False: 235]
  ------------------
 5739|  1.22k|          input[composition_count] += input[++input_count] - hangul_tbase;
 5740|  1.22k|        }
 5741|  2.51k|      }
 5742|  20.5k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5742:16): [True: 2.76k, False: 17.8k]
  ------------------
 5743|  2.76k|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5743:16): [True: 0, False: 2.76k]
  ------------------
 5744|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5744:11): [True: 0, False: 0]
  ------------------
 5745|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5745:11): [True: 0, False: 0]
  ------------------
 5746|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5746:11): [True: 0, False: 0]
  ------------------
 5747|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5747:11): [True: 0, False: 0]
  ------------------
 5748|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5749|      0|      }
 5750|  20.5k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5750:16): [True: 20.5k, False: 0]
  ------------------
 5751|  20.5k|      const uint16_t* composition =
 5752|  20.5k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5753|  20.5k|          (input[input_count] % 256);
 5754|  20.5k|      size_t initial_composition_count = composition_count;
 5755|  31.7k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5755:39): [True: 28.5k, False: 3.19k]
  ------------------
 5756|  28.5k|           input_count++) {
 5757|  28.5k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5758|       |
 5759|  28.5k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5759:13): [True: 11.8k, False: 16.7k]
  |  Branch (5759:49): [True: 11.0k, False: 760]
  ------------------
 5760|  11.0k|          int left = composition[0];
 5761|  11.0k|          int right = composition[1];
 5762|  11.0k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5762:15): [True: 0, False: 11.0k]
  |  Branch (5762:27): [True: 0, False: 11.0k]
  ------------------
 5763|  11.0k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5763:15): [True: 0, False: 11.0k]
  ------------------
 5764|      0|            break;
 5765|      0|          }
 5766|  25.6k|          while (left + 2 < right) {
  ------------------
  |  Branch (5766:18): [True: 14.6k, False: 11.0k]
  ------------------
 5767|  14.6k|            int middle = left + (((right - left) >> 1) & ~1);
 5768|  14.6k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5768:17): [True: 7.46k, False: 7.17k]
  ------------------
 5769|  14.6k|                input[input_count + 1]) {
 5770|  7.46k|              left = middle;
 5771|  7.46k|            }
 5772|  14.6k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5772:17): [True: 9.11k, False: 5.52k]
  ------------------
 5773|  14.6k|                input[input_count + 1]) {
 5774|  9.11k|              right = middle;
 5775|  9.11k|            }
 5776|  14.6k|          }
 5777|  11.0k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5777:15): [True: 11.0k, False: 0]
  ------------------
 5778|  11.0k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5778:15): [True: 6.16k, False: 4.88k]
  ------------------
 5779|  11.0k|                  input[input_count + 1]) {
 5780|  6.16k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5781|  6.16k|            input[initial_composition_count] = composed;
 5782|  6.16k|            composition =
 5783|  6.16k|                composition_block_row(composition_index[composed >> 8]) +
 5784|  6.16k|                (composed % 256);
 5785|  6.16k|            continue;
 5786|  6.16k|          }
 5787|  11.0k|        }
 5788|       |
 5789|  22.3k|        if (ccc == 0) {
  ------------------
  |  Branch (5789:13): [True: 17.4k, False: 4.99k]
  ------------------
 5790|  17.4k|          break;
 5791|  17.4k|        }
 5792|  4.99k|        previous_ccc = ccc;
 5793|  4.99k|        input[++composition_count] = input[input_count + 1];
 5794|  4.99k|      }
 5795|  20.5k|    }
 5796|  24.3k|  }
 5797|       |
 5798|  3.82k|  if (composition_count < input_count) {
  ------------------
  |  Branch (5798:7): [True: 2.91k, False: 915]
  ------------------
 5799|  2.91k|    input.resize(composition_count);
 5800|  2.91k|  }
 5801|  3.82k|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5803|  16.2k|bool normalize(std::u32string& input) {
 5804|       |  /**
 5805|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5806|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5807|       |   */
 5808|  16.2k|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5808:7): [True: 0, False: 16.2k]
  |  Branch (5808:27): [True: 0, False: 16.2k]
  ------------------
 5809|  16.2k|      composition_index == nullptr) {
  ------------------
  |  Branch (5809:7): [True: 0, False: 16.2k]
  ------------------
 5810|      0|    return false;
 5811|      0|  }
 5812|  16.2k|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5812:7): [True: 12.3k, False: 3.82k]
  ------------------
 5813|  12.3k|    return true;
 5814|  12.3k|  }
 5815|  3.82k|  decompose_nfc(input);
 5816|  3.82k|  compose(input);
 5817|  3.82k|  return true;
 5818|  16.2k|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5878|  32.7k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5879|  32.7k|  int32_t written_out{0};
 5880|  32.7k|  out.reserve(out.size() + input.size());
 5881|  32.7k|  uint32_t n = initial_n;
 5882|  32.7k|  int32_t i = 0;
 5883|  32.7k|  int32_t bias = initial_bias;
 5884|       |  // grab ascii content
 5885|       |  // RFC 3492 section 6.2: copy the code points before the last delimiter,
 5886|       |  // then consume the delimiter only "if more than zero code points were
 5887|       |  // consumed". With a leading delimiter, b == 0, decoding starts at the
 5888|       |  // delimiter itself, which is not a digit, and fails. This matches the
 5889|       |  // reference implementation in appendix C (`in = b > 0 ? b + 1 : 0`).
 5890|  32.7k|  size_t end_of_ascii = input.find_last_of('-');
 5891|  32.7k|  if (end_of_ascii != std::string_view::npos && end_of_ascii > 0) {
  ------------------
  |  Branch (5891:7): [True: 5.48k, False: 27.2k]
  |  Branch (5891:49): [True: 5.16k, False: 327]
  ------------------
 5892|  50.2k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5892:20): [True: 50.2k, False: 4.83k]
  ------------------
 5893|  50.2k|      if (c >= 0x80) {
  ------------------
  |  Branch (5893:11): [True: 330, False: 49.8k]
  ------------------
 5894|    330|        return false;
 5895|    330|      }
 5896|  49.8k|      out.push_back(c);
 5897|  49.8k|      written_out++;
 5898|  49.8k|    }
 5899|  4.83k|    input.remove_prefix(end_of_ascii + 1);
 5900|  4.83k|  }
 5901|   122k|  while (!input.empty()) {
  ------------------
  |  Branch (5901:10): [True: 94.6k, False: 27.8k]
  ------------------
 5902|  94.6k|    int32_t oldi = i;
 5903|  94.6k|    int32_t w = 1;
 5904|   160k|    for (int32_t k = base;; k += base) {
 5905|   160k|      if (input.empty()) {
  ------------------
  |  Branch (5905:11): [True: 381, False: 160k]
  ------------------
 5906|    381|        return false;
 5907|    381|      }
 5908|   160k|      uint8_t code_point = input.front();
 5909|   160k|      input.remove_prefix(1);
 5910|   160k|      int32_t digit = char_to_digit_value(code_point);
 5911|   160k|      if (digit < 0) {
  ------------------
  |  Branch (5911:11): [True: 3.96k, False: 156k]
  ------------------
 5912|  3.96k|        return false;
 5913|  3.96k|      }
 5914|   156k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5914:11): [True: 103, False: 156k]
  ------------------
 5915|    103|        return false;
 5916|    103|      }
 5917|   156k|      i = i + digit * w;
 5918|   156k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5918:19): [True: 43.4k, False: 112k]
  |  Branch (5918:38): [True: 99.6k, False: 13.2k]
  ------------------
 5919|   156k|      if (digit < t) {
  ------------------
  |  Branch (5919:11): [True: 90.1k, False: 66.2k]
  ------------------
 5920|  90.1k|        break;
 5921|  90.1k|      }
 5922|  66.2k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5922:11): [True: 0, False: 66.2k]
  ------------------
 5923|      0|        return false;
 5924|      0|      }
 5925|  66.2k|      w = w * (base - t);
 5926|  66.2k|    }
 5927|  90.1k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5928|  90.1k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5928:9): [True: 118, False: 90.0k]
  ------------------
 5929|    118|      return false;
 5930|    118|    }
 5931|  90.0k|    n = n + i / (written_out + 1);
 5932|  90.0k|    i = i % (written_out + 1);
 5933|  90.0k|    if (n < 0x80) {
  ------------------
  |  Branch (5933:9): [True: 0, False: 90.0k]
  ------------------
 5934|      0|      return false;
 5935|      0|    }
 5936|  90.0k|    out.insert(out.begin() + i, n);
 5937|  90.0k|    written_out++;
 5938|  90.0k|    ++i;
 5939|  90.0k|  }
 5940|       |  // See https://github.com/whatwg/url/issues/803
 5941|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5942|  27.8k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5942:7): [True: 6.24k, False: 21.6k]
  |  Branch (5942:26): [True: 1.27k, False: 4.97k]
  |  Branch (5942:44): [True: 770, False: 506]
  |  Branch (5942:62): [True: 482, False: 288]
  ------------------
 5943|    482|      out[3] == U'-') {
  ------------------
  |  Branch (5943:7): [True: 298, False: 184]
  ------------------
 5944|    298|    return false;
 5945|    298|  }
 5946|  27.5k|  return true;
 5947|  27.8k|}
_ZN3ada4idna15verify_punycodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 5949|  4.56k|bool verify_punycode(std::string_view input) {
 5950|       |  // Track only the first 4 decoded code points to check for the "xn--" prefix.
 5951|       |  // This avoids heap allocation while still detecting double-encoded ACE
 5952|       |  // labels.
 5953|  4.56k|  uint32_t first4[4]{};
 5954|  4.56k|  size_t written_out{0};
 5955|  4.56k|  uint32_t n = initial_n;
 5956|  4.56k|  int32_t i = 0;
 5957|  4.56k|  int32_t bias = initial_bias;
 5958|       |  // grab ascii content
 5959|  4.56k|  size_t end_of_ascii = input.find_last_of('-');
 5960|  4.56k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5960:7): [True: 1.48k, False: 3.07k]
  ------------------
 5961|  30.0k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5961:20): [True: 30.0k, False: 1.18k]
  ------------------
 5962|  30.0k|      if (c >= 0x80) {
  ------------------
  |  Branch (5962:11): [True: 294, False: 29.7k]
  ------------------
 5963|    294|        return false;
 5964|    294|      }
 5965|  29.7k|      if (written_out < 4) {
  ------------------
  |  Branch (5965:11): [True: 4.48k, False: 25.2k]
  ------------------
 5966|  4.48k|        first4[written_out] = c;
 5967|  4.48k|      }
 5968|  29.7k|      written_out++;
 5969|  29.7k|    }
 5970|  1.18k|    input.remove_prefix(end_of_ascii + 1);
 5971|  1.18k|  }
 5972|  16.0k|  while (!input.empty()) {
  ------------------
  |  Branch (5972:10): [True: 14.4k, False: 1.55k]
  ------------------
 5973|  14.4k|    int32_t oldi = i;
 5974|  14.4k|    int32_t w = 1;
 5975|  21.1k|    for (int32_t k = base;; k += base) {
 5976|  21.1k|      if (input.empty()) {
  ------------------
  |  Branch (5976:11): [True: 81, False: 21.0k]
  ------------------
 5977|     81|        return false;
 5978|     81|      }
 5979|  21.0k|      uint8_t code_point = input.front();
 5980|  21.0k|      input.remove_prefix(1);
 5981|  21.0k|      int32_t digit = char_to_digit_value(code_point);
 5982|  21.0k|      if (digit < 0) {
  ------------------
  |  Branch (5982:11): [True: 2.58k, False: 18.5k]
  ------------------
 5983|  2.58k|        return false;
 5984|  2.58k|      }
 5985|  18.5k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5985:11): [True: 18, False: 18.4k]
  ------------------
 5986|     18|        return false;
 5987|     18|      }
 5988|  18.4k|      i = i + digit * w;
 5989|  18.4k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5989:19): [True: 4.22k, False: 14.2k]
  |  Branch (5989:38): [True: 13.5k, False: 763]
  ------------------
 5990|  18.4k|      if (digit < t) {
  ------------------
  |  Branch (5990:11): [True: 11.7k, False: 6.71k]
  ------------------
 5991|  11.7k|        break;
 5992|  11.7k|      }
 5993|  6.71k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5993:11): [True: 0, False: 6.71k]
  ------------------
 5994|      0|        return false;
 5995|      0|      }
 5996|  6.71k|      w = w * (base - t);
 5997|  6.71k|    }
 5998|  11.7k|    bias = adapt(i - oldi, int32_t(written_out + 1), oldi == 0);
 5999|  11.7k|    if (i / (written_out + 1) > 0x7fffffff - n) {
  ------------------
  |  Branch (5999:9): [True: 34, False: 11.7k]
  ------------------
 6000|     34|      return false;
 6001|     34|    }
 6002|  11.7k|    n = n + i / int32_t(written_out + 1);
 6003|  11.7k|    i = i % int32_t(written_out + 1);
 6004|  11.7k|    if (n < 0x80) {
  ------------------
  |  Branch (6004:9): [True: 0, False: 11.7k]
  ------------------
 6005|      0|      return false;
 6006|      0|    }
 6007|       |    // Simulate insert at position i, maintaining only the first 4 slots.
 6008|  11.7k|    size_t insert_pos = size_t(i);
 6009|  11.7k|    if (insert_pos < 4) {
  ------------------
  |  Branch (6009:9): [True: 2.79k, False: 8.95k]
  ------------------
 6010|  7.38k|      for (size_t j = 3; j > insert_pos; j--) {
  ------------------
  |  Branch (6010:26): [True: 4.58k, False: 2.79k]
  ------------------
 6011|  4.58k|        first4[j] = first4[j - 1];
 6012|  4.58k|      }
 6013|  2.79k|      first4[insert_pos] = n;
 6014|  2.79k|    }
 6015|  11.7k|    written_out++;
 6016|  11.7k|    ++i;
 6017|  11.7k|  }
 6018|       |  // See https://github.com/whatwg/url/issues/803
 6019|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 6020|  1.55k|  if (written_out >= 4 && first4[0] == U'x' && first4[1] == U'n' &&
  ------------------
  |  Branch (6020:7): [True: 850, False: 703]
  |  Branch (6020:27): [True: 532, False: 318]
  |  Branch (6020:48): [True: 427, False: 105]
  ------------------
 6021|    427|      first4[2] == U'-' && first4[3] == U'-') {
  ------------------
  |  Branch (6021:7): [True: 322, False: 105]
  |  Branch (6021:28): [True: 230, False: 92]
  ------------------
 6022|    230|    return false;
 6023|    230|  }
 6024|  1.32k|  return true;
 6025|  1.55k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 6027|  5.86k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 6028|  5.86k|  out.reserve(input.size() + out.size());
 6029|  5.86k|  uint32_t n = initial_n;
 6030|  5.86k|  int32_t d = 0;
 6031|  5.86k|  int32_t bias = initial_bias;
 6032|  5.86k|  size_t h = 0;
 6033|       |  // first push the ascii content
 6034|  51.4k|  for (uint32_t c : input) {
  ------------------
  |  Branch (6034:19): [True: 51.4k, False: 5.67k]
  ------------------
 6035|  51.4k|    if (c < 0x80) {
  ------------------
  |  Branch (6035:9): [True: 14.9k, False: 36.4k]
  ------------------
 6036|  14.9k|      ++h;
 6037|  14.9k|      out.push_back(char(c));
 6038|  14.9k|    }
 6039|  51.4k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (6039:9): [True: 168, False: 51.2k]
  |  Branch (6039:26): [True: 986, False: 50.2k]
  |  Branch (6039:41): [True: 16, False: 970]
  ------------------
 6040|    184|      return false;
 6041|    184|    }
 6042|  51.4k|  }
 6043|  5.67k|  size_t b = h;
 6044|  5.67k|  if (b > 0) {
  ------------------
  |  Branch (6044:7): [True: 2.05k, False: 3.62k]
  ------------------
 6045|  2.05k|    out.push_back('-');
 6046|  2.05k|  }
 6047|  26.0k|  while (h < input.size()) {
  ------------------
  |  Branch (6047:10): [True: 20.4k, False: 5.67k]
  ------------------
 6048|  20.4k|    uint32_t m = 0x10FFFF;
 6049|   371k|    for (auto code_point : input) {
  ------------------
  |  Branch (6049:26): [True: 371k, False: 20.4k]
  ------------------
 6050|   371k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (6050:11): [True: 192k, False: 179k]
  |  Branch (6050:30): [True: 36.4k, False: 156k]
  ------------------
 6051|   371k|    }
 6052|       |
 6053|  20.4k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (6053:9): [True: 0, False: 20.4k]
  ------------------
 6054|      0|      return false;
 6055|      0|    }
 6056|  20.4k|    d = d + int32_t((m - n) * (h + 1));
 6057|  20.4k|    n = m;
 6058|   371k|    for (auto c : input) {
  ------------------
  |  Branch (6058:17): [True: 371k, False: 20.4k]
  ------------------
 6059|   371k|      if (c < n) {
  ------------------
  |  Branch (6059:11): [True: 179k, False: 192k]
  ------------------
 6060|   179k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (6060:13): [True: 0, False: 179k]
  ------------------
 6061|      0|          return false;
 6062|      0|        }
 6063|   179k|        ++d;
 6064|   179k|      }
 6065|   371k|      if (c == n) {
  ------------------
  |  Branch (6065:11): [True: 36.2k, False: 335k]
  ------------------
 6066|  36.2k|        int32_t q = d;
 6067|  72.0k|        for (int32_t k = base;; k += base) {
 6068|  72.0k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (6068:23): [True: 17.5k, False: 54.5k]
  |  Branch (6068:42): [True: 44.3k, False: 10.1k]
  ------------------
 6069|       |
 6070|  72.0k|          if (q < t) {
  ------------------
  |  Branch (6070:15): [True: 36.2k, False: 35.8k]
  ------------------
 6071|  36.2k|            break;
 6072|  36.2k|          }
 6073|  35.8k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 6074|  35.8k|          q = (q - t) / (base - t);
 6075|  35.8k|        }
 6076|  36.2k|        out.push_back(digit_to_char(q));
 6077|  36.2k|        bias = adapt(d, int32_t(h + 1), h == b);
 6078|  36.2k|        d = 0;
 6079|  36.2k|        ++h;
 6080|  36.2k|      }
 6081|   371k|    }
 6082|  20.4k|    ++d;
 6083|  20.4k|    ++n;
 6084|  20.4k|  }
 6085|  5.67k|  return true;
 6086|  5.67k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6387|    458|bool is_label_valid(const std::u32string_view label) {
 6388|    458|  return check_label(label).ok(false);
 6389|    458|}
_ZN3ada4idna36contains_forbidden_domain_code_pointENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6518|  4.56k|bool contains_forbidden_domain_code_point(std::string_view view) {
 6519|  4.56k|  return std::ranges::any_of(view, is_forbidden_domain_code_point);
 6520|  4.56k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6548|  11.8k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6549|  11.8k|  out.clear();
 6550|       |  // The ASCII path is a single same-size copy, so it needs no length bound.
 6551|       |  // Checking first would reject the (longer) ASCII output of a non-ASCII input
 6552|       |  // that was accepted, breaking to_ascii(to_ascii(x)) == to_ascii(x).
 6553|  11.8k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6553:7): [True: 8.92k, False: 2.95k]
  ------------------
 6554|  8.92k|    from_ascii_to_ascii(ut8_string, out);
 6555|  8.92k|    return true;
 6556|  8.92k|  }
 6557|  2.95k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6557:7): [True: 0, False: 2.95k]
  ------------------
 6558|      0|    return false;
 6559|      0|  }
 6560|       |
 6561|       |#ifdef ADA_USE_SIMDUTF
 6562|       |  size_t utf32_length =
 6563|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6564|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6565|       |    return false;
 6566|       |  }
 6567|       |  std::u32string working(utf32_length, U'\0');
 6568|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6569|       |      ut8_string.data(), ut8_string.size(), working.data());
 6570|       |#else
 6571|  2.95k|  size_t utf32_length =
 6572|  2.95k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6573|  2.95k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6573:7): [True: 23, False: 2.93k]
  |  Branch (6573:28): [True: 23, False: 0]
  ------------------
 6574|     23|    return false;
 6575|     23|  }
 6576|  2.93k|  std::u32string working(utf32_length, U'\0');
 6577|  2.93k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6578|  2.93k|      ut8_string.data(), ut8_string.size(), working.data());
 6579|  2.93k|#endif
 6580|  2.93k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6580:7): [True: 480, False: 2.45k]
  |  Branch (6580:35): [True: 0, False: 2.45k]
  ------------------
 6581|    480|    return false;
 6582|    480|  }
 6583|  2.45k|  working.resize(actual_utf32_length);
 6584|       |
 6585|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6586|  2.45k|  std::u32string mapped;
 6587|  2.45k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6587:7): [True: 323, False: 2.12k]
  ------------------
 6588|    323|    return false;
 6589|    323|  }
 6590|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6591|  2.12k|  working.clear();
 6592|       |
 6593|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6594|  2.12k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6594:7): [True: 1.87k, False: 249]
  |  Branch (6594:28): [True: 239, False: 1.64k]
  ------------------
 6595|    239|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6595:9): [True: 0, False: 239]
  ------------------
 6596|      0|      return false;
 6597|      0|    }
 6598|    239|  }
 6599|       |
 6600|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6601|  2.12k|  out.reserve(mapped.size() + 8);
 6602|       |
 6603|       |  // CheckBidi applies to every label once any label is RTL (RFC 5893), which a
 6604|       |  // later label can decide. Any failure rejects the whole domain, so it is
 6605|       |  // enough to know at the end whether some label is RTL and whether every
 6606|       |  // label satisfies the Bidi rule.
 6607|  2.12k|  bool bidi_domain = false;
 6608|  2.12k|  bool bidi_rule_holds = true;
 6609|  2.12k|  auto accept = [&](const label_check& check) {
 6610|  2.12k|    bidi_domain = bidi_domain || check.rtl;
 6611|  2.12k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
 6612|  2.12k|    return check.valid && (bidi_rule_holds || !bidi_domain);
 6613|  2.12k|  };
 6614|       |
 6615|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6616|  2.12k|  const char32_t* p = mapped.data();
 6617|  2.12k|  const char32_t* const end = p + mapped.size();
 6618|  2.12k|  std::u32string post_map;
 6619|       |
 6620|  10.2k|  while (p < end) {
  ------------------
  |  Branch (6620:10): [True: 8.71k, False: 1.50k]
  ------------------
 6621|  8.71k|    const char32_t* label_begin = p;
 6622|  81.1k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6622:12): [True: 79.2k, False: 1.94k]
  |  Branch (6622:23): [True: 72.4k, False: 6.76k]
  ------------------
 6623|  72.4k|      ++p;
 6624|  72.4k|    }
 6625|  8.71k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6626|  8.71k|    std::u32string_view label_view(label_begin, label_size);
 6627|  8.71k|    const bool is_last_label = (p == end);
 6628|  8.71k|    if (p < end) {
  ------------------
  |  Branch (6628:9): [True: 6.76k, False: 1.94k]
  ------------------
 6629|  6.76k|      ++p;  // skip dot
 6630|  6.76k|    }
 6631|       |
 6632|  8.71k|    if (label_size == 0) {
  ------------------
  |  Branch (6632:9): [True: 639, False: 8.07k]
  ------------------
 6633|       |      // empty label
 6634|  8.07k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6634:16): [True: 915, False: 7.16k]
  ------------------
 6635|  11.9k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6635:23): [True: 11.9k, False: 905]
  ------------------
 6636|  11.9k|        if (c >= 0x80) {
  ------------------
  |  Branch (6636:13): [True: 10, False: 11.9k]
  ------------------
 6637|     10|          out.clear();
 6638|     10|          return false;
 6639|     10|        }
 6640|  11.9k|      }
 6641|    905|      append_ascii_label(out, label_view);
 6642|    905|      std::string_view puny_segment_ascii(
 6643|    905|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6644|    905|      working.clear();
 6645|    905|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6645:11): [True: 19, False: 886]
  ------------------
 6646|     19|        out.clear();
 6647|     19|        return false;
 6648|     19|      }
 6649|    886|      if (is_ascii(working)) {
  ------------------
  |  Branch (6649:11): [True: 39, False: 847]
  ------------------
 6650|     39|        out.clear();
 6651|     39|        return false;
 6652|     39|      }
 6653|    847|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6653:11): [True: 25, False: 822]
  |  Branch (6653:49): [True: 52, False: 770]
  ------------------
 6654|     77|        out.clear();
 6655|     77|        return false;
 6656|     77|      }
 6657|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6658|    770|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6658:11): [True: 770, False: 0]
  |  Branch (6658:34): [True: 108, False: 662]
  ------------------
 6659|    108|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6659:13): [True: 0, False: 108]
  |  Branch (6659:37): [True: 50, False: 58]
  ------------------
 6660|     50|          out.clear();
 6661|     50|          return false;
 6662|     50|        }
 6663|    108|      }
 6664|    720|      if (post_map.empty() || !accept(check_label(post_map))) {
  ------------------
  |  Branch (6664:11): [True: 0, False: 720]
  |  Branch (6664:11): [True: 18, False: 702]
  |  Branch (6664:31): [True: 18, False: 702]
  ------------------
 6665|     18|        out.clear();
 6666|     18|        return false;
 6667|     18|      }
 6668|  7.16k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6668:16): [True: 1.72k, False: 5.43k]
  ------------------
 6669|       |      // All-ASCII domains never reach here (they return above). An ASCII label
 6670|       |      // in a Bidi domain must still satisfy RFC 5893 rules 1, 5, and 6.
 6671|  1.72k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6671:11): [True: 13, False: 1.71k]
  ------------------
 6672|     13|        out.clear();
 6673|     13|        return false;
 6674|     13|      }
 6675|  1.71k|      append_ascii_label(out, label_view);
 6676|  5.43k|    } else {
 6677|  5.43k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6677:11): [True: 402, False: 5.03k]
  ------------------
 6678|    402|        out.clear();
 6679|    402|        return false;
 6680|    402|      }
 6681|  5.03k|      out.append("xn--");
 6682|  5.03k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6682:11): [True: 0, False: 5.03k]
  ------------------
 6683|      0|        out.clear();
 6684|      0|        return false;
 6685|      0|      }
 6686|  5.03k|    }
 6687|  8.08k|    if (!is_last_label) {
  ------------------
  |  Branch (6687:9): [True: 6.67k, False: 1.40k]
  ------------------
 6688|  6.67k|      out.push_back('.');
 6689|  6.67k|    }
 6690|  8.08k|  }
 6691|  1.50k|  return true;
 6692|  2.12k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6694|  11.8k|std::string to_ascii(std::string_view ut8_string) {
 6695|  11.8k|  std::string out;
 6696|  11.8k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6696:7): [True: 1.45k, False: 10.4k]
  ------------------
 6697|  1.45k|    return {};
 6698|  1.45k|  }
 6699|  10.4k|  return out;
 6700|  11.8k|}
_ZN3ada4idna10to_unicodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6915|  11.3k|[[nodiscard]] bool to_unicode(std::string_view input, std::string& output) {
 6916|  11.3k|  output.clear();
 6917|  11.3k|  if (input.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6917:7): [True: 0, False: 11.3k]
  ------------------
 6918|      0|    return false;
 6919|      0|  }
 6920|       |  // Without an ACE label or a non-ASCII character, every label is kept as is.
 6921|  11.3k|  if (is_ascii(input) && input.find("xn--") == std::string_view::npos) {
  ------------------
  |  Branch (6921:7): [True: 5.90k, False: 5.45k]
  |  Branch (6921:26): [True: 2.07k, False: 3.82k]
  ------------------
 6922|  2.07k|    output.assign(input);
 6923|  2.07k|    return true;
 6924|  2.07k|  }
 6925|  9.28k|  output.reserve(input.size());
 6926|       |
 6927|  9.28k|  const conversion result = convert_labels(input, output, false);
 6928|  9.28k|  if (!result.bidi_domain) {
  ------------------
  |  Branch (6928:7): [True: 7.17k, False: 2.11k]
  ------------------
 6929|  7.17k|    return true;
 6930|  7.17k|  }
 6931|       |
 6932|       |  // An ASCII label that is only illegal because the domain is a Bidi domain
 6933|       |  // fails ToUnicode for the whole input (UTS #46), not just that label.
 6934|  2.11k|  std::u32string buffer;
 6935|  2.11k|  size_t label_start = 0;
 6936|  14.3k|  while (label_start < input.size()) {
  ------------------
  |  Branch (6936:10): [True: 14.2k, False: 72]
  ------------------
 6937|  14.2k|    const size_t loc_dot = input.find('.', label_start);
 6938|  14.2k|    const bool is_last_label = (loc_dot == std::string_view::npos);
 6939|  14.2k|    const size_t label_size =
 6940|  14.2k|        is_last_label ? input.size() - label_start : loc_dot - label_start;
  ------------------
  |  Branch (6940:9): [True: 1.98k, False: 12.2k]
  ------------------
 6941|  14.2k|    const std::string_view label = input.substr(label_start, label_size);
 6942|  14.2k|    if (!label.empty() && is_ascii(label) && !label.starts_with("xn--") &&
  ------------------
  |  Branch (6942:9): [True: 12.7k, False: 1.52k]
  |  Branch (6942:27): [True: 9.06k, False: 3.67k]
  |  Branch (6942:46): [True: 2.42k, False: 6.64k]
  ------------------
 6943|  2.42k|        ascii_label_fails_bidi_domain(label, buffer)) {
  ------------------
  |  Branch (6943:9): [True: 127, False: 2.30k]
  ------------------
 6944|    127|      output.assign(input);
 6945|    127|      return true;
 6946|    127|    }
 6947|  14.1k|    if (is_last_label) {
  ------------------
  |  Branch (6947:9): [True: 1.91k, False: 12.2k]
  ------------------
 6948|  1.91k|      break;
 6949|  1.91k|    }
 6950|  12.2k|    label_start += label_size + 1;
 6951|  12.2k|  }
 6952|       |
 6953|       |  // Labels before the first RTL label were checked without the Bidi rule.
 6954|  1.98k|  if (result.needs_bidi_pass) {
  ------------------
  |  Branch (6954:7): [True: 516, False: 1.47k]
  ------------------
 6955|    516|    output.clear();
 6956|    516|    convert_labels(input, output, true);
 6957|    516|  }
 6958|  1.98k|  return true;
 6959|  2.11k|}
_ZN3ada4idna10to_unicodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6961|  11.3k|std::string to_unicode(std::string_view input) {
 6962|  11.3k|  std::string output;
 6963|  11.3k|  if (!to_unicode(input, output)) {
  ------------------
  |  Branch (6963:7): [True: 0, False: 11.3k]
  ------------------
 6964|       |    // Over-limit input: return original (ToUnicode never fails in the sense of
 6965|       |    // producing no answer for valid-length inputs).
 6966|      0|    return std::string(input);
 6967|      0|  }
 6968|  11.3k|  return output;
 6969|  11.3k|}
idna.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  274|   438k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|   438k|    return c > -65;
  278|   438k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  481|      2|inline Huff make_fixed_litlen_huff() {
  482|      2|  Huff h;
  483|      2|  uint8_t lens[288];
  484|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  485|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (485:19): [True: 288, False: 2]
  ------------------
  486|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (486:21): [True: 224, False: 2]
  ------------------
  487|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (487:21): [True: 48, False: 2]
  ------------------
  488|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (488:21): [True: 16, False: 2]
  ------------------
  489|      2|  h.build(lens, 288);
  490|      2|  return h;
  491|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  430|     16|  bool build(const uint8_t* lens, int n) {
  431|     16|    std::memset(counts, 0, sizeof(counts));
  432|     16|    std::memset(first_code, 0, sizeof(first_code));
  433|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  434|     16|    nsymbols = n;
  435|     16|    max_bits = 0;
  436|  1.99k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (436:21): [True: 1.97k, False: 16]
  ------------------
  437|  1.97k|      lengths[i] = lens[i];
  438|  1.97k|      if (lens[i]) {
  ------------------
  |  Branch (438:11): [True: 1.93k, False: 41]
  ------------------
  439|  1.93k|        counts[lens[i]]++;
  440|  1.93k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (440:13): [True: 48, False: 1.88k]
  ------------------
  441|  1.93k|      }
  442|  1.97k|    }
  443|       |    // Canonical first code for each bit length (RFC 1951).
  444|     16|    int code = 0;
  445|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (445:24): [True: 240, False: 16]
  ------------------
  446|    240|      code = (code + counts[bits - 1]) << 1;
  447|    240|      first_code[bits] = code;
  448|    240|    }
  449|     16|    int idx = 0;
  450|    157|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (450:24): [True: 141, False: 16]
  ------------------
  451|    141|      base_idx[bits] = idx;
  452|       |      // assign symbols in symbol order for codes of this length
  453|  21.7k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (453:25): [True: 21.6k, False: 141]
  ------------------
  454|  21.6k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (454:13): [True: 1.93k, False: 19.6k]
  ------------------
  455|  1.93k|          symbols[idx++] = static_cast<int16_t>(sym);
  456|  1.93k|        }
  457|  21.6k|      }
  458|    141|    }
  459|     16|    return true;
  460|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  493|      2|inline Huff make_fixed_dist_huff() {
  494|      2|  Huff h;
  495|      2|  uint8_t lens[32];
  496|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (496:19): [True: 64, False: 2]
  ------------------
  497|      2|  h.build(lens, 32);
  498|      2|  return h;
  499|      2|}
idna.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5260|  40.4k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|  40.4k|    return 0x101010101010101ull * v;
 5262|  40.4k|  };
_ZN3ada4idna13ensure_tablesEv:
 4983|  65.7k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4984|  65.7k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4985|  65.7k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4985:7): [True: 65.7k, False: 1]
  ------------------
 4986|  65.7k|    return true;
 4987|  65.7k|  }
 4988|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4988:7): [True: 0, False: 1]
  ------------------
 4989|      0|    return false;
 4990|      0|  }
 4991|       |
 4992|      1|  uint8_t expected = kTablesUninit;
 4993|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4993:7): [True: 1, False: 0]
  ------------------
 4994|      1|                                                std::memory_order_acq_rel,
 4995|      1|                                                std::memory_order_acquire)) {
 4996|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4997|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4997:9): [True: 0, False: 1]
  ------------------
 4998|       |      // Leave the state uninitialized so a later call can retry. A corrupt
 4999|       |      // blob (below) is permanent; running out of memory may not be.
 5000|       |      // LCOV_EXCL_START
 5001|      0|      tables_init_state.store(kTablesUninit, std::memory_order_release);
 5002|      0|      return false;
 5003|       |      // LCOV_EXCL_STOP
 5004|      0|    }
 5005|       |
 5006|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 5007|      1|                                          table_blob::compressed_size, buffer,
 5008|      1|                                          table_blob::uncompressed_size);
 5009|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (5009:9): [True: 0, False: 1]
  ------------------
 5010|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (5010:9): [True: 0, False: 1]
  ------------------
 5011|      0|      delete[] buffer;
 5012|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5013|      0|      return false;
 5014|      0|    }
 5015|       |
 5016|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 5017|      1|    detail::convert_table_blob_to_host_endian(buffer);
 5018|       |
 5019|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|      1|      return buffer + off;
 5021|      1|    };
 5022|       |
 5023|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 5024|       |    // acquire on tables_init_state and then observe these writes.
 5025|      1|    idna_stage1 =
 5026|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 5027|      1|    idna_stage2 =
 5028|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 5029|      1|    idna_bool_blocks =
 5030|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 5031|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 5032|       |
 5033|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 5034|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 5035|      1|        at(table_blob::off_decomposition_block));
 5036|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 5037|      1|        at(table_blob::off_decomposition_data));
 5038|      1|    ccc_index = at(table_blob::off_ccc_index);
 5039|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 5040|      1|    composition_index = at(table_blob::off_composition_index);
 5041|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 5042|      1|        at(table_blob::off_composition_block));
 5043|      1|    composition_data =
 5044|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 5045|      1|    nfc_qc_index = at(table_blob::off_nfc_qc_index);
 5046|      1|    nfc_qc_block_flat = at(table_blob::off_nfc_qc_block);
 5047|       |
 5048|      1|    id_continue =
 5049|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 5050|      1|    id_start =
 5051|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 5052|       |
 5053|      1|    dir_index = at(table_blob::off_dir_index);
 5054|      1|    dir_block_flat = at(table_blob::off_dir_block);
 5055|      1|    combining_ranges =
 5056|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 5057|      1|    joining_start =
 5058|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_start));
 5059|      1|    joining_final =
 5060|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_final));
 5061|      1|    joining_value = at(table_blob::off_joining_value);
 5062|       |
 5063|      1|    tables_buffer = buffer;
 5064|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 5065|      1|    return true;
 5066|      1|  }
 5067|       |
 5068|       |  // Another thread owns init (or finished between our loads).
 5069|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (5069:28): [True: 0, False: 0]
  ------------------
 5070|      0|    state = tables_init_state.load(std::memory_order_acquire);
 5071|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (5071:9): [True: 0, False: 0]
  ------------------
 5072|      0|      return true;
 5073|      0|    }
 5074|       |    // Failed is permanent. Uninit means the peer gave up after a failed
 5075|       |    // allocation: do not spin, the next call can take the init slot. One
 5076|       |    // comparison, same shape as the old Failed check, so this wait loop does
 5077|       |    // not grow the unity translation unit.
 5078|       |    // LCOV_EXCL_START
 5079|      0|    if (state != kTablesInProgress) {
  ------------------
  |  Branch (5079:9): [True: 0, False: 0]
  ------------------
 5080|      0|      return false;
 5081|      0|    }
 5082|       |    // LCOV_EXCL_STOP
 5083|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 5084|      0|    defined(_M_IX86)
 5085|      0|#if defined(__GNUC__) || defined(__clang__)
 5086|      0|    __builtin_ia32_pause();
 5087|      0|#endif
 5088|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 5089|       |#if defined(__GNUC__) || defined(__clang__)
 5090|       |    asm volatile("yield" ::: "memory");
 5091|       |#endif
 5092|       |#endif
 5093|      0|  }
 5094|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 5095|      0|  return false;
 5096|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  526|      1|                          size_t dst_cap) {
  527|      1|  BitReader br(src, src_len);
  528|      1|  size_t out = 0;
  529|      4|  for (;;) {
  530|      4|    uint32_t bfinal = br.get(1);
  531|      4|    uint32_t btype = br.get(2);
  532|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (532:9): [True: 0, False: 4]
  |  Branch (532:33): [True: 0, False: 4]
  ------------------
  533|      4|    if (btype == 0) {
  ------------------
  |  Branch (533:9): [True: 0, False: 4]
  ------------------
  534|       |      // stored
  535|      0|      br.align_byte();
  536|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (536:11): [True: 0, False: 0]
  ------------------
  537|       |      // read 16+16 from bit buffer awkwardly - use byte path
  538|       |      // Align: bits is multiple of 8
  539|       |      // Get len from remaining bits then bytes
  540|      0|      uint32_t len = br.get(16);
  541|      0|      uint32_t nlen = br.get(16);
  542|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  |  Branch (542:32): [True: 0, False: 0]
  ------------------
  543|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (543:11): [True: 0, False: 0]
  ------------------
  544|       |      // After get, may have bits in acc from previous - for stored, should be
  545|       |      // byte aligned Copy len bytes from p
  546|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (546:11): [True: 0, False: 0]
  ------------------
  547|       |        // leftover bits should be 0 if aligned
  548|      0|      }
  549|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (550:11): [True: 0, False: 0]
  ------------------
  551|      0|      std::memcpy(dst + out, br.p, len);
  552|      0|      br.p += len;
  553|      0|      out += len;
  554|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (554:16): [True: 0, False: 4]
  |  Branch (554:30): [True: 4, False: 0]
  ------------------
  555|      4|      Huff lit, dist;
  556|      4|      if (btype == 1) {
  ------------------
  |  Branch (556:11): [True: 0, False: 4]
  ------------------
  557|       |        // use fixed via functions
  558|      4|      } else {
  559|       |        // dynamic
  560|      4|        uint32_t hlit = br.get(5);
  561|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (561:13): [True: 0, False: 4]
  ------------------
  562|      4|        hlit += 257;
  563|      4|        uint32_t hdist = br.get(5);
  564|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (564:13): [True: 0, False: 4]
  ------------------
  565|      4|        hdist += 1;
  566|      4|        uint32_t hclen = br.get(4);
  567|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (567:13): [True: 0, False: 4]
  ------------------
  568|      4|        hclen += 4;
  569|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  570|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  571|      4|        uint8_t clen[19]{};
  572|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (572:30): [True: 65, False: 4]
  ------------------
  573|     65|          uint32_t v = br.get(3);
  574|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (574:15): [True: 0, False: 65]
  ------------------
  575|     65|          clen[order[i]] = uint8_t(v);
  576|     65|        }
  577|      4|        Huff cl;
  578|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (578:13): [True: 0, False: 4]
  ------------------
  579|      4|        uint8_t lens[288 + 32]{};
  580|      4|        uint32_t n = hlit + hdist;
  581|  1.06k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (581:30): [True: 1.06k, False: 4]
  ------------------
  582|  1.06k|          int sym = cl.decode(br);
  583|  1.06k|          if (sym < 0) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 1.06k]
  ------------------
  584|  1.06k|          if (sym < 16) {
  ------------------
  |  Branch (584:15): [True: 1.00k, False: 60]
  ------------------
  585|  1.00k|            lens[i++] = uint8_t(sym);
  586|  1.00k|          } else if (sym == 16) {
  ------------------
  |  Branch (586:22): [True: 60, False: 0]
  ------------------
  587|     60|            uint32_t rep = br.get(2);
  588|     60|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (588:17): [True: 0, False: 60]
  ------------------
  589|     60|            rep += 3;
  590|     60|            if (i == 0) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 60]
  ------------------
  591|     60|            uint8_t v = lens[i - 1];
  592|    318|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (592:20): [True: 258, False: 60]
  ------------------
  593|     60|          } else if (sym == 17) {
  ------------------
  |  Branch (593:22): [True: 0, False: 0]
  ------------------
  594|      0|            uint32_t rep = br.get(3);
  595|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (595:17): [True: 0, False: 0]
  ------------------
  596|      0|            rep += 3;
  597|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (597:20): [True: 0, False: 0]
  ------------------
  598|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (598:22): [True: 0, False: 0]
  ------------------
  599|      0|            uint32_t rep = br.get(7);
  600|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|            rep += 11;
  602|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (602:20): [True: 0, False: 0]
  ------------------
  603|      0|          } else
  604|      0|            return 0;
  605|  1.06k|        }
  606|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (606:13): [True: 0, False: 4]
  ------------------
  607|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (607:13): [True: 0, False: 4]
  ------------------
  608|      4|      }
  609|  53.6k|      for (;;) {
  610|  53.6k|        int sym;
  611|  53.6k|        if (btype == 1)
  ------------------
  |  Branch (611:13): [True: 0, False: 53.6k]
  ------------------
  612|      0|          sym = fixed_litlen(br);
  613|  53.6k|        else
  614|  53.6k|          sym = lit.decode(br);
  615|  53.6k|        if (sym < 0) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 53.6k]
  ------------------
  616|  53.6k|        if (sym < 256) {
  ------------------
  |  Branch (616:13): [True: 38.1k, False: 15.5k]
  ------------------
  617|  38.1k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (617:15): [True: 0, False: 38.1k]
  ------------------
  618|  38.1k|          dst[out++] = uint8_t(sym);
  619|  38.1k|        } else if (sym == 256) {
  ------------------
  |  Branch (619:20): [True: 4, False: 15.5k]
  ------------------
  620|      4|          break;
  621|  15.5k|        } else {
  622|  15.5k|          int len_code = sym - 257;
  623|  15.5k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (623:15): [True: 0, False: 15.5k]
  |  Branch (623:31): [True: 0, False: 15.5k]
  ------------------
  624|  15.5k|          uint32_t extra = br.get(len_extra[len_code]);
  625|  15.5k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (625:15): [True: 2.60k, False: 12.9k]
  |  Branch (625:38): [True: 0, False: 2.60k]
  ------------------
  626|  15.5k|          uint32_t length =
  627|  15.5k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (627:37): [True: 2.60k, False: 12.9k]
  ------------------
  628|  15.5k|          int dsym;
  629|  15.5k|          if (btype == 1)
  ------------------
  |  Branch (629:15): [True: 0, False: 15.5k]
  ------------------
  630|      0|            dsym = fixed_dist(br);
  631|  15.5k|          else
  632|  15.5k|            dsym = dist.decode(br);
  633|  15.5k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (633:15): [True: 0, False: 15.5k]
  |  Branch (633:27): [True: 0, False: 15.5k]
  ------------------
  634|  15.5k|          uint32_t dextra = br.get(dist_extra[dsym]);
  635|  15.5k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (635:15): [True: 9.94k, False: 5.58k]
  |  Branch (635:35): [True: 0, False: 9.94k]
  ------------------
  636|  15.5k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (636:50): [True: 9.94k, False: 5.58k]
  ------------------
  637|  15.5k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (637:15): [True: 0, False: 15.5k]
  |  Branch (637:33): [True: 0, False: 15.5k]
  ------------------
  638|   236k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (638:32): [True: 220k, False: 15.5k]
  ------------------
  639|   220k|            dst[out] = dst[out - distance];
  640|   220k|            out++;
  641|   220k|          }
  642|  15.5k|        }
  643|  53.6k|      }
  644|      4|    } else {
  645|      0|      return 0;  // reserved
  646|      0|    }
  647|      4|    if (bfinal) break;
  ------------------
  |  Branch (647:9): [True: 1, False: 3]
  ------------------
  648|      4|  }
  649|      1|  return out;
  650|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  393|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  403|   471k|  uint32_t get(int n) {
  404|   471k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (404:9): [True: 0, False: 471k]
  ------------------
  405|   471k|    uint32_t v = acc & ((1u << n) - 1);
  406|   471k|    acc >>= n;
  407|   471k|    bits -= n;
  408|   471k|    return v;
  409|   471k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  395|   471k|  bool ensure(int n) {
  396|   534k|    while (bits < n) {
  ------------------
  |  Branch (396:12): [True: 63.5k, False: 471k]
  ------------------
  397|  63.5k|      if (p >= end) return false;
  ------------------
  |  Branch (397:11): [True: 0, False: 63.5k]
  ------------------
  398|  63.5k|      acc |= uint32_t(*p++) << bits;
  399|  63.5k|      bits += 8;
  400|  63.5k|    }
  401|   471k|    return true;
  402|   471k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  462|  70.2k|  int decode(BitReader& br) const {
  463|  70.2k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (463:9): [True: 0, False: 70.2k]
  ------------------
  464|  70.2k|    int code = 0;
  465|   439k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (465:23): [True: 439k, False: 0]
  ------------------
  466|   439k|      uint32_t b = br.get(1);
  467|   439k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (467:11): [True: 0, False: 439k]
  ------------------
  468|   439k|      code = (code << 1) | int(b);
  469|   439k|      int first = first_code[len];
  470|   439k|      int cnt = counts[len];
  471|   439k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (471:11): [True: 271k, False: 168k]
  |  Branch (471:18): [True: 70.2k, False: 201k]
  ------------------
  472|  70.2k|        return symbols[base_idx[len] + (code - first)];
  473|  70.2k|      }
  474|   439k|    }
  475|      0|    return -1;
  476|  70.2k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4966|      1|                                         size_t len) noexcept {
 4967|      1|  uint32_t c = 0xFFFFFFFFu;
 4968|   258k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4968:22): [True: 258k, False: 1]
  ------------------
 4969|   258k|    c ^= data[i];
 4970|  2.32M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4970:21): [True: 2.06M, False: 258k]
  ------------------
 4971|  2.06M|      const uint32_t mask = 0u - (c & 1u);
 4972|  2.06M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4973|  2.06M|    }
 4974|   258k|  }
 4975|      1|  return ~c;
 4976|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4766|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4767|      1|  if constexpr (std::endian::native == std::endian::little) {
 4768|      1|    (void)buffer;
 4769|      1|    return;
 4770|      1|  }
 4771|      0|  auto u16 = [&](size_t off, size_t count) {
 4772|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4773|      1|  };
 4774|      1|  auto u32 = [&](size_t off, size_t count) {
 4775|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4776|      1|  };
 4777|      1|  auto u64 = [&](size_t off, size_t count) {
 4778|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4779|      1|  };
 4780|       |
 4781|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4782|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4783|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4784|      1|  u16(table_blob::off_decomposition_block,
 4785|      1|      table_blob::count_decomposition_block);
 4786|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4787|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4788|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4789|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4790|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4791|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4792|      1|  u32(table_blob::off_joining_start, table_blob::count_joining_start);
 4793|      1|  u32(table_blob::off_joining_final, table_blob::count_joining_final);
 4794|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 5019|     22|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|     22|      return buffer + off;
 5021|     22|    };
idna.cc:_ZN3ada4idnaL11idna_lookupEj:
 5198|   406k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5199|   406k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5199:7): [True: 404k, False: 1.41k]
  ------------------
 5200|   404k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5201|   404k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5201:9): [True: 167k, False: 237k]
  ------------------
 5202|   167k|      uint32_t bit_idx =
 5203|   167k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5204|   167k|          (cp & IDNA_BLOCK_MASK);
 5205|   167k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5206|   167k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5206:14): [True: 167k, False: 152]
  ------------------
 5207|   167k|    }
 5208|   237k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5209|   404k|  }
 5210|       |
 5211|  1.41k|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5211:7): [True: 1.26k, False: 151]
  |  Branch (5211:40): [True: 443, False: 825]
  ------------------
 5212|    443|    return IDNA_IGNORED;
 5213|    443|  }
 5214|       |
 5215|    976|  return IDNA_DISALLOWED;
 5216|  1.41k|}
idna.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5241|  34.9k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5242|  34.9k|  size_t n = 0;
 5243|   294k|  while (*ptr != 0) {
  ------------------
  |  Branch (5243:10): [True: 259k, False: 34.9k]
  ------------------
 5244|   259k|    ++n;
 5245|   259k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5245:9): [True: 52.6k, False: 206k]
  ------------------
 5246|  52.6k|      ++ptr;
 5247|   206k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5247:16): [True: 165k, False: 41.5k]
  ------------------
 5248|   165k|      ptr += 2;
 5249|   165k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5249:16): [True: 41.2k, False: 341]
  ------------------
 5250|  41.2k|      ptr += 3;
 5251|  41.2k|    } else {
 5252|    341|      ptr += 4;
 5253|    341|    }
 5254|   259k|  }
 5255|  34.9k|  return n;
 5256|  34.9k|}
idna.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5219|   259k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5220|   259k|  uint8_t b0 = *ptr++;
 5221|   259k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5221:7): [True: 52.5k, False: 206k]
  ------------------
 5222|   206k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5222:7): [True: 164k, False: 41.5k]
  ------------------
 5223|   164k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5224|   164k|    cp |= (*ptr++ & 0x3Fu);
 5225|   164k|    return static_cast<char32_t>(cp);
 5226|   164k|  }
 5227|  41.5k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5227:7): [True: 41.2k, False: 341]
  ------------------
 5228|  41.2k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5229|  41.2k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5230|  41.2k|    cp |= (*ptr++ & 0x3Fu);
 5231|  41.2k|    return static_cast<char32_t>(cp);
 5232|  41.2k|  }
 5233|    341|  uint32_t cp = (b0 & 0x07u) << 18;
 5234|    341|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5235|    341|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5236|    341|  cp |= (*ptr++ & 0x3Fu);
 5237|    341|  return static_cast<char32_t>(cp);
 5238|  41.5k|}
_ZN3ada4idna23decomposition_block_rowEh:
 5101|   148k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 5102|   148k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (5102:7): [True: 0, False: 148k]
  ------------------
 5103|      0|    bi = 0;
 5104|      0|  }
 5105|   148k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 5106|   148k|}
_ZN3ada4idna13ccc_block_rowEh:
 5108|   315k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 5109|   315k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (5109:7): [True: 0, False: 315k]
  ------------------
 5110|      0|    bi = 0;
 5111|      0|  }
 5112|   315k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5113|   315k|}
_ZN3ada4idna16tables_are_readyEv:
 4978|  18.8k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4979|  18.8k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4980|  18.8k|}
idna.cc:_ZN3ada4idnaL19get_nfc_quick_checkEDi:
 5645|   115k|static nfc_quick_check get_nfc_quick_check(char32_t c) noexcept {
 5646|   115k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5646:7): [True: 0, False: 115k]
  ------------------
 5647|      0|    return nfc_quick_check::yes;
 5648|      0|  }
 5649|   115k|  return static_cast<nfc_quick_check>(
 5650|   115k|      nfc_qc_block_row(nfc_qc_index[c >> 8])[c % 256]);
 5651|   115k|}
_ZN3ada4idna16nfc_qc_block_rowEh:
 5122|   115k|inline const uint8_t* nfc_qc_block_row(uint8_t bi) noexcept {
 5123|   115k|  if (bi >= kNfcQcBlockRows) {
  ------------------
  |  Branch (5123:7): [True: 0, False: 115k]
  ------------------
 5124|      0|    bi = 0;
 5125|      0|  }
 5126|   115k|  return nfc_qc_block_flat + static_cast<size_t>(bi) * kNfcQcBlockCols;
 5127|   115k|}
idna.cc:_ZN3ada4idnaL12maybe_is_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5656|  4.06k|static bool maybe_is_nfc(std::u32string_view input) noexcept {
 5657|       |  // 1) A character whose decomposition starts with a code point that composes
 5658|       |  //    with the previous character (e.g. U+1611E U+16121).
 5659|  4.06k|  char32_t previous = 0x110000;  // none
 5660|  51.2k|  for (char32_t c : input) {
  ------------------
  |  Branch (5660:19): [True: 51.2k, False: 3.85k]
  ------------------
 5661|  51.2k|    if (decomposition_composes_with_previous(previous, c)) {
  ------------------
  |  Branch (5661:9): [True: 211, False: 51.0k]
  ------------------
 5662|    211|      return false;
 5663|    211|    }
 5664|  51.0k|    previous = c;
 5665|  51.0k|  }
 5666|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5667|       |  //    trailing class of the previous character's canonical decomposition so a
 5668|       |  //    composite starter followed by a lower-class mark is caught.
 5669|  3.85k|  uint8_t prev_ccc = 0;
 5670|  48.8k|  for (char32_t c : input) {
  ------------------
  |  Branch (5670:19): [True: 48.8k, False: 3.47k]
  ------------------
 5671|  48.8k|    uint8_t ccc = get_ccc(c);
 5672|  48.8k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5672:9): [True: 5.56k, False: 43.3k]
  |  Branch (5672:21): [True: 377, False: 5.18k]
  ------------------
 5673|    377|      return false;
 5674|    377|    }
 5675|  48.5k|    prev_ccc = trailing_ccc(c);
 5676|  48.5k|  }
 5677|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5678|  3.47k|  return !would_compose(input);
 5679|  3.85k|}
idna.cc:_ZN3ada4idnaL36decomposition_composes_with_previousEDiDi:
 5620|  51.2k|                                                 char32_t c) noexcept {
 5621|  51.2k|  const size_t length = canonical_decomp_length(c);
 5622|  51.2k|  if (length < 2 || previous >= 0x110000) {
  ------------------
  |  Branch (5622:7): [True: 48.0k, False: 3.28k]
  |  Branch (5622:21): [True: 422, False: 2.86k]
  ------------------
 5623|  48.4k|    return false;
 5624|  48.4k|  }
 5625|  2.86k|  const uint16_t* const decomposition =
 5626|  2.86k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5627|  2.86k|  const size_t base = decomposition[0] >> 2;
 5628|  2.86k|  if (base + length > decomposition_data_size) {
  ------------------
  |  Branch (5628:7): [True: 0, False: 2.86k]
  ------------------
 5629|      0|    return false;
 5630|      0|  }
 5631|  2.86k|  return has_composition(
 5632|  2.86k|      composition_block_row(composition_index[previous >> 8]) +
 5633|  2.86k|          (previous % 256),
 5634|  2.86k|      decomposition_data[base]);
 5635|  2.86k|}
idna.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5399|  99.8k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5400|  99.8k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5400:7): [True: 9.34k, False: 90.4k]
  ------------------
 5401|  9.34k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5401:7): [True: 4.38k, False: 4.96k]
  ------------------
 5402|       |    // Hangul precomposed syllables are NFC.
 5403|  4.38k|    return 0;
 5404|  4.38k|  }
 5405|  95.4k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5405:7): [True: 0, False: 95.4k]
  ------------------
 5406|      0|    return 0;
 5407|      0|  }
 5408|  95.4k|  const uint8_t di = decomposition_index[current_character >> 8];
 5409|  95.4k|  const uint16_t* const decomposition =
 5410|  95.4k|      decomposition_block_row(di) + (current_character % 256);
 5411|  95.4k|  size_t decomposition_length =
 5412|  95.4k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5413|  95.4k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5413:7): [True: 5.69k, False: 89.7k]
  |  Branch (5413:37): [True: 303, False: 5.39k]
  ------------------
 5414|    303|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5415|    303|  }
 5416|  95.4k|  return decomposition_length;
 5417|  95.4k|}
idna.cc:_ZN3ada4idnaL15has_compositionEPKtDi:
 5532|  8.99k|                            char32_t second) noexcept {
 5533|  8.99k|  int left = composition[0];
 5534|  8.99k|  int right = composition[1];
 5535|  8.99k|  if (left < 0 || right <= left ||
  ------------------
  |  Branch (5535:7): [True: 0, False: 8.99k]
  |  Branch (5535:19): [True: 1.64k, False: 7.34k]
  ------------------
 5536|  7.34k|      static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5536:7): [True: 0, False: 7.34k]
  ------------------
 5537|  1.64k|    return false;
 5538|  1.64k|  }
 5539|  17.5k|  while (left + 2 < right) {
  ------------------
  |  Branch (5539:10): [True: 10.1k, False: 7.34k]
  ------------------
 5540|  10.1k|    int middle = left + (((right - left) >> 1) & ~1);
 5541|  10.1k|    if (composition_data[static_cast<size_t>(middle)] <= second) {
  ------------------
  |  Branch (5541:9): [True: 2.73k, False: 7.41k]
  ------------------
 5542|  2.73k|      left = middle;
 5543|  2.73k|    }
 5544|  10.1k|    if (composition_data[static_cast<size_t>(middle)] >= second) {
  ------------------
  |  Branch (5544:9): [True: 7.71k, False: 2.43k]
  ------------------
 5545|  7.71k|      right = middle;
 5546|  7.71k|    }
 5547|  10.1k|  }
 5548|  7.34k|  return static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5548:10): [True: 7.34k, False: 0]
  ------------------
 5549|  7.34k|         composition_data[static_cast<size_t>(left)] == second;
  ------------------
  |  Branch (5549:10): [True: 1.25k, False: 6.09k]
  ------------------
 5550|  8.99k|}
idna.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5605|  48.5k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5606|  48.5k|  const size_t length = canonical_decomp_length(c);
 5607|  48.5k|  if (length == 0) {
  ------------------
  |  Branch (5607:7): [True: 46.3k, False: 2.10k]
  ------------------
 5608|  46.3k|    return get_ccc(c);
 5609|  46.3k|  }
 5610|  2.10k|  const uint16_t* const decomposition =
 5611|  2.10k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5612|  2.10k|  const size_t base = decomposition[0] >> 2;
 5613|  2.10k|  return get_ccc(decomposition_data[base + length - 1]);
 5614|  48.5k|}
idna.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5553|  3.47k|static bool would_compose(std::u32string_view input) noexcept {
 5554|  25.1k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5554:32): [True: 23.3k, False: 1.77k]
  ------------------
 5555|  23.3k|    const char32_t current = input[input_count];
 5556|  23.3k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5556:9): [True: 7.66k, False: 15.7k]
  |  Branch (5556:36): [True: 1.64k, False: 6.01k]
  ------------------
 5557|  1.64k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5557:11): [True: 1.57k, False: 74]
  ------------------
 5558|  1.57k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5558:11): [True: 750, False: 821]
  ------------------
 5559|    750|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5559:11): [True: 476, False: 274]
  ------------------
 5560|    476|        return true;
 5561|    476|      }
 5562|  1.16k|      ++input_count;
 5563|  1.16k|      continue;
 5564|  1.64k|    }
 5565|  21.7k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5565:9): [True: 3.32k, False: 18.4k]
  |  Branch (5565:36): [True: 1.85k, False: 1.46k]
  ------------------
 5566|  1.85k|      if ((current - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5566:11): [True: 1.24k, False: 614]
  ------------------
 5567|  1.24k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5567:11): [True: 1.13k, False: 104]
  ------------------
 5568|  1.13k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5568:11): [True: 859, False: 280]
  ------------------
 5569|    859|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5569:11): [True: 182, False: 677]
  ------------------
 5570|    182|        return true;
 5571|    182|      }
 5572|  1.67k|      ++input_count;
 5573|  1.67k|      continue;
 5574|  1.85k|    }
 5575|  19.8k|    if (current < 0x110000) {
  ------------------
  |  Branch (5575:9): [True: 19.8k, False: 0]
  ------------------
 5576|  19.8k|      const uint16_t* composition =
 5577|  19.8k|          composition_block_row(composition_index[current >> 8]) +
 5578|  19.8k|          (current % 256);
 5579|  19.8k|      int32_t previous_ccc = -1;
 5580|  19.8k|      size_t j = input_count;
 5581|  24.1k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5581:14): [True: 22.6k, False: 1.58k]
  ------------------
 5582|  22.6k|        uint8_t ccc = get_ccc(input[j + 1]);
 5583|  22.6k|        if (composition[1] != composition[0] && previous_ccc < ccc &&
  ------------------
  |  Branch (5583:13): [True: 6.43k, False: 16.1k]
  |  Branch (5583:49): [True: 6.12k, False: 311]
  ------------------
 5584|  6.12k|            has_composition(composition, input[j + 1])) {
  ------------------
  |  Branch (5584:13): [True: 1.04k, False: 5.08k]
  ------------------
 5585|  1.04k|          return true;
 5586|  1.04k|        }
 5587|  21.5k|        if (ccc == 0) {
  ------------------
  |  Branch (5587:13): [True: 17.2k, False: 4.30k]
  ------------------
 5588|  17.2k|          break;
 5589|  17.2k|        }
 5590|  4.30k|        previous_ccc = ccc;
 5591|  4.30k|      }
 5592|  18.8k|      input_count = j + 1;
 5593|  18.8k|      continue;
 5594|  19.8k|    }
 5595|      0|    ++input_count;
 5596|      0|  }
 5597|  1.77k|  return false;
 5598|  3.47k|}
_ZN3ada4idna21composition_block_rowEh:
 5115|  49.5k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5116|  49.5k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5116:7): [True: 0, False: 49.5k]
  ------------------
 5117|      0|    bi = 0;
 5118|      0|  }
 5119|  49.5k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5120|  49.5k|}
idna.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5853|   181k|static constexpr int32_t char_to_digit_value(char value) {
 5854|   181k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5854:7): [True: 136k, False: 44.9k]
  |  Branch (5854:23): [True: 136k, False: 406]
  ------------------
 5855|  45.3k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5855:7): [True: 40.1k, False: 5.16k]
  |  Branch (5855:23): [True: 38.8k, False: 1.37k]
  ------------------
 5856|  6.54k|  return -1;
 5857|  45.3k|}
idna.cc:_ZN3ada4idnaL5adaptEiib:
 5863|   138k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5864|   138k|  if (firsttime) {
  ------------------
  |  Branch (5864:7): [True: 24.0k, False: 114k]
  ------------------
 5865|  24.0k|    d = d / damp;
 5866|   114k|  } else {
 5867|   114k|    d = d / 2;
 5868|   114k|  }
 5869|   138k|  d += d / n;
 5870|   138k|  int32_t k = 0;
 5871|   164k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5871:10): [True: 26.1k, False: 138k]
  ------------------
 5872|  26.1k|    d /= base - tmin;
 5873|  26.1k|    k += base;
 5874|  26.1k|  }
 5875|   138k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5876|   138k|}
idna.cc:_ZN3ada4idnaL13digit_to_charEi:
 5859|  72.0k|static constexpr char digit_to_char(int32_t digit) {
 5860|  72.0k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5860:10): [True: 55.0k, False: 17.0k]
  ------------------
 5861|  72.0k|}
idna.cc:_ZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6260|  20.3k|static label_check check_label(const std::u32string_view label) {
 6261|  20.3k|  if (label.empty()) {
  ------------------
  |  Branch (6261:7): [True: 0, False: 20.3k]
  ------------------
 6262|      0|    return {true, false, true};
 6263|      0|  }
 6264|  20.3k|  if (!ensure_tables() || combining_ranges == nullptr || dir_index == nullptr ||
  ------------------
  |  Branch (6264:7): [True: 0, False: 20.3k]
  |  Branch (6264:27): [True: 0, False: 20.3k]
  |  Branch (6264:58): [True: 0, False: 20.3k]
  ------------------
 6265|  20.3k|      dir_block_flat == nullptr || joining_start == nullptr ||
  ------------------
  |  Branch (6265:7): [True: 0, False: 20.3k]
  |  Branch (6265:36): [True: 0, False: 20.3k]
  ------------------
 6266|  20.3k|      joining_final == nullptr || joining_value == nullptr) {
  ------------------
  |  Branch (6266:7): [True: 0, False: 20.3k]
  |  Branch (6266:35): [True: 0, False: 20.3k]
  ------------------
 6267|      0|    return {};
 6268|      0|  }
 6269|       |
 6270|       |  // An invalid RTL label still makes the domain a Bidi domain name, so `rtl`
 6271|       |  // is reported even when another criterion fails.
 6272|  20.3k|  uint32_t directions = 0;
 6273|  20.3k|  direction last = direction::NSM;  // last direction that is not NSM
 6274|   129k|  for (char32_t c : label) {
  ------------------
  |  Branch (6274:19): [True: 129k, False: 20.3k]
  ------------------
 6275|   129k|    const direction d = find_direction(c);
 6276|   129k|    directions |= 1u << d;
 6277|   129k|    if (d != direction::NSM) {
  ------------------
  |  Branch (6277:9): [True: 121k, False: 7.38k]
  ------------------
 6278|   121k|      last = d;
 6279|   121k|    }
 6280|   129k|  }
 6281|  20.3k|  const bool rtl = (directions & rtl_directions) != 0;
 6282|       |
 6283|       |  ///////////////
 6284|       |  // We have a normalization step which ensures that we are in NFC.
 6285|       |  // If we receive punycode, we normalize and check that the normalized
 6286|       |  // version matches the original.
 6287|       |  // --------------------------------------
 6288|       |  // The label must be in Unicode Normalization Form NFC.
 6289|       |
 6290|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 6291|       |  // ---------------------------------------
 6292|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 6293|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 6294|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 6295|       |
 6296|       |  // This is not necessary because we segment the
 6297|       |  // labels by '.'.
 6298|       |  // ---------------------------------------
 6299|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 6300|       |  // if (label.find('.') != std::string_view::npos) return false;
 6301|       |
 6302|       |  // The label must not begin with a combining mark.
 6303|       |  // Range membership via lower_bound on range end.
 6304|  20.3k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 6305|  20.3k|                                               combining_range_count};
 6306|  20.3k|  const auto comb_it = std::ranges::lower_bound(
 6307|  20.3k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 6308|  20.3k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (6308:7): [True: 20.2k, False: 115]
  |  Branch (6308:7): [True: 490, False: 19.8k]
  |  Branch (6308:37): [True: 490, False: 19.7k]
  ------------------
 6309|    490|    return {false, rtl, false};
 6310|    490|  }
 6311|       |  // We verify this next step as part of the mapping:
 6312|       |  // ---------------------------------------------
 6313|       |  // Each code point in the label must only have certain status values
 6314|       |  // according to Section 5, IDNA Mapping Table:
 6315|       |  // - For Transitional Processing, each value must be valid.
 6316|       |  // - For Nontransitional Processing, each value must be either valid or
 6317|       |  // deviation.
 6318|       |
 6319|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6320|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6321|       |  // Applications (IDNA) [IDNA2008].
 6322|  19.8k|  if (!is_contextj_valid(label)) {
  ------------------
  |  Branch (6322:7): [True: 1.29k, False: 18.5k]
  ------------------
 6323|  1.29k|    return {false, rtl, false};
 6324|  1.29k|  }
 6325|       |
 6326|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6327|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6328|       |  // Section 2.
 6329|       |
 6330|       |  // The following rule, consisting of six conditions, applies to labels
 6331|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6332|       |  // described in Section 3.  All of the conditions must be satisfied for
 6333|       |  // the rule to be satisfied.
 6334|       |  //
 6335|       |  //  1.  The first character must be a character with Bidi property L, R,
 6336|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6337|       |  //     has the L property, it is an LTR label.
 6338|       |  //
 6339|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6340|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6341|       |  //
 6342|       |  //   3.  In an RTL label, the end of the label must be a character with
 6343|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6344|       |  //       characters with Bidi property NSM.
 6345|       |  //
 6346|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6347|       |  //       vice versa.
 6348|       |  //
 6349|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6350|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6351|       |  //
 6352|       |  //   6.  In an LTR label, the end of the label must be a character with
 6353|       |  //       Bidi property L or EN, followed by zero or more characters with
 6354|       |  //       Bidi property NSM.
 6355|       |  //
 6356|       |  // Every character after the last non-NSM character is NSM, which both the
 6357|       |  // LTR and the RTL rules allow, so conditions 2, 4 and 5 only depend on the
 6358|       |  // set of directions in the whole label.
 6359|  18.5k|  if (last == direction::NSM) {
  ------------------
  |  Branch (6359:7): [True: 0, False: 18.5k]
  ------------------
 6360|      0|    return {false, rtl, false};
 6361|      0|  }
 6362|       |
 6363|  18.5k|  label_check result{true, rtl, false};
 6364|  18.5k|  const direction first = find_direction(label[0]);
 6365|  18.5k|  if (first == direction::L) {
  ------------------
  |  Branch (6365:7): [True: 11.0k, False: 7.52k]
  ------------------
 6366|  11.0k|    constexpr uint32_t ltr_allowed =
 6367|  11.0k|        (1u << direction::L) | (1u << direction::EN) | (1u << direction::ES) |
 6368|  11.0k|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6369|  11.0k|        (1u << direction::BN) | (1u << direction::NSM);
 6370|  11.0k|    result.bidi = (directions & ~ltr_allowed) == 0 &&
  ------------------
  |  Branch (6370:19): [True: 10.0k, False: 956]
  ------------------
 6371|  10.0k|                  (last == direction::L || last == direction::EN);
  ------------------
  |  Branch (6371:20): [True: 9.18k, False: 868]
  |  Branch (6371:44): [True: 402, False: 466]
  ------------------
 6372|  11.0k|  } else if (first == direction::R || first == direction::AL) {
  ------------------
  |  Branch (6372:14): [True: 1.26k, False: 6.26k]
  |  Branch (6372:39): [True: 1.53k, False: 4.73k]
  ------------------
 6373|  2.79k|    constexpr uint32_t rtl_allowed =
 6374|  2.79k|        rtl_directions | (1u << direction::EN) | (1u << direction::ES) |
 6375|  2.79k|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6376|  2.79k|        (1u << direction::BN) | (1u << direction::NSM);
 6377|  2.79k|    constexpr uint32_t en_and_an =
 6378|  2.79k|        (1u << direction::EN) | (1u << direction::AN);
 6379|  2.79k|    result.bidi = (directions & ~rtl_allowed) == 0 &&
  ------------------
  |  Branch (6379:19): [True: 2.46k, False: 331]
  ------------------
 6380|  2.46k|                  (directions & en_and_an) != en_and_an &&
  ------------------
  |  Branch (6380:19): [True: 2.34k, False: 119]
  ------------------
 6381|  2.34k|                  (last == direction::R || last == direction::AL ||
  ------------------
  |  Branch (6381:20): [True: 923, False: 1.42k]
  |  Branch (6381:44): [True: 925, False: 498]
  ------------------
 6382|    498|                   last == direction::AN || last == direction::EN);
  ------------------
  |  Branch (6382:20): [True: 209, False: 289]
  |  Branch (6382:45): [True: 238, False: 51]
  ------------------
 6383|  2.79k|  }
 6384|  18.5k|  return result;
 6385|  18.5k|}
idna.cc:_ZN3ada4idnaL14find_directionEj:
 6165|   169k|inline static direction find_direction(uint32_t code_point) noexcept {
 6166|   169k|  if (code_point >= 0x110000) {
  ------------------
  |  Branch (6166:7): [True: 2.05k, False: 167k]
  ------------------
 6167|  2.05k|    return direction::NONE;
 6168|  2.05k|  }
 6169|   167k|  return static_cast<direction>(
 6170|   167k|      dir_block_row(dir_index[code_point >> 8])[code_point & 0xFF]);
 6171|   169k|}
_ZN3ada4idna13dir_block_rowEh:
 5129|   167k|inline const uint8_t* dir_block_row(uint8_t bi) noexcept {
 5130|   167k|  if (bi >= kDirBlockRows) {
  ------------------
  |  Branch (5130:7): [True: 0, False: 167k]
  ------------------
 5131|      0|    bi = 0;
 5132|      0|  }
 5133|   167k|  return dir_block_flat + static_cast<size_t>(bi) * kDirBlockCols;
 5134|   167k|}
idna.cc:_ZZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 6307|   174k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
idna.cc:_ZN3ada4idnaL17is_contextj_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6182|  19.8k|inline static bool is_contextj_valid(std::u32string_view label) noexcept {
 6183|  19.8k|  constexpr uint8_t virama_ccc = 9;
 6184|   144k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6184:22): [True: 125k, False: 18.5k]
  ------------------
 6185|   125k|    if (label[i] != 0x200C && label[i] != 0x200D) {
  ------------------
  |  Branch (6185:9): [True: 124k, False: 1.68k]
  |  Branch (6185:31): [True: 123k, False: 270]
  ------------------
 6186|   123k|      continue;
 6187|   123k|    }
 6188|       |    // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
 6189|  1.95k|    if (i > 0 && get_ccc(label[i - 1]) == virama_ccc) {
  ------------------
  |  Branch (6189:9): [True: 1.45k, False: 500]
  |  Branch (6189:18): [True: 194, False: 1.26k]
  ------------------
 6190|    194|      continue;
 6191|    194|    }
 6192|  1.76k|    if (label[i] == 0x200D) {
  ------------------
  |  Branch (6192:9): [True: 267, False: 1.49k]
  ------------------
 6193|    267|      return false;
 6194|    267|    }
 6195|       |    // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
 6196|       |    //    (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
 6197|  1.49k|    joining_type before = joining_type::U;
 6198|  1.98k|    for (size_t j = i; j > 0;) {
  ------------------
  |  Branch (6198:24): [True: 1.64k, False: 339]
  ------------------
 6199|  1.64k|      before = find_joining_type(label[--j]);
 6200|  1.64k|      if (before != joining_type::T) {
  ------------------
  |  Branch (6200:11): [True: 1.15k, False: 494]
  ------------------
 6201|  1.15k|        break;
 6202|  1.15k|      }
 6203|  1.64k|    }
 6204|  1.49k|    if (before != joining_type::L && before != joining_type::D) {
  ------------------
  |  Branch (6204:9): [True: 1.41k, False: 80]
  |  Branch (6204:38): [True: 648, False: 765]
  ------------------
 6205|    648|      return false;
 6206|    648|    }
 6207|    845|    joining_type after = joining_type::U;
 6208|  1.47k|    for (size_t j = i + 1; j < label.size(); j++) {
  ------------------
  |  Branch (6208:28): [True: 1.20k, False: 270]
  ------------------
 6209|  1.20k|      after = find_joining_type(label[j]);
 6210|  1.20k|      if (after != joining_type::T) {
  ------------------
  |  Branch (6210:11): [True: 575, False: 630]
  ------------------
 6211|    575|        break;
 6212|    575|      }
 6213|  1.20k|    }
 6214|    845|    if (after != joining_type::R && after != joining_type::D) {
  ------------------
  |  Branch (6214:9): [True: 637, False: 208]
  |  Branch (6214:37): [True: 382, False: 255]
  ------------------
 6215|    382|      return false;
 6216|    382|    }
 6217|    845|  }
 6218|  18.5k|  return true;
 6219|  19.8k|}
idna.cc:_ZN3ada4idnaL17find_joining_typeEj:
 6174|  2.85k|inline static joining_type find_joining_type(uint32_t code_point) noexcept {
 6175|  2.85k|  size_t i =
 6176|  2.85k|      find_range(joining_start, joining_final, joining_table_count, code_point);
 6177|  2.85k|  return i == joining_table_count ? joining_type::U
  ------------------
  |  Branch (6177:10): [True: 415, False: 2.43k]
  ------------------
 6178|  2.85k|                                  : static_cast<joining_type>(joining_value[i]);
 6179|  2.85k|}
idna.cc:_ZN3ada4idnaL10find_rangeEPKjS2_mj:
 6151|  2.85k|                                size_t count, uint32_t code_point) noexcept {
 6152|  2.85k|  size_t lo = 0, hi = count;
 6153|  29.1k|  while (lo < hi) {
  ------------------
  |  Branch (6153:10): [True: 26.2k, False: 2.85k]
  ------------------
 6154|  26.2k|    size_t mid = lo + (hi - lo) / 2;
 6155|  26.2k|    if (last[mid] < code_point) {
  ------------------
  |  Branch (6155:9): [True: 11.3k, False: 14.9k]
  ------------------
 6156|  11.3k|      lo = mid + 1;
 6157|  14.9k|    } else {
 6158|  14.9k|      hi = mid;
 6159|  14.9k|    }
 6160|  26.2k|  }
 6161|  2.85k|  return lo < count && code_point >= start[lo] ? lo : count;
  ------------------
  |  Branch (6161:10): [True: 2.81k, False: 34]
  |  Branch (6161:24): [True: 2.43k, False: 381]
  ------------------
 6162|  2.85k|}
_ZNK3ada4idna11label_check2okEb:
 6254|  21.1k|  [[nodiscard]] bool ok(bool bidi_domain) const noexcept {
 6255|  21.1k|    return valid && (bidi || !(bidi_domain || rtl));
  ------------------
  |  Branch (6255:12): [True: 19.6k, False: 1.51k]
  |  Branch (6255:22): [True: 12.6k, False: 7.07k]
  |  Branch (6255:32): [True: 3.98k, False: 3.09k]
  |  Branch (6255:47): [True: 318, False: 2.77k]
  ------------------
 6256|  21.1k|  }
_ZN3ada4idna30is_forbidden_domain_code_pointEc:
 6514|  52.5k|inline bool is_forbidden_domain_code_point(const char c) noexcept {
 6515|  52.5k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 6516|  52.5k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6490|  76.5k|bool constexpr is_ascii(std::string_view view) {
 6491|   878k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6491:18): [True: 878k, False: 48.9k]
  ------------------
 6492|   878k|    if (c >= 0x80) {
  ------------------
  |  Branch (6492:9): [True: 27.6k, False: 850k]
  ------------------
 6493|  27.6k|      return false;
 6494|  27.6k|    }
 6495|   878k|  }
 6496|  48.9k|  return true;
 6497|  76.5k|}
idna.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6527|  8.92k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6528|  8.92k|  out.assign(ut8_string);
 6529|  8.92k|  ascii_map(out.data(), out.size());
 6530|  8.92k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6481|  27.4k|bool constexpr is_ascii(std::u32string_view view) {
 6482|  57.1k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6482:19): [True: 57.1k, False: 3.85k]
  ------------------
 6483|  57.1k|    if (c >= 0x80) {
  ------------------
  |  Branch (6483:9): [True: 23.6k, False: 33.5k]
  ------------------
 6484|  23.6k|      return false;
 6485|  23.6k|    }
 6486|  57.1k|  }
 6487|  3.85k|  return true;
 6488|  27.4k|}
idna.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6543|  8.07k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6544|  8.07k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6544:10): [True: 4.09k, False: 3.98k]
  |  Branch (6544:31): [True: 1.47k, False: 2.62k]
  |  Branch (6544:51): [True: 1.13k, False: 344]
  ------------------
 6545|  1.13k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6545:10): [True: 1.01k, False: 114]
  |  Branch (6545:30): [True: 915, False: 101]
  ------------------
 6546|  8.07k|}
idna.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6533|  2.61k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6534|  2.61k|  const size_t old = out.size();
 6535|  2.61k|  out.resize(old + label.size());
 6536|  2.61k|  char* dest = out.data() + old;
 6537|  16.7k|  for (char32_t c : label) {
  ------------------
  |  Branch (6537:19): [True: 16.7k, False: 2.61k]
  ------------------
 6538|  16.7k|    *dest++ = static_cast<char>(c);
 6539|  16.7k|  }
 6540|  2.61k|}
idna.cc:_ZZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEENK3$_0clERKNS0_11label_checkE:
 6609|  7.88k|  auto accept = [&](const label_check& check) {
 6610|  7.88k|    bidi_domain = bidi_domain || check.rtl;
  ------------------
  |  Branch (6610:19): [True: 1.72k, False: 6.15k]
  |  Branch (6610:34): [True: 477, False: 5.67k]
  ------------------
 6611|  7.88k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
  ------------------
  |  Branch (6611:23): [True: 5.54k, False: 2.33k]
  |  Branch (6611:42): [True: 4.61k, False: 929]
  ------------------
 6612|  7.88k|    return check.valid && (bidi_rule_holds || !bidi_domain);
  ------------------
  |  Branch (6612:12): [True: 7.61k, False: 271]
  |  Branch (6612:28): [True: 4.61k, False: 2.99k]
  |  Branch (6612:47): [True: 2.83k, False: 162]
  ------------------
 6613|  7.88k|  };
idna.cc:_ZN3ada4idnaL14convert_labelsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEb:
 6821|  9.80k|                                 bool bidi_domain) {
 6822|  9.80k|  conversion result{bidi_domain, false};
 6823|  9.80k|  size_t label_start = 0;
 6824|  9.80k|  std::u32string tmp_buffer;
 6825|  9.80k|  std::u32string post_map;
 6826|  49.2k|  while (label_start < input.size()) {
  ------------------
  |  Branch (6826:10): [True: 39.4k, False: 9.80k]
  ------------------
 6827|  39.4k|    size_t loc_dot = input.find('.', label_start);
 6828|  39.4k|    bool is_last_label = (loc_dot == std::string_view::npos);
 6829|  39.4k|    size_t label_size =
 6830|  39.4k|        is_last_label ? input.size() - label_start : loc_dot - label_start;
  ------------------
  |  Branch (6830:9): [True: 9.62k, False: 29.8k]
  ------------------
 6831|  39.4k|    auto label_view = std::string_view(input.data() + label_start, label_size);
 6832|       |
 6833|  39.4k|    if (label_view.starts_with("xn--") && ada::idna::is_ascii(label_view)) {
  ------------------
  |  Branch (6833:9): [True: 18.6k, False: 20.8k]
  |  Branch (6833:43): [True: 18.1k, False: 500]
  ------------------
 6834|  18.1k|      label_view.remove_prefix(4);
 6835|  18.1k|      tmp_buffer.clear();
 6836|  18.1k|      if (ada::idna::punycode_to_utf32(label_view, tmp_buffer)) {
  ------------------
  |  Branch (6836:11): [True: 16.5k, False: 1.63k]
  ------------------
 6837|       |        // Per UTS #46, the decoded label must be re-validated. Reject decodings
 6838|       |        // that are pure ASCII (xn-- encoding of an ASCII-only label), or whose
 6839|       |        // mapping/normalization is not stable, or that fail label validity.
 6840|       |        // A rejected label still makes the domain a Bidi domain name when it
 6841|       |        // decodes to an RTL label.
 6842|  16.5k|        bool accept_decoded = false;
 6843|  16.5k|        bool rtl = false;
 6844|  16.5k|        if (ada::idna::is_ascii(tmp_buffer)) {
  ------------------
  |  Branch (6844:13): [True: 1.83k, False: 14.6k]
  ------------------
 6845|       |          // ASCII has no R, AL or AN character.
 6846|  14.6k|        } else {
 6847|  14.6k|          post_map.clear();
 6848|  14.6k|          if (!ada::idna::map(tmp_buffer, post_map) || post_map != tmp_buffer ||
  ------------------
  |  Branch (6848:15): [True: 1.42k, False: 13.2k]
  |  Branch (6848:56): [True: 1.06k, False: 12.1k]
  ------------------
 6849|  12.1k|              !ada::idna::normalize(post_map) || post_map != tmp_buffer ||
  ------------------
  |  Branch (6849:15): [True: 0, False: 12.1k]
  |  Branch (6849:50): [True: 2.63k, False: 9.55k]
  ------------------
 6850|  9.55k|              post_map.empty()) {
  ------------------
  |  Branch (6850:15): [True: 0, False: 9.55k]
  ------------------
 6851|  5.12k|            rtl = label_contains_rtl(tmp_buffer);
 6852|  9.55k|          } else {
 6853|  9.55k|            const label_check check = check_label(post_map);
 6854|  9.55k|            rtl = check.rtl;
 6855|  9.55k|            accept_decoded = check.ok(result.bidi_domain);
 6856|  9.55k|            if (accept_decoded && !check.ok(true)) {
  ------------------
  |  Branch (6856:17): [True: 6.31k, False: 3.24k]
  |  Branch (6856:35): [True: 2.35k, False: 3.96k]
  ------------------
 6857|  2.35k|              result.needs_bidi_pass = true;
 6858|  2.35k|            }
 6859|  9.55k|          }
 6860|  14.6k|        }
 6861|  16.5k|        result.bidi_domain = result.bidi_domain || rtl;
  ------------------
  |  Branch (6861:30): [True: 6.39k, False: 10.1k]
  |  Branch (6861:52): [True: 1.05k, False: 9.06k]
  ------------------
 6862|       |
 6863|  16.5k|        if (accept_decoded) {
  ------------------
  |  Branch (6863:13): [True: 6.31k, False: 10.2k]
  ------------------
 6864|       |#ifdef ADA_USE_SIMDUTF
 6865|       |          auto utf8_size = simdutf::utf8_length_from_utf32(tmp_buffer.data(),
 6866|       |                                                           tmp_buffer.size());
 6867|       |          size_t old_size = output.size();
 6868|       |          output.resize(old_size + utf8_size);
 6869|       |          size_t written = simdutf::convert_utf32_to_utf8(
 6870|       |              tmp_buffer.data(), tmp_buffer.size(), output.data() + old_size);
 6871|       |          if (written != utf8_size) {
 6872|       |            output.resize(old_size);
 6873|       |            output.append(
 6874|       |                std::string_view(input.data() + label_start, label_size));
 6875|       |          }
 6876|       |#else
 6877|  6.31k|          auto utf8_size = ada::idna::utf8_length_from_utf32(tmp_buffer.data(),
 6878|  6.31k|                                                             tmp_buffer.size());
 6879|  6.31k|          size_t old_size = output.size();
 6880|  6.31k|          output.resize(old_size + utf8_size);
 6881|  6.31k|          size_t written = ada::idna::utf32_to_utf8(
 6882|  6.31k|              tmp_buffer.data(), tmp_buffer.size(), output.data() + old_size);
 6883|  6.31k|          if (written != utf8_size) {
  ------------------
  |  Branch (6883:15): [True: 0, False: 6.31k]
  ------------------
 6884|      0|            output.resize(old_size);
 6885|      0|            output.append(
 6886|      0|                std::string_view(input.data() + label_start, label_size));
 6887|      0|          }
 6888|  6.31k|#endif
 6889|  10.2k|        } else {
 6890|       |          // ToUnicode never fails. If any step fails, return the original
 6891|       |          // input sequence for the label.
 6892|  10.2k|          output.append(
 6893|  10.2k|              std::string_view(input.data() + label_start, label_size));
 6894|  10.2k|        }
 6895|  16.5k|      } else {
 6896|  1.63k|        output.append(std::string_view(input.data() + label_start, label_size));
 6897|  1.63k|      }
 6898|  21.3k|    } else {
 6899|  21.3k|      if (!result.bidi_domain && !ada::idna::is_ascii(label_view) &&
  ------------------
  |  Branch (6899:11): [True: 17.3k, False: 3.94k]
  |  Branch (6899:34): [True: 12.3k, False: 4.99k]
  ------------------
 6900|  12.3k|          utf8_label_contains_rtl(label_view, tmp_buffer)) {
  ------------------
  |  Branch (6900:11): [True: 1.05k, False: 11.3k]
  ------------------
 6901|  1.05k|        result.bidi_domain = true;
 6902|  1.05k|      }
 6903|  21.3k|      output.append(label_view);
 6904|  21.3k|    }
 6905|       |
 6906|  39.4k|    if (!is_last_label) {
  ------------------
  |  Branch (6906:9): [True: 29.8k, False: 9.62k]
  ------------------
 6907|  29.8k|      output.push_back('.');
 6908|  29.8k|    }
 6909|       |
 6910|  39.4k|    label_start += label_size + 1;
 6911|  39.4k|  }
 6912|  9.80k|  return result;
 6913|  9.80k|}
idna.cc:_ZN3ada4idnaL18label_contains_rtlENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6228|  7.50k|inline static bool label_contains_rtl(std::u32string_view label) noexcept {
 6229|  7.50k|  if (label.empty() || !ensure_tables() || dir_index == nullptr ||
  ------------------
  |  Branch (6229:7): [True: 0, False: 7.50k]
  |  Branch (6229:24): [True: 0, False: 7.50k]
  |  Branch (6229:44): [True: 0, False: 7.50k]
  ------------------
 6230|  7.50k|      dir_block_flat == nullptr) {
  ------------------
  |  Branch (6230:7): [True: 0, False: 7.50k]
  ------------------
 6231|      0|    return false;
 6232|      0|  }
 6233|  32.6k|  for (char32_t c : label) {
  ------------------
  |  Branch (6233:19): [True: 32.6k, False: 5.94k]
  ------------------
 6234|  32.6k|    if (c >= first_rtl_code_point &&
  ------------------
  |  Branch (6234:9): [True: 22.0k, False: 10.6k]
  ------------------
 6235|  22.0k|        ((1u << find_direction(c)) & rtl_directions) != 0) {
  ------------------
  |  Branch (6235:9): [True: 1.55k, False: 20.5k]
  ------------------
 6236|  1.55k|      return true;
 6237|  1.55k|    }
 6238|  32.6k|  }
 6239|  5.94k|  return false;
 6240|  7.50k|}
idna.cc:_ZN3ada4idnaL23utf8_label_contains_rtlENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 6793|  12.3k|                                    std::u32string& buffer) {
 6794|  12.3k|  if (std::ranges::none_of(label, is_rtl_lead_byte)) {
  ------------------
  |  Branch (6794:7): [True: 7.69k, False: 4.66k]
  ------------------
 6795|  7.69k|    return false;
 6796|  7.69k|  }
 6797|       |  // A label decodes to at most one code point per byte.
 6798|  4.66k|  char32_t stack_buffer[64];
 6799|  4.66k|  char32_t* decoded = stack_buffer;
 6800|  4.66k|  if (label.size() > std::size(stack_buffer)) {
  ------------------
  |  Branch (6800:7): [True: 173, False: 4.49k]
  ------------------
 6801|    173|    buffer.resize(label.size());
 6802|    173|    decoded = buffer.data();
 6803|    173|  }
 6804|  4.66k|  const size_t written = utf8_to_utf32(label.data(), label.size(), decoded);
 6805|  4.66k|  return written != 0 && label_contains_rtl({decoded, written});
  ------------------
  |  Branch (6805:10): [True: 2.38k, False: 2.28k]
  |  Branch (6805:26): [True: 1.05k, False: 1.32k]
  ------------------
 6806|  12.3k|}
_ZN3ada4idna16is_rtl_lead_byteEc:
 6784|  61.3k|constexpr bool is_rtl_lead_byte(char byte) noexcept {
 6785|  61.3k|  const auto b = static_cast<uint8_t>(byte);
 6786|  61.3k|  return b >= 0xD6 && (b <= 0xE0 || b == 0xE2 || b == 0xEF || b == 0xF0);
  ------------------
  |  Branch (6786:10): [True: 15.9k, False: 45.4k]
  |  Branch (6786:24): [True: 2.09k, False: 13.8k]
  |  Branch (6786:37): [True: 641, False: 13.1k]
  |  Branch (6786:50): [True: 929, False: 12.2k]
  |  Branch (6786:63): [True: 1.00k, False: 11.2k]
  ------------------
 6787|  61.3k|}
idna.cc:_ZN3ada4idnaL29ascii_label_fails_bidi_domainENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 6773|  2.42k|                                          std::u32string& buffer) {
 6774|  2.42k|  buffer.resize(label.size());
 6775|  10.7k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6775:22): [True: 8.32k, False: 2.42k]
  ------------------
 6776|  8.32k|    buffer[i] = static_cast<unsigned char>(label[i]);
 6777|  8.32k|  }
 6778|  2.42k|  const label_check check = check_label(buffer);
 6779|  2.42k|  return check.ok(false) && !check.ok(true);
  ------------------
  |  Branch (6779:10): [True: 2.42k, False: 0]
  |  Branch (6779:29): [True: 127, False: 2.30k]
  ------------------
 6780|  2.42k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  102|  4.74k|    std::string_view input) noexcept {
  103|  4.74k|  if (input.empty()) return false;
  ------------------
  |  Branch (103:7): [True: 4.17k, False: 561]
  ------------------
  104|    561|  if (input.back() == '.') {
  ------------------
  |  Branch (104:7): [True: 91, False: 470]
  ------------------
  105|     91|    if (input.size() > 254) return false;
  ------------------
  |  Branch (105:9): [True: 7, False: 84]
  ------------------
  106|    470|  } else if (input.size() > 253)
  ------------------
  |  Branch (106:14): [True: 72, False: 398]
  ------------------
  107|     72|    return false;
  108|       |
  109|    482|  size_t start = 0;
  110|  2.16k|  while (start < input.size()) {
  ------------------
  |  Branch (110:10): [True: 1.75k, False: 413]
  ------------------
  111|  1.75k|    auto dot_location = input.find('.', start);
  112|       |    // If not found, it's likely the end of the domain
  113|  1.75k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (113:9): [True: 382, False: 1.37k]
  ------------------
  114|       |
  115|  1.75k|    auto label_size = dot_location - start;
  116|  1.75k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (116:9): [True: 38, False: 1.71k]
  |  Branch (116:28): [True: 31, False: 1.68k]
  ------------------
  117|       |
  118|  1.68k|    start = dot_location + 1;
  119|  1.68k|  }
  120|       |
  121|    413|  return true;
  122|    482|}

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

LLVMFuzzerTestOneInput:
    9|  4.56k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   10|  4.56k|  FuzzedDataProvider fdp(data, size);
   11|  4.56k|  std::string source = fdp.ConsumeRandomLengthString(256);
   12|  4.56k|  std::string source2 = fdp.ConsumeRandomLengthString(64);
   13|       |
   14|       |  /**
   15|       |   * High-level IDNA API
   16|       |   */
   17|  4.56k|  std::string ascii_result = ada::idna::to_ascii(source);
   18|  4.56k|  std::string unicode_result = ada::idna::to_unicode(source);
   19|       |
   20|       |  // Avoid dead-code elimination
   21|  4.56k|  volatile size_t length = 0;
   22|  4.56k|  length += ascii_result.size();
   23|  4.56k|  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.56k|  if (!ascii_result.empty()) {
  ------------------
  |  Branch (29:7): [True: 2.76k, False: 1.79k]
  ------------------
   30|  2.76k|    std::string roundtrip = ada::idna::to_unicode(ascii_result);
   31|  2.76k|    length += roundtrip.size();
   32|  2.76k|  }
   33|       |
   34|       |  /**
   35|       |   * Punycode functions
   36|       |   */
   37|  4.56k|  {
   38|  4.56k|    std::u32string utf32_out;
   39|       |    // punycode_to_utf32: source can be any string (it's a punycode label)
   40|  4.56k|    bool punycode_ok = ada::idna::punycode_to_utf32(source, utf32_out);
   41|  4.56k|    length += utf32_out.size();
   42|       |
   43|       |    // verify_punycode: checks if source is valid punycode
   44|  4.56k|    volatile bool is_valid_punycode = ada::idna::verify_punycode(source);
   45|  4.56k|    (void)is_valid_punycode;
   46|       |
   47|       |    // utf32_to_punycode: round-trip if punycode_to_utf32 succeeded
   48|  4.56k|    if (punycode_ok && !utf32_out.empty()) {
  ------------------
  |  Branch (48:9): [True: 1.32k, False: 3.23k]
  |  Branch (48:24): [True: 798, False: 523]
  ------------------
   49|    798|      std::string punycode_back;
   50|    798|      volatile bool encode_ok =
   51|    798|          ada::idna::utf32_to_punycode(utf32_out, punycode_back);
   52|    798|      length += punycode_back.size();
   53|    798|      (void)encode_ok;
   54|    798|    }
   55|  4.56k|  }
   56|       |
   57|       |  /**
   58|       |   * Unicode transcoding
   59|       |   */
   60|  4.56k|  {
   61|       |    // UTF-8 to UTF-32 conversion
   62|  4.56k|    size_t utf32_len =
   63|  4.56k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
   64|  4.56k|    if (utf32_len > 0 && utf32_len < 1024) {
  ------------------
  |  Branch (64:9): [True: 4.01k, False: 542]
  |  Branch (64:26): [True: 4.01k, False: 0]
  ------------------
   65|  4.01k|      std::vector<char32_t> utf32_buf(utf32_len + 1, 0);
   66|  4.01k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
   67|  4.01k|                                               utf32_buf.data());
   68|  4.01k|      length += actual;
   69|       |
   70|       |      // UTF-32 to UTF-8 round-trip
   71|  4.01k|      if (actual > 0) {
  ------------------
  |  Branch (71:11): [True: 3.68k, False: 332]
  ------------------
   72|  3.68k|        size_t utf8_len =
   73|  3.68k|            ada::idna::utf8_length_from_utf32(utf32_buf.data(), actual);
   74|  3.68k|        if (utf8_len > 0 && utf8_len < 4096) {
  ------------------
  |  Branch (74:13): [True: 3.68k, False: 0]
  |  Branch (74:29): [True: 3.68k, False: 0]
  ------------------
   75|  3.68k|          std::string utf8_back(utf8_len, '\0');
   76|  3.68k|          size_t written = ada::idna::utf32_to_utf8(utf32_buf.data(), actual,
   77|  3.68k|                                                    utf8_back.data());
   78|  3.68k|          length += written;
   79|  3.68k|        }
   80|  3.68k|      }
   81|  4.01k|    }
   82|  4.56k|  }
   83|       |
   84|       |  /**
   85|       |   * IDNA label validation
   86|       |   */
   87|  4.56k|  {
   88|       |    // is_label_valid requires a UTF-32 string
   89|  4.56k|    std::u32string utf32_label;
   90|  4.56k|    bool ok = ada::idna::punycode_to_utf32(source2, utf32_label);
   91|  4.56k|    if (ok && !utf32_label.empty()) {
  ------------------
  |  Branch (91:9): [True: 4.42k, False: 138]
  |  Branch (91:15): [True: 160, False: 4.26k]
  ------------------
   92|    160|      volatile bool label_valid = ada::idna::is_label_valid(utf32_label);
   93|    160|      (void)label_valid;
   94|    160|    }
   95|       |
   96|       |    // Also test is_label_valid with direct ASCII-to-UTF32 conversion
   97|  4.56k|    std::u32string ascii_label(source2.begin(), source2.end());
   98|  4.56k|    if (!ascii_label.empty()) {
  ------------------
  |  Branch (98:9): [True: 298, False: 4.26k]
  ------------------
   99|    298|      volatile bool ascii_label_valid = ada::idna::is_label_valid(ascii_label);
  100|    298|      (void)ascii_label_valid;
  101|    298|    }
  102|  4.56k|  }
  103|       |
  104|       |  /**
  105|       |   * IDNA mapping
  106|       |   */
  107|  4.56k|  {
  108|       |    // ASCII mapping: just lowercases ASCII characters
  109|  4.56k|    std::string ascii_copy = source;
  110|  4.56k|    ada::idna::ascii_map(ascii_copy.data(), ascii_copy.size());
  111|  4.56k|    length += ascii_copy.size();
  112|       |
  113|       |    // Unicode mapping: maps UTF-32 characters according to IDNA
  114|  4.56k|    size_t utf32_len =
  115|  4.56k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
  116|  4.56k|    if (utf32_len > 0 && utf32_len < 256) {
  ------------------
  |  Branch (116:9): [True: 4.01k, False: 542]
  |  Branch (116:26): [True: 4.00k, False: 10]
  ------------------
  117|  4.00k|      std::u32string utf32_input(utf32_len, 0);
  118|  4.00k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
  119|  4.00k|                                               utf32_input.data());
  120|  4.00k|      if (actual > 0) {
  ------------------
  |  Branch (120:11): [True: 3.68k, False: 327]
  ------------------
  121|  3.68k|        utf32_input.resize(actual);
  122|  3.68k|        std::u32string mapped = ada::idna::map(utf32_input);
  123|  3.68k|        length += mapped.size();
  124|  3.68k|      }
  125|  4.00k|    }
  126|  4.56k|  }
  127|       |
  128|       |  /**
  129|       |   * Domain code point validation
  130|       |   */
  131|  4.56k|  {
  132|  4.56k|    volatile bool has_forbidden =
  133|  4.56k|        ada::idna::contains_forbidden_domain_code_point(source);
  134|  4.56k|    (void)has_forbidden;
  135|       |
  136|       |    // is_ascii checks
  137|  4.56k|    volatile bool is_ascii_str =
  138|  4.56k|        ada::idna::is_ascii(std::string_view(source.data(), source.size()));
  139|  4.56k|    (void)is_ascii_str;
  140|  4.56k|  }
  141|       |
  142|       |  /**
  143|       |   * Normalization
  144|       |   */
  145|  4.56k|  {
  146|  4.56k|    size_t utf32_len =
  147|  4.56k|        ada::idna::utf32_length_from_utf8(source.data(), source.size());
  148|  4.56k|    if (utf32_len > 0 && utf32_len < 256) {
  ------------------
  |  Branch (148:9): [True: 4.01k, False: 542]
  |  Branch (148:26): [True: 4.00k, False: 10]
  ------------------
  149|  4.00k|      std::u32string utf32_input(utf32_len, 0);
  150|  4.00k|      size_t actual = ada::idna::utf8_to_utf32(source.data(), source.size(),
  151|  4.00k|                                               utf32_input.data());
  152|  4.00k|      if (actual > 0) {
  ------------------
  |  Branch (152:11): [True: 3.68k, False: 327]
  ------------------
  153|  3.68k|        utf32_input.resize(actual);
  154|  3.68k|        ada::idna::normalize(utf32_input);
  155|  3.68k|        length += utf32_input.size();
  156|  3.68k|      }
  157|  4.00k|    }
  158|  4.56k|  }
  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.56k|  {
  173|  4.56k|    if (!ascii_result.empty()) {
  ------------------
  |  Branch (173:9): [True: 2.76k, False: 1.79k]
  ------------------
  174|  2.76k|      std::string ascii_result2 = ada::idna::to_ascii(ascii_result);
  175|  2.76k|      if (!ascii_result2.empty() && ascii_result2 != ascii_result) {
  ------------------
  |  Branch (175:11): [True: 2.76k, False: 0]
  |  Branch (175:37): [True: 0, False: 2.76k]
  ------------------
  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.76k|    }
  183|  4.56k|  }
  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.56k|  {
  193|  4.56k|    if (!unicode_result.empty()) {
  ------------------
  |  Branch (193:9): [True: 4.03k, False: 523]
  ------------------
  194|  4.03k|      std::string unicode_result2 = ada::idna::to_unicode(unicode_result);
  195|  4.03k|      if (!unicode_result2.empty() && unicode_result2 != unicode_result) {
  ------------------
  |  Branch (195:11): [True: 4.03k, False: 0]
  |  Branch (195:39): [True: 0, False: 4.03k]
  ------------------
  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|  4.03k|    }
  203|  4.56k|  }
  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.56k|  {
  214|  4.56k|    std::string long_domain = fdp.ConsumeRandomLengthString(270);
  215|  4.56k|    std::string long_ascii = ada::idna::to_ascii(long_domain);
  216|  4.56k|    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.56k|    volatile bool long_dns_ok = ada::checkers::verify_dns_length(long_domain);
  221|  4.56k|    (void)long_dns_ok;
  222|       |
  223|  4.56k|    if (!long_ascii.empty()) {
  ------------------
  |  Branch (223:9): [True: 180, False: 4.38k]
  ------------------
  224|    180|      volatile bool long_ascii_dns_ok =
  225|    180|          ada::checkers::verify_dns_length(long_ascii);
  226|    180|      (void)long_ascii_dns_ok;
  227|    180|    }
  228|  4.56k|  }
  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.56k|  {
  237|  4.56k|    std::string blob = fdp.ConsumeRandomLengthString(128);
  238|  4.56k|    std::u32string decoded;
  239|  4.56k|    bool ok = ada::idna::punycode_to_utf32(blob, decoded);
  240|  4.56k|    if (ok && !decoded.empty()) {
  ------------------
  |  Branch (240:9): [True: 4.39k, False: 162]
  |  Branch (240:15): [True: 30, False: 4.36k]
  ------------------
  241|     30|      std::string reencoded;
  242|     30|      bool enc_ok = ada::idna::utf32_to_punycode(decoded, reencoded);
  243|     30|      (void)enc_ok;
  244|     30|      length += reencoded.size();
  245|       |
  246|       |      // Re-decode the re-encoded form; it must match the first decoded form.
  247|     30|      if (enc_ok && !reencoded.empty()) {
  ------------------
  |  Branch (247:11): [True: 25, False: 5]
  |  Branch (247:21): [True: 25, False: 0]
  ------------------
  248|     25|        std::u32string redecoded;
  249|     25|        bool redec_ok = ada::idna::punycode_to_utf32(reencoded, redecoded);
  250|     25|        if (redec_ok && redecoded != decoded) {
  ------------------
  |  Branch (250:13): [True: 25, False: 0]
  |  Branch (250:25): [True: 0, False: 25]
  ------------------
  251|      0|          printf("Punycode round-trip mismatch!\n");
  252|      0|          abort();
  253|      0|        }
  254|     25|      }
  255|     30|    }
  256|  4.56k|  }
  257|       |
  258|  4.56k|  return 0;
  259|  4.56k|}

