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

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

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

