_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  162|  2.46k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  163|  2.46k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  164|  2.46k|  size_t pos = 0;
  165|  2.46k|  const char32_t* start{utf32_output};
  166|  27.7k|  while (pos < len) {
  ------------------
  |  Branch (166:10): [True: 25.4k, False: 2.31k]
  ------------------
  167|       |    // try to convert the next block of 16 ASCII bytes
  168|  25.4k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (168:9): [True: 9.44k, False: 15.9k]
  ------------------
  169|       |                            // bytes, check that they are ascii
  170|  9.44k|      uint64_t v1;
  171|  9.44k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  172|  9.44k|      uint64_t v2;
  173|  9.44k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  174|  9.44k|      uint64_t v{v1 | v2};
  175|  9.44k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (175:11): [True: 923, False: 8.52k]
  ------------------
  176|    923|        size_t final_pos = pos + 16;
  177|  15.6k|        while (pos < final_pos) {
  ------------------
  |  Branch (177:16): [True: 14.7k, False: 923]
  ------------------
  178|  14.7k|          *utf32_output++ = char32_t(buf[pos]);
  179|  14.7k|          pos++;
  180|  14.7k|        }
  181|    923|        continue;
  182|    923|      }
  183|  9.44k|    }
  184|  24.4k|    uint8_t leading_byte = data[pos];  // leading byte
  185|  24.4k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (185:9): [True: 16.0k, False: 8.43k]
  ------------------
  186|       |      // converting one ASCII byte !!!
  187|  16.0k|      *utf32_output++ = char32_t(leading_byte);
  188|  16.0k|      pos++;
  189|  16.0k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (189:16): [True: 2.68k, False: 5.74k]
  ------------------
  190|       |      // We have a two-byte UTF-8
  191|  2.68k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (191:11): [True: 4, False: 2.68k]
  ------------------
  192|      4|        return 0;
  193|      4|      }  // minimal bound checking
  194|  2.68k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (194:11): [True: 25, False: 2.65k]
  ------------------
  195|     25|        return 0;
  196|     25|      }
  197|       |      // range check
  198|  2.65k|      uint32_t code_point =
  199|  2.65k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  200|  2.65k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (200:11): [True: 2, False: 2.65k]
  |  Branch (200:32): [True: 0, False: 2.65k]
  ------------------
  201|      2|        return 0;
  202|      2|      }
  203|  2.65k|      *utf32_output++ = char32_t(code_point);
  204|  2.65k|      pos += 2;
  205|  5.74k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (205:16): [True: 5.33k, False: 409]
  ------------------
  206|       |      // We have a three-byte UTF-8
  207|  5.33k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (207:11): [True: 1, False: 5.33k]
  ------------------
  208|      1|        return 0;
  209|      1|      }  // minimal bound checking
  210|       |
  211|  5.33k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (211:11): [True: 9, False: 5.32k]
  ------------------
  212|      9|        return 0;
  213|      9|      }
  214|  5.32k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (214:11): [True: 8, False: 5.32k]
  ------------------
  215|      8|        return 0;
  216|      8|      }
  217|       |      // range check
  218|  5.32k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  219|  5.32k|                            (data[pos + 1] & 0b00111111) << 6 |
  220|  5.32k|                            (data[pos + 2] & 0b00111111);
  221|  5.32k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (221:11): [True: 5, False: 5.31k]
  |  Branch (221:33): [True: 0, False: 5.31k]
  ------------------
  222|  5.31k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (222:12): [True: 806, False: 4.50k]
  |  Branch (222:35): [True: 1, False: 805]
  ------------------
  223|      6|        return 0;
  224|      6|      }
  225|  5.31k|      *utf32_output++ = char32_t(code_point);
  226|  5.31k|      pos += 3;
  227|  5.31k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (227:16): [True: 342, False: 67]
  ------------------
  228|       |      // we have a 4-byte UTF-8 word.
  229|    342|      if (pos + 3 >= len) {
  ------------------
  |  Branch (229:11): [True: 7, False: 335]
  ------------------
  230|      7|        return 0;
  231|      7|      }  // minimal bound checking
  232|    335|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (232:11): [True: 6, False: 329]
  ------------------
  233|      6|        return 0;
  234|      6|      }
  235|    329|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (235:11): [True: 3, False: 326]
  ------------------
  236|      3|        return 0;
  237|      3|      }
  238|    326|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (238:11): [True: 3, False: 323]
  ------------------
  239|      3|        return 0;
  240|      3|      }
  241|       |
  242|       |      // range check
  243|    323|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  244|    323|                            (data[pos + 1] & 0b00111111) << 12 |
  245|    323|                            (data[pos + 2] & 0b00111111) << 6 |
  246|    323|                            (data[pos + 3] & 0b00111111);
  247|    323|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (247:11): [True: 5, False: 318]
  |  Branch (247:35): [True: 4, False: 314]
  ------------------
  248|      9|        return 0;
  249|      9|      }
  250|    314|      *utf32_output++ = char32_t(code_point);
  251|    314|      pos += 4;
  252|    314|    } else {
  253|     67|      return 0;
  254|     67|    }
  255|  24.4k|  }
  256|  2.31k|  return utf32_output - start;
  257|  2.46k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  272|  2.46k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  273|  2.46k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  274|  2.46k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|  2.46k|    return c > -65;
  278|  2.46k|  });
  279|  2.46k|}
_ZN3ada4idna9ascii_mapEPcm:
 5259|    163|void ascii_map(char* input, size_t length) {
 5260|    163|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|    163|    return 0x101010101010101ull * v;
 5262|    163|  };
 5263|    163|  uint64_t broadcast_80 = broadcast(0x80);
 5264|    163|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5265|    163|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5266|    163|  size_t i = 0;
 5267|       |
 5268|    544|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5268:10): [True: 381, False: 163]
  ------------------
 5269|    381|    uint64_t word{};
 5270|    381|    std::memcpy(&word, input + i, sizeof(word));
 5271|    381|    word ^=
 5272|    381|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5273|    381|    std::memcpy(input + i, &word, sizeof(word));
 5274|    381|  }
 5275|    163|  if (i < length) {
  ------------------
  |  Branch (5275:7): [True: 131, False: 32]
  ------------------
 5276|    131|    uint64_t word{};
 5277|    131|    std::memcpy(&word, input + i, length - i);
 5278|    131|    word ^=
 5279|    131|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5280|    131|    std::memcpy(input + i, &word, length - i);
 5281|    131|  }
 5282|    163|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5286|  3.42k|bool map(std::u32string_view input, std::u32string& out) {
 5287|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5288|  3.42k|  out.clear();
 5289|  3.42k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5289:7): [True: 0, False: 3.42k]
  ------------------
 5290|      0|    return false;
 5291|      0|  }
 5292|       |
 5293|       |  // Pass 1: validate and compute exact output length.
 5294|  3.42k|  size_t out_size = 0;
 5295|  48.3k|  for (char32_t x : input) {
  ------------------
  |  Branch (5295:19): [True: 48.3k, False: 3.20k]
  ------------------
 5296|  48.3k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5297|  48.3k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5297:9): [True: 215, False: 48.1k]
  ------------------
 5298|    215|      return false;
 5299|    215|    }
 5300|  48.1k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5300:9): [True: 37.1k, False: 10.9k]
  ------------------
 5301|  37.1k|      ++out_size;
 5302|  37.1k|      continue;
 5303|  37.1k|    }
 5304|  10.9k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5304:9): [True: 0, False: 10.9k]
  ------------------
 5305|      0|      return false;
 5306|      0|    }
 5307|  10.9k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5308|  10.9k|  }
 5309|       |
 5310|       |  // Pass 2: write into a single allocation.
 5311|  3.20k|  out.resize(out_size);
 5312|  3.20k|  size_t w = 0;
 5313|  47.9k|  for (char32_t x : input) {
  ------------------
  |  Branch (5313:19): [True: 47.9k, False: 3.20k]
  ------------------
 5314|  47.9k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5315|  47.9k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5315:9): [True: 37.0k, False: 10.9k]
  ------------------
 5316|  37.0k|      out[w++] = x;
 5317|  37.0k|      continue;
 5318|  37.0k|    }
 5319|       |    // IGNORED or mapped (status already validated in pass 1).
 5320|  10.9k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5321|  52.9k|    while (*ptr != 0) {
  ------------------
  |  Branch (5321:12): [True: 42.0k, False: 10.9k]
  ------------------
 5322|  42.0k|      out[w++] = utf8_next(ptr);
 5323|  42.0k|    }
 5324|  10.9k|  }
 5325|  3.20k|  return true;
 5326|  3.42k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5420|    781|    const std::u32string_view input) noexcept {
 5421|    781|  bool decomposition_needed{false};
 5422|    781|  size_t additional_elements{0};
 5423|  15.6k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5423:35): [True: 15.6k, False: 781]
  ------------------
 5424|  15.6k|    size_t decomposition_length{0};
 5425|       |
 5426|  15.6k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5426:9): [True: 2.06k, False: 13.5k]
  ------------------
 5427|  2.06k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5427:9): [True: 1.05k, False: 1.00k]
  ------------------
 5428|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5429|  1.05k|      decomposition_length = 2;
 5430|  1.05k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5430:11): [True: 655, False: 402]
  ------------------
 5431|    655|        decomposition_length = 3;
 5432|    655|      }
 5433|  14.5k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5433:16): [True: 14.5k, False: 0]
  ------------------
 5434|  14.5k|      const uint8_t di = decomposition_index[current_character >> 8];
 5435|  14.5k|      const uint16_t* const decomposition =
 5436|  14.5k|          decomposition_block_row(di) + (current_character % 256);
 5437|  14.5k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5438|  14.5k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5438:11): [True: 1.86k, False: 12.7k]
  |  Branch (5438:41): [True: 0, False: 1.86k]
  ------------------
 5439|      0|        decomposition_length = 0;
 5440|      0|      }
 5441|  14.5k|    }
 5442|  15.6k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5442:9): [True: 2.92k, False: 12.7k]
  ------------------
 5443|  2.92k|      decomposition_needed = true;
 5444|  2.92k|      additional_elements += decomposition_length - 1;
 5445|  2.92k|    }
 5446|  15.6k|  }
 5447|    781|  return {decomposition_needed, additional_elements};
 5448|    781|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5450|    474|void decompose(std::u32string& input, size_t additional_elements) {
 5451|    474|  input.resize(input.size() + additional_elements);
 5452|    474|  for (size_t descending_idx = input.size(),
 5453|    474|              input_count = descending_idx - additional_elements;
 5454|  10.4k|       input_count--;) {
  ------------------
  |  Branch (5454:8): [True: 10.0k, False: 474]
  ------------------
 5455|  10.0k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5455:9): [True: 1.88k, False: 8.13k]
  ------------------
 5456|  1.88k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5456:9): [True: 1.05k, False: 830]
  ------------------
 5457|       |      // Hangul decomposition.
 5458|  1.05k|      char32_t s_index = input[input_count] - hangul_sbase;
 5459|  1.05k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5459:11): [True: 655, False: 402]
  ------------------
 5460|    655|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5461|    655|      }
 5462|  1.05k|      input[--descending_idx] =
 5463|  1.05k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5464|  1.05k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5465|  8.96k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5465:16): [True: 8.96k, False: 0]
  ------------------
 5466|  8.96k|      const uint16_t* decomposition =
 5467|  8.96k|          decomposition_block_row(
 5468|  8.96k|              decomposition_index[input[input_count] >> 8]) +
 5469|  8.96k|          (input[input_count] % 256);
 5470|  8.96k|      uint16_t decomposition_length =
 5471|  8.96k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5472|  8.96k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5472:11): [True: 1.86k, False: 7.09k]
  |  Branch (5472:39): [True: 0, False: 1.86k]
  ------------------
 5473|      0|        decomposition_length = 0;
 5474|      0|      }
 5475|  8.96k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5475:11): [True: 1.86k, False: 7.09k]
  ------------------
 5476|  1.86k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5477|  1.86k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5477:13): [True: 0, False: 1.86k]
  ------------------
 5478|      0|          input[--descending_idx] = input[input_count];
 5479|  1.86k|        } else {
 5480|  6.26k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5480:18): [True: 4.40k, False: 1.86k]
  ------------------
 5481|  4.40k|            input[--descending_idx] =
 5482|  4.40k|                decomposition_data[base + decomposition_length];
 5483|  4.40k|          }
 5484|  1.86k|        }
 5485|  7.09k|      } else {
 5486|  7.09k|        input[--descending_idx] = input[input_count];
 5487|  7.09k|      }
 5488|  8.96k|    } else {
 5489|      0|      input[--descending_idx] = input[input_count];
 5490|      0|    }
 5491|  10.0k|  }
 5492|    474|}
_ZN3ada4idna7get_cccEDi:
 5494|   166k|uint8_t get_ccc(char32_t c) noexcept {
 5495|   166k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5495:7): [True: 0, False: 166k]
  ------------------
 5496|      0|    return 0;
 5497|      0|  }
 5498|   166k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5499|   166k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5501|    781|void sort_marks(std::u32string& input) {
 5502|  19.8k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5502:24): [True: 19.0k, False: 781]
  ------------------
 5503|  19.0k|    uint8_t ccc = get_ccc(input[idx]);
 5504|  19.0k|    if (ccc == 0) {
  ------------------
  |  Branch (5504:9): [True: 14.8k, False: 4.21k]
  ------------------
 5505|  14.8k|      continue;
 5506|  14.8k|    }
 5507|  4.21k|    auto current_character = input[idx];
 5508|  4.21k|    size_t back_idx = idx;
 5509|  12.8k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5509:12): [True: 12.7k, False: 63]
  |  Branch (5509:29): [True: 8.62k, False: 4.14k]
  ------------------
 5510|  8.62k|      input[back_idx] = input[back_idx - 1];
 5511|  8.62k|      back_idx--;
 5512|  8.62k|    }
 5513|  4.21k|    input[back_idx] = current_character;
 5514|  4.21k|  }
 5515|    781|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5517|    781|void decompose_nfc(std::u32string& input) {
 5518|       |  /**
 5519|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5520|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5521|       |   */
 5522|    781|  auto [decomposition_needed, additional_elements] =
 5523|    781|      compute_decomposition_length(input);
 5524|    781|  if (decomposition_needed) {
  ------------------
  |  Branch (5524:7): [True: 474, False: 307]
  ------------------
 5525|    474|    decompose(input, additional_elements);
 5526|    474|  }
 5527|    781|  sort_marks(input);
 5528|    781|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5688|  3.23k|bool is_already_nfc(std::u32string_view input) noexcept {
 5689|  3.23k|  if (input.empty()) {
  ------------------
  |  Branch (5689:7): [True: 0, False: 3.23k]
  ------------------
 5690|      0|    return true;
 5691|      0|  }
 5692|  3.23k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5692:7): [True: 0, False: 3.23k]
  |  Branch (5692:30): [True: 0, False: 0]
  ------------------
 5693|      0|    return false;
 5694|      0|  }
 5695|  3.23k|  uint8_t last_ccc = 0;
 5696|  3.23k|  bool maybe = false;
 5697|  64.5k|  for (char32_t c : input) {
  ------------------
  |  Branch (5697:19): [True: 64.5k, False: 3.04k]
  ------------------
 5698|  64.5k|    if (c < nfc_qc_first_non_starter) {
  ------------------
  |  Branch (5698:9): [True: 24.7k, False: 39.8k]
  ------------------
 5699|  24.7k|      last_ccc = 0;
 5700|  24.7k|      continue;
 5701|  24.7k|    }
 5702|  39.8k|    const uint8_t ccc = get_ccc(c);
 5703|  39.8k|    if (ccc != 0 && last_ccc > ccc) {
  ------------------
  |  Branch (5703:9): [True: 3.98k, False: 35.8k]
  |  Branch (5703:21): [True: 182, False: 3.80k]
  ------------------
 5704|    182|      return false;
 5705|    182|    }
 5706|  39.6k|    const nfc_quick_check check = get_nfc_quick_check(c);
 5707|  39.6k|    if (check == nfc_quick_check::no) {
  ------------------
  |  Branch (5707:9): [True: 0, False: 39.6k]
  ------------------
 5708|      0|      return false;
 5709|      0|    }
 5710|  39.6k|    maybe = maybe || check == nfc_quick_check::maybe;
  ------------------
  |  Branch (5710:13): [True: 6.01k, False: 33.6k]
  |  Branch (5710:22): [True: 1.73k, False: 31.8k]
  ------------------
 5711|  39.6k|    last_ccc = ccc;
 5712|  39.6k|  }
 5713|  3.04k|  return !maybe || maybe_is_nfc(input);
  ------------------
  |  Branch (5713:10): [True: 1.39k, False: 1.65k]
  |  Branch (5713:20): [True: 277, False: 1.38k]
  ------------------
 5714|  3.23k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5716|    781|void compose(std::u32string& input) {
 5717|       |  /**
 5718|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5719|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5720|       |   */
 5721|    781|  size_t input_count{0};
 5722|    781|  size_t composition_count{0};
 5723|  14.2k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5723:10): [True: 13.5k, False: 781]
  ------------------
 5724|  13.5k|    input[composition_count] = input[input_count];
 5725|  13.5k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5725:9): [True: 3.06k, False: 10.4k]
  ------------------
 5726|  3.06k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5726:9): [True: 1.41k, False: 1.65k]
  ------------------
 5727|  1.41k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5727:11): [True: 1.38k, False: 28]
  ------------------
 5728|  1.38k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5728:11): [True: 1.17k, False: 211]
  ------------------
 5729|  1.17k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5729:11): [True: 1.08k, False: 87]
  ------------------
 5730|  1.08k|        input[composition_count] =
 5731|  1.08k|            hangul_sbase +
 5732|  1.08k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5733|  1.08k|             input[input_count + 1] - hangul_vbase) *
 5734|  1.08k|                hangul_tcount;
 5735|  1.08k|        input_count++;
 5736|  1.08k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5736:13): [True: 1.06k, False: 21]
  ------------------
 5737|  1.06k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5737:13): [True: 773, False: 292]
  ------------------
 5738|    773|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5738:13): [True: 689, False: 84]
  ------------------
 5739|    689|          input[composition_count] += input[++input_count] - hangul_tbase;
 5740|    689|        }
 5741|  1.08k|      }
 5742|  12.0k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5742:16): [True: 954, False: 11.1k]
  ------------------
 5743|    954|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5743:16): [True: 0, False: 954]
  ------------------
 5744|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5744:11): [True: 0, False: 0]
  ------------------
 5745|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5745:11): [True: 0, False: 0]
  ------------------
 5746|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5746:11): [True: 0, False: 0]
  ------------------
 5747|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5747:11): [True: 0, False: 0]
  ------------------
 5748|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5749|      0|      }
 5750|  12.0k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5750:16): [True: 12.0k, False: 0]
  ------------------
 5751|  12.0k|      const uint16_t* composition =
 5752|  12.0k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5753|  12.0k|          (input[input_count] % 256);
 5754|  12.0k|      size_t initial_composition_count = composition_count;
 5755|  16.6k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5755:39): [True: 15.9k, False: 712]
  ------------------
 5756|  15.9k|           input_count++) {
 5757|  15.9k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5758|       |
 5759|  15.9k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5759:13): [True: 6.84k, False: 9.13k]
  |  Branch (5759:49): [True: 6.32k, False: 516]
  ------------------
 5760|  6.32k|          int left = composition[0];
 5761|  6.32k|          int right = composition[1];
 5762|  6.32k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5762:15): [True: 0, False: 6.32k]
  |  Branch (5762:27): [True: 0, False: 6.32k]
  ------------------
 5763|  6.32k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5763:15): [True: 0, False: 6.32k]
  ------------------
 5764|      0|            break;
 5765|      0|          }
 5766|  16.3k|          while (left + 2 < right) {
  ------------------
  |  Branch (5766:18): [True: 9.99k, False: 6.32k]
  ------------------
 5767|  9.99k|            int middle = left + (((right - left) >> 1) & ~1);
 5768|  9.99k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5768:17): [True: 4.35k, False: 5.64k]
  ------------------
 5769|  9.99k|                input[input_count + 1]) {
 5770|  4.35k|              left = middle;
 5771|  4.35k|            }
 5772|  9.99k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5772:17): [True: 8.06k, False: 1.93k]
  ------------------
 5773|  9.99k|                input[input_count + 1]) {
 5774|  8.06k|              right = middle;
 5775|  8.06k|            }
 5776|  9.99k|          }
 5777|  6.32k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5777:15): [True: 6.32k, False: 0]
  ------------------
 5778|  6.32k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5778:15): [True: 2.88k, False: 3.44k]
  ------------------
 5779|  6.32k|                  input[input_count + 1]) {
 5780|  2.88k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5781|  2.88k|            input[initial_composition_count] = composed;
 5782|  2.88k|            composition =
 5783|  2.88k|                composition_block_row(composition_index[composed >> 8]) +
 5784|  2.88k|                (composed % 256);
 5785|  2.88k|            continue;
 5786|  2.88k|          }
 5787|  6.32k|        }
 5788|       |
 5789|  13.0k|        if (ccc == 0) {
  ------------------
  |  Branch (5789:13): [True: 11.3k, False: 1.71k]
  ------------------
 5790|  11.3k|          break;
 5791|  11.3k|        }
 5792|  1.71k|        previous_ccc = ccc;
 5793|  1.71k|        input[++composition_count] = input[input_count + 1];
 5794|  1.71k|      }
 5795|  12.0k|    }
 5796|  13.5k|  }
 5797|       |
 5798|    781|  if (composition_count < input_count) {
  ------------------
  |  Branch (5798:7): [True: 709, False: 72]
  ------------------
 5799|    709|    input.resize(composition_count);
 5800|    709|  }
 5801|    781|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5803|    781|bool normalize(std::u32string& input) {
 5804|       |  /**
 5805|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5806|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5807|       |   */
 5808|    781|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5808:7): [True: 0, False: 781]
  |  Branch (5808:27): [True: 0, False: 781]
  ------------------
 5809|    781|      composition_index == nullptr) {
  ------------------
  |  Branch (5809:7): [True: 0, False: 781]
  ------------------
 5810|      0|    return false;
 5811|      0|  }
 5812|    781|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5812:7): [True: 0, False: 781]
  ------------------
 5813|      0|    return true;
 5814|      0|  }
 5815|    781|  decompose_nfc(input);
 5816|    781|  compose(input);
 5817|    781|  return true;
 5818|    781|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5878|  1.24k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5879|  1.24k|  int32_t written_out{0};
 5880|  1.24k|  out.reserve(out.size() + input.size());
 5881|  1.24k|  uint32_t n = initial_n;
 5882|  1.24k|  int32_t i = 0;
 5883|  1.24k|  int32_t bias = initial_bias;
 5884|       |  // grab ascii content
 5885|       |  // RFC 3492 section 6.2: copy the code points before the last delimiter,
 5886|       |  // then consume the delimiter only "if more than zero code points were
 5887|       |  // consumed". With a leading delimiter, b == 0, decoding starts at the
 5888|       |  // delimiter itself, which is not a digit, and fails. This matches the
 5889|       |  // reference implementation in appendix C (`in = b > 0 ? b + 1 : 0`).
 5890|  1.24k|  size_t end_of_ascii = input.find_last_of('-');
 5891|  1.24k|  if (end_of_ascii != std::string_view::npos && end_of_ascii > 0) {
  ------------------
  |  Branch (5891:7): [True: 231, False: 1.01k]
  |  Branch (5891:49): [True: 229, False: 2]
  ------------------
 5892|  1.73k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5892:20): [True: 1.73k, False: 229]
  ------------------
 5893|  1.73k|      if (c >= 0x80) {
  ------------------
  |  Branch (5893:11): [True: 0, False: 1.73k]
  ------------------
 5894|      0|        return false;
 5895|      0|      }
 5896|  1.73k|      out.push_back(c);
 5897|  1.73k|      written_out++;
 5898|  1.73k|    }
 5899|    229|    input.remove_prefix(end_of_ascii + 1);
 5900|    229|  }
 5901|  11.3k|  while (!input.empty()) {
  ------------------
  |  Branch (5901:10): [True: 10.1k, False: 1.16k]
  ------------------
 5902|  10.1k|    int32_t oldi = i;
 5903|  10.1k|    int32_t w = 1;
 5904|  15.5k|    for (int32_t k = base;; k += base) {
 5905|  15.5k|      if (input.empty()) {
  ------------------
  |  Branch (5905:11): [True: 39, False: 15.4k]
  ------------------
 5906|     39|        return false;
 5907|     39|      }
 5908|  15.4k|      uint8_t code_point = input.front();
 5909|  15.4k|      input.remove_prefix(1);
 5910|  15.4k|      int32_t digit = char_to_digit_value(code_point);
 5911|  15.4k|      if (digit < 0) {
  ------------------
  |  Branch (5911:11): [True: 9, False: 15.4k]
  ------------------
 5912|      9|        return false;
 5913|      9|      }
 5914|  15.4k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5914:11): [True: 9, False: 15.4k]
  ------------------
 5915|      9|        return false;
 5916|      9|      }
 5917|  15.4k|      i = i + digit * w;
 5918|  15.4k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5918:19): [True: 3.21k, False: 12.2k]
  |  Branch (5918:38): [True: 11.3k, False: 937]
  ------------------
 5919|  15.4k|      if (digit < t) {
  ------------------
  |  Branch (5919:11): [True: 10.0k, False: 5.38k]
  ------------------
 5920|  10.0k|        break;
 5921|  10.0k|      }
 5922|  5.38k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5922:11): [True: 0, False: 5.38k]
  ------------------
 5923|      0|        return false;
 5924|      0|      }
 5925|  5.38k|      w = w * (base - t);
 5926|  5.38k|    }
 5927|  10.0k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5928|  10.0k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5928:9): [True: 26, False: 10.0k]
  ------------------
 5929|     26|      return false;
 5930|     26|    }
 5931|  10.0k|    n = n + i / (written_out + 1);
 5932|  10.0k|    i = i % (written_out + 1);
 5933|  10.0k|    if (n < 0x80) {
  ------------------
  |  Branch (5933:9): [True: 0, False: 10.0k]
  ------------------
 5934|      0|      return false;
 5935|      0|    }
 5936|  10.0k|    out.insert(out.begin() + i, n);
 5937|  10.0k|    written_out++;
 5938|  10.0k|    ++i;
 5939|  10.0k|  }
 5940|       |  // See https://github.com/whatwg/url/issues/803
 5941|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5942|  1.16k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5942:7): [True: 543, False: 621]
  |  Branch (5942:26): [True: 139, False: 404]
  |  Branch (5942:44): [True: 94, False: 45]
  |  Branch (5942:62): [True: 48, False: 46]
  ------------------
 5943|     48|      out[3] == U'-') {
  ------------------
  |  Branch (5943:7): [True: 1, False: 47]
  ------------------
 5944|      1|    return false;
 5945|      1|  }
 5946|  1.16k|  return true;
 5947|  1.16k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 6027|  2.81k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 6028|  2.81k|  out.reserve(input.size() + out.size());
 6029|  2.81k|  uint32_t n = initial_n;
 6030|  2.81k|  int32_t d = 0;
 6031|  2.81k|  int32_t bias = initial_bias;
 6032|  2.81k|  size_t h = 0;
 6033|       |  // first push the ascii content
 6034|  15.2k|  for (uint32_t c : input) {
  ------------------
  |  Branch (6034:19): [True: 15.2k, False: 2.81k]
  ------------------
 6035|  15.2k|    if (c < 0x80) {
  ------------------
  |  Branch (6035:9): [True: 2.41k, False: 12.8k]
  ------------------
 6036|  2.41k|      ++h;
 6037|  2.41k|      out.push_back(char(c));
 6038|  2.41k|    }
 6039|  15.2k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (6039:9): [True: 0, False: 15.2k]
  |  Branch (6039:26): [True: 286, False: 14.9k]
  |  Branch (6039:41): [True: 0, False: 286]
  ------------------
 6040|      0|      return false;
 6041|      0|    }
 6042|  15.2k|  }
 6043|  2.81k|  size_t b = h;
 6044|  2.81k|  if (b > 0) {
  ------------------
  |  Branch (6044:7): [True: 633, False: 2.17k]
  ------------------
 6045|    633|    out.push_back('-');
 6046|    633|  }
 6047|  12.7k|  while (h < input.size()) {
  ------------------
  |  Branch (6047:10): [True: 9.93k, False: 2.81k]
  ------------------
 6048|  9.93k|    uint32_t m = 0x10FFFF;
 6049|  76.3k|    for (auto code_point : input) {
  ------------------
  |  Branch (6049:26): [True: 76.3k, False: 9.93k]
  ------------------
 6050|  76.3k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (6050:11): [True: 43.2k, False: 33.1k]
  |  Branch (6050:30): [True: 16.2k, False: 27.0k]
  ------------------
 6051|  76.3k|    }
 6052|       |
 6053|  9.93k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (6053:9): [True: 0, False: 9.93k]
  ------------------
 6054|      0|      return false;
 6055|      0|    }
 6056|  9.93k|    d = d + int32_t((m - n) * (h + 1));
 6057|  9.93k|    n = m;
 6058|  76.3k|    for (auto c : input) {
  ------------------
  |  Branch (6058:17): [True: 76.3k, False: 9.93k]
  ------------------
 6059|  76.3k|      if (c < n) {
  ------------------
  |  Branch (6059:11): [True: 33.1k, False: 43.2k]
  ------------------
 6060|  33.1k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (6060:13): [True: 0, False: 33.1k]
  ------------------
 6061|      0|          return false;
 6062|      0|        }
 6063|  33.1k|        ++d;
 6064|  33.1k|      }
 6065|  76.3k|      if (c == n) {
  ------------------
  |  Branch (6065:11): [True: 12.8k, False: 63.5k]
  ------------------
 6066|  12.8k|        int32_t q = d;
 6067|  29.5k|        for (int32_t k = base;; k += base) {
 6068|  29.5k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (6068:23): [True: 7.55k, False: 21.9k]
  |  Branch (6068:42): [True: 16.2k, False: 5.73k]
  ------------------
 6069|       |
 6070|  29.5k|          if (q < t) {
  ------------------
  |  Branch (6070:15): [True: 12.8k, False: 16.6k]
  ------------------
 6071|  12.8k|            break;
 6072|  12.8k|          }
 6073|  16.6k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 6074|  16.6k|          q = (q - t) / (base - t);
 6075|  16.6k|        }
 6076|  12.8k|        out.push_back(digit_to_char(q));
 6077|  12.8k|        bias = adapt(d, int32_t(h + 1), h == b);
 6078|  12.8k|        d = 0;
 6079|  12.8k|        ++h;
 6080|  12.8k|      }
 6081|  76.3k|    }
 6082|  9.93k|    ++d;
 6083|  9.93k|    ++n;
 6084|  9.93k|  }
 6085|  2.81k|  return true;
 6086|  2.81k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6548|  2.62k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6549|  2.62k|  out.clear();
 6550|       |  // The ASCII path is a single same-size copy, so it needs no length bound.
 6551|       |  // Checking first would reject the (longer) ASCII output of a non-ASCII input
 6552|       |  // that was accepted, breaking to_ascii(to_ascii(x)) == to_ascii(x).
 6553|  2.62k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6553:7): [True: 163, False: 2.46k]
  ------------------
 6554|    163|    from_ascii_to_ascii(ut8_string, out);
 6555|    163|    return true;
 6556|    163|  }
 6557|  2.46k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6557:7): [True: 0, False: 2.46k]
  ------------------
 6558|      0|    return false;
 6559|      0|  }
 6560|       |
 6561|       |#ifdef ADA_USE_SIMDUTF
 6562|       |  size_t utf32_length =
 6563|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6564|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6565|       |    return false;
 6566|       |  }
 6567|       |  std::u32string working(utf32_length, U'\0');
 6568|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6569|       |      ut8_string.data(), ut8_string.size(), working.data());
 6570|       |#else
 6571|  2.46k|  size_t utf32_length =
 6572|  2.46k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6573|  2.46k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6573:7): [True: 5, False: 2.46k]
  |  Branch (6573:28): [True: 5, False: 0]
  ------------------
 6574|      5|    return false;
 6575|      5|  }
 6576|  2.46k|  std::u32string working(utf32_length, U'\0');
 6577|  2.46k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6578|  2.46k|      ut8_string.data(), ut8_string.size(), working.data());
 6579|  2.46k|#endif
 6580|  2.46k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6580:7): [True: 150, False: 2.31k]
  |  Branch (6580:35): [True: 0, False: 2.31k]
  ------------------
 6581|    150|    return false;
 6582|    150|  }
 6583|  2.31k|  working.resize(actual_utf32_length);
 6584|       |
 6585|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6586|  2.31k|  std::u32string mapped;
 6587|  2.31k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6587:7): [True: 42, False: 2.26k]
  ------------------
 6588|     42|    return false;
 6589|     42|  }
 6590|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6591|  2.26k|  working.clear();
 6592|       |
 6593|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6594|  2.26k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6594:7): [True: 1.58k, False: 688]
  |  Branch (6594:28): [True: 421, False: 1.16k]
  ------------------
 6595|    421|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6595:9): [True: 0, False: 421]
  ------------------
 6596|      0|      return false;
 6597|      0|    }
 6598|    421|  }
 6599|       |
 6600|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6601|  2.26k|  out.reserve(mapped.size() + 8);
 6602|       |
 6603|       |  // CheckBidi applies to every label once any label is RTL (RFC 5893), which a
 6604|       |  // later label can decide. Any failure rejects the whole domain, so it is
 6605|       |  // enough to know at the end whether some label is RTL and whether every
 6606|       |  // label satisfies the Bidi rule.
 6607|  2.26k|  bool bidi_domain = false;
 6608|  2.26k|  bool bidi_rule_holds = true;
 6609|  2.26k|  auto accept = [&](const label_check& check) {
 6610|  2.26k|    bidi_domain = bidi_domain || check.rtl;
 6611|  2.26k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
 6612|  2.26k|    return check.valid && (bidi_rule_holds || !bidi_domain);
 6613|  2.26k|  };
 6614|       |
 6615|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6616|  2.26k|  const char32_t* p = mapped.data();
 6617|  2.26k|  const char32_t* const end = p + mapped.size();
 6618|  2.26k|  std::u32string post_map;
 6619|       |
 6620|  7.88k|  while (p < end) {
  ------------------
  |  Branch (6620:10): [True: 6.59k, False: 1.29k]
  ------------------
 6621|  6.59k|    const char32_t* label_begin = p;
 6622|  61.3k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6622:12): [True: 59.9k, False: 1.39k]
  |  Branch (6622:23): [True: 54.7k, False: 5.19k]
  ------------------
 6623|  54.7k|      ++p;
 6624|  54.7k|    }
 6625|  6.59k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6626|  6.59k|    std::u32string_view label_view(label_begin, label_size);
 6627|  6.59k|    const bool is_last_label = (p == end);
 6628|  6.59k|    if (p < end) {
  ------------------
  |  Branch (6628:9): [True: 5.19k, False: 1.39k]
  ------------------
 6629|  5.19k|      ++p;  // skip dot
 6630|  5.19k|    }
 6631|       |
 6632|  6.59k|    if (label_size == 0) {
  ------------------
  |  Branch (6632:9): [True: 192, False: 6.39k]
  ------------------
 6633|       |      // empty label
 6634|  6.39k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6634:16): [True: 1.26k, False: 5.13k]
  ------------------
 6635|  22.5k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6635:23): [True: 22.5k, False: 1.24k]
  ------------------
 6636|  22.5k|        if (c >= 0x80) {
  ------------------
  |  Branch (6636:13): [True: 13, False: 22.5k]
  ------------------
 6637|     13|          out.clear();
 6638|     13|          return false;
 6639|     13|        }
 6640|  22.5k|      }
 6641|  1.24k|      append_ascii_label(out, label_view);
 6642|  1.24k|      std::string_view puny_segment_ascii(
 6643|  1.24k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6644|  1.24k|      working.clear();
 6645|  1.24k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6645:11): [True: 84, False: 1.16k]
  ------------------
 6646|     84|        out.clear();
 6647|     84|        return false;
 6648|     84|      }
 6649|  1.16k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6649:11): [True: 54, False: 1.10k]
  ------------------
 6650|     54|        out.clear();
 6651|     54|        return false;
 6652|     54|      }
 6653|  1.10k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6653:11): [True: 173, False: 936]
  |  Branch (6653:49): [True: 67, False: 869]
  ------------------
 6654|    240|        out.clear();
 6655|    240|        return false;
 6656|    240|      }
 6657|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6658|    869|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6658:11): [True: 869, False: 0]
  |  Branch (6658:34): [True: 360, False: 509]
  ------------------
 6659|    360|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6659:13): [True: 0, False: 360]
  |  Branch (6659:37): [True: 99, False: 261]
  ------------------
 6660|     99|          out.clear();
 6661|     99|          return false;
 6662|     99|        }
 6663|    360|      }
 6664|    770|      if (post_map.empty() || !accept(check_label(post_map))) {
  ------------------
  |  Branch (6664:11): [True: 0, False: 770]
  |  Branch (6664:11): [True: 36, False: 734]
  |  Branch (6664:31): [True: 36, False: 734]
  ------------------
 6665|     36|        out.clear();
 6666|     36|        return false;
 6667|     36|      }
 6668|  5.13k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6668:16): [True: 1.98k, False: 3.15k]
  ------------------
 6669|       |      // All-ASCII domains never reach here (they return above). An ASCII label
 6670|       |      // in a Bidi domain must still satisfy RFC 5893 rules 1, 5, and 6.
 6671|  1.98k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6671:11): [True: 108, False: 1.87k]
  ------------------
 6672|    108|        out.clear();
 6673|    108|        return false;
 6674|    108|      }
 6675|  1.87k|      append_ascii_label(out, label_view);
 6676|  3.15k|    } else {
 6677|  3.15k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6677:11): [True: 343, False: 2.81k]
  ------------------
 6678|    343|        out.clear();
 6679|    343|        return false;
 6680|    343|      }
 6681|  2.81k|      out.append("xn--");
 6682|  2.81k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6682:11): [True: 0, False: 2.81k]
  ------------------
 6683|      0|        out.clear();
 6684|      0|        return false;
 6685|      0|      }
 6686|  2.81k|    }
 6687|  5.61k|    if (!is_last_label) {
  ------------------
  |  Branch (6687:9): [True: 4.33k, False: 1.27k]
  ------------------
 6688|  4.33k|      out.push_back('.');
 6689|  4.33k|    }
 6690|  5.61k|  }
 6691|  1.29k|  return true;
 6692|  2.26k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6694|  2.62k|std::string to_ascii(std::string_view ut8_string) {
 6695|  2.62k|  std::string out;
 6696|  2.62k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6696:7): [True: 1.17k, False: 1.45k]
  ------------------
 6697|  1.17k|    return {};
 6698|  1.17k|  }
 6699|  1.45k|  return out;
 6700|  2.62k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7679|  45.9k|                    std::string& out) {
 7680|  45.9k|  ada_log("percent_encode ", input, " to output string while ",
 7681|  45.9k|          append ? "appending" : "overwriting");
 7682|  45.9k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|  45.9k|    return character_sets::bit_at(character_set, c);
 7684|  45.9k|  });
 7685|  45.9k|  ada_log("percent_encode done checking, moved to ",
 7686|  45.9k|          std::distance(input.begin(), pointer));
 7687|       |
 7688|       |  // Optimization: Don't iterate if percent encode is not required
 7689|  45.9k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7689:7): [True: 42.7k, False: 3.24k]
  ------------------
 7690|  42.7k|    ada_log("percent_encode encoding not needed.");
 7691|  42.7k|    return false;
 7692|  42.7k|  }
 7693|       |  if constexpr (!append) {
 7694|       |    out.clear();
 7695|       |  }
 7696|  3.24k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7697|  3.24k|          " bytes");
 7698|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7699|  3.24k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7700|  3.24k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7701|  3.24k|          " bytes");
 7702|  58.6k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7702:10): [True: 55.4k, False: 3.24k]
  ------------------
 7703|  55.4k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7703:9): [True: 30.8k, False: 24.5k]
  ------------------
 7704|  30.8k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7705|  30.8k|    } else {
 7706|  24.5k|      out += *pointer;
 7707|  24.5k|    }
 7708|  55.4k|  }
 7709|  3.24k|  return true;
 7710|  45.9k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7679|  41.8k|                    std::string& out) {
 7680|  41.8k|  ada_log("percent_encode ", input, " to output string while ",
 7681|  41.8k|          append ? "appending" : "overwriting");
 7682|  41.8k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|  41.8k|    return character_sets::bit_at(character_set, c);
 7684|  41.8k|  });
 7685|  41.8k|  ada_log("percent_encode done checking, moved to ",
 7686|  41.8k|          std::distance(input.begin(), pointer));
 7687|       |
 7688|       |  // Optimization: Don't iterate if percent encode is not required
 7689|  41.8k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7689:7): [True: 39.7k, False: 2.07k]
  ------------------
 7690|  39.7k|    ada_log("percent_encode encoding not needed.");
 7691|  39.7k|    return false;
 7692|  39.7k|  }
 7693|  2.07k|  if constexpr (!append) {
 7694|  2.07k|    out.clear();
 7695|  2.07k|  }
 7696|  2.07k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7697|  2.07k|          " bytes");
 7698|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7699|  2.07k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7700|  2.07k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7701|  2.07k|          " bytes");
 7702|  48.5k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7702:10): [True: 46.5k, False: 2.07k]
  ------------------
 7703|  46.5k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7703:9): [True: 24.8k, False: 21.6k]
  ------------------
 7704|  24.8k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7705|  24.8k|    } else {
 7706|  21.6k|      out += *pointer;
 7707|  21.6k|    }
 7708|  46.5k|  }
 7709|  2.07k|  return true;
 7710|  41.8k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7510|  1.06k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7511|       |  // next line is for safety only, we expect users to avoid calling
 7512|       |  // percent_decode when first_percent is outside the range.
 7513|  1.06k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7513:7): [True: 0, False: 1.06k]
  ------------------
 7514|      0|    return std::string(input);
 7515|      0|  }
 7516|       |
 7517|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7518|  1.06k|  const char* const src = input.data();
 7519|  1.06k|  const char* const end = src + input.size();
 7520|       |
 7521|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7522|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7523|       |  // byte-at-a-time appends of the naive version.
 7524|  1.06k|  std::string out(input.size(), '\0');
 7525|  1.06k|  char* d = out.data();
 7526|  1.06k|  char* const d0 = d;
 7527|       |
 7528|  1.06k|  std::memcpy(d, src, first_percent);
 7529|  1.06k|  d += first_percent;
 7530|       |
 7531|  1.06k|  const char* p = src + first_percent;
 7532|  6.04k|  while (p < end) {
  ------------------
  |  Branch (7532:10): [True: 4.98k, False: 1.06k]
  ------------------
 7533|  4.98k|    if (*p == '%') {
  ------------------
  |  Branch (7533:9): [True: 3.07k, False: 1.91k]
  ------------------
 7534|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7535|  7.97k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7535:14): [True: 7.37k, False: 601]
  |  Branch (7535:29): [True: 6.54k, False: 829]
  ------------------
 7536|  6.54k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7536:13): [True: 976, False: 5.57k]
  |  Branch (7536:42): [True: 668, False: 4.90k]
  ------------------
 7537|  1.64k|          break;
 7538|  1.64k|        }
 7539|  4.90k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7540|  4.90k|                                 convert_hex_to_binary(p[2]));
 7541|  4.90k|        p += 3;
 7542|  4.90k|      }
 7543|  3.07k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7543:11): [True: 2.77k, False: 304]
  |  Branch (7543:22): [True: 1.81k, False: 952]
  ------------------
 7544|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7545|       |        // literally and keep scanning after it.
 7546|  1.81k|        *d++ = *p++;
 7547|  1.81k|      }
 7548|  3.07k|    } else {
 7549|  1.91k|      const char* q = static_cast<const char*>(
 7550|  1.91k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7551|  1.91k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7551:29): [True: 1.25k, False: 658]
  ------------------
 7552|  1.91k|      const size_t n = static_cast<size_t>(run_end - p);
 7553|  1.91k|      std::memcpy(d, p, n);
 7554|  1.91k|      d += n;
 7555|  1.91k|      p = run_end;
 7556|  1.91k|    }
 7557|  4.98k|  }
 7558|       |
 7559|  1.06k|  out.resize(static_cast<size_t>(d - d0));
 7560|  1.06k|  return out;
 7561|  1.06k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7649|  50.4k|                           const uint8_t character_set[]) {
 7650|  50.4k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7651|  50.4k|    return character_sets::bit_at(character_set, c);
 7652|  50.4k|  });
 7653|       |  // Optimization: Don't iterate if percent encode is not required
 7654|  50.4k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7654:7): [True: 47.7k, False: 2.71k]
  ------------------
 7655|  47.7k|    return std::string(input);
 7656|  47.7k|  }
 7657|       |
 7658|  2.71k|  std::string result;
 7659|  2.71k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7660|       |                                   // produce 3 characters.
 7661|  2.71k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7662|  2.71k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7662:7): [True: 501, False: 2.21k]
  ------------------
 7663|    501|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7664|    501|                          result);
 7665|  2.21k|  } else {
 7666|  26.1k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7666:12): [True: 23.9k, False: 2.21k]
  ------------------
 7667|  23.9k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7667:11): [True: 14.6k, False: 9.38k]
  ------------------
 7668|  14.6k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7669|  14.6k|      } else {
 7670|  9.38k|        result += *pointer;
 7671|  9.38k|      }
 7672|  23.9k|    }
 7673|  2.21k|  }
 7674|  2.71k|  return result;
 7675|  50.4k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7720|  2.62k|              size_t first_percent) {
 7721|  2.62k|  std::string percent_decoded_buffer;
 7722|  2.62k|  std::string_view input = plain;
 7723|  2.62k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7723:7): [True: 119, False: 2.51k]
  ------------------
 7724|    119|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7725|    119|    input = percent_decoded_buffer;
 7726|    119|  }
 7727|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7728|  2.62k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7729|  2.62k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7729:7): [True: 1.17k, False: 1.45k]
  |  Branch (7729:29): [True: 226, False: 1.22k]
  ------------------
 7730|  1.45k|                                idna_ascii.data(), idna_ascii.size())) {
 7731|  1.40k|    return false;
 7732|  1.40k|  }
 7733|  1.22k|  out = std::move(idna_ascii);
 7734|  1.22k|  return true;
 7735|  2.62k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7738|  41.8k|                           const uint8_t character_set[], size_t index) {
 7739|  41.8k|  std::string out;
 7740|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7741|  41.8k|  out.append(input.data(), index);
 7742|  41.8k|  auto pointer = input.begin() + index;
 7743|  41.8k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7743:7): [True: 747, False: 41.0k]
  ------------------
 7744|    747|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7745|    747|                          out);
 7746|  41.0k|  } else {
 7747|  59.1k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7747:12): [True: 18.1k, False: 41.0k]
  ------------------
 7748|  18.1k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7748:11): [True: 7.30k, False: 10.8k]
  ------------------
 7749|  7.30k|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7750|  10.8k|      } else {
 7751|  10.8k|        out += *pointer;
 7752|  10.8k|      }
 7753|  18.1k|    }
 7754|  41.0k|  }
 7755|  41.8k|  return out;
 7756|  41.8k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 8054|  1.24k|                           const uint8_t character_set[], std::string& out) {
 8055|  1.24k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 8056|  1.24k|#ifdef ADA_UNICODE_NEED_SSSE3_TARGET
 8057|  1.24k|  static const bool ssse3_supported = __builtin_cpu_supports("ssse3") != 0;
 8058|  1.24k|  const bool use_wide = ssse3_supported;
 8059|       |#else
 8060|       |  const bool use_wide = true;
 8061|       |#endif
 8062|  1.24k|  if (use_wide && static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (8062:7): [True: 1.24k, False: 0]
  |  Branch (8062:19): [True: 1.24k, False: 0]
  ------------------
 8063|  1.24k|    percent_encode_to_wide(p, end, character_set, out);
 8064|  1.24k|    return;
 8065|  1.24k|  }
 8066|      0|#endif
 8067|      0|  percent_encode_to_scalar(p, end, character_set, out);
 8068|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 8133|  13.9k|    size_t& compress_length) noexcept {
 8134|  13.9k|  compress = 0;
 8135|  13.9k|  compress_length = 0;
 8136|  13.9k|  size_t i = 0;
 8137|   119k|  while (i < 8) {
  ------------------
  |  Branch (8137:10): [True: 105k, False: 13.9k]
  ------------------
 8138|   105k|    if (address[i] != 0) {
  ------------------
  |  Branch (8138:9): [True: 100k, False: 4.86k]
  ------------------
 8139|   100k|      ++i;
 8140|   100k|      continue;
 8141|   100k|    }
 8142|  4.86k|    size_t next = i + 1;
 8143|  11.0k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (8143:12): [True: 10.2k, False: 823]
  |  Branch (8143:24): [True: 6.18k, False: 4.04k]
  ------------------
 8144|  6.18k|      ++next;
 8145|  6.18k|    }
 8146|  4.86k|    const size_t count = next - i;
 8147|  4.86k|    if (count > compress_length) {
  ------------------
  |  Branch (8147:9): [True: 4.34k, False: 517]
  ------------------
 8148|  4.34k|      compress_length = count;
 8149|  4.34k|      compress = i;
 8150|  4.34k|    }
 8151|  4.86k|    i = next;
 8152|  4.86k|  }
 8153|  13.9k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 8155|  6.99k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 8156|  6.99k|  size_t compress = 0;
 8157|  6.99k|  size_t compress_length = 0;
 8158|  6.99k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 8159|       |
 8160|       |  // Skip compression when the longest zero run is a single piece.
 8161|  6.99k|  if (compress_length <= 1) {
  ------------------
  |  Branch (8161:7): [True: 5.94k, False: 1.04k]
  ------------------
 8162|  5.94k|    compress = compress_length = 8;
 8163|  5.94k|  }
 8164|       |
 8165|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 8166|  6.99k|  char output[4 * 8 + 7 + 2];
 8167|  6.99k|  char* point = output;
 8168|  6.99k|  *point++ = '[';
 8169|  6.99k|  size_t piece_index = 0;
 8170|  52.1k|  while (true) {
  ------------------
  |  Branch (8170:10): [True: 52.1k, Folded]
  ------------------
 8171|  52.1k|    if (piece_index == compress) {
  ------------------
  |  Branch (8171:9): [True: 1.04k, False: 51.0k]
  ------------------
 8172|  1.04k|      *point++ = ':';
 8173|       |      // If we skip a value initially, we need to write '::'.
 8174|  1.04k|      if (piece_index == 0) {
  ------------------
  |  Branch (8174:11): [True: 408, False: 639]
  ------------------
 8175|    408|        *point++ = ':';
 8176|    408|      }
 8177|  1.04k|      piece_index += compress_length;
 8178|  1.04k|      if (piece_index == 8) {
  ------------------
  |  Branch (8178:11): [True: 347, False: 700]
  ------------------
 8179|    347|        break;
 8180|    347|      }
 8181|  1.04k|    }
 8182|  51.7k|    point = write_hex_u16(point, address[piece_index]);
 8183|  51.7k|    ++piece_index;
 8184|  51.7k|    if (piece_index == 8) {
  ------------------
  |  Branch (8184:9): [True: 6.64k, False: 45.1k]
  ------------------
 8185|  6.64k|      break;
 8186|  6.64k|    }
 8187|  45.1k|    *point++ = ':';
 8188|  45.1k|  }
 8189|  6.99k|  *point++ = ']';
 8190|  6.99k|  return std::string(output, static_cast<size_t>(point - output));
 8191|  6.99k|}
_ZN3ada11serializers4ipv4Em:
 8193|  7.67k|std::string ipv4(const uint64_t address) {
 8194|  7.67k|  std::string output(15, '\0');
 8195|  7.67k|  char* point = output.data();
 8196|  7.67k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 8197|  7.67k|  *point++ = '.';
 8198|  7.67k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 8199|  7.67k|  *point++ = '.';
 8200|  7.67k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 8201|  7.67k|  *point++ = '.';
 8202|  7.67k|  point = write_u8(point, static_cast<uint8_t>(address));
 8203|  7.67k|  output.resize(static_cast<size_t>(point - output.data()));
 8204|  7.67k|  return output;
 8205|  7.67k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8609|  13.1k|    std::string_view input, const result_type* base_url) {
 8610|  13.1k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8611|  13.1k|  if (!u.is_valid) {
  ------------------
  |  Branch (8611:7): [True: 10.6k, False: 2.51k]
  ------------------
 8612|  10.6k|    return tl::unexpected(errors::type_error);
 8613|  10.6k|  }
 8614|  2.51k|  return u;
 8615|  13.1k|}
_ZN3ada20get_max_input_lengthEv:
 8230|  13.1k|uint32_t get_max_input_length() {
 8231|  13.1k|  return max_input_length_.load(std::memory_order_relaxed);
 8232|  13.1k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9597|  11.8k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9598|  11.8k|  while (!input.empty() &&
  ------------------
  |  Branch (9598:10): [True: 11.8k, False: 0]
  ------------------
 9599|  11.8k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9599:10): [True: 0, False: 11.8k]
  ------------------
 9600|      0|    input.remove_prefix(1);
 9601|      0|  }
 9602|  11.8k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9602:10): [True: 11.8k, False: 0]
  |  Branch (9602:28): [True: 0, False: 11.8k]
  ------------------
 9603|      0|    input.remove_suffix(1);
 9604|      0|  }
 9605|  11.8k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9769|      2|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9770|      2|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9771|      2|          input1.size(), " bytes] is part of string '", input2, "' [",
 9772|      2|          input2.size(), " bytes]");
 9773|      2|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9773:10): [True: 2, False: 0]
  |  Branch (9773:29): [True: 2, False: 0]
  |  Branch (9773:48): [True: 2, False: 0]
  ------------------
 9774|      2|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9774:10): [True: 0, False: 2]
  ------------------
 9775|      2|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12329|  4.70k|                                                result_type& out) {
12330|  4.70k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12331|  4.70k|  constexpr bool is_aggregator =
12332|  4.70k|      std::is_same_v<result_type, ada::url_aggregator>;
12333|  4.70k|  static_assert(is_ada_url || is_aggregator);
12334|       |
12335|  4.70k|  const size_t len = input.size();
12336|       |  // Shortest accepted form is "ws://x" (6).
12337|  4.70k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12337:7): [True: 0, False: 4.70k]
  ------------------
12338|      0|    return false;
12339|      0|  }
12340|  4.70k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12341|       |
12342|  4.70k|  size_t pos = 0;
12343|  4.70k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12344|  4.70k|  uint32_t protocol_end = 0;
12345|  4.70k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12346|  4.70k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12347|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12348|       |  // Masked compares cover the shorter special schemes without extra loads.
12349|  4.70k|  if (len >= 8) {
  ------------------
  |  Branch (12349:7): [True: 4.70k, False: 0]
  ------------------
12350|  4.70k|    uint64_t first8 = 0;
12351|  4.70k|    std::memcpy(&first8, b, 8);
12352|  4.70k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12352:9): [True: 0, False: 4.70k]
  ------------------
12353|      0|      pos = 8;
12354|      0|      scheme_type = ada::scheme::type::HTTPS;
12355|      0|      protocol_end = 6;
12356|  4.70k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12356:16): [True: 4.70k, False: 0]
  ------------------
12357|  4.70k|               0x002f2f3a70747468ull) {  // "http://"
12358|  4.70k|      pos = 7;
12359|  4.70k|      scheme_type = ada::scheme::type::HTTP;
12360|  4.70k|      protocol_end = 5;
12361|  4.70k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12361:16): [True: 0, False: 0]
  ------------------
12362|      0|               0x00002f2f3a737377ull) {  // "wss://"
12363|      0|      pos = 6;
12364|      0|      scheme_type = ada::scheme::type::WSS;
12365|      0|      protocol_end = 4;
12366|      0|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12366:16): [True: 0, False: 0]
  ------------------
12367|      0|               0x00002f2f3a707466ull) {  // "ftp://"
12368|      0|      pos = 6;
12369|      0|      scheme_type = ada::scheme::type::FTP;
12370|      0|      protocol_end = 4;
12371|      0|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12371:16): [True: 0, False: 0]
  ------------------
12372|      0|               0x0000002f2f3a7377ull) {  // "ws://"
12373|      0|      pos = 5;
12374|      0|      scheme_type = ada::scheme::type::WS;
12375|      0|      protocol_end = 3;
12376|      0|    } else {
12377|      0|      return false;
12378|      0|    }
12379|  4.70k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12379:14): [True: 0, False: 0]
  |  Branch (12379:29): [True: 0, False: 0]
  ------------------
12380|      0|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12380:9): [True: 0, False: 0]
  |  Branch (12380:24): [True: 0, False: 0]
  |  Branch (12380:39): [True: 0, False: 0]
  ------------------
12381|      0|      pos = 5;
12382|      0|      scheme_type = ada::scheme::type::WS;
12383|      0|      protocol_end = 3;
12384|      0|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12384:16): [True: 0, False: 0]
  |  Branch (12384:31): [True: 0, False: 0]
  |  Branch (12384:46): [True: 0, False: 0]
  |  Branch (12384:61): [True: 0, False: 0]
  ------------------
12385|      0|      pos = 6;
12386|      0|      scheme_type = ada::scheme::type::WSS;
12387|      0|      protocol_end = 4;
12388|      0|    } else {
12389|      0|      return false;
12390|      0|    }
12391|      0|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12391:14): [True: 0, False: 0]
  |  Branch (12391:29): [True: 0, False: 0]
  |  Branch (12391:44): [True: 0, False: 0]
  |  Branch (12391:59): [True: 0, False: 0]
  ------------------
12392|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12392:14): [True: 0, False: 0]
  |  Branch (12392:29): [True: 0, False: 0]
  ------------------
12393|      0|    pos = 6;
12394|      0|    scheme_type = ada::scheme::type::FTP;
12395|      0|    protocol_end = 4;
12396|      0|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12396:14): [True: 0, False: 0]
  |  Branch (12396:26): [True: 0, False: 0]
  |  Branch (12396:41): [True: 0, False: 0]
  |  Branch (12396:56): [True: 0, False: 0]
  ------------------
12397|      0|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12397:14): [True: 0, False: 0]
  |  Branch (12397:29): [True: 0, False: 0]
  |  Branch (12397:44): [True: 0, False: 0]
  |  Branch (12397:59): [True: 0, False: 0]
  ------------------
12398|      0|    pos = 7;
12399|      0|    scheme_type = ada::scheme::type::HTTP;
12400|      0|    protocol_end = 5;
12401|      0|  } else {
12402|      0|    return false;
12403|      0|  }
12404|       |#else
12405|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12406|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12407|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12408|       |    pos = 8;
12409|       |    scheme_type = ada::scheme::type::HTTPS;
12410|       |    protocol_end = 6;
12411|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12412|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12413|       |    pos = 7;
12414|       |    scheme_type = ada::scheme::type::HTTP;
12415|       |    protocol_end = 5;
12416|       |  } else if (b[0] == 'w' && b[1] == 's') {
12417|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12418|       |      pos = 5;
12419|       |      scheme_type = ada::scheme::type::WS;
12420|       |      protocol_end = 3;
12421|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12422|       |               b[5] == '/') {
12423|       |      pos = 6;
12424|       |      scheme_type = ada::scheme::type::WSS;
12425|       |      protocol_end = 4;
12426|       |    } else {
12427|       |      return false;
12428|       |    }
12429|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12430|       |             b[4] == '/' && b[5] == '/') {
12431|       |    pos = 6;
12432|       |    scheme_type = ada::scheme::type::FTP;
12433|       |    protocol_end = 4;
12434|       |  } else {
12435|       |    return false;
12436|       |  }
12437|       |#endif
12438|  4.70k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12438:7): [True: 4.70k, False: 0]
  |  Branch (12438:21): [True: 18, False: 4.68k]
  |  Branch (12438:38): [True: 6, False: 4.67k]
  ------------------
12439|     24|    return false;
12440|     24|  }
12441|       |
12442|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12443|  4.67k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12443:7): [True: 4.67k, False: 0]
  |  Branch (12443:22): [True: 3.85k, False: 824]
  |  Branch (12443:39): [True: 0, False: 3.85k]
  |  Branch (12443:57): [True: 0, False: 4.67k]
  ------------------
12444|      0|    return false;
12445|      0|  }
12446|       |
12447|  4.67k|  const size_t host_start = pos;
12448|  4.67k|  bool has_upper = false;
12449|  4.67k|  bool has_x = false;
12450|  4.67k|  size_t host_end = pos;
12451|  4.67k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12451:7): [True: 2.72k, False: 1.94k]
  ------------------
12452|  2.72k|    return false;
12453|  2.72k|  }
12454|  1.94k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12454:7): [True: 38, False: 1.90k]
  ------------------
12455|     38|    return false;
12456|     38|  }
12457|  1.90k|  const size_t host_len = host_end - host_start;
12458|  1.90k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12458:7): [True: 0, False: 1.90k]
  ------------------
12459|      0|    return false;
12460|      0|  }
12461|  1.90k|  {
12462|  1.90k|    std::string_view hv(input.data() + host_start, host_len);
12463|  1.90k|    char host_buf[256];
12464|  1.90k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12464:9): [True: 446, False: 1.46k]
  ------------------
12465|    446|      std::memcpy(host_buf, input.data() + host_start, host_len);
12466|    446|      unicode::to_lower_ascii(host_buf, host_len);
12467|    446|      hv = std::string_view(host_buf, host_len);
12468|    446|    }
12469|  1.90k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12469:9): [True: 263, False: 1.64k]
  ------------------
12470|    263|      return false;
12471|    263|    }
12472|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12473|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12474|  1.64k|    static constexpr std::string_view xn{"xn-", 3};
12475|  1.64k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12475:10): [True: 210, False: 1.43k]
  |  Branch (12475:19): [True: 248, False: 1.18k]
  |  Branch (12475:33): [True: 26, False: 432]
  ------------------
12476|     26|        [[unlikely]] {
12477|     26|      return false;
12478|     26|    }
12479|  1.64k|  }
12480|       |
12481|  1.62k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12481:7): [True: 1.62k, False: 0]
  |  Branch (12481:25): [True: 703, False: 917]
  ------------------
12482|    703|    return finish_simple_absolute_with_port(input, out, scheme_type,
12483|    703|                                            protocol_end, host_start, host_end,
12484|    703|                                            host_len, has_upper);
12485|    703|  }
12486|       |
12487|    917|  size_t i = host_end;
12488|    917|  size_t path_start = host_end;
12489|    917|  size_t path_end = host_end;
12490|    917|  size_t query_start = std::string_view::npos;
12491|    917|  size_t hash_start = std::string_view::npos;
12492|    917|  bool has_path = false;
12493|    917|  bool maybe_dot_segment = false;
12494|    917|  bool rest_simple = true;
12495|       |
12496|    917|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12496:7): [True: 917, False: 0]
  |  Branch (12496:18): [True: 769, False: 148]
  ------------------
12497|    769|    has_path = true;
12498|    769|    path_start = i;
12499|    769|    ++i;
12500|    769|    scan_path_run(b, i, len, maybe_dot_segment);
12501|    769|    if (i < len) {
  ------------------
  |  Branch (12501:9): [True: 544, False: 225]
  ------------------
12502|    544|      const uint8_t cls = k_path[b[i]];
12503|    544|      if (cls == 1) {
  ------------------
  |  Branch (12503:11): [True: 70, False: 474]
  ------------------
12504|     70|        path_end = i;
12505|     70|        if (b[i] == '?') {
  ------------------
  |  Branch (12505:13): [True: 41, False: 29]
  ------------------
12506|     41|          query_start = i;
12507|     41|          ++i;
12508|     41|          goto scan_query;
12509|     41|        }
12510|     29|        hash_start = i;
12511|     29|        ++i;
12512|     29|        goto scan_hash;
12513|     70|      }
12514|    474|      rest_simple = false;
12515|    474|      hash_start = input.find('#', i);
12516|    474|      query_start = input.substr(0, hash_start).find('?', i);
12517|    474|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12517:11): [True: 32, False: 442]
  ------------------
12518|     32|        path_end = query_start;
12519|    442|      } else {
12520|    442|        path_end = hash_start != std::string_view::npos ? hash_start : len;
  ------------------
  |  Branch (12520:20): [True: 27, False: 415]
  ------------------
12521|    442|      }
12522|    474|      goto after_rest;
12523|    544|    }
12524|    225|    path_end = i;
12525|    225|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12525:14): [True: 148, False: 0]
  |  Branch (12525:25): [True: 79, False: 69]
  ------------------
12526|     79|    query_start = i;
12527|     79|    ++i;
12528|     79|    goto scan_query;
12529|     79|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12529:14): [True: 69, False: 0]
  |  Branch (12529:25): [True: 69, False: 0]
  ------------------
12530|     69|    hash_start = i;
12531|     69|    ++i;
12532|     69|    goto scan_hash;
12533|     69|  }
12534|    225|  goto after_rest;
12535|       |
12536|    225|scan_query:
12537|    120|  scan_query_run(b, i, len);
12538|    120|  if (i < len) {
  ------------------
  |  Branch (12538:7): [True: 63, False: 57]
  ------------------
12539|     63|    if (b[i] == '#') {
  ------------------
  |  Branch (12539:9): [True: 14, False: 49]
  ------------------
12540|     14|      hash_start = i;
12541|     14|      ++i;
12542|     14|      goto scan_hash;
12543|     14|    }
12544|     49|    rest_simple = false;
12545|     49|    goto scan_query_boundary;
12546|     63|  }
12547|     57|  goto after_rest;
12548|       |
12549|     57|scan_query_boundary:
12550|     49|  hash_start = input.find('#', i);
12551|     49|  goto after_rest;
12552|       |
12553|    112|scan_hash:
12554|    112|  scan_hash_run(b, i, len);
12555|    112|  if (i < len) {
  ------------------
  |  Branch (12555:7): [True: 56, False: 56]
  ------------------
12556|     56|    rest_simple = false;
12557|     56|  }
12558|       |
12559|    917|after_rest:
12560|    917|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12560:7): [True: 338, False: 579]
  |  Branch (12560:22): [True: 226, False: 112]
  ------------------
12561|    226|    const std::string_view path_body(input.data() + path_start,
12562|    226|                                     path_end - path_start);
12563|    226|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12563:9): [True: 132, False: 94]
  ------------------
12564|    132|      rest_simple = false;
12565|    132|    }
12566|    226|  }
12567|       |
12568|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12569|       |  // trailing C0 control or space; this fast path does neither. A query or
12570|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12571|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12572|       |  // inputs back to the slow path.
12573|    917|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12573:7): [True: 711, False: 206]
  |  Branch (12573:24): [True: 0, False: 711]
  ------------------
12574|    711|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12574:24): [True: 54, False: 657]
  ------------------
12575|     54|    return false;
12576|     54|  }
12577|       |
12578|    863|  out.type = scheme_type;
12579|    863|  out.is_valid = true;
12580|    863|  out.has_opaque_path = false;
12581|    863|  out.host_type = DEFAULT;
12582|       |
12583|    863|  if (!rest_simple) {
  ------------------
  |  Branch (12583:7): [True: 657, False: 206]
  ------------------
12584|       |    // Host is a plain domain. Finish path/query/hash with
12585|       |    // the regular helpers
12586|       |    // so percent-encoding and dot segments do not re-parse the authority.
12587|    657|    const std::string_view path_view =
12588|    657|        has_path
  ------------------
  |  Branch (12588:9): [True: 578, False: 79]
  ------------------
12589|    657|            ? std::string_view(input.data() + path_start, path_end - path_start)
12590|    657|            : std::string_view{};
12591|    657|    auto apply_query_and_hash = [&]() {
12592|    657|      if (query_start != std::string_view::npos) {
12593|    657|        const size_t q_end =
12594|    657|            (hash_start != std::string_view::npos) ? hash_start : len;
12595|    657|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|    657|                                                q_end - query_start - 1),
12597|    657|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|    657|      }
12599|    657|      if (hash_start != std::string_view::npos) {
12600|    657|        out.update_unencoded_base_hash(std::string_view(
12601|    657|            input.data() + hash_start + 1, len - hash_start - 1));
12602|    657|      }
12603|    657|    };
12604|    657|    if constexpr (is_aggregator) {
12605|    657|      out.buffer.assign(input.substr(0, host_end));
12606|    657|      if (has_upper) {
  ------------------
  |  Branch (12606:11): [True: 71, False: 586]
  ------------------
12607|     71|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12608|     71|      }
12609|    657|      out.components.protocol_end = protocol_end;
12610|    657|      out.components.username_end = protocol_end + 2;
12611|    657|      out.components.host_start = protocol_end + 2;
12612|    657|      out.components.host_end = static_cast<uint32_t>(host_end);
12613|    657|      out.components.port = url_components::omitted;
12614|    657|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12615|    657|      out.components.search_start = url_components::omitted;
12616|    657|      out.components.hash_start = url_components::omitted;
12617|    657|      out.parse_path(path_view);
12618|    657|      apply_query_and_hash();
12619|       |    } else {
12620|       |      std::string host_str(input.substr(host_start, host_len));
12621|       |      if (has_upper) {
12622|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12623|       |      }
12624|       |      out.host = std::move(host_str);
12625|       |      out.parse_path(path_view);
12626|       |      apply_query_and_hash();
12627|       |    }
12628|    657|    return true;
12629|    657|  }
12630|       |
12631|    206|  const bool need_slash = !has_path;
12632|    206|  if constexpr (is_aggregator) {
12633|    206|    if (!need_slash) {
  ------------------
  |  Branch (12633:9): [True: 149, False: 57]
  ------------------
12634|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12635|    149|      out.buffer.assign(input);
12636|    149|      if (has_upper) {
  ------------------
  |  Branch (12636:11): [True: 22, False: 127]
  ------------------
12637|     22|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12638|     22|      }
12639|    149|      out.components.protocol_end = protocol_end;
12640|    149|      out.components.username_end = protocol_end + 2;
12641|    149|      out.components.host_start = protocol_end + 2;
12642|    149|      out.components.host_end = static_cast<uint32_t>(host_end);
12643|    149|      out.components.port = url_components::omitted;
12644|    149|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12645|    149|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12645:37): [True: 12, False: 137]
  ------------------
12646|    149|                                        ? static_cast<uint32_t>(query_start)
12647|    149|                                        : url_components::omitted;
12648|    149|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12648:35): [True: 13, False: 136]
  ------------------
12649|    149|                                      ? static_cast<uint32_t>(hash_start)
12650|    149|                                      : url_components::omitted;
12651|    149|    } else {
12652|     57|      out.buffer.clear();
12653|     57|      out.buffer.reserve(len + 1);
12654|     57|      out.buffer.append(input.substr(0, host_end));
12655|     57|      out.buffer.push_back('/');
12656|     57|      if (host_end < len) {
  ------------------
  |  Branch (12656:11): [True: 57, False: 0]
  ------------------
12657|     57|        out.buffer.append(input.substr(host_end));
12658|     57|      }
12659|     57|      if (has_upper) {
  ------------------
  |  Branch (12659:11): [True: 16, False: 41]
  ------------------
12660|     16|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12661|     16|      }
12662|     57|      out.components.protocol_end = protocol_end;
12663|     57|      out.components.username_end = protocol_end + 2;
12664|     57|      out.components.host_start = protocol_end + 2;
12665|     57|      out.components.host_end = static_cast<uint32_t>(host_end);
12666|     57|      out.components.port = url_components::omitted;
12667|     57|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12668|     57|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12668:37): [True: 40, False: 17]
  ------------------
12669|     57|                                        ? static_cast<uint32_t>(query_start + 1)
12670|     57|                                        : url_components::omitted;
12671|     57|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12671:35): [True: 28, False: 29]
  ------------------
12672|     57|                                      ? static_cast<uint32_t>(hash_start + 1)
12673|     57|                                      : url_components::omitted;
12674|     57|    }
12675|       |  } else {
12676|       |    std::string host_str(input.substr(host_start, host_len));
12677|       |    if (has_upper) {
12678|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12679|       |    }
12680|       |    out.host = std::move(host_str);
12681|       |    if (need_slash) {
12682|       |      out.path = "/";
12683|       |    } else {
12684|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12685|       |    }
12686|       |    if (query_start != std::string_view::npos) {
12687|       |      const size_t q_end =
12688|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12689|       |      out.query.emplace(input.data() + query_start + 1,
12690|       |                        q_end - query_start - 1);
12691|       |    }
12692|       |    if (hash_start != std::string_view::npos) {
12693|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12694|       |    }
12695|       |  }
12696|    206|  return true;
12697|    863|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
12057|    703|    bool has_upper) {
12058|    703|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12059|    703|  constexpr bool is_aggregator =
12060|    703|      std::is_same_v<result_type, ada::url_aggregator>;
12061|    703|  static_assert(is_ada_url || is_aggregator);
12062|       |
12063|    703|  const size_t len = input.size();
12064|    703|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12065|    703|  size_t p = host_end + 1;
12066|    703|  uint32_t port_value = 0;
12067|    703|  bool any_digit = false;
12068|  1.21k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12068:10): [True: 1.21k, False: 0]
  |  Branch (12068:21): [True: 637, False: 574]
  |  Branch (12068:36): [True: 524, False: 113]
  ------------------
12069|    524|    any_digit = true;
12070|    524|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12071|    524|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12071:9): [True: 16, False: 508]
  ------------------
12072|     16|      return false;
12073|     16|    }
12074|    508|    ++p;
12075|    508|  }
12076|    687|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12076:7): [True: 687, False: 0]
  |  Branch (12076:18): [True: 369, False: 318]
  |  Branch (12076:33): [True: 289, False: 80]
  |  Branch (12076:48): [True: 199, False: 90]
  ------------------
12077|    199|    return false;
12078|    199|  }
12079|    488|  uint32_t parsed_port = url_components::omitted;
12080|    488|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12081|    488|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12081:7): [True: 90, False: 398]
  |  Branch (12081:20): [True: 89, False: 1]
  ------------------
12082|     89|    parsed_port = port_value;
12083|     89|  }
12084|    488|  const size_t authority_end = p;
12085|       |
12086|    488|  size_t i = authority_end;
12087|    488|  size_t path_start = host_end;
12088|    488|  size_t path_end = host_end;
12089|    488|  size_t query_start = std::string_view::npos;
12090|    488|  size_t hash_start = std::string_view::npos;
12091|    488|  bool has_path = false;
12092|    488|  bool maybe_dot_segment = false;
12093|    488|  bool rest_simple = true;
12094|       |
12095|    488|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12095:7): [True: 488, False: 0]
  |  Branch (12095:18): [True: 318, False: 170]
  ------------------
12096|    318|    has_path = true;
12097|    318|    path_start = i;
12098|    318|    ++i;
12099|    318|    scan_path_run(b, i, len, maybe_dot_segment);
12100|    318|    if (i < len) {
  ------------------
  |  Branch (12100:9): [True: 195, False: 123]
  ------------------
12101|    195|      const uint8_t cls = k_path[b[i]];
12102|    195|      if (cls == 1) {
  ------------------
  |  Branch (12102:11): [True: 44, False: 151]
  ------------------
12103|     44|        path_end = i;
12104|     44|        if (b[i] == '?') {
  ------------------
  |  Branch (12104:13): [True: 30, False: 14]
  ------------------
12105|     30|          query_start = i;
12106|     30|          ++i;
12107|     30|          goto scan_query;
12108|     30|        }
12109|     14|        hash_start = i;
12110|     14|        ++i;
12111|     14|        goto scan_hash;
12112|     44|      }
12113|    151|      rest_simple = false;
12114|  2.00k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12114:14): [True: 1.87k, False: 132]
  ------------------
12115|  1.87k|        if (b[i] == '?') {
  ------------------
  |  Branch (12115:13): [True: 14, False: 1.86k]
  ------------------
12116|     14|          path_end = i;
12117|     14|          query_start = i;
12118|     14|          ++i;
12119|     14|          goto scan_query_boundary;
12120|     14|        }
12121|  1.86k|        if (b[i] == '#') {
  ------------------
  |  Branch (12121:13): [True: 5, False: 1.85k]
  ------------------
12122|      5|          path_end = i;
12123|      5|          hash_start = i;
12124|      5|          ++i;
12125|      5|          goto after_rest;
12126|      5|        }
12127|  1.86k|      }
12128|    132|      path_end = i;
12129|    132|      goto after_rest;
12130|    151|    }
12131|    123|    path_end = i;
12132|    170|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12132:14): [True: 170, False: 0]
  |  Branch (12132:25): [True: 80, False: 90]
  ------------------
12133|     80|    query_start = i;
12134|     80|    ++i;
12135|     80|    goto scan_query;
12136|     90|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12136:14): [True: 90, False: 0]
  |  Branch (12136:25): [True: 90, False: 0]
  ------------------
12137|     90|    hash_start = i;
12138|     90|    ++i;
12139|     90|    goto scan_hash;
12140|     90|  }
12141|    123|  goto after_rest;
12142|       |
12143|    123|scan_query:
12144|    110|  scan_query_run(b, i, len);
12145|    110|  if (i < len) {
  ------------------
  |  Branch (12145:7): [True: 64, False: 46]
  ------------------
12146|     64|    if (b[i] == '#') {
  ------------------
  |  Branch (12146:9): [True: 7, False: 57]
  ------------------
12147|      7|      hash_start = i;
12148|      7|      ++i;
12149|      7|      goto scan_hash;
12150|      7|    }
12151|     57|    rest_simple = false;
12152|     57|    goto scan_query_boundary;
12153|     64|  }
12154|     46|  goto after_rest;
12155|       |
12156|     71|scan_query_boundary:
12157|    795|  for (; i < len; ++i) {
  ------------------
  |  Branch (12157:10): [True: 734, False: 61]
  ------------------
12158|    734|    if (b[i] == '#') {
  ------------------
  |  Branch (12158:9): [True: 10, False: 724]
  ------------------
12159|     10|      hash_start = i;
12160|     10|      ++i;
12161|     10|      goto after_rest;
12162|     10|    }
12163|    734|  }
12164|     61|  goto after_rest;
12165|       |
12166|    111|scan_hash:
12167|    111|  scan_hash_run(b, i, len);
12168|    111|  if (i < len) {
  ------------------
  |  Branch (12168:7): [True: 40, False: 71]
  ------------------
12169|     40|    rest_simple = false;
12170|     40|  }
12171|       |
12172|    488|after_rest:
12173|    488|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12173:7): [True: 240, False: 248]
  |  Branch (12173:22): [True: 87, False: 153]
  ------------------
12174|     87|    const std::string_view path_body(input.data() + path_start,
12175|     87|                                     path_end - path_start);
12176|     87|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12176:9): [True: 48, False: 39]
  ------------------
12177|     48|      rest_simple = false;
12178|     48|    }
12179|     87|  }
12180|       |
12181|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12182|       |  // trailing C0 control or space; this fast path does neither. A query or
12183|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12184|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12185|       |  // inputs back to the slow path.
12186|    488|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12186:7): [True: 296, False: 192]
  |  Branch (12186:24): [True: 0, False: 296]
  ------------------
12187|    296|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12187:24): [True: 33, False: 263]
  ------------------
12188|     33|    return false;
12189|     33|  }
12190|       |
12191|    455|  out.type = scheme_type;
12192|    455|  out.is_valid = true;
12193|    455|  out.has_opaque_path = false;
12194|    455|  out.host_type = DEFAULT;
12195|       |
12196|    455|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12196:31): [True: 89, False: 366]
  ------------------
12197|    455|                                  ? (1 + port_decimal_digit_count(parsed_port))
12198|    455|                                  : 0;
12199|       |
12200|    455|  if (!rest_simple) {
  ------------------
  |  Branch (12200:7): [True: 263, False: 192]
  ------------------
12201|    263|    const std::string_view path_view =
12202|    263|        has_path
  ------------------
  |  Branch (12202:9): [True: 194, False: 69]
  ------------------
12203|    263|            ? std::string_view(input.data() + path_start, path_end - path_start)
12204|    263|            : std::string_view{};
12205|    263|    auto apply_query_and_hash = [&]() {
12206|    263|      if (query_start != std::string_view::npos) {
12207|    263|        const size_t q_end =
12208|    263|            (hash_start != std::string_view::npos) ? hash_start : len;
12209|    263|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|    263|                                                q_end - query_start - 1),
12211|    263|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|    263|      }
12213|    263|      if (hash_start != std::string_view::npos) {
12214|    263|        out.update_unencoded_base_hash(std::string_view(
12215|    263|            input.data() + hash_start + 1, len - hash_start - 1));
12216|    263|      }
12217|    263|    };
12218|    263|    if constexpr (is_aggregator) {
12219|    263|      out.buffer.assign(input.substr(0, host_end));
12220|    263|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12220:11): [True: 15, False: 248]
  ------------------
12221|     15|        append_canonical_port(out.buffer, parsed_port);
12222|     15|      }
12223|    263|      if (has_upper) {
  ------------------
  |  Branch (12223:11): [True: 40, False: 223]
  ------------------
12224|     40|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12225|     40|      }
12226|    263|      out.components.protocol_end = protocol_end;
12227|    263|      out.components.username_end = protocol_end + 2;
12228|    263|      out.components.host_start = protocol_end + 2;
12229|    263|      out.components.host_end = static_cast<uint32_t>(host_end);
12230|    263|      out.components.port = parsed_port;
12231|    263|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12232|    263|      out.components.search_start = url_components::omitted;
12233|    263|      out.components.hash_start = url_components::omitted;
12234|    263|      out.parse_path(path_view);
12235|    263|      apply_query_and_hash();
12236|       |    } else {
12237|       |      std::string host_str(input.substr(host_start, host_len));
12238|       |      if (has_upper) {
12239|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12240|       |      }
12241|       |      out.host = std::move(host_str);
12242|       |      if (parsed_port != url_components::omitted) {
12243|       |        out.port = static_cast<uint16_t>(parsed_port);
12244|       |      }
12245|       |      out.parse_path(path_view);
12246|       |      apply_query_and_hash();
12247|       |    }
12248|    263|    return true;
12249|    263|  }
12250|       |
12251|    192|  const bool insert_slash = !has_path;
12252|    192|  if constexpr (is_aggregator) {
12253|    192|    const size_t out_len =
12254|    192|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (12254:34): [True: 89, False: 103]
  ------------------
12255|    192|    const bool omit_port_bytes = parsed_port == url_components::omitted;
12256|    192|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (12256:9): [True: 31, False: 161]
  |  Branch (12256:27): [True: 8, False: 23]
  |  Branch (12256:44): [True: 8, False: 0]
  ------------------
12257|      8|      out.buffer.assign(input);
12258|    184|    } else {
12259|    184|      out.buffer.clear();
12260|    184|      out.buffer.reserve(out_len);
12261|    184|      out.buffer.append(input.substr(0, host_end));
12262|    184|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12262:11): [True: 66, False: 118]
  ------------------
12263|     66|        append_canonical_port(out.buffer, parsed_port);
12264|     66|      }
12265|    184|      if (insert_slash) {
  ------------------
  |  Branch (12265:11): [True: 89, False: 95]
  ------------------
12266|     89|        out.buffer.push_back('/');
12267|     89|      }
12268|    184|      if (authority_end < len) {
  ------------------
  |  Branch (12268:11): [True: 184, False: 0]
  ------------------
12269|    184|        out.buffer.append(input.substr(authority_end));
12270|    184|      }
12271|    184|    }
12272|    192|    if (has_upper) {
  ------------------
  |  Branch (12272:9): [True: 47, False: 145]
  ------------------
12273|     47|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12274|     47|    }
12275|    192|    const uint32_t pathname_start =
12276|    192|        static_cast<uint32_t>(host_end) + port_bytes;
12277|    192|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12278|    192|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (12278:33): [True: 89, False: 103]
  ------------------
12279|    192|                               static_cast<int32_t>(authority_end);
12280|    192|    out.components.protocol_end = protocol_end;
12281|    192|    out.components.username_end = protocol_end + 2;
12282|    192|    out.components.host_start = protocol_end + 2;
12283|    192|    out.components.host_end = static_cast<uint32_t>(host_end);
12284|    192|    out.components.port = parsed_port;
12285|    192|    out.components.pathname_start = pathname_start;
12286|    192|    out.components.search_start =
12287|    192|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (12287:9): [True: 42, False: 150]
  ------------------
12288|    192|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12289|     42|                                    tail_delta)
12290|    192|            : url_components::omitted;
12291|    192|    out.components.hash_start =
12292|    192|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12292:9): [True: 67, False: 125]
  ------------------
12293|    192|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12294|     67|                                    tail_delta)
12295|    192|            : url_components::omitted;
12296|       |  } else {
12297|       |    std::string host_str(input.substr(host_start, host_len));
12298|       |    if (has_upper) {
12299|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12300|       |    }
12301|       |    out.host = std::move(host_str);
12302|       |    if (parsed_port != url_components::omitted) {
12303|       |      out.port = static_cast<uint16_t>(parsed_port);
12304|       |    }
12305|       |    if (insert_slash) {
12306|       |      out.path = "/";
12307|       |    } else {
12308|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12309|       |    }
12310|       |    if (query_start != std::string_view::npos) {
12311|       |      const size_t q_end =
12312|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12313|       |      out.query.emplace(input.data() + query_start + 1,
12314|       |                        q_end - query_start - 1);
12315|       |    }
12316|       |    if (hash_start != std::string_view::npos) {
12317|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12318|       |    }
12319|       |  }
12320|    192|  return true;
12321|    455|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12886|  13.1k|                           const result_type* base_url) {
12887|       |  // We can specialize the implementation per type.
12888|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12889|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12890|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12891|       |  // and ada::url **do not have to support the exact same API**.
12892|  13.1k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12893|  13.1k|  constexpr bool result_type_is_ada_url_aggregator =
12894|  13.1k|      std::is_same_v<url_aggregator, result_type>;
12895|  13.1k|  static_assert(result_type_is_ada_url ||
12896|  13.1k|                result_type_is_ada_url_aggregator);  // We don't support
12897|       |                                                     // anything else for now.
12898|       |
12899|  13.1k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12900|  13.1k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12901|  13.1k|          ")");
12902|       |
12903|  13.1k|  result_type url{};
12904|       |
12905|  13.1k|  const uint32_t max_input_length = ada::get_max_input_length();
12906|       |
12907|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12908|       |  // max_input_length even when the input fit under it. The check at the end of
12909|       |  // the state machine covers URLs that run to completion, but several states
12910|       |  // return early after appending a query or fragment, so run the same check on
12911|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12912|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12913|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12914|  13.1k|  const auto enforce_max_input_length = [&]() {
12915|  13.1k|    if constexpr (store_values) {
12916|  13.1k|      if (url.is_valid) {
12917|  13.1k|        if constexpr (result_type_is_ada_url_aggregator) {
12918|  13.1k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12919|  13.1k|            url.is_valid = false;
12920|  13.1k|          }
12921|  13.1k|        } else {
12922|  13.1k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12923|  13.1k|            url.is_valid = false;
12924|  13.1k|          }
12925|  13.1k|        }
12926|  13.1k|      }
12927|  13.1k|    }
12928|  13.1k|  };
12929|       |
12930|       |  // We refuse to parse URL strings that exceed the maximum input length.
12931|       |  // By default, this is 4GB but can be configured via
12932|       |  // ada::set_max_input_length().
12933|  13.1k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12933:7): [True: 0, False: 13.1k]
  ------------------
12934|      0|    url.is_valid = false;
12935|      0|  }
12936|       |  // Going forward, user_input.size() is in [0,
12937|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12938|       |  // base, or the optional_url was invalid, we must return.
12939|  13.1k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12939:7): [True: 0, False: 13.1k]
  ------------------
12940|      0|    url.is_valid &= base_url->is_valid;
12941|      0|  }
12942|  13.1k|  if (!url.is_valid) {
  ------------------
  |  Branch (12942:7): [True: 0, False: 13.1k]
  ------------------
12943|      0|    return url;
12944|      0|  }
12945|       |
12946|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12947|  13.1k|  if constexpr (store_values) {
12948|  13.1k|    bool hit_fast_path = false;
12949|  13.1k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12949:9): [True: 13.1k, False: 0]
  ------------------
12950|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12951|       |      // call so those URLs (including SetHref) do not pay for a miss.
12952|  13.1k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12953|  13.1k|      const size_t n = user_input.size();
12954|  13.1k|      size_t host_start = 0;
12955|  13.1k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12955:11): [True: 13.1k, False: 0]
  |  Branch (12955:21): [True: 13.1k, False: 0]
  |  Branch (12955:36): [True: 13.1k, False: 0]
  |  Branch (12955:51): [True: 13.1k, False: 0]
  ------------------
12956|  13.1k|        host_start = 7;
12957|  13.1k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12957:18): [True: 0, False: 0]
  |  Branch (12957:28): [True: 0, False: 0]
  |  Branch (12957:43): [True: 0, False: 0]
  |  Branch (12957:58): [True: 0, False: 0]
  ------------------
12958|      0|        host_start = 8;
12959|      0|      }
12960|  13.1k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12960:34): [True: 13.1k, False: 0]
  ------------------
12961|  13.1k|      const bool skip_ip =
12962|  13.1k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12962:11): [True: 7.17k, False: 5.95k]
  |  Branch (12962:33): [True: 5.09k, False: 853]
  |  Branch (12962:54): [True: 1.16k, False: 3.93k]
  ------------------
12963|       |      // Only scan for userinfo when the host is not an IP literal, so
12964|       |      // IPv4/IPv6 inputs skip the SIMD '@' check entirely.
12965|  13.1k|      hit_fast_path =
12966|  13.1k|          !skip_ip &&
  ------------------
  |  Branch (12966:11): [True: 4.78k, False: 8.34k]
  ------------------
12967|  4.78k|          !(host_start != 0 && authority_has_at(p, host_start, n)) &&
  ------------------
  |  Branch (12967:13): [True: 4.78k, False: 0]
  |  Branch (12967:32): [True: 88, False: 4.70k]
  ------------------
12968|  4.70k|          try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12968:11): [True: 1.31k, False: 3.38k]
  ------------------
12969|  13.1k|    } else {
12970|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12971|      0|    }
12972|  13.1k|    if (hit_fast_path) {
  ------------------
  |  Branch (12972:9): [True: 1.31k, False: 11.8k]
  ------------------
12973|  1.31k|      if constexpr (result_type_is_ada_url_aggregator) {
12974|  1.31k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12974:13): [True: 0, False: 1.31k]
  ------------------
12975|      0|          url.is_valid = false;
12976|      0|        }
12977|       |      } else {
12978|       |        // For a small absolute input, even worst-case normalization cannot
12979|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12980|       |        // most 4.5x. Avoid traversing every stored component on the common
12981|       |        // default-limit path.
12982|       |        if ((base_url != nullptr ||
12983|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12984|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12985|       |          url.is_valid = false;
12986|       |        }
12987|       |      }
12988|  1.31k|      return url;
12989|  1.31k|    }
12990|  13.1k|  }
12991|       |
12992|  11.8k|  state state = state::SCHEME_START;
12993|       |
12994|  13.1k|  std::string tmp_buffer;
12995|  13.1k|  std::string_view url_data;
12996|  13.1k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12996:7): [True: 169, False: 12.9k]
  ------------------
12997|    169|    tmp_buffer = user_input;
12998|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12999|       |    // just directly build the string from user_input.
13000|    169|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
13001|    169|    url_data = tmp_buffer;
13002|  12.9k|  } else [[likely]] {
13003|  12.9k|    url_data = user_input;
13004|  12.9k|  }
13005|       |
13006|       |  // Leading and trailing control characters are uncommon and easy to deal with
13007|       |  // (no performance concern).
13008|  13.1k|  helpers::trim_c0_whitespace(url_data);
13009|       |
13010|  13.1k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
13011|       |    // Most of the time, we just need user_input.size().
13012|       |    // In some instances, we may need a bit more.
13013|       |    ///////////////////////////
13014|       |    // This is *very* important. This line should *not* be removed
13015|       |    // hastily. There are principled reasons why reserve is important
13016|       |    // for performance. If you have a benchmark with small inputs,
13017|       |    // it may not matter, but in other instances, it could.
13018|       |    ////
13019|       |    // This rounds up to the next power of two.
13020|       |    // We know that user_input.size() is in [0,
13021|       |    // std::numeric_limits<uint32_t>::max).
13022|  13.1k|    uint32_t reserve_capacity =
13023|  13.1k|        (0xFFFFFFFF >>
13024|  13.1k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
13025|  13.1k|        1;
13026|  13.1k|    url.reserve(reserve_capacity);
13027|  13.1k|  }
13028|       |
13029|       |  // Optimization opportunity. Most websites do not have fragment.
13030|  13.1k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
13031|       |  // We add it last so that an implementation like ada::url_aggregator
13032|       |  // can append it last to its internal buffer, thus improving performance.
13033|       |
13034|       |  // Here url_data no longer has its fragment.
13035|       |  // We are going to access the data from url_data (it is immutable).
13036|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
13037|       |  // The input_position variable should range from 0 to input_size.
13038|       |  // It is illegal to access url_data at input_size.
13039|  13.1k|  size_t input_position = 0;
13040|  13.1k|  const size_t input_size = url_data.size();
13041|       |  // Keep running the following state machine by switching on state.
13042|       |  // If after a run pointer points to the EOF code point, go to the next step.
13043|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
13044|       |  // We never decrement input_position.
13045|  64.2k|  while (input_position <= input_size) {
  ------------------
  |  Branch (13045:10): [True: 62.2k, False: 1.97k]
  ------------------
13046|  62.2k|    ada_log("In parsing at ", input_position, " out of ", input_size,
13047|  62.2k|            " in state ", ada::to_string(state));
13048|  62.2k|    switch (state) {
13049|  11.8k|      case state::SCHEME_START: {
  ------------------
  |  Branch (13049:7): [True: 11.8k, False: 50.4k]
  ------------------
13050|  11.8k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
13051|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
13052|       |        // state to scheme state.
13053|  11.8k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13053:13): [True: 11.8k, False: 0]
  ------------------
13054|  11.8k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (13054:13): [True: 11.8k, False: 0]
  ------------------
13055|  11.8k|          state = state::SCHEME;
13056|  11.8k|          input_position++;
13057|  11.8k|        } else {
13058|       |          // Otherwise, if state override is not given, set state to no scheme
13059|       |          // state and decrease pointer by 1.
13060|      0|          state = state::NO_SCHEME;
13061|      0|        }
13062|  11.8k|        break;
13063|      0|      }
13064|  11.8k|      case state::SCHEME: {
  ------------------
  |  Branch (13064:7): [True: 11.8k, False: 50.4k]
  ------------------
13065|  11.8k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
13066|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
13067|       |        // append c, lowercased, to buffer.
13068|  47.2k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13068:16): [True: 47.2k, False: 0]
  ------------------
13069|  47.2k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13069:16): [True: 35.4k, False: 11.8k]
  ------------------
13070|  35.4k|          input_position++;
13071|  35.4k|        }
13072|       |        // Otherwise, if c is U+003A (:), then:
13073|  11.8k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:13): [True: 11.8k, False: 0]
  ------------------
13074|  11.8k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13074:13): [True: 11.8k, False: 0]
  ------------------
13075|  11.8k|          ada_log("SCHEME the scheme should be ",
13076|  11.8k|                  url_data.substr(0, input_position));
13077|       |          if constexpr (result_type_is_ada_url) {
13078|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
13079|       |              return url;
13080|       |            }
13081|  11.8k|          } else {
13082|       |            // we pass the colon along instead of painfully adding it back.
13083|  11.8k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (13083:17): [True: 0, False: 11.8k]
  ------------------
13084|  11.8k|                    url_data.substr(0, input_position + 1))) {
13085|      0|              return url;
13086|      0|            }
13087|  11.8k|          }
13088|  11.8k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13089|       |
13090|       |          // If url's scheme is "file", then:
13091|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13092|  11.8k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13092:15): [True: 0, False: 11.8k]
  ------------------
13093|       |            // Set state to file state.
13094|      0|            state = state::FILE;
13095|      0|          }
13096|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13097|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13098|       |          // != nullptr is false.
13099|  11.8k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13099:20): [True: 11.8k, False: 0]
  |  Branch (13099:40): [True: 0, False: 11.8k]
  ------------------
13100|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13100:20): [True: 0, False: 0]
  ------------------
13101|       |            // Set state to special relative or authority state.
13102|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13103|      0|          }
13104|       |          // Otherwise, if url is special, set state to special authority
13105|       |          // slashes state.
13106|  11.8k|          else if (url.is_special()) {
  ------------------
  |  Branch (13106:20): [True: 11.8k, False: 0]
  ------------------
13107|  11.8k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13108|  11.8k|          }
13109|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13110|       |          // path or authority state and increase pointer by 1.
13111|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13111:20): [True: 0, False: 0]
  ------------------
13112|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13112:20): [True: 0, False: 0]
  ------------------
13113|      0|            state = state::PATH_OR_AUTHORITY;
13114|      0|            input_position++;
13115|      0|          }
13116|       |          // Otherwise, set url's path to the empty string and set state to
13117|       |          // opaque path state.
13118|      0|          else {
13119|      0|            state = state::OPAQUE_PATH;
13120|      0|          }
13121|  11.8k|        }
13122|       |        // Otherwise, if state override is not given, set buffer to the empty
13123|       |        // string, state to no scheme state, and start over (from the first code
13124|       |        // point in input).
13125|      0|        else {
13126|      0|          state = state::NO_SCHEME;
13127|      0|          input_position = 0;
13128|      0|          break;
13129|      0|        }
13130|  11.8k|        input_position++;
13131|  11.8k|        break;
13132|  11.8k|      }
13133|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13133:7): [True: 0, False: 62.2k]
  ------------------
13134|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13135|       |        // The fragment was pruned from url_data before the state machine ran,
13136|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13137|       |        // nothing else remains in front of it.
13138|      0|        const bool c_is_hash =
13139|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13139:13): [True: 0, False: 0]
  |  Branch (13139:37): [True: 0, False: 0]
  ------------------
13140|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13141|       |        // validation error, return failure.
13142|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13142:13): [True: 0, False: 0]
  |  Branch (13142:37): [True: 0, False: 0]
  |  Branch (13142:66): [True: 0, False: 0]
  ------------------
13143|      0|          ada_log("NO_SCHEME validation error");
13144|      0|          url.is_valid = false;
13145|      0|          return url;
13146|      0|        }
13147|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13148|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13149|       |        // query to base's query, and set state to fragment state.
13150|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13150:18): [True: 0, False: 0]
  |  Branch (13150:47): [True: 0, False: 0]
  ------------------
13151|      0|          ada_log("NO_SCHEME opaque base with fragment");
13152|      0|          url.copy_scheme(*base_url);
13153|      0|          url.has_opaque_path = base_url->has_opaque_path;
13154|       |
13155|       |          if constexpr (result_type_is_ada_url) {
13156|       |            url.path = base_url->path;
13157|       |            url.query = base_url->query;
13158|      0|          } else {
13159|      0|            url.update_base_pathname(base_url->get_pathname());
13160|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13160:17): [True: 0, False: 0]
  ------------------
13161|       |              // get_search() returns "" for an empty query string (URL ends
13162|       |              // with '?'). update_base_search("") would incorrectly clear the
13163|       |              // query, so pass "?" to preserve the empty query distinction.
13164|      0|              auto s = base_url->get_search();
13165|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13165:38): [True: 0, False: 0]
  ------------------
13166|      0|            }
13167|      0|          }
13168|      0|          url.update_unencoded_base_hash(*fragment);
13169|      0|          enforce_max_input_length();
13170|      0|          return url;
13171|      0|        }
13172|       |        // Otherwise, if base's scheme is not "file", set state to relative
13173|       |        // state and decrease pointer by 1.
13174|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13175|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13175:18): [True: 0, False: 0]
  ------------------
13176|      0|          ada_log("NO_SCHEME non-file relative path");
13177|      0|          state = state::RELATIVE_SCHEME;
13178|      0|        }
13179|       |        // Otherwise, set state to file state and decrease pointer by 1.
13180|      0|        else {
13181|      0|          ada_log("NO_SCHEME file base type");
13182|      0|          state = state::FILE;
13183|      0|        }
13184|      0|        break;
13185|      0|      }
13186|  11.8k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13186:7): [True: 11.8k, False: 50.4k]
  ------------------
13187|  11.8k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13188|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13189|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13190|       |        // worry about AUTHORITY.
13191|       |        // TODO: Instead of just collecting a bool, collect the location of the
13192|       |        // '@' and do something useful with it.
13193|       |        // TODO: We could do various processing early on, using a single pass
13194|       |        // over the string to collect information about it, e.g., telling us
13195|       |        // whether there is a @ and if so, where (or how many).
13196|       |
13197|       |        // Check if url data contains an @.
13198|  11.8k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13198:13): [True: 11.5k, False: 255]
  ------------------
13199|  11.5k|          state = state::HOST;
13200|  11.5k|          break;
13201|  11.5k|        }
13202|    255|        bool at_sign_seen{false};
13203|    255|        bool password_token_seen{false};
13204|       |        /**
13205|       |         * We expect something of the sort...
13206|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13207|       |         * --------^
13208|       |         */
13209|  1.86k|        do {
13210|  1.86k|          std::string_view view = url_data.substr(input_position);
13211|       |          // The delimiters are @, /, ? \\.
13212|  1.86k|          size_t location =
13213|  1.86k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13213:15): [True: 1.86k, False: 0]
  ------------------
13214|  1.86k|                               : helpers::find_authority_delimiter(view);
13215|  1.86k|          std::string_view authority_view = view.substr(0, location);
13216|  1.86k|          size_t end_of_authority = input_position + authority_view.size();
13217|       |          // If c is U+0040 (@), then:
13218|  1.86k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13218:15): [True: 1.83k, False: 28]
  ------------------
13219|  1.83k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13219:15): [True: 1.61k, False: 227]
  ------------------
13220|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13221|  1.61k|            if (at_sign_seen) {
  ------------------
  |  Branch (13221:17): [True: 1.38k, False: 232]
  ------------------
13222|  1.38k|              if (password_token_seen) {
  ------------------
  |  Branch (13222:19): [True: 459, False: 921]
  ------------------
13223|       |                if constexpr (result_type_is_ada_url) {
13224|       |                  url.password += "%40";
13225|    459|                } else {
13226|    459|                  url.append_base_password("%40");
13227|    459|                }
13228|    921|              } else {
13229|       |                if constexpr (result_type_is_ada_url) {
13230|       |                  url.username += "%40";
13231|    921|                } else {
13232|    921|                  url.append_base_username("%40");
13233|    921|                }
13234|    921|              }
13235|  1.38k|            }
13236|       |
13237|  1.61k|            at_sign_seen = true;
13238|       |
13239|  1.61k|            if (!password_token_seen) {
  ------------------
  |  Branch (13239:17): [True: 1.15k, False: 459]
  ------------------
13240|  1.15k|              size_t password_token_location = authority_view.find(':');
13241|  1.15k|              password_token_seen =
13242|  1.15k|                  password_token_location != std::string_view::npos;
13243|       |
13244|  1.15k|              if constexpr (store_values) {
13245|  1.15k|                if (!password_token_seen) {
  ------------------
  |  Branch (13245:21): [True: 1.08k, False: 67]
  ------------------
13246|       |                  if constexpr (result_type_is_ada_url) {
13247|       |                    url.username += unicode::percent_encode(
13248|       |                        authority_view,
13249|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13250|  1.08k|                  } else {
13251|  1.08k|                    url.append_base_username(unicode::percent_encode(
13252|  1.08k|                        authority_view,
13253|  1.08k|                        character_sets::USERINFO_PERCENT_ENCODE));
13254|  1.08k|                  }
13255|  1.08k|                } else {
13256|       |                  if constexpr (result_type_is_ada_url) {
13257|       |                    url.username += unicode::percent_encode(
13258|       |                        authority_view.substr(0, password_token_location),
13259|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13260|       |                    url.password += unicode::percent_encode(
13261|       |                        authority_view.substr(password_token_location + 1),
13262|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13263|     67|                  } else {
13264|     67|                    url.append_base_username(unicode::percent_encode(
13265|     67|                        authority_view.substr(0, password_token_location),
13266|     67|                        character_sets::USERINFO_PERCENT_ENCODE));
13267|     67|                    url.append_base_password(unicode::percent_encode(
13268|     67|                        authority_view.substr(password_token_location + 1),
13269|     67|                        character_sets::USERINFO_PERCENT_ENCODE));
13270|     67|                  }
13271|     67|                }
13272|  1.15k|              }
13273|  1.15k|            } else if constexpr (store_values) {
13274|       |              if constexpr (result_type_is_ada_url) {
13275|       |                url.password += unicode::percent_encode(
13276|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13277|    459|              } else {
13278|    459|                url.append_base_password(unicode::percent_encode(
13279|    459|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13280|    459|              }
13281|    459|            }
13282|  1.61k|          }
13283|       |          // Otherwise, if one of the following is true:
13284|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13285|       |          // - url is special and c is U+005C (\)
13286|    255|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13286:20): [True: 28, False: 227]
  ------------------
13287|    227|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13287:20): [True: 210, False: 17]
  ------------------
13288|     17|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13288:20): [True: 16, False: 1]
  ------------------
13289|    255|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13289:21): [True: 1, False: 0]
  |  Branch (13289:41): [True: 1, False: 0]
  ------------------
13290|       |            // If atSignSeen is true and authority_view is the empty string,
13291|       |            // validation error, return failure.
13292|    255|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13292:17): [True: 232, False: 23]
  |  Branch (13292:33): [True: 4, False: 228]
  ------------------
13293|      4|              url.is_valid = false;
13294|      4|              return url;
13295|      4|            }
13296|    251|            state = state::HOST;
13297|    251|            break;
13298|    255|          }
13299|  1.61k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13299:15): [True: 0, False: 1.61k]
  ------------------
13300|      0|            if constexpr (store_values) {
13301|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13301:19): [True: 0, False: 0]
  ------------------
13302|      0|                url.update_unencoded_base_hash(*fragment);
13303|      0|              }
13304|      0|            }
13305|      0|            enforce_max_input_length();
13306|      0|            return url;
13307|      0|          }
13308|  1.61k|          input_position = end_of_authority + 1;
13309|  1.61k|        } while (true);
  ------------------
  |  Branch (13309:18): [True: 1.61k, Folded]
  ------------------
13310|       |
13311|    251|        break;
13312|    255|      }
13313|    251|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13313:7): [True: 0, False: 62.2k]
  ------------------
13314|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13315|      0|                helpers::substring(url_data, input_position));
13316|       |
13317|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13318|       |        // then set state to special authority ignore slashes state and increase
13319|       |        // pointer by 1.
13320|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13320:13): [True: 0, False: 0]
  ------------------
13321|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13322|      0|          input_position += 2;
13323|      0|        } else {
13324|       |          // Otherwise, validation error, set state to relative state and
13325|       |          // decrease pointer by 1.
13326|      0|          state = state::RELATIVE_SCHEME;
13327|      0|        }
13328|       |
13329|      0|        break;
13330|    255|      }
13331|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13331:7): [True: 0, False: 62.2k]
  ------------------
13332|      0|        ada_log("PATH_OR_AUTHORITY ",
13333|      0|                helpers::substring(url_data, input_position));
13334|       |
13335|       |        // If c is U+002F (/), then set state to authority state.
13336|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13336:13): [True: 0, False: 0]
  ------------------
13337|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13337:13): [True: 0, False: 0]
  ------------------
13338|      0|          state = state::AUTHORITY;
13339|      0|          input_position++;
13340|      0|        } else {
13341|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13342|      0|          state = state::PATH;
13343|      0|        }
13344|       |
13345|      0|        break;
13346|    255|      }
13347|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13347:7): [True: 0, False: 62.2k]
  ------------------
13348|      0|        ada_log("RELATIVE_SCHEME ",
13349|      0|                helpers::substring(url_data, input_position));
13350|       |
13351|       |        // Set url's scheme to base's scheme.
13352|      0|        url.copy_scheme(*base_url);
13353|       |
13354|       |        // If c is U+002F (/), then set state to relative slash state.
13355|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13355:13): [True: 0, False: 0]
  ------------------
13356|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13357|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13357:13): [True: 0, False: 0]
  ------------------
13358|      0|          ada_log(
13359|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13360|      0|              "slash state");
13361|      0|          state = state::RELATIVE_SLASH;
13362|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13362:20): [True: 0, False: 0]
  |  Branch (13362:40): [True: 0, False: 0]
  ------------------
13363|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13363:20): [True: 0, False: 0]
  ------------------
13364|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13365|       |          // set state to relative slash state.
13366|      0|          ada_log(
13367|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13368|      0|              "error, set state to relative slash state");
13369|      0|          state = state::RELATIVE_SLASH;
13370|      0|        } else {
13371|      0|          ada_log("RELATIVE_SCHEME otherwise");
13372|       |          // Set url's username to base's username, url's password to base's
13373|       |          // password, url's host to base's host, url's port to base's port,
13374|       |          // url's path to a clone of base's path, and url's query to base's
13375|       |          // query.
13376|       |          if constexpr (result_type_is_ada_url) {
13377|       |            url.username = base_url->username;
13378|       |            url.password = base_url->password;
13379|       |            url.host = base_url->host;
13380|       |            url.port = base_url->port;
13381|       |            // cloning the base path includes cloning the has_opaque_path flag
13382|       |            url.has_opaque_path = base_url->has_opaque_path;
13383|       |            url.path = base_url->path;
13384|       |            url.query = base_url->query;
13385|      0|          } else {
13386|      0|            url.update_base_authority(base_url->get_href(),
13387|      0|                                      base_url->get_components());
13388|      0|            url.update_host_to_base_host(base_url->get_hostname());
13389|      0|            url.update_base_port(base_url->retrieve_base_port());
13390|       |            // cloning the base path includes cloning the has_opaque_path flag
13391|      0|            url.has_opaque_path = base_url->has_opaque_path;
13392|      0|            url.update_base_pathname(base_url->get_pathname());
13393|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13393:17): [True: 0, False: 0]
  ------------------
13394|       |              // get_search() returns "" for an empty query string (URL ends
13395|       |              // with '?'). update_base_search("") would incorrectly clear the
13396|       |              // query, so pass "?" to preserve the empty query distinction.
13397|      0|              auto s = base_url->get_search();
13398|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13398:38): [True: 0, False: 0]
  ------------------
13399|      0|            }
13400|      0|          }
13401|       |
13402|      0|          url.has_opaque_path = base_url->has_opaque_path;
13403|       |
13404|       |          // If c is U+003F (?), then set url's query to the empty string, and
13405|       |          // state to query state.
13406|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13406:15): [True: 0, False: 0]
  ------------------
13407|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13407:15): [True: 0, False: 0]
  ------------------
13408|      0|            state = state::QUERY;
13409|      0|          }
13410|       |          // Otherwise, if c is not the EOF code point:
13411|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13411:20): [True: 0, False: 0]
  ------------------
13412|       |            // Set url's query to null.
13413|      0|            url.clear_search();
13414|       |            if constexpr (result_type_is_ada_url) {
13415|       |              // Shorten url's path.
13416|       |              helpers::shorten_path(url.path, url.type);
13417|      0|            } else {
13418|      0|              std::string_view path = url.get_pathname();
13419|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13419:19): [True: 0, False: 0]
  ------------------
13420|      0|                url.update_base_pathname(std::move(std::string(path)));
13421|      0|              }
13422|      0|            }
13423|       |            // Set state to path state and decrease pointer by 1.
13424|      0|            state = state::PATH;
13425|      0|            break;
13426|      0|          }
13427|      0|        }
13428|      0|        input_position++;
13429|      0|        break;
13430|      0|      }
13431|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13431:7): [True: 0, False: 62.2k]
  ------------------
13432|      0|        ada_log("RELATIVE_SLASH ",
13433|      0|                helpers::substring(url_data, input_position));
13434|       |
13435|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13436|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13437|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13437:13): [True: 0, False: 0]
  |  Branch (13437:33): [True: 0, False: 0]
  ------------------
13438|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13438:14): [True: 0, False: 0]
  ------------------
13439|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13439:14): [True: 0, False: 0]
  ------------------
13440|       |          // Set state to special authority ignore slashes state.
13441|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13442|      0|        }
13443|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13444|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13444:18): [True: 0, False: 0]
  ------------------
13445|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13445:18): [True: 0, False: 0]
  ------------------
13446|      0|          state = state::AUTHORITY;
13447|      0|        }
13448|       |        // Otherwise, set
13449|       |        // - url's username to base's username,
13450|       |        // - url's password to base's password,
13451|       |        // - url's host to base's host,
13452|       |        // - url's port to base's port,
13453|       |        // - state to path state, and then, decrease pointer by 1.
13454|      0|        else {
13455|       |          if constexpr (result_type_is_ada_url) {
13456|       |            url.username = base_url->username;
13457|       |            url.password = base_url->password;
13458|       |            url.host = base_url->host;
13459|       |            url.port = base_url->port;
13460|      0|          } else {
13461|      0|            url.update_base_authority(base_url->get_href(),
13462|      0|                                      base_url->get_components());
13463|      0|            url.update_host_to_base_host(base_url->get_hostname());
13464|      0|            url.update_base_port(base_url->retrieve_base_port());
13465|      0|          }
13466|      0|          state = state::PATH;
13467|      0|          break;
13468|      0|        }
13469|       |
13470|      0|        input_position++;
13471|      0|        break;
13472|      0|      }
13473|  11.8k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13473:7): [True: 11.8k, False: 50.4k]
  ------------------
13474|  11.8k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13475|  11.8k|                helpers::substring(url_data, input_position));
13476|       |
13477|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13478|       |        // then set state to special authority ignore slashes state and increase
13479|       |        // pointer by 1.
13480|  11.8k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13480:13): [True: 11.8k, False: 0]
  ------------------
13481|  11.8k|          input_position += 2;
13482|  11.8k|        }
13483|       |
13484|  11.8k|        [[fallthrough]];
13485|  11.8k|      }
13486|  11.8k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13486:7): [True: 0, False: 62.2k]
  ------------------
13487|  11.8k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13488|  11.8k|                helpers::substring(url_data, input_position));
13489|       |
13490|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13491|       |        // authority state and decrease pointer by 1.
13492|  12.2k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13492:16): [True: 12.2k, False: 1]
  ------------------
13493|  12.2k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13493:17): [True: 255, False: 11.9k]
  ------------------
13494|  11.9k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13494:17): [True: 174, False: 11.8k]
  ------------------
13495|    429|          input_position++;
13496|    429|        }
13497|  11.8k|        state = state::AUTHORITY;
13498|       |
13499|  11.8k|        break;
13500|  11.8k|      }
13501|    427|      case state::QUERY: {
  ------------------
  |  Branch (13501:7): [True: 427, False: 61.8k]
  ------------------
13502|    427|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13503|    427|        if constexpr (store_values) {
13504|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13505|       |          // if url is special; otherwise the query percent-encode set.
13506|    427|          const uint8_t* query_percent_encode_set =
13507|    427|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13507:15): [True: 427, False: 0]
  ------------------
13508|    427|                               : character_sets::QUERY_PERCENT_ENCODE;
13509|       |
13510|       |          // Percent-encode after encoding, with encoding, buffer, and
13511|       |          // queryPercentEncodeSet, and append the result to url's query.
13512|    427|          url.update_base_search(url_data.substr(input_position),
13513|    427|                                 query_percent_encode_set);
13514|    427|          ada_log("QUERY update_base_search completed ");
13515|    427|          if (fragment.has_value()) {
  ------------------
  |  Branch (13515:15): [True: 8, False: 419]
  ------------------
13516|      8|            url.update_unencoded_base_hash(*fragment);
13517|      8|          }
13518|    427|        }
13519|    427|        enforce_max_input_length();
13520|    427|        return url;
13521|  11.8k|      }
13522|  11.8k|      case state::HOST: {
  ------------------
  |  Branch (13522:7): [True: 11.8k, False: 50.4k]
  ------------------
13523|  11.8k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13524|       |
13525|  11.8k|        std::string_view host_view = url_data.substr(input_position);
13526|  11.8k|        auto [location, found_colon] =
13527|  11.8k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13528|  11.8k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13528:26): [True: 11.8k, False: 0]
  ------------------
13529|  11.8k|                             ? input_position + location
13530|  11.8k|                             : input_size;
13531|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13532|       |        // Note: the 'found_colon' value is true if and only if a colon was
13533|       |        // encountered while not inside brackets.
13534|  11.8k|        if (found_colon) {
  ------------------
  |  Branch (13534:13): [True: 785, False: 11.0k]
  ------------------
13535|       |          // If buffer is the empty string, validation error, return failure.
13536|       |          // Let host be the result of host parsing buffer with url is not
13537|       |          // special.
13538|    785|          ada_log("HOST parsing ", host_view);
13539|    785|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13539:15): [True: 182, False: 603]
  ------------------
13540|    182|            return url;
13541|    182|          }
13542|    603|          ada_log("HOST parsing results in ", url.get_hostname());
13543|       |          // Set url's host to host, buffer to the empty string, and state to
13544|       |          // port state.
13545|    603|          state = state::PORT;
13546|    603|          input_position++;
13547|    603|        }
13548|       |        // Otherwise, if one of the following is true:
13549|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13550|       |        // - url is special and c is U+005C (\)
13551|       |        // The get_host_delimiter_location function either brings us to
13552|       |        // the colon outside of the bracket, or to one of those characters.
13553|  11.0k|        else {
13554|       |          // If url is special and host_view is the empty string, validation
13555|       |          // error, return failure.
13556|  11.0k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13556:15): [True: 11, False: 11.0k]
  |  Branch (13556:36): [True: 11, False: 0]
  ------------------
13557|     11|            url.is_valid = false;
13558|     11|            return url;
13559|     11|          }
13560|  11.0k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13561|       |          // Let host be the result of host parsing host_view with url is not
13562|       |          // special.
13563|  11.0k|          if (host_view.empty()) {
  ------------------
  |  Branch (13563:15): [True: 0, False: 11.0k]
  ------------------
13564|      0|            url.update_base_hostname("");
13565|  11.0k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13565:22): [True: 9.89k, False: 1.11k]
  ------------------
13566|  9.89k|            return url;
13567|  9.89k|          }
13568|  1.11k|          ada_log("HOST parsing results in ", url.get_hostname(),
13569|  1.11k|                  " href=", url.get_href());
13570|       |
13571|       |          // Set url's host to host, and state to path start state.
13572|  1.11k|          state = state::PATH_START;
13573|  1.11k|        }
13574|       |
13575|  1.71k|        break;
13576|  11.8k|      }
13577|  1.71k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13577:7): [True: 0, False: 62.2k]
  ------------------
13578|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13579|       |        // Opaque path, query, and fragment are structurally always valid:
13580|       |        // the parser would just percent-encode whatever is there. When we
13581|       |        // are not storing values (can_parse), we can return immediately.
13582|       |        // We must set has_opaque_path = true before returning so that when
13583|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13584|       |        // correctly rejects relative inputs against an opaque-path base
13585|       |        // (e.g. can_parse("", &"W:") must return false).
13586|       |        if constexpr (!store_values) {
13587|       |          url.has_opaque_path = true;
13588|       |          return url;
13589|       |        }
13590|      0|        std::string_view view = url_data.substr(input_position);
13591|       |        // If c is U+003F (?), then set url's query to the empty string and
13592|       |        // state to query state.
13593|      0|        size_t location = view.find('?');
13594|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13594:13): [True: 0, False: 0]
  ------------------
13595|      0|          view.remove_suffix(view.size() - location);
13596|      0|          state = state::QUERY;
13597|      0|          input_position += location + 1;
13598|      0|        } else {
13599|      0|          input_position = input_size + 1;
13600|      0|        }
13601|      0|        url.has_opaque_path = true;
13602|       |
13603|       |        // This is a really unlikely scenario in real world. We should not seek
13604|       |        // to optimize it.
13605|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13605:13): [True: 0, False: 0]
  ------------------
13606|      0|          std::string modified_view =
13607|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
13608|      0|          url.update_base_pathname(unicode::percent_encode(
13609|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13610|      0|        } else {
13611|      0|          url.update_base_pathname(unicode::percent_encode(
13612|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13613|      0|        }
13614|      0|        break;
13615|  11.8k|      }
13616|    603|      case state::PORT: {
  ------------------
  |  Branch (13616:7): [True: 603, False: 61.6k]
  ------------------
13617|    603|        ada_log("PORT ", helpers::substring(url_data, input_position));
13618|    603|        std::string_view port_view = url_data.substr(input_position);
13619|    603|        input_position += url.parse_port(port_view, true);
13620|    603|        if (!url.is_valid) {
  ------------------
  |  Branch (13620:13): [True: 518, False: 85]
  ------------------
13621|    518|          return url;
13622|    518|        }
13623|     85|        state = state::PATH_START;
13624|     85|        [[fallthrough]];
13625|     85|      }
13626|  1.19k|      case state::PATH_START: {
  ------------------
  |  Branch (13626:7): [True: 1.11k, False: 61.1k]
  ------------------
13627|  1.19k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13628|       |        // Path, query, and fragment are structurally always valid: the
13629|       |        // parser would just percent-encode whatever is there. When we are
13630|       |        // not storing values (can_parse), we can return immediately since
13631|       |        // no subsequent state can invalidate the URL.
13632|       |        if constexpr (!store_values) {
13633|       |          return url;
13634|       |        }
13635|       |
13636|       |        // If url is special, then:
13637|  1.19k|        if (url.is_special()) {
  ------------------
  |  Branch (13637:13): [True: 1.19k, False: 0]
  ------------------
13638|       |          // Set state to path state.
13639|  1.19k|          state = state::PATH;
13640|       |
13641|       |          // Optimization: Avoiding going into PATH state improves the
13642|       |          // performance of urls ending with /.
13643|  1.19k|          if (input_position == input_size) {
  ------------------
  |  Branch (13643:15): [True: 111, False: 1.08k]
  ------------------
13644|    111|            if constexpr (store_values) {
13645|    111|              url.update_base_pathname("/");
13646|    111|              if (fragment.has_value()) {
  ------------------
  |  Branch (13646:19): [True: 111, False: 0]
  ------------------
13647|    111|                url.update_unencoded_base_hash(*fragment);
13648|    111|              }
13649|    111|            }
13650|    111|            enforce_max_input_length();
13651|    111|            return url;
13652|    111|          }
13653|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13654|       |          // by 1. We know that (input_position == input_size) is impossible
13655|       |          // here, because of the previous if-check.
13656|  1.08k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13656:15): [True: 100, False: 987]
  ------------------
13657|    100|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13657:15): [True: 99, False: 1]
  ------------------
13658|     99|            break;
13659|     99|          }
13660|  1.08k|        }
13661|       |        // Otherwise, if state override is not given and c is U+003F (?),
13662|       |        // set url's query to the empty string and state to query state.
13663|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13663:18): [True: 0, False: 0]
  ------------------
13664|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13664:18): [True: 0, False: 0]
  ------------------
13665|      0|          state = state::QUERY;
13666|      0|        }
13667|       |        // Otherwise, if c is not the EOF code point:
13668|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (13668:18): [True: 0, False: 0]
  ------------------
13669|       |          // Set state to path state.
13670|      0|          state = state::PATH;
13671|       |
13672|       |          // If c is not U+002F (/), then decrease pointer by 1.
13673|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13673:15): [True: 0, False: 0]
  ------------------
13674|      0|            break;
13675|      0|          }
13676|      0|        }
13677|       |
13678|    988|        input_position++;
13679|    988|        break;
13680|  1.19k|      }
13681|  1.08k|      case state::PATH: {
  ------------------
  |  Branch (13681:7): [True: 1.08k, False: 61.1k]
  ------------------
13682|  1.08k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13683|       |        // Path, query, and fragment are structurally always valid: the
13684|       |        // parser would just percent-encode whatever is there. When we are
13685|       |        // not storing values (can_parse), we can return immediately since
13686|       |        // no subsequent state can invalidate the URL.
13687|       |        if constexpr (!store_values) {
13688|       |          return url;
13689|       |        }
13690|  1.08k|        std::string_view view = url_data.substr(input_position);
13691|       |
13692|       |        // Most time, we do not need percent encoding.
13693|       |        // Furthermore, we can immediately locate the '?'.
13694|  1.08k|        size_t locofquestionmark = view.find('?');
13695|  1.08k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13695:13): [True: 427, False: 660]
  ------------------
13696|    427|          state = state::QUERY;
13697|    427|          view.remove_suffix(view.size() - locofquestionmark);
13698|    427|          input_position += locofquestionmark + 1;
13699|    660|        } else {
13700|    660|          input_position = input_size + 1;
13701|    660|        }
13702|  1.08k|        if constexpr (store_values) {
13703|       |          if constexpr (result_type_is_ada_url) {
13704|       |            helpers::parse_prepared_path(view, url.type, url.path);
13705|  1.08k|          } else {
13706|  1.08k|            url.consume_prepared_path(view);
13707|  1.08k|            ADA_ASSERT_TRUE(url.validate());
13708|  1.08k|          }
13709|  1.08k|        }
13710|  1.08k|        break;
13711|  1.19k|      }
13712|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13712:7): [True: 0, False: 62.2k]
  ------------------
13713|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13714|       |
13715|       |        // If c is U+002F (/) or U+005C (\), then:
13716|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13716:13): [True: 0, False: 0]
  ------------------
13717|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13717:14): [True: 0, False: 0]
  ------------------
13718|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13718:14): [True: 0, False: 0]
  ------------------
13719|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
13720|       |          // Set state to file host state.
13721|      0|          state = state::FILE_HOST;
13722|      0|          input_position++;
13723|      0|        } else {
13724|      0|          ada_log("FILE_SLASH otherwise");
13725|       |          // If base is non-null and base's scheme is "file", then:
13726|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13727|       |          // base_url_has_value() is true.
13728|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13728:15): [True: 0, False: 0]
  |  Branch (13728:38): [True: 0, False: 0]
  ------------------
13729|       |            // Set url's host to base's host.
13730|       |            if constexpr (result_type_is_ada_url) {
13731|       |              url.host = base_url->host;
13732|      0|            } else {
13733|      0|              url.update_host_to_base_host(base_url->get_host());
13734|      0|            }
13735|       |            // If the code point substring from pointer to the end of input does
13736|       |            // not start with a Windows drive letter and base's path[0] is a
13737|       |            // normalized Windows drive letter, then append base's path[0] to
13738|       |            // url's path.
13739|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13739:17): [True: 0, False: 0]
  ------------------
13740|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13740:19): [True: 0, False: 0]
  ------------------
13741|      0|                      url_data.substr(input_position))) {
13742|      0|                std::string_view first_base_url_path =
13743|      0|                    base_url->get_pathname().substr(1);
13744|      0|                size_t loc = first_base_url_path.find('/');
13745|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13745:21): [True: 0, False: 0]
  ------------------
13746|      0|                  helpers::resize(first_base_url_path, loc);
13747|      0|                }
13748|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13748:21): [True: 0, False: 0]
  ------------------
13749|      0|                        first_base_url_path)) {
13750|       |                  if constexpr (result_type_is_ada_url) {
13751|       |                    url.path += '/';
13752|       |                    url.path += first_base_url_path;
13753|      0|                  } else {
13754|      0|                    url.append_base_pathname(
13755|      0|                        helpers::concat("/", first_base_url_path));
13756|      0|                  }
13757|      0|                }
13758|      0|              }
13759|      0|            }
13760|      0|          }
13761|       |
13762|       |          // Set state to path state, and decrease pointer by 1.
13763|      0|          state = state::PATH;
13764|      0|        }
13765|       |
13766|      0|        break;
13767|  1.19k|      }
13768|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13768:7): [True: 0, False: 62.2k]
  ------------------
13769|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13770|      0|        std::string_view view = url_data.substr(input_position);
13771|       |
13772|      0|        size_t location = view.find_first_of("/\\?");
13773|      0|        std::string_view file_host_buffer = view.substr(
13774|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13774:16): [True: 0, False: 0]
  ------------------
13775|       |
13776|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13776:13): [True: 0, False: 0]
  ------------------
13777|      0|          state = state::PATH;
13778|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13778:20): [True: 0, False: 0]
  ------------------
13779|       |          // Set url's host to the empty string.
13780|       |          if constexpr (result_type_is_ada_url) {
13781|       |            url.host = "";
13782|      0|          } else {
13783|      0|            url.update_base_hostname("");
13784|      0|          }
13785|       |          // Set state to path start state.
13786|      0|          state = state::PATH_START;
13787|      0|        } else {
13788|      0|          size_t consumed_bytes = file_host_buffer.size();
13789|      0|          input_position += consumed_bytes;
13790|       |          // Let host be the result of host parsing buffer with url is not
13791|       |          // special.
13792|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13792:15): [True: 0, False: 0]
  ------------------
13793|      0|            return url;
13794|      0|          }
13795|       |
13796|       |          if constexpr (result_type_is_ada_url) {
13797|       |            // If host is "localhost", then set host to the empty string.
13798|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13799|       |              url.host = "";
13800|       |            }
13801|      0|          } else {
13802|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13802:17): [True: 0, False: 0]
  ------------------
13803|      0|              url.update_base_hostname("");
13804|      0|            }
13805|      0|          }
13806|       |
13807|       |          // Set buffer to the empty string and state to path start state.
13808|      0|          state = state::PATH_START;
13809|      0|        }
13810|       |
13811|      0|        break;
13812|      0|      }
13813|      0|      case state::FILE: {
  ------------------
  |  Branch (13813:7): [True: 0, False: 62.2k]
  ------------------
13814|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
13815|      0|        std::string_view file_view = url_data.substr(input_position);
13816|       |
13817|      0|        url.set_protocol_as_file();
13818|       |        if constexpr (result_type_is_ada_url) {
13819|       |          // Set url's host to the empty string.
13820|       |          url.host = "";
13821|      0|        } else {
13822|      0|          url.update_base_hostname("");
13823|      0|        }
13824|       |        // If c is U+002F (/) or U+005C (\), then:
13825|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (13825:13): [True: 0, False: 0]
  ------------------
13826|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13826:14): [True: 0, False: 0]
  ------------------
13827|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13827:14): [True: 0, False: 0]
  ------------------
13828|      0|          ada_log("FILE c is U+002F or U+005C");
13829|       |          // Set state to file slash state.
13830|      0|          state = state::FILE_SLASH;
13831|      0|        }
13832|       |        // Otherwise, if base is non-null and base's scheme is "file":
13833|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13833:18): [True: 0, False: 0]
  |  Branch (13833:41): [True: 0, False: 0]
  ------------------
13834|       |          // Set url's host to base's host, url's path to a clone of base's
13835|       |          // path, and url's query to base's query.
13836|      0|          ada_log("FILE base non-null");
13837|       |          if constexpr (result_type_is_ada_url) {
13838|       |            url.host = base_url->host;
13839|       |            url.path = base_url->path;
13840|       |            url.query = base_url->query;
13841|      0|          } else {
13842|      0|            url.update_host_to_base_host(base_url->get_hostname());
13843|      0|            url.update_base_pathname(base_url->get_pathname());
13844|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13844:17): [True: 0, False: 0]
  ------------------
13845|       |              // get_search() returns "" for an empty query string (URL ends
13846|       |              // with '?'). update_base_search("") would incorrectly clear the
13847|       |              // query, so pass "?" to preserve the empty query distinction.
13848|      0|              auto s = base_url->get_search();
13849|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13849:38): [True: 0, False: 0]
  ------------------
13850|      0|            }
13851|      0|          }
13852|      0|          url.has_opaque_path = base_url->has_opaque_path;
13853|       |
13854|       |          // If c is U+003F (?), then set url's query to the empty string and
13855|       |          // state to query state.
13856|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13856:15): [True: 0, False: 0]
  |  Branch (13856:47): [True: 0, False: 0]
  ------------------
13857|      0|            state = state::QUERY;
13858|      0|          }
13859|       |          // Otherwise, if c is not the EOF code point:
13860|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13860:20): [True: 0, False: 0]
  ------------------
13861|       |            // Set url's query to null.
13862|      0|            url.clear_search();
13863|       |            // If the code point substring from pointer to the end of input does
13864|       |            // not start with a Windows drive letter, then shorten url's path.
13865|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13865:17): [True: 0, False: 0]
  ------------------
13866|       |              if constexpr (result_type_is_ada_url) {
13867|       |                helpers::shorten_path(url.path, url.type);
13868|      0|              } else {
13869|      0|                std::string_view path = url.get_pathname();
13870|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13870:21): [True: 0, False: 0]
  ------------------
13871|      0|                  url.update_base_pathname(std::move(std::string(path)));
13872|      0|                }
13873|      0|              }
13874|      0|            }
13875|       |            // Otherwise:
13876|      0|            else {
13877|       |              // Set url's path to an empty list.
13878|      0|              url.clear_pathname();
13879|      0|            }
13880|       |
13881|       |            // Set state to path state and decrease pointer by 1.
13882|      0|            state = state::PATH;
13883|      0|            break;
13884|      0|          }
13885|      0|        }
13886|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13887|      0|        else {
13888|      0|          ada_log("FILE go to path");
13889|      0|          state = state::PATH;
13890|      0|          break;
13891|      0|        }
13892|       |
13893|      0|        input_position++;
13894|      0|        break;
13895|      0|      }
13896|      0|      default:
  ------------------
  |  Branch (13896:7): [True: 0, False: 62.2k]
  ------------------
13897|      0|        unreachable();
13898|  62.2k|    }
13899|  62.2k|  }
13900|  1.97k|  if constexpr (store_values) {
13901|  1.97k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13901:9): [True: 20, False: 1.95k]
  ------------------
13902|     20|      url.update_unencoded_base_hash(*fragment);
13903|     20|    }
13904|  1.97k|  }
13905|  1.97k|  enforce_max_input_length();
13906|  1.97k|  return url;
13907|  13.1k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14969|  2.95k|    ada_lifetime_bound {
14970|  2.95k|  ada_log("url_aggregator::get_hostname");
14971|       |  // Technically, we should check if there is a hostname, but
14972|       |  // the code below works even if there isn't.
14973|       |  // if(!has_hostname()) { return ""; }
14974|  2.95k|  size_t start = components.host_start;
14975|       |  // So host_start is not where the host begins.
14976|  2.95k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14976:7): [True: 330, False: 2.62k]
  ------------------
14977|    330|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14977:7): [True: 29, False: 301]
  ------------------
14978|     29|    start++;
14979|     29|  }
14980|  2.95k|  return helpers::substring(buffer, start, components.host_end);
14981|  2.95k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
15114|  2.15k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
15115|  2.15k|  ada_log("parse_ipv4 ", input, " [", input.size(),
15116|  2.15k|          " bytes], overlaps with buffer: ",
15117|  2.15k|          helpers::overlaps(input, buffer) ? "yes" : "no");
15118|  2.15k|  ADA_ASSERT_TRUE(validate());
15119|  2.15k|  if (input.empty()) {
  ------------------
  |  Branch (15119:7): [True: 0, False: 2.15k]
  ------------------
15120|      0|    return is_valid = false;
15121|      0|  }
15122|  2.15k|  const bool trailing_dot = (input.back() == '.');
15123|  2.15k|  if (trailing_dot) {
  ------------------
  |  Branch (15123:7): [True: 16, False: 2.13k]
  ------------------
15124|     16|    input.remove_suffix(1);
15125|     16|    if (input.empty()) {
  ------------------
  |  Branch (15125:9): [True: 0, False: 16]
  ------------------
15126|      0|      return is_valid = false;
15127|      0|    }
15128|     16|  }
15129|       |
15130|  2.15k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
15131|  2.15k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (15131:7): [True: 2, False: 2.14k]
  ------------------
15132|       |    // Pure decimal: keep the buffer when it already holds the address.
15133|       |    // Otherwise write the (trailing-dot-stripped) input.
15134|      2|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (15134:11): [True: 0, False: 2]
  |  Branch (15134:23): [True: 0, False: 0]
  ------------------
15135|      2|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (15135:11): [True: 0, False: 2]
  ------------------
15136|      0|        update_base_hostname(std::string(input));
15137|      2|      } else {
15138|      2|        update_base_hostname(input);
15139|      2|      }
15140|      2|    }
15141|      2|    host_type = IPV4;
15142|      2|    ADA_ASSERT_TRUE(validate());
15143|      2|    return true;
15144|      2|  }
15145|       |
15146|  2.14k|  const char* p = input.data();
15147|  2.14k|  const char* end = p + input.size();
15148|  2.14k|  uint64_t ipv4 = 0;
15149|  2.14k|  int digit_count = 0;
15150|  2.14k|  int pure_decimal_count = 0;
15151|       |
15152|  2.34k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (15152:10): [True: 2.34k, False: 4]
  |  Branch (15152:29): [True: 2.34k, False: 0]
  ------------------
15153|  2.34k|    uint64_t segment = 0;
15154|  2.34k|    bool pure = false;
15155|  2.34k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (15155:9): [True: 1.47k, False: 863]
  ------------------
15156|  1.47k|      return is_valid = false;
15157|  1.47k|    }
15158|    863|    if (pure) {
  ------------------
  |  Branch (15158:9): [True: 634, False: 229]
  ------------------
15159|    634|      ++pure_decimal_count;
15160|    634|    }
15161|    863|    if (p >= end) {
  ------------------
  |  Branch (15161:9): [True: 638, False: 225]
  ------------------
15162|    638|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
15163|    638|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (15163:11): [True: 8, False: 630]
  ------------------
15164|      8|        return is_valid = false;
15165|      8|      }
15166|    630|      ipv4 = (ipv4 << shift) | segment;
15167|    630|      goto ipv4_done;
15168|    638|    }
15169|    225|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (15169:9): [True: 29, False: 196]
  |  Branch (15169:26): [True: 0, False: 196]
  ------------------
15170|     29|      return is_valid = false;
15171|     29|    }
15172|    196|    ipv4 = (ipv4 << 8) | segment;
15173|    196|    ++p;
15174|    196|  }
15175|      4|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (15175:7): [True: 0, False: 4]
  |  Branch (15175:27): [True: 4, False: 0]
  ------------------
15176|      4|    return is_valid = false;
15177|      4|  }
15178|    630|ipv4_done:
15179|    630|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
15180|    630|          " host: ", get_host());
15181|    630|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (15181:7): [True: 0, False: 630]
  |  Branch (15181:19): [True: 0, False: 0]
  |  Branch (15181:46): [True: 0, False: 0]
  ------------------
15182|      0|    ada_log(
15183|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
15184|      0|        "buffer");
15185|    630|  } else {
15186|    630|    update_base_hostname(ada::serializers::ipv4(ipv4));
15187|    630|  }
15188|    630|  host_type = IPV4;
15189|    630|  ADA_ASSERT_TRUE(validate());
15190|    630|  return true;
15191|      4|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15193|  7.11k|bool url_aggregator::parse_ipv6(std::string_view input) {
15194|  7.11k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
15195|  7.11k|  ADA_ASSERT_TRUE(validate());
15196|  7.11k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15197|  7.11k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (15197:7): [True: 6, False: 7.10k]
  |  Branch (15197:24): [True: 2, False: 7.10k]
  ------------------
15198|      8|    return is_valid = false;
15199|      8|  }
15200|  7.10k|  std::array<uint16_t, 8> address{};
15201|       |#if defined(ADA_AVX512_IPV6)
15202|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
15203|       |                                                     address, simd_valid)) {
15204|       |    if (!simd_valid) [[unlikely]] {
15205|       |      return is_valid = false;
15206|       |    }
15207|       |    const std::string serialized = ada::serializers::ipv6(address);
15208|       |    if (get_hostname() != serialized) {
15209|       |      update_base_hostname(serialized);
15210|       |    }
15211|       |    host_type = IPV6;
15212|       |    return true;
15213|       |  }
15214|       |  address = {};
15215|       |#endif
15216|  7.10k|  const char* pointer = input.data();
15217|  7.10k|  const char* const end = pointer + input.size();
15218|  7.10k|  int piece_index = 0;
15219|  7.10k|  int compress = -1;
15220|       |
15221|  7.10k|  if (*pointer == ':') {
  ------------------
  |  Branch (15221:7): [True: 21, False: 7.08k]
  ------------------
15222|     21|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (15222:9): [True: 1, False: 20]
  |  Branch (15222:30): [True: 7, False: 13]
  ------------------
15223|      8|      return is_valid = false;
15224|      8|    }
15225|     13|    pointer += 2;
15226|     13|    compress = ++piece_index;
15227|     13|  }
15228|       |
15229|  7.28k|  while (pointer != end) {
  ------------------
  |  Branch (15229:10): [True: 7.24k, False: 39]
  ------------------
15230|  7.24k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (15230:9): [True: 2, False: 7.24k]
  ------------------
15231|      2|      return is_valid = false;
15232|      2|    }
15233|  7.24k|    if (*pointer == ':') {
  ------------------
  |  Branch (15233:9): [True: 10, False: 7.23k]
  ------------------
15234|     10|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (15234:11): [True: 1, False: 9]
  ------------------
15235|      1|        return is_valid = false;
15236|      1|      }
15237|      9|      ++pointer;
15238|      9|      compress = ++piece_index;
15239|      9|      continue;
15240|     10|    }
15241|       |
15242|  7.23k|    uint16_t value = 0;
15243|  7.23k|    const int length = detail::parse_hex_piece(pointer, end, value);
15244|       |
15245|  7.23k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (15245:9): [True: 7.20k, False: 29]
  |  Branch (15245:27): [True: 57, False: 7.14k]
  ------------------
15246|     57|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15246:11): [True: 1, False: 56]
  ------------------
15247|      1|        return is_valid = false;
15248|      1|      }
15249|     56|      pointer -= length;
15250|     56|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (15250:11): [True: 1, False: 55]
  ------------------
15251|      1|        return is_valid = false;
15252|      1|      }
15253|       |
15254|     55|      int numbers_seen = 0;
15255|    130|      while (pointer != end) {
  ------------------
  |  Branch (15255:14): [True: 123, False: 7]
  ------------------
15256|    123|        int ipv4_piece = -1;
15257|    123|        if (numbers_seen > 0) {
  ------------------
  |  Branch (15257:13): [True: 68, False: 55]
  ------------------
15258|     68|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (15258:15): [True: 53, False: 15]
  |  Branch (15258:34): [True: 52, False: 1]
  ------------------
15259|     52|            ++pointer;
15260|     52|          } else {
15261|     16|            return is_valid = false;
15262|     16|          }
15263|     68|        }
15264|    107|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (15264:13): [True: 17, False: 90]
  |  Branch (15264:31): [True: 1, False: 89]
  |  Branch (15264:49): [True: 5, False: 84]
  ------------------
15265|     23|          return is_valid = false;
15266|     23|        }
15267|     84|        ipv4_piece = *pointer - '0';
15268|     84|        ++pointer;
15269|     84|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15269:13): [True: 81, False: 3]
  |  Branch (15269:31): [True: 46, False: 35]
  |  Branch (15269:50): [True: 41, False: 5]
  ------------------
15270|     41|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (15270:15): [True: 3, False: 38]
  ------------------
15271|      3|            return is_valid = false;
15272|      3|          }
15273|     38|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15274|     38|          ++pointer;
15275|     38|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15275:15): [True: 37, False: 1]
  |  Branch (15275:33): [True: 23, False: 14]
  |  Branch (15275:52): [True: 21, False: 2]
  ------------------
15276|     21|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15277|     21|            ++pointer;
15278|     21|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (15278:17): [True: 6, False: 15]
  ------------------
15279|      6|              return is_valid = false;
15280|      6|            }
15281|     21|          }
15282|     38|        }
15283|     75|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
15284|     75|            address[static_cast<size_t>(piece_index)] * 0x100 +
15285|     75|            static_cast<uint16_t>(ipv4_piece));
15286|     75|        ++numbers_seen;
15287|     75|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (15287:13): [True: 22, False: 53]
  |  Branch (15287:34): [True: 4, False: 49]
  ------------------
15288|     26|          ++piece_index;
15289|     26|        }
15290|     75|      }
15291|      7|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (15291:11): [True: 5, False: 2]
  ------------------
15292|      5|        return is_valid = false;
15293|      5|      }
15294|      2|      break;
15295|      7|    }
15296|       |
15297|  7.17k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15297:9): [True: 6.97k, False: 197]
  ------------------
15298|  6.97k|      return is_valid = false;
15299|  6.97k|    }
15300|       |
15301|    197|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (15301:9): [True: 168, False: 29]
  |  Branch (15301:27): [True: 156, False: 12]
  ------------------
15302|    156|      ++pointer;
15303|    156|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (15303:11): [True: 6, False: 150]
  ------------------
15304|      6|        return is_valid = false;
15305|      6|      }
15306|    156|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (15306:16): [True: 12, False: 29]
  ------------------
15307|     12|      return is_valid = false;
15308|     12|    }
15309|       |
15310|    179|    address[static_cast<size_t>(piece_index)] = value;
15311|    179|    ++piece_index;
15312|    179|  }
15313|       |
15314|     41|  if (compress != -1) {
  ------------------
  |  Branch (15314:7): [True: 19, False: 22]
  ------------------
15315|     19|    const int right = piece_index - compress;
15316|     19|    if (right > 0) {
  ------------------
  |  Branch (15316:9): [True: 9, False: 10]
  ------------------
15317|      9|      const size_t dest = static_cast<size_t>(8 - right);
15318|      9|      const size_t src = static_cast<size_t>(compress);
15319|      9|      if (dest != src) {
  ------------------
  |  Branch (15319:11): [True: 6, False: 3]
  ------------------
15320|     22|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (15320:53): [True: 16, False: 6]
  ------------------
15321|     16|          address[dest + i] = address[src + i];
15322|     16|          address[src + i] = 0;
15323|     16|        }
15324|      6|      }
15325|      9|    }
15326|     22|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (15326:14): [True: 19, False: 3]
  ------------------
15327|     19|    return is_valid = false;
15328|     19|  }
15329|       |
15330|       |  // Serialize once; skip rewrite when hostname is already canonical.
15331|     22|  const std::string serialized = ada::serializers::ipv6(address);
15332|     22|  const std::string_view current = get_hostname();
15333|     22|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (15333:7): [True: 0, False: 22]
  ------------------
15334|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (15334:7): [True: 0, False: 0]
  ------------------
15335|      0|    ada_log("parse_ipv6 in-place canonical match");
15336|     22|  } else {
15337|     22|    update_base_hostname(serialized);
15338|     22|  }
15339|     22|  ada_log("parse_ipv6 ", get_hostname());
15340|     22|  ADA_ASSERT_TRUE(validate());
15341|     22|  host_type = IPV6;
15342|     22|  return true;
15343|     41|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  274|  55.5k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|  55.5k|    return c > -65;
  278|  55.5k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  481|      2|inline Huff make_fixed_litlen_huff() {
  482|      2|  Huff h;
  483|      2|  uint8_t lens[288];
  484|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  485|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (485:19): [True: 288, False: 2]
  ------------------
  486|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (486:21): [True: 224, False: 2]
  ------------------
  487|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (487:21): [True: 48, False: 2]
  ------------------
  488|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (488:21): [True: 16, False: 2]
  ------------------
  489|      2|  h.build(lens, 288);
  490|      2|  return h;
  491|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  430|     16|  bool build(const uint8_t* lens, int n) {
  431|     16|    std::memset(counts, 0, sizeof(counts));
  432|     16|    std::memset(first_code, 0, sizeof(first_code));
  433|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  434|     16|    nsymbols = n;
  435|     16|    max_bits = 0;
  436|  1.99k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (436:21): [True: 1.97k, False: 16]
  ------------------
  437|  1.97k|      lengths[i] = lens[i];
  438|  1.97k|      if (lens[i]) {
  ------------------
  |  Branch (438:11): [True: 1.93k, False: 41]
  ------------------
  439|  1.93k|        counts[lens[i]]++;
  440|  1.93k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (440:13): [True: 48, False: 1.88k]
  ------------------
  441|  1.93k|      }
  442|  1.97k|    }
  443|       |    // Canonical first code for each bit length (RFC 1951).
  444|     16|    int code = 0;
  445|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (445:24): [True: 240, False: 16]
  ------------------
  446|    240|      code = (code + counts[bits - 1]) << 1;
  447|    240|      first_code[bits] = code;
  448|    240|    }
  449|     16|    int idx = 0;
  450|    157|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (450:24): [True: 141, False: 16]
  ------------------
  451|    141|      base_idx[bits] = idx;
  452|       |      // assign symbols in symbol order for codes of this length
  453|  21.7k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (453:25): [True: 21.6k, False: 141]
  ------------------
  454|  21.6k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (454:13): [True: 1.93k, False: 19.6k]
  ------------------
  455|  1.93k|          symbols[idx++] = static_cast<int16_t>(sym);
  456|  1.93k|        }
  457|  21.6k|      }
  458|    141|    }
  459|     16|    return true;
  460|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  493|      2|inline Huff make_fixed_dist_huff() {
  494|      2|  Huff h;
  495|      2|  uint8_t lens[32];
  496|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (496:19): [True: 64, False: 2]
  ------------------
  497|      2|  h.build(lens, 32);
  498|      2|  return h;
  499|      2|}
serializers.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5260|    489|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|    489|    return 0x101010101010101ull * v;
 5262|    489|  };
_ZN3ada4idna13ensure_tablesEv:
 4983|  10.1k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4984|  10.1k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4985|  10.1k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4985:7): [True: 10.1k, False: 1]
  ------------------
 4986|  10.1k|    return true;
 4987|  10.1k|  }
 4988|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4988:7): [True: 0, False: 1]
  ------------------
 4989|      0|    return false;
 4990|      0|  }
 4991|       |
 4992|      1|  uint8_t expected = kTablesUninit;
 4993|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4993:7): [True: 1, False: 0]
  ------------------
 4994|      1|                                                std::memory_order_acq_rel,
 4995|      1|                                                std::memory_order_acquire)) {
 4996|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4997|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4997:9): [True: 0, False: 1]
  ------------------
 4998|       |      // Leave the state uninitialized so a later call can retry. A corrupt
 4999|       |      // blob (below) is permanent; running out of memory may not be.
 5000|       |      // LCOV_EXCL_START
 5001|      0|      tables_init_state.store(kTablesUninit, std::memory_order_release);
 5002|      0|      return false;
 5003|       |      // LCOV_EXCL_STOP
 5004|      0|    }
 5005|       |
 5006|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 5007|      1|                                          table_blob::compressed_size, buffer,
 5008|      1|                                          table_blob::uncompressed_size);
 5009|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (5009:9): [True: 0, False: 1]
  ------------------
 5010|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (5010:9): [True: 0, False: 1]
  ------------------
 5011|      0|      delete[] buffer;
 5012|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5013|      0|      return false;
 5014|      0|    }
 5015|       |
 5016|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 5017|      1|    detail::convert_table_blob_to_host_endian(buffer);
 5018|       |
 5019|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|      1|      return buffer + off;
 5021|      1|    };
 5022|       |
 5023|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 5024|       |    // acquire on tables_init_state and then observe these writes.
 5025|      1|    idna_stage1 =
 5026|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 5027|      1|    idna_stage2 =
 5028|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 5029|      1|    idna_bool_blocks =
 5030|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 5031|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 5032|       |
 5033|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 5034|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 5035|      1|        at(table_blob::off_decomposition_block));
 5036|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 5037|      1|        at(table_blob::off_decomposition_data));
 5038|      1|    ccc_index = at(table_blob::off_ccc_index);
 5039|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 5040|      1|    composition_index = at(table_blob::off_composition_index);
 5041|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 5042|      1|        at(table_blob::off_composition_block));
 5043|      1|    composition_data =
 5044|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 5045|      1|    nfc_qc_index = at(table_blob::off_nfc_qc_index);
 5046|      1|    nfc_qc_block_flat = at(table_blob::off_nfc_qc_block);
 5047|       |
 5048|      1|    id_continue =
 5049|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 5050|      1|    id_start =
 5051|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 5052|       |
 5053|      1|    dir_index = at(table_blob::off_dir_index);
 5054|      1|    dir_block_flat = at(table_blob::off_dir_block);
 5055|      1|    combining_ranges =
 5056|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 5057|      1|    joining_start =
 5058|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_start));
 5059|      1|    joining_final =
 5060|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_final));
 5061|      1|    joining_value = at(table_blob::off_joining_value);
 5062|       |
 5063|      1|    tables_buffer = buffer;
 5064|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 5065|      1|    return true;
 5066|      1|  }
 5067|       |
 5068|       |  // Another thread owns init (or finished between our loads).
 5069|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (5069:28): [True: 0, False: 0]
  ------------------
 5070|      0|    state = tables_init_state.load(std::memory_order_acquire);
 5071|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (5071:9): [True: 0, False: 0]
  ------------------
 5072|      0|      return true;
 5073|      0|    }
 5074|       |    // Failed is permanent. Uninit means the peer gave up after a failed
 5075|       |    // allocation: do not spin, the next call can take the init slot. One
 5076|       |    // comparison, same shape as the old Failed check, so this wait loop does
 5077|       |    // not grow the unity translation unit.
 5078|       |    // LCOV_EXCL_START
 5079|      0|    if (state != kTablesInProgress) {
  ------------------
  |  Branch (5079:9): [True: 0, False: 0]
  ------------------
 5080|      0|      return false;
 5081|      0|    }
 5082|       |    // LCOV_EXCL_STOP
 5083|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 5084|      0|    defined(_M_IX86)
 5085|      0|#if defined(__GNUC__) || defined(__clang__)
 5086|      0|    __builtin_ia32_pause();
 5087|      0|#endif
 5088|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 5089|       |#if defined(__GNUC__) || defined(__clang__)
 5090|       |    asm volatile("yield" ::: "memory");
 5091|       |#endif
 5092|       |#endif
 5093|      0|  }
 5094|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 5095|      0|  return false;
 5096|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  526|      1|                          size_t dst_cap) {
  527|      1|  BitReader br(src, src_len);
  528|      1|  size_t out = 0;
  529|      4|  for (;;) {
  530|      4|    uint32_t bfinal = br.get(1);
  531|      4|    uint32_t btype = br.get(2);
  532|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (532:9): [True: 0, False: 4]
  |  Branch (532:33): [True: 0, False: 4]
  ------------------
  533|      4|    if (btype == 0) {
  ------------------
  |  Branch (533:9): [True: 0, False: 4]
  ------------------
  534|       |      // stored
  535|      0|      br.align_byte();
  536|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (536:11): [True: 0, False: 0]
  ------------------
  537|       |      // read 16+16 from bit buffer awkwardly - use byte path
  538|       |      // Align: bits is multiple of 8
  539|       |      // Get len from remaining bits then bytes
  540|      0|      uint32_t len = br.get(16);
  541|      0|      uint32_t nlen = br.get(16);
  542|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  |  Branch (542:32): [True: 0, False: 0]
  ------------------
  543|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (543:11): [True: 0, False: 0]
  ------------------
  544|       |      // After get, may have bits in acc from previous - for stored, should be
  545|       |      // byte aligned Copy len bytes from p
  546|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (546:11): [True: 0, False: 0]
  ------------------
  547|       |        // leftover bits should be 0 if aligned
  548|      0|      }
  549|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (550:11): [True: 0, False: 0]
  ------------------
  551|      0|      std::memcpy(dst + out, br.p, len);
  552|      0|      br.p += len;
  553|      0|      out += len;
  554|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (554:16): [True: 0, False: 4]
  |  Branch (554:30): [True: 4, False: 0]
  ------------------
  555|      4|      Huff lit, dist;
  556|      4|      if (btype == 1) {
  ------------------
  |  Branch (556:11): [True: 0, False: 4]
  ------------------
  557|       |        // use fixed via functions
  558|      4|      } else {
  559|       |        // dynamic
  560|      4|        uint32_t hlit = br.get(5);
  561|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (561:13): [True: 0, False: 4]
  ------------------
  562|      4|        hlit += 257;
  563|      4|        uint32_t hdist = br.get(5);
  564|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (564:13): [True: 0, False: 4]
  ------------------
  565|      4|        hdist += 1;
  566|      4|        uint32_t hclen = br.get(4);
  567|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (567:13): [True: 0, False: 4]
  ------------------
  568|      4|        hclen += 4;
  569|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  570|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  571|      4|        uint8_t clen[19]{};
  572|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (572:30): [True: 65, False: 4]
  ------------------
  573|     65|          uint32_t v = br.get(3);
  574|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (574:15): [True: 0, False: 65]
  ------------------
  575|     65|          clen[order[i]] = uint8_t(v);
  576|     65|        }
  577|      4|        Huff cl;
  578|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (578:13): [True: 0, False: 4]
  ------------------
  579|      4|        uint8_t lens[288 + 32]{};
  580|      4|        uint32_t n = hlit + hdist;
  581|  1.06k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (581:30): [True: 1.06k, False: 4]
  ------------------
  582|  1.06k|          int sym = cl.decode(br);
  583|  1.06k|          if (sym < 0) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 1.06k]
  ------------------
  584|  1.06k|          if (sym < 16) {
  ------------------
  |  Branch (584:15): [True: 1.00k, False: 60]
  ------------------
  585|  1.00k|            lens[i++] = uint8_t(sym);
  586|  1.00k|          } else if (sym == 16) {
  ------------------
  |  Branch (586:22): [True: 60, False: 0]
  ------------------
  587|     60|            uint32_t rep = br.get(2);
  588|     60|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (588:17): [True: 0, False: 60]
  ------------------
  589|     60|            rep += 3;
  590|     60|            if (i == 0) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 60]
  ------------------
  591|     60|            uint8_t v = lens[i - 1];
  592|    318|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (592:20): [True: 258, False: 60]
  ------------------
  593|     60|          } else if (sym == 17) {
  ------------------
  |  Branch (593:22): [True: 0, False: 0]
  ------------------
  594|      0|            uint32_t rep = br.get(3);
  595|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (595:17): [True: 0, False: 0]
  ------------------
  596|      0|            rep += 3;
  597|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (597:20): [True: 0, False: 0]
  ------------------
  598|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (598:22): [True: 0, False: 0]
  ------------------
  599|      0|            uint32_t rep = br.get(7);
  600|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|            rep += 11;
  602|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (602:20): [True: 0, False: 0]
  ------------------
  603|      0|          } else
  604|      0|            return 0;
  605|  1.06k|        }
  606|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (606:13): [True: 0, False: 4]
  ------------------
  607|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (607:13): [True: 0, False: 4]
  ------------------
  608|      4|      }
  609|  53.6k|      for (;;) {
  610|  53.6k|        int sym;
  611|  53.6k|        if (btype == 1)
  ------------------
  |  Branch (611:13): [True: 0, False: 53.6k]
  ------------------
  612|      0|          sym = fixed_litlen(br);
  613|  53.6k|        else
  614|  53.6k|          sym = lit.decode(br);
  615|  53.6k|        if (sym < 0) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 53.6k]
  ------------------
  616|  53.6k|        if (sym < 256) {
  ------------------
  |  Branch (616:13): [True: 38.1k, False: 15.5k]
  ------------------
  617|  38.1k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (617:15): [True: 0, False: 38.1k]
  ------------------
  618|  38.1k|          dst[out++] = uint8_t(sym);
  619|  38.1k|        } else if (sym == 256) {
  ------------------
  |  Branch (619:20): [True: 4, False: 15.5k]
  ------------------
  620|      4|          break;
  621|  15.5k|        } else {
  622|  15.5k|          int len_code = sym - 257;
  623|  15.5k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (623:15): [True: 0, False: 15.5k]
  |  Branch (623:31): [True: 0, False: 15.5k]
  ------------------
  624|  15.5k|          uint32_t extra = br.get(len_extra[len_code]);
  625|  15.5k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (625:15): [True: 2.60k, False: 12.9k]
  |  Branch (625:38): [True: 0, False: 2.60k]
  ------------------
  626|  15.5k|          uint32_t length =
  627|  15.5k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (627:37): [True: 2.60k, False: 12.9k]
  ------------------
  628|  15.5k|          int dsym;
  629|  15.5k|          if (btype == 1)
  ------------------
  |  Branch (629:15): [True: 0, False: 15.5k]
  ------------------
  630|      0|            dsym = fixed_dist(br);
  631|  15.5k|          else
  632|  15.5k|            dsym = dist.decode(br);
  633|  15.5k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (633:15): [True: 0, False: 15.5k]
  |  Branch (633:27): [True: 0, False: 15.5k]
  ------------------
  634|  15.5k|          uint32_t dextra = br.get(dist_extra[dsym]);
  635|  15.5k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (635:15): [True: 9.94k, False: 5.58k]
  |  Branch (635:35): [True: 0, False: 9.94k]
  ------------------
  636|  15.5k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (636:50): [True: 9.94k, False: 5.58k]
  ------------------
  637|  15.5k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (637:15): [True: 0, False: 15.5k]
  |  Branch (637:33): [True: 0, False: 15.5k]
  ------------------
  638|   236k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (638:32): [True: 220k, False: 15.5k]
  ------------------
  639|   220k|            dst[out] = dst[out - distance];
  640|   220k|            out++;
  641|   220k|          }
  642|  15.5k|        }
  643|  53.6k|      }
  644|      4|    } else {
  645|      0|      return 0;  // reserved
  646|      0|    }
  647|      4|    if (bfinal) break;
  ------------------
  |  Branch (647:9): [True: 1, False: 3]
  ------------------
  648|      4|  }
  649|      1|  return out;
  650|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  393|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  403|   471k|  uint32_t get(int n) {
  404|   471k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (404:9): [True: 0, False: 471k]
  ------------------
  405|   471k|    uint32_t v = acc & ((1u << n) - 1);
  406|   471k|    acc >>= n;
  407|   471k|    bits -= n;
  408|   471k|    return v;
  409|   471k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  395|   471k|  bool ensure(int n) {
  396|   534k|    while (bits < n) {
  ------------------
  |  Branch (396:12): [True: 63.5k, False: 471k]
  ------------------
  397|  63.5k|      if (p >= end) return false;
  ------------------
  |  Branch (397:11): [True: 0, False: 63.5k]
  ------------------
  398|  63.5k|      acc |= uint32_t(*p++) << bits;
  399|  63.5k|      bits += 8;
  400|  63.5k|    }
  401|   471k|    return true;
  402|   471k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  462|  70.2k|  int decode(BitReader& br) const {
  463|  70.2k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (463:9): [True: 0, False: 70.2k]
  ------------------
  464|  70.2k|    int code = 0;
  465|   439k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (465:23): [True: 439k, False: 0]
  ------------------
  466|   439k|      uint32_t b = br.get(1);
  467|   439k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (467:11): [True: 0, False: 439k]
  ------------------
  468|   439k|      code = (code << 1) | int(b);
  469|   439k|      int first = first_code[len];
  470|   439k|      int cnt = counts[len];
  471|   439k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (471:11): [True: 271k, False: 168k]
  |  Branch (471:18): [True: 70.2k, False: 201k]
  ------------------
  472|  70.2k|        return symbols[base_idx[len] + (code - first)];
  473|  70.2k|      }
  474|   439k|    }
  475|      0|    return -1;
  476|  70.2k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4966|      1|                                         size_t len) noexcept {
 4967|      1|  uint32_t c = 0xFFFFFFFFu;
 4968|   258k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4968:22): [True: 258k, False: 1]
  ------------------
 4969|   258k|    c ^= data[i];
 4970|  2.32M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4970:21): [True: 2.06M, False: 258k]
  ------------------
 4971|  2.06M|      const uint32_t mask = 0u - (c & 1u);
 4972|  2.06M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4973|  2.06M|    }
 4974|   258k|  }
 4975|      1|  return ~c;
 4976|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4766|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4767|      1|  if constexpr (std::endian::native == std::endian::little) {
 4768|      1|    (void)buffer;
 4769|      1|    return;
 4770|      1|  }
 4771|      0|  auto u16 = [&](size_t off, size_t count) {
 4772|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4773|      1|  };
 4774|      1|  auto u32 = [&](size_t off, size_t count) {
 4775|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4776|      1|  };
 4777|      1|  auto u64 = [&](size_t off, size_t count) {
 4778|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4779|      1|  };
 4780|       |
 4781|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4782|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4783|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4784|      1|  u16(table_blob::off_decomposition_block,
 4785|      1|      table_blob::count_decomposition_block);
 4786|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4787|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4788|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4789|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4790|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4791|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4792|      1|  u32(table_blob::off_joining_start, table_blob::count_joining_start);
 4793|      1|  u32(table_blob::off_joining_final, table_blob::count_joining_final);
 4794|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 5019|     22|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|     22|      return buffer + off;
 5021|     22|    };
serializers.cc:_ZN3ada4idnaL11idna_lookupEj:
 5198|  96.2k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5199|  96.2k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5199:7): [True: 95.6k, False: 607]
  ------------------
 5200|  95.6k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5201|  95.6k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5201:9): [True: 45.7k, False: 49.8k]
  ------------------
 5202|  45.7k|      uint32_t bit_idx =
 5203|  45.7k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5204|  45.7k|          (cp & IDNA_BLOCK_MASK);
 5205|  45.7k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5206|  45.7k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5206:14): [True: 45.7k, False: 10]
  ------------------
 5207|  45.7k|    }
 5208|  49.8k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5209|  95.6k|  }
 5210|       |
 5211|    607|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5211:7): [True: 588, False: 19]
  |  Branch (5211:40): [True: 442, False: 146]
  ------------------
 5212|    442|    return IDNA_IGNORED;
 5213|    442|  }
 5214|       |
 5215|    165|  return IDNA_DISALLOWED;
 5216|    607|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5241|  10.9k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5242|  10.9k|  size_t n = 0;
 5243|  53.2k|  while (*ptr != 0) {
  ------------------
  |  Branch (5243:10): [True: 42.3k, False: 10.9k]
  ------------------
 5244|  42.3k|    ++n;
 5245|  42.3k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5245:9): [True: 13.9k, False: 28.3k]
  ------------------
 5246|  13.9k|      ++ptr;
 5247|  28.3k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5247:16): [True: 17.3k, False: 11.0k]
  ------------------
 5248|  17.3k|      ptr += 2;
 5249|  17.3k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5249:16): [True: 10.7k, False: 284]
  ------------------
 5250|  10.7k|      ptr += 3;
 5251|  10.7k|    } else {
 5252|    284|      ptr += 4;
 5253|    284|    }
 5254|  42.3k|  }
 5255|  10.9k|  return n;
 5256|  10.9k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5219|  42.0k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5220|  42.0k|  uint8_t b0 = *ptr++;
 5221|  42.0k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5221:7): [True: 13.9k, False: 28.0k]
  ------------------
 5222|  28.0k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5222:7): [True: 17.0k, False: 11.0k]
  ------------------
 5223|  17.0k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5224|  17.0k|    cp |= (*ptr++ & 0x3Fu);
 5225|  17.0k|    return static_cast<char32_t>(cp);
 5226|  17.0k|  }
 5227|  11.0k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5227:7): [True: 10.7k, False: 284]
  ------------------
 5228|  10.7k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5229|  10.7k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5230|  10.7k|    cp |= (*ptr++ & 0x3Fu);
 5231|  10.7k|    return static_cast<char32_t>(cp);
 5232|  10.7k|  }
 5233|    284|  uint32_t cp = (b0 & 0x07u) << 18;
 5234|    284|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5235|    284|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5236|    284|  cp |= (*ptr++ & 0x3Fu);
 5237|    284|  return static_cast<char32_t>(cp);
 5238|  11.0k|}
_ZN3ada4idna23decomposition_block_rowEh:
 5101|  88.2k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 5102|  88.2k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (5102:7): [True: 0, False: 88.2k]
  ------------------
 5103|      0|    bi = 0;
 5104|      0|  }
 5105|  88.2k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 5106|  88.2k|}
_ZN3ada4idna13ccc_block_rowEh:
 5108|   166k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 5109|   166k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (5109:7): [True: 0, False: 166k]
  ------------------
 5110|      0|    bi = 0;
 5111|      0|  }
 5112|   166k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5113|   166k|}
_ZN3ada4idna16tables_are_readyEv:
 4978|  3.23k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4979|  3.23k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4980|  3.23k|}
serializers.cc:_ZN3ada4idnaL19get_nfc_quick_checkEDi:
 5645|  39.6k|static nfc_quick_check get_nfc_quick_check(char32_t c) noexcept {
 5646|  39.6k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5646:7): [True: 0, False: 39.6k]
  ------------------
 5647|      0|    return nfc_quick_check::yes;
 5648|      0|  }
 5649|  39.6k|  return static_cast<nfc_quick_check>(
 5650|  39.6k|      nfc_qc_block_row(nfc_qc_index[c >> 8])[c % 256]);
 5651|  39.6k|}
_ZN3ada4idna16nfc_qc_block_rowEh:
 5122|  39.6k|inline const uint8_t* nfc_qc_block_row(uint8_t bi) noexcept {
 5123|  39.6k|  if (bi >= kNfcQcBlockRows) {
  ------------------
  |  Branch (5123:7): [True: 0, False: 39.6k]
  ------------------
 5124|      0|    bi = 0;
 5125|      0|  }
 5126|  39.6k|  return nfc_qc_block_flat + static_cast<size_t>(bi) * kNfcQcBlockCols;
 5127|  39.6k|}
serializers.cc:_ZN3ada4idnaL12maybe_is_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5656|  1.65k|static bool maybe_is_nfc(std::u32string_view input) noexcept {
 5657|       |  // 1) A character whose decomposition starts with a code point that composes
 5658|       |  //    with the previous character (e.g. U+1611E U+16121).
 5659|  1.65k|  char32_t previous = 0x110000;  // none
 5660|  31.9k|  for (char32_t c : input) {
  ------------------
  |  Branch (5660:19): [True: 31.9k, False: 1.63k]
  ------------------
 5661|  31.9k|    if (decomposition_composes_with_previous(previous, c)) {
  ------------------
  |  Branch (5661:9): [True: 24, False: 31.9k]
  ------------------
 5662|     24|      return false;
 5663|     24|    }
 5664|  31.9k|    previous = c;
 5665|  31.9k|  }
 5666|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5667|       |  //    trailing class of the previous character's canonical decomposition so a
 5668|       |  //    composite starter followed by a lower-class mark is caught.
 5669|  1.63k|  uint8_t prev_ccc = 0;
 5670|  30.7k|  for (char32_t c : input) {
  ------------------
  |  Branch (5670:19): [True: 30.7k, False: 1.06k]
  ------------------
 5671|  30.7k|    uint8_t ccc = get_ccc(c);
 5672|  30.7k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5672:9): [True: 2.87k, False: 27.9k]
  |  Branch (5672:21): [True: 566, False: 2.31k]
  ------------------
 5673|    566|      return false;
 5674|    566|    }
 5675|  30.2k|    prev_ccc = trailing_ccc(c);
 5676|  30.2k|  }
 5677|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5678|  1.06k|  return !would_compose(input);
 5679|  1.63k|}
serializers.cc:_ZN3ada4idnaL36decomposition_composes_with_previousEDiDi:
 5620|  31.9k|                                                 char32_t c) noexcept {
 5621|  31.9k|  const size_t length = canonical_decomp_length(c);
 5622|  31.9k|  if (length < 2 || previous >= 0x110000) {
  ------------------
  |  Branch (5622:7): [True: 28.1k, False: 3.79k]
  |  Branch (5622:21): [True: 518, False: 3.28k]
  ------------------
 5623|  28.6k|    return false;
 5624|  28.6k|  }
 5625|  3.28k|  const uint16_t* const decomposition =
 5626|  3.28k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5627|  3.28k|  const size_t base = decomposition[0] >> 2;
 5628|  3.28k|  if (base + length > decomposition_data_size) {
  ------------------
  |  Branch (5628:7): [True: 0, False: 3.28k]
  ------------------
 5629|      0|    return false;
 5630|      0|  }
 5631|  3.28k|  return has_composition(
 5632|  3.28k|      composition_block_row(composition_index[previous >> 8]) +
 5633|  3.28k|          (previous % 256),
 5634|  3.28k|      decomposition_data[base]);
 5635|  3.28k|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5399|  62.1k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5400|  62.1k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5400:7): [True: 7.32k, False: 54.8k]
  ------------------
 5401|  7.32k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5401:7): [True: 4.09k, False: 3.22k]
  ------------------
 5402|       |    // Hangul precomposed syllables are NFC.
 5403|  4.09k|    return 0;
 5404|  4.09k|  }
 5405|  58.0k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5405:7): [True: 0, False: 58.0k]
  ------------------
 5406|      0|    return 0;
 5407|      0|  }
 5408|  58.0k|  const uint8_t di = decomposition_index[current_character >> 8];
 5409|  58.0k|  const uint16_t* const decomposition =
 5410|  58.0k|      decomposition_block_row(di) + (current_character % 256);
 5411|  58.0k|  size_t decomposition_length =
 5412|  58.0k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5413|  58.0k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5413:7): [True: 7.17k, False: 50.9k]
  |  Branch (5413:37): [True: 0, False: 7.17k]
  ------------------
 5414|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5415|      0|  }
 5416|  58.0k|  return decomposition_length;
 5417|  58.0k|}
serializers.cc:_ZN3ada4idnaL15has_compositionEPKtDi:
 5532|  7.55k|                            char32_t second) noexcept {
 5533|  7.55k|  int left = composition[0];
 5534|  7.55k|  int right = composition[1];
 5535|  7.55k|  if (left < 0 || right <= left ||
  ------------------
  |  Branch (5535:7): [True: 0, False: 7.55k]
  |  Branch (5535:19): [True: 1.83k, False: 5.72k]
  ------------------
 5536|  5.72k|      static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5536:7): [True: 0, False: 5.72k]
  ------------------
 5537|  1.83k|    return false;
 5538|  1.83k|  }
 5539|  14.0k|  while (left + 2 < right) {
  ------------------
  |  Branch (5539:10): [True: 8.35k, False: 5.72k]
  ------------------
 5540|  8.35k|    int middle = left + (((right - left) >> 1) & ~1);
 5541|  8.35k|    if (composition_data[static_cast<size_t>(middle)] <= second) {
  ------------------
  |  Branch (5541:9): [True: 3.08k, False: 5.27k]
  ------------------
 5542|  3.08k|      left = middle;
 5543|  3.08k|    }
 5544|  8.35k|    if (composition_data[static_cast<size_t>(middle)] >= second) {
  ------------------
  |  Branch (5544:9): [True: 5.86k, False: 2.49k]
  ------------------
 5545|  5.86k|      right = middle;
 5546|  5.86k|    }
 5547|  8.35k|  }
 5548|  5.72k|  return static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5548:10): [True: 5.72k, False: 0]
  ------------------
 5549|  5.72k|         composition_data[static_cast<size_t>(left)] == second;
  ------------------
  |  Branch (5549:10): [True: 692, False: 5.03k]
  ------------------
 5550|  7.55k|}
serializers.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5605|  30.2k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5606|  30.2k|  const size_t length = canonical_decomp_length(c);
 5607|  30.2k|  if (length == 0) {
  ------------------
  |  Branch (5607:7): [True: 26.8k, False: 3.37k]
  ------------------
 5608|  26.8k|    return get_ccc(c);
 5609|  26.8k|  }
 5610|  3.37k|  const uint16_t* const decomposition =
 5611|  3.37k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5612|  3.37k|  const size_t base = decomposition[0] >> 2;
 5613|  3.37k|  return get_ccc(decomposition_data[base + length - 1]);
 5614|  30.2k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5553|  1.06k|static bool would_compose(std::u32string_view input) noexcept {
 5554|  18.6k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5554:32): [True: 18.3k, False: 277]
  ------------------
 5555|  18.3k|    const char32_t current = input[input_count];
 5556|  18.3k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5556:9): [True: 3.92k, False: 14.4k]
  |  Branch (5556:36): [True: 487, False: 3.44k]
  ------------------
 5557|    487|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5557:11): [True: 475, False: 12]
  ------------------
 5558|    475|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5558:11): [True: 205, False: 270]
  ------------------
 5559|    205|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5559:11): [True: 54, False: 151]
  ------------------
 5560|     54|        return true;
 5561|     54|      }
 5562|    433|      ++input_count;
 5563|    433|      continue;
 5564|    487|    }
 5565|  17.8k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5565:9): [True: 2.58k, False: 15.2k]
  |  Branch (5565:36): [True: 1.63k, False: 946]
  ------------------
 5566|  1.63k|      if ((current - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5566:11): [True: 670, False: 968]
  ------------------
 5567|    670|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5567:11): [True: 651, False: 19]
  ------------------
 5568|    651|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5568:11): [True: 554, False: 97]
  ------------------
 5569|    554|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5569:11): [True: 68, False: 486]
  ------------------
 5570|     68|        return true;
 5571|     68|      }
 5572|  1.57k|      ++input_count;
 5573|  1.57k|      continue;
 5574|  1.63k|    }
 5575|  16.2k|    if (current < 0x110000) {
  ------------------
  |  Branch (5575:9): [True: 16.2k, False: 0]
  ------------------
 5576|  16.2k|      const uint16_t* composition =
 5577|  16.2k|          composition_block_row(composition_index[current >> 8]) +
 5578|  16.2k|          (current % 256);
 5579|  16.2k|      int32_t previous_ccc = -1;
 5580|  16.2k|      size_t j = input_count;
 5581|  17.5k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5581:14): [True: 17.2k, False: 246]
  ------------------
 5582|  17.2k|        uint8_t ccc = get_ccc(input[j + 1]);
 5583|  17.2k|        if (composition[1] != composition[0] && previous_ccc < ccc &&
  ------------------
  |  Branch (5583:13): [True: 4.58k, False: 12.7k]
  |  Branch (5583:49): [True: 4.27k, False: 306]
  ------------------
 5584|  4.27k|            has_composition(composition, input[j + 1])) {
  ------------------
  |  Branch (5584:13): [True: 668, False: 3.60k]
  ------------------
 5585|    668|          return true;
 5586|    668|        }
 5587|  16.6k|        if (ccc == 0) {
  ------------------
  |  Branch (5587:13): [True: 15.3k, False: 1.29k]
  ------------------
 5588|  15.3k|          break;
 5589|  15.3k|        }
 5590|  1.29k|        previous_ccc = ccc;
 5591|  1.29k|      }
 5592|  15.5k|      input_count = j + 1;
 5593|  15.5k|      continue;
 5594|  16.2k|    }
 5595|      0|    ++input_count;
 5596|      0|  }
 5597|    277|  return false;
 5598|  1.06k|}
_ZN3ada4idna21composition_block_rowEh:
 5115|  34.4k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5116|  34.4k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5116:7): [True: 0, False: 34.4k]
  ------------------
 5117|      0|    bi = 0;
 5118|      0|  }
 5119|  34.4k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5120|  34.4k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5853|  15.4k|static constexpr int32_t char_to_digit_value(char value) {
 5854|  15.4k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5854:7): [True: 12.6k, False: 2.87k]
  |  Branch (5854:23): [True: 12.6k, False: 1]
  ------------------
 5855|  2.87k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5855:7): [True: 2.87k, False: 4]
  |  Branch (5855:23): [True: 2.86k, False: 5]
  ------------------
 5856|      9|  return -1;
 5857|  2.87k|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5863|  22.9k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5864|  22.9k|  if (firsttime) {
  ------------------
  |  Branch (5864:7): [True: 3.97k, False: 18.9k]
  ------------------
 5865|  3.97k|    d = d / damp;
 5866|  18.9k|  } else {
 5867|  18.9k|    d = d / 2;
 5868|  18.9k|  }
 5869|  22.9k|  d += d / n;
 5870|  22.9k|  int32_t k = 0;
 5871|  27.5k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5871:10): [True: 4.62k, False: 22.9k]
  ------------------
 5872|  4.62k|    d /= base - tmin;
 5873|  4.62k|    k += base;
 5874|  4.62k|  }
 5875|  22.9k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5876|  22.9k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5859|  29.5k|static constexpr char digit_to_char(int32_t digit) {
 5860|  29.5k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5860:10): [True: 22.3k, False: 7.14k]
  ------------------
 5861|  29.5k|}
serializers.cc:_ZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6260|  5.90k|static label_check check_label(const std::u32string_view label) {
 6261|  5.90k|  if (label.empty()) {
  ------------------
  |  Branch (6261:7): [True: 0, False: 5.90k]
  ------------------
 6262|      0|    return {true, false, true};
 6263|      0|  }
 6264|  5.90k|  if (!ensure_tables() || combining_ranges == nullptr || dir_index == nullptr ||
  ------------------
  |  Branch (6264:7): [True: 0, False: 5.90k]
  |  Branch (6264:27): [True: 0, False: 5.90k]
  |  Branch (6264:58): [True: 0, False: 5.90k]
  ------------------
 6265|  5.90k|      dir_block_flat == nullptr || joining_start == nullptr ||
  ------------------
  |  Branch (6265:7): [True: 0, False: 5.90k]
  |  Branch (6265:36): [True: 0, False: 5.90k]
  ------------------
 6266|  5.90k|      joining_final == nullptr || joining_value == nullptr) {
  ------------------
  |  Branch (6266:7): [True: 0, False: 5.90k]
  |  Branch (6266:35): [True: 0, False: 5.90k]
  ------------------
 6267|      0|    return {};
 6268|      0|  }
 6269|       |
 6270|       |  // An invalid RTL label still makes the domain a Bidi domain name, so `rtl`
 6271|       |  // is reported even when another criterion fails.
 6272|  5.90k|  uint32_t directions = 0;
 6273|  5.90k|  direction last = direction::NSM;  // last direction that is not NSM
 6274|  37.2k|  for (char32_t c : label) {
  ------------------
  |  Branch (6274:19): [True: 37.2k, False: 5.90k]
  ------------------
 6275|  37.2k|    const direction d = find_direction(c);
 6276|  37.2k|    directions |= 1u << d;
 6277|  37.2k|    if (d != direction::NSM) {
  ------------------
  |  Branch (6277:9): [True: 35.1k, False: 2.08k]
  ------------------
 6278|  35.1k|      last = d;
 6279|  35.1k|    }
 6280|  37.2k|  }
 6281|  5.90k|  const bool rtl = (directions & rtl_directions) != 0;
 6282|       |
 6283|       |  ///////////////
 6284|       |  // We have a normalization step which ensures that we are in NFC.
 6285|       |  // If we receive punycode, we normalize and check that the normalized
 6286|       |  // version matches the original.
 6287|       |  // --------------------------------------
 6288|       |  // The label must be in Unicode Normalization Form NFC.
 6289|       |
 6290|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 6291|       |  // ---------------------------------------
 6292|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 6293|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 6294|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 6295|       |
 6296|       |  // This is not necessary because we segment the
 6297|       |  // labels by '.'.
 6298|       |  // ---------------------------------------
 6299|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 6300|       |  // if (label.find('.') != std::string_view::npos) return false;
 6301|       |
 6302|       |  // The label must not begin with a combining mark.
 6303|       |  // Range membership via lower_bound on range end.
 6304|  5.90k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 6305|  5.90k|                                               combining_range_count};
 6306|  5.90k|  const auto comb_it = std::ranges::lower_bound(
 6307|  5.90k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 6308|  5.90k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (6308:7): [True: 5.90k, False: 0]
  |  Branch (6308:7): [True: 119, False: 5.79k]
  |  Branch (6308:37): [True: 119, False: 5.79k]
  ------------------
 6309|    119|    return {false, rtl, false};
 6310|    119|  }
 6311|       |  // We verify this next step as part of the mapping:
 6312|       |  // ---------------------------------------------
 6313|       |  // Each code point in the label must only have certain status values
 6314|       |  // according to Section 5, IDNA Mapping Table:
 6315|       |  // - For Transitional Processing, each value must be valid.
 6316|       |  // - For Nontransitional Processing, each value must be either valid or
 6317|       |  // deviation.
 6318|       |
 6319|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6320|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6321|       |  // Applications (IDNA) [IDNA2008].
 6322|  5.79k|  if (!is_contextj_valid(label)) {
  ------------------
  |  Branch (6322:7): [True: 121, False: 5.66k]
  ------------------
 6323|    121|    return {false, rtl, false};
 6324|    121|  }
 6325|       |
 6326|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6327|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6328|       |  // Section 2.
 6329|       |
 6330|       |  // The following rule, consisting of six conditions, applies to labels
 6331|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6332|       |  // described in Section 3.  All of the conditions must be satisfied for
 6333|       |  // the rule to be satisfied.
 6334|       |  //
 6335|       |  //  1.  The first character must be a character with Bidi property L, R,
 6336|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6337|       |  //     has the L property, it is an LTR label.
 6338|       |  //
 6339|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6340|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6341|       |  //
 6342|       |  //   3.  In an RTL label, the end of the label must be a character with
 6343|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6344|       |  //       characters with Bidi property NSM.
 6345|       |  //
 6346|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6347|       |  //       vice versa.
 6348|       |  //
 6349|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6350|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6351|       |  //
 6352|       |  //   6.  In an LTR label, the end of the label must be a character with
 6353|       |  //       Bidi property L or EN, followed by zero or more characters with
 6354|       |  //       Bidi property NSM.
 6355|       |  //
 6356|       |  // Every character after the last non-NSM character is NSM, which both the
 6357|       |  // LTR and the RTL rules allow, so conditions 2, 4 and 5 only depend on the
 6358|       |  // set of directions in the whole label.
 6359|  5.66k|  if (last == direction::NSM) {
  ------------------
  |  Branch (6359:7): [True: 0, False: 5.66k]
  ------------------
 6360|      0|    return {false, rtl, false};
 6361|      0|  }
 6362|       |
 6363|  5.66k|  label_check result{true, rtl, false};
 6364|  5.66k|  const direction first = find_direction(label[0]);
 6365|  5.66k|  if (first == direction::L) {
  ------------------
  |  Branch (6365:7): [True: 3.26k, False: 2.40k]
  ------------------
 6366|  3.26k|    constexpr uint32_t ltr_allowed =
 6367|  3.26k|        (1u << direction::L) | (1u << direction::EN) | (1u << direction::ES) |
 6368|  3.26k|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6369|  3.26k|        (1u << direction::BN) | (1u << direction::NSM);
 6370|  3.26k|    result.bidi = (directions & ~ltr_allowed) == 0 &&
  ------------------
  |  Branch (6370:19): [True: 3.13k, False: 128]
  ------------------
 6371|  3.13k|                  (last == direction::L || last == direction::EN);
  ------------------
  |  Branch (6371:20): [True: 2.88k, False: 254]
  |  Branch (6371:44): [True: 147, False: 107]
  ------------------
 6372|  3.26k|  } else if (first == direction::R || first == direction::AL) {
  ------------------
  |  Branch (6372:14): [True: 178, False: 2.22k]
  |  Branch (6372:39): [True: 267, False: 1.95k]
  ------------------
 6373|    445|    constexpr uint32_t rtl_allowed =
 6374|    445|        rtl_directions | (1u << direction::EN) | (1u << direction::ES) |
 6375|    445|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6376|    445|        (1u << direction::BN) | (1u << direction::NSM);
 6377|    445|    constexpr uint32_t en_and_an =
 6378|    445|        (1u << direction::EN) | (1u << direction::AN);
 6379|    445|    result.bidi = (directions & ~rtl_allowed) == 0 &&
  ------------------
  |  Branch (6379:19): [True: 384, False: 61]
  ------------------
 6380|    384|                  (directions & en_and_an) != en_and_an &&
  ------------------
  |  Branch (6380:19): [True: 383, False: 1]
  ------------------
 6381|    383|                  (last == direction::R || last == direction::AL ||
  ------------------
  |  Branch (6381:20): [True: 124, False: 259]
  |  Branch (6381:44): [True: 169, False: 90]
  ------------------
 6382|     90|                   last == direction::AN || last == direction::EN);
  ------------------
  |  Branch (6382:20): [True: 35, False: 55]
  |  Branch (6382:45): [True: 40, False: 15]
  ------------------
 6383|    445|  }
 6384|  5.66k|  return result;
 6385|  5.66k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 6165|  42.9k|inline static direction find_direction(uint32_t code_point) noexcept {
 6166|  42.9k|  if (code_point >= 0x110000) {
  ------------------
  |  Branch (6166:7): [True: 0, False: 42.9k]
  ------------------
 6167|      0|    return direction::NONE;
 6168|      0|  }
 6169|  42.9k|  return static_cast<direction>(
 6170|  42.9k|      dir_block_row(dir_index[code_point >> 8])[code_point & 0xFF]);
 6171|  42.9k|}
_ZN3ada4idna13dir_block_rowEh:
 5129|  42.9k|inline const uint8_t* dir_block_row(uint8_t bi) noexcept {
 5130|  42.9k|  if (bi >= kDirBlockRows) {
  ------------------
  |  Branch (5130:7): [True: 0, False: 42.9k]
  ------------------
 5131|      0|    bi = 0;
 5132|      0|  }
 5133|  42.9k|  return dir_block_flat + static_cast<size_t>(bi) * kDirBlockCols;
 5134|  42.9k|}
serializers.cc:_ZZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 6307|  50.8k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZN3ada4idnaL17is_contextj_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6182|  5.79k|inline static bool is_contextj_valid(std::u32string_view label) noexcept {
 6183|  5.79k|  constexpr uint8_t virama_ccc = 9;
 6184|  41.9k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6184:22): [True: 36.3k, False: 5.66k]
  ------------------
 6185|  36.3k|    if (label[i] != 0x200C && label[i] != 0x200D) {
  ------------------
  |  Branch (6185:9): [True: 36.0k, False: 260]
  |  Branch (6185:31): [True: 35.9k, False: 67]
  ------------------
 6186|  35.9k|      continue;
 6187|  35.9k|    }
 6188|       |    // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
 6189|    327|    if (i > 0 && get_ccc(label[i - 1]) == virama_ccc) {
  ------------------
  |  Branch (6189:9): [True: 325, False: 2]
  |  Branch (6189:18): [True: 62, False: 263]
  ------------------
 6190|     62|      continue;
 6191|     62|    }
 6192|    265|    if (label[i] == 0x200D) {
  ------------------
  |  Branch (6192:9): [True: 6, False: 259]
  ------------------
 6193|      6|      return false;
 6194|      6|    }
 6195|       |    // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
 6196|       |    //    (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
 6197|    259|    joining_type before = joining_type::U;
 6198|    480|    for (size_t j = i; j > 0;) {
  ------------------
  |  Branch (6198:24): [True: 478, False: 2]
  ------------------
 6199|    478|      before = find_joining_type(label[--j]);
 6200|    478|      if (before != joining_type::T) {
  ------------------
  |  Branch (6200:11): [True: 257, False: 221]
  ------------------
 6201|    257|        break;
 6202|    257|      }
 6203|    478|    }
 6204|    259|    if (before != joining_type::L && before != joining_type::D) {
  ------------------
  |  Branch (6204:9): [True: 241, False: 18]
  |  Branch (6204:38): [True: 51, False: 190]
  ------------------
 6205|     51|      return false;
 6206|     51|    }
 6207|    208|    joining_type after = joining_type::U;
 6208|    541|    for (size_t j = i + 1; j < label.size(); j++) {
  ------------------
  |  Branch (6208:28): [True: 507, False: 34]
  ------------------
 6209|    507|      after = find_joining_type(label[j]);
 6210|    507|      if (after != joining_type::T) {
  ------------------
  |  Branch (6210:11): [True: 174, False: 333]
  ------------------
 6211|    174|        break;
 6212|    174|      }
 6213|    507|    }
 6214|    208|    if (after != joining_type::R && after != joining_type::D) {
  ------------------
  |  Branch (6214:9): [True: 168, False: 40]
  |  Branch (6214:37): [True: 64, False: 104]
  ------------------
 6215|     64|      return false;
 6216|     64|    }
 6217|    208|  }
 6218|  5.66k|  return true;
 6219|  5.79k|}
serializers.cc:_ZN3ada4idnaL17find_joining_typeEj:
 6174|    985|inline static joining_type find_joining_type(uint32_t code_point) noexcept {
 6175|    985|  size_t i =
 6176|    985|      find_range(joining_start, joining_final, joining_table_count, code_point);
 6177|    985|  return i == joining_table_count ? joining_type::U
  ------------------
  |  Branch (6177:10): [True: 76, False: 909]
  ------------------
 6178|    985|                                  : static_cast<joining_type>(joining_value[i]);
 6179|    985|}
serializers.cc:_ZN3ada4idnaL10find_rangeEPKjS2_mj:
 6151|    985|                                size_t count, uint32_t code_point) noexcept {
 6152|    985|  size_t lo = 0, hi = count;
 6153|  10.4k|  while (lo < hi) {
  ------------------
  |  Branch (6153:10): [True: 9.42k, False: 985]
  ------------------
 6154|  9.42k|    size_t mid = lo + (hi - lo) / 2;
 6155|  9.42k|    if (last[mid] < code_point) {
  ------------------
  |  Branch (6155:9): [True: 2.09k, False: 7.33k]
  ------------------
 6156|  2.09k|      lo = mid + 1;
 6157|  7.33k|    } else {
 6158|  7.33k|      hi = mid;
 6159|  7.33k|    }
 6160|  9.42k|  }
 6161|    985|  return lo < count && code_point >= start[lo] ? lo : count;
  ------------------
  |  Branch (6161:10): [True: 985, False: 0]
  |  Branch (6161:24): [True: 909, False: 76]
  ------------------
 6162|    985|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6490|  2.62k|bool constexpr is_ascii(std::string_view view) {
 6491|  20.6k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6491:18): [True: 20.6k, False: 163]
  ------------------
 6492|  20.6k|    if (c >= 0x80) {
  ------------------
  |  Branch (6492:9): [True: 2.46k, False: 18.1k]
  ------------------
 6493|  2.46k|      return false;
 6494|  2.46k|    }
 6495|  20.6k|  }
 6496|    163|  return true;
 6497|  2.62k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6527|    163|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6528|    163|  out.assign(ut8_string);
 6529|    163|  ascii_map(out.data(), out.size());
 6530|    163|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6481|  9.44k|bool constexpr is_ascii(std::u32string_view view) {
 6482|  40.6k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6482:19): [True: 40.6k, False: 2.72k]
  ------------------
 6483|  40.6k|    if (c >= 0x80) {
  ------------------
  |  Branch (6483:9): [True: 6.71k, False: 33.9k]
  ------------------
 6484|  6.71k|      return false;
 6485|  6.71k|    }
 6486|  40.6k|  }
 6487|  2.72k|  return true;
 6488|  9.44k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6543|  6.39k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6544|  6.39k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6544:10): [True: 3.39k, False: 3.00k]
  |  Branch (6544:31): [True: 1.44k, False: 1.95k]
  |  Branch (6544:51): [True: 1.37k, False: 69]
  ------------------
 6545|  1.37k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6545:10): [True: 1.30k, False: 63]
  |  Branch (6545:30): [True: 1.26k, False: 48]
  ------------------
 6546|  6.39k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6533|  3.12k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6534|  3.12k|  const size_t old = out.size();
 6535|  3.12k|  out.resize(old + label.size());
 6536|  3.12k|  char* dest = out.data() + old;
 6537|  26.7k|  for (char32_t c : label) {
  ------------------
  |  Branch (6537:19): [True: 26.7k, False: 3.12k]
  ------------------
 6538|  26.7k|    *dest++ = static_cast<char>(c);
 6539|  26.7k|  }
 6540|  3.12k|}
serializers.cc:_ZZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEENK3$_0clERKNS0_11label_checkE:
 6609|  5.90k|  auto accept = [&](const label_check& check) {
 6610|  5.90k|    bidi_domain = bidi_domain || check.rtl;
  ------------------
  |  Branch (6610:19): [True: 539, False: 5.37k]
  |  Branch (6610:34): [True: 334, False: 5.03k]
  ------------------
 6611|  5.90k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
  ------------------
  |  Branch (6611:23): [True: 4.60k, False: 1.30k]
  |  Branch (6611:42): [True: 2.95k, False: 1.65k]
  ------------------
 6612|  5.90k|    return check.valid && (bidi_rule_holds || !bidi_domain);
  ------------------
  |  Branch (6612:12): [True: 5.66k, False: 240]
  |  Branch (6612:28): [True: 2.95k, False: 2.71k]
  |  Branch (6612:47): [True: 2.46k, False: 247]
  ------------------
 6613|  5.90k|  };
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7682|  37.1k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|  37.1k|    return character_sets::bit_at(character_set, c);
 7684|  37.1k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7682|  26.1k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|  26.1k|    return character_sets::bit_at(character_set, c);
 7684|  26.1k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7416|  12.1k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7417|  12.1k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7417:11): [True: 10.6k, False: 1.45k]
  |  Branch (7417:23): [True: 5.67k, False: 4.98k]
  |  Branch (7417:37): [True: 4.96k, False: 1.48k]
  |  Branch (7417:49): [True: 3.47k, False: 1.48k]
  ------------------
 7418|  2.96k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7418:11): [True: 1.44k, False: 1.52k]
  |  Branch (7418:23): [True: 1.32k, False: 115]
  ------------------
 7419|  12.1k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7506|  9.80k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7507|  9.80k|  return hex_to_binary_table[c - '0'];
 7508|  9.80k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7650|  30.9k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7651|  30.9k|    return character_sets::bit_at(character_set, c);
 7652|  30.9k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7343|  8.42k|    const char* input, size_t length) noexcept {
 7344|  8.42k|  size_t i = 0;
 7345|  8.42k|  uint8_t accumulator{};
 7346|  53.9k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7346:10): [True: 45.4k, False: 8.42k]
  ------------------
 7347|  45.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7348|  45.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7349|  45.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7350|  45.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7351|  45.4k|  }
 7352|  19.9k|  for (; i < length; i++) {
  ------------------
  |  Branch (7352:10): [True: 11.5k, False: 8.42k]
  ------------------
 7353|  11.5k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7354|  11.5k|  }
 7355|  8.42k|  return accumulator;
 7356|  8.42k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 8036|  1.24k|                            const uint8_t character_set[], std::string& out) {
 8037|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 8038|  1.24k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 8039|  1.24k|#if ADA_UNICODE_SSSE3
 8040|  1.24k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 8041|  1.24k|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 8042|       |#elif ADA_NEON
 8043|       |  percent_encode_to_neon(p, end, character_set,
 8044|       |                         load_neon_percent_table(character_set), out);
 8045|       |#elif ADA_RVV
 8046|       |  percent_encode_to_rvv(p, end, character_set, out);
 8047|       |#endif
 8048|  1.24k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7863|  1.24k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7864|  1.24k|  ssse3_percent_tables t{};
 7865|  1.24k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7866|  1.24k|  t.cs_hi =
 7867|  1.24k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7868|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7869|  1.24k|  t.pow2 =
 7870|  1.24k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7871|  1.24k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7872|  1.24k|  t.mask_07 = _mm_set1_epi8(0x07);
 7873|  1.24k|  t.zero = _mm_setzero_si128();
 7874|  1.24k|  return t;
 7875|  1.24k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7894|  1.24k|    const ssse3_percent_tables& tables, std::string& out) {
 7895|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7896|  3.30k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7896:10): [True: 2.06k, False: 1.24k]
  ------------------
 7897|  2.06k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7898|  2.06k|    const __m128i word1 =
 7899|  2.06k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7900|  2.06k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7901|  2.06k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7902|  2.06k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7902:9): [True: 380, False: 1.68k]
  ------------------
 7903|    380|      out.append(p, 32);
 7904|  1.68k|    } else {
 7905|  1.68k|      if (mask0 == 0) {
  ------------------
  |  Branch (7905:11): [True: 169, False: 1.51k]
  ------------------
 7906|    169|        out.append(p, 16);
 7907|  1.51k|      } else {
 7908|  1.51k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7909|  1.51k|      }
 7910|  1.68k|      if (mask1 == 0) {
  ------------------
  |  Branch (7910:11): [True: 299, False: 1.38k]
  ------------------
 7911|    299|        out.append(p + 16, 16);
 7912|  1.38k|      } else {
 7913|  1.38k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7914|  1.38k|      }
 7915|  1.68k|    }
 7916|  2.06k|    p += 32;
 7917|  2.06k|  }
 7918|  1.24k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7918:7): [True: 860, False: 388]
  ------------------
 7919|    860|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7920|    860|    const int mask = ssse3_percent_mask(word, tables);
 7921|    860|    if (mask == 0) {
  ------------------
  |  Branch (7921:9): [True: 162, False: 698]
  ------------------
 7922|    162|      out.append(p, 16);
 7923|    698|    } else {
 7924|    698|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7925|    698|    }
 7926|    860|    p += 16;
 7927|    860|  }
 7928|  1.24k|  percent_encode_to_scalar(p, end, character_set, out);
 7929|  1.24k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7878|  4.98k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7879|  4.98k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7880|  4.98k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7881|  4.98k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7882|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7883|  4.98k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7884|  4.98k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7885|  4.98k|                                       _mm_andnot_si128(high_byte, lo));
 7886|  4.98k|  const __m128i bits =
 7887|  4.98k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7888|  4.98k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7889|  4.98k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7890|  4.98k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7818|  3.59k|                                          size_t width, std::string& out) {
 7819|  3.59k|  uint64_t bits = mask;
 7820|  3.59k|  size_t off = 0;
 7821|  36.4k|  while (bits != 0) {
  ------------------
  |  Branch (7821:10): [True: 32.8k, False: 3.59k]
  ------------------
 7822|  32.8k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7823|  32.8k|    if (zero_run != 0) {
  ------------------
  |  Branch (7823:9): [True: 4.31k, False: 28.5k]
  ------------------
 7824|  4.31k|      out.append(p + off, static_cast<size_t>(zero_run));
 7825|  4.31k|    }
 7826|  32.8k|    off += static_cast<size_t>(zero_run);
 7827|  32.8k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7828|  32.8k|    ++off;
 7829|  32.8k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7830|  32.8k|  }
 7831|  3.59k|  if (off < width) {
  ------------------
  |  Branch (7831:7): [True: 1.70k, False: 1.89k]
  ------------------
 7832|  1.70k|    out.append(p + off, width - off);
 7833|  1.70k|  }
 7834|  3.59k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7806|  32.8k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7807|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7808|       |  unsigned long ret;
 7809|       |  _BitScanForward(&ret, input_num);
 7810|       |  return static_cast<int>(ret);
 7811|       |#else
 7812|  32.8k|  return __builtin_ctz(input_num);
 7813|  32.8k|#endif
 7814|  32.8k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7839|  1.24k|                                                std::string& out) {
 7840|  4.39k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7840:10): [True: 3.14k, False: 1.24k]
  ------------------
 7841|  3.14k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7841:9): [True: 1.27k, False: 1.87k]
  ------------------
 7842|  1.27k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7843|  1.87k|    } else {
 7844|  1.87k|      out += *p;
 7845|  1.87k|    }
 7846|  3.14k|  }
 7847|  1.24k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 8109|  51.7k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 8110|  51.7k|  static constexpr char kHex[] = "0123456789abcdef";
 8111|  51.7k|  if (v >= 0x1000) {
  ------------------
  |  Branch (8111:7): [True: 46.1k, False: 5.65k]
  ------------------
 8112|  46.1k|    *p++ = kHex[(v >> 12) & 0xf];
 8113|  46.1k|    *p++ = kHex[(v >> 8) & 0xf];
 8114|  46.1k|    *p++ = kHex[(v >> 4) & 0xf];
 8115|  46.1k|    *p++ = kHex[v & 0xf];
 8116|  46.1k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (8116:14): [True: 1.43k, False: 4.22k]
  ------------------
 8117|  1.43k|    *p++ = kHex[(v >> 8) & 0xf];
 8118|  1.43k|    *p++ = kHex[(v >> 4) & 0xf];
 8119|  1.43k|    *p++ = kHex[v & 0xf];
 8120|  4.22k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (8120:14): [True: 2.24k, False: 1.97k]
  ------------------
 8121|  2.24k|    *p++ = kHex[(v >> 4) & 0xf];
 8122|  2.24k|    *p++ = kHex[v & 0xf];
 8123|  2.24k|  } else {
 8124|  1.97k|    *p++ = kHex[v & 0xf];
 8125|  1.97k|  }
 8126|  51.7k|  return p;
 8127|  51.7k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 8095|  30.6k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 8096|  30.6k|  if (v < 10) {
  ------------------
  |  Branch (8096:7): [True: 6.76k, False: 23.9k]
  ------------------
 8097|  6.76k|    *p++ = static_cast<char>('0' + v);
 8098|  23.9k|  } else if (v < 100) {
  ------------------
  |  Branch (8098:14): [True: 14.2k, False: 9.71k]
  ------------------
 8099|  14.2k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 8100|  14.2k|    p += 2;
 8101|  14.2k|  } else {
 8102|  9.71k|    *p++ = static_cast<char>('0' + v / 100);
 8103|  9.71k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 8104|  9.71k|    p += 2;
 8105|  9.71k|  }
 8106|  30.6k|  return p;
 8107|  30.6k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7192|  20.8k|    std::string_view user_input) noexcept {
 7193|       |  // first check for short strings in which case we do it naively.
 7194|  20.8k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (7194:7): [True: 6.62k, False: 14.2k]
  ------------------
 7195|  6.62k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 7196|  6.62k|  }
 7197|       |  // fast path for long strings (expected to be common)
 7198|  14.2k|  size_t i = 0;
 7199|  14.2k|  const __m128i mask1 = _mm_set1_epi8('\r');
 7200|  14.2k|  const __m128i mask2 = _mm_set1_epi8('\n');
 7201|  14.2k|  const __m128i mask3 = _mm_set1_epi8('\t');
 7202|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 7203|  14.2k|  __m128i running{0};
 7204|  48.8k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (7204:10): [True: 34.6k, False: 14.2k]
  ------------------
 7205|  34.6k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 7206|  34.6k|    running = _mm_or_si128(
 7207|  34.6k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7208|  34.6k|                                           _mm_cmpeq_epi8(word, mask2))),
 7209|  34.6k|        _mm_cmpeq_epi8(word, mask3));
 7210|  34.6k|  }
 7211|  14.2k|  if (i < user_input.size()) {
  ------------------
  |  Branch (7211:7): [True: 13.3k, False: 871]
  ------------------
 7212|  13.3k|    __m128i word = _mm_loadu_si128(
 7213|  13.3k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 7214|  13.3k|    running = _mm_or_si128(
 7215|  13.3k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7216|  13.3k|                                           _mm_cmpeq_epi8(word, mask2))),
 7217|  13.3k|        _mm_cmpeq_epi8(word, mask3));
 7218|  13.3k|  }
 7219|  14.2k|  return _mm_movemask_epi8(running) != 0;
 7220|  20.8k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 7078|  51.9k|constexpr bool is_tabs_or_newline(char c) noexcept {
 7079|  51.9k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (7079:10): [True: 56, False: 51.8k]
  |  Branch (7079:23): [True: 98, False: 51.7k]
  |  Branch (7079:36): [True: 53, False: 51.7k]
  ------------------
 7080|  51.9k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8904|    169|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8905|       |  // Fast path: inputs with no tab/newline (the common case) avoid the
 8906|       |  // per-character erase_if scan. has_tabs_or_newline uses SIMD for inputs
 8907|       |  // >= 16 bytes, making this check much cheaper than erase_if's scalar
 8908|       |  // predicate walk when there is nothing to remove.
 8909|    169|  if (!ada::unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (8909:7): [True: 0, False: 169]
  ------------------
 8910|      0|    return;
 8911|      0|  }
 8912|    169|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8913|    169|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7437|  5.53k|    const char c) noexcept {
 7438|  5.53k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7438:10): [True: 300, False: 5.23k]
  |  Branch (7438:23): [True: 275, False: 4.96k]
  |  Branch (7438:36): [True: 219, False: 4.74k]
  ------------------
 7439|  5.53k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7432|  24.6k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7433|  24.6k|  return (unsigned char)c <= ' ';
 7434|  24.6k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7445|  4.28k|    std::string_view input) noexcept {
 7446|       |  // This will catch most cases:
 7447|       |  // The length must be 2,4 or 6.
 7448|       |  // We divide by two and require
 7449|       |  // that the result be between 1 and 3 inclusively.
 7450|  4.28k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7451|  4.28k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7451:7): [True: 2.77k, False: 1.50k]
  ------------------
 7452|  2.77k|    return false;
 7453|  2.77k|  }
 7454|       |  // We have a string of length 2, 4 or 6.
 7455|       |  // We now check the first character:
 7456|  1.50k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7456:7): [True: 720, False: 789]
  |  Branch (7456:28): [True: 471, False: 249]
  ------------------
 7457|    471|    return false;
 7458|    471|  }
 7459|       |  // We are unlikely the get beyond this point.
 7460|  1.03k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7461|  1.03k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7462|  1.03k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7462:7): [True: 252, False: 786]
  ------------------
 7463|    252|    return false;
 7464|    252|  }
 7465|       |  // We almost never get here.
 7466|       |  // Optimizing the rest is relatively unimportant.
 7467|    786|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7468|    786|    uint16_t A, B;
 7469|    786|    memcpy(&A, a.data(), sizeof(A));
 7470|    786|    memcpy(&B, b.data(), sizeof(B));
 7471|    786|    return A == B;
 7472|    786|  };
 7473|    786|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7473:7): [True: 331, False: 455]
  ------------------
 7474|    331|    return false;
 7475|    331|  }
 7476|    691|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7476:22): [True: 366, False: 325]
  ------------------
 7477|    366|    char c = input[i];
 7478|    366|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7478:9): [True: 130, False: 236]
  |  Branch (7478:10): [True: 170, False: 196]
  ------------------
 7479|    130|      return false;
 7480|    130|    }
 7481|    366|  }
 7482|    325|  return true;
 7483|       |  // The above code might be a bit better than the code below. Compilers
 7484|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7485|       |  // 6 and other tricks.
 7486|       |  // return input == ".." ||
 7487|       |  //  input == ".%2e" || input == ".%2E" ||
 7488|       |  //  input == "%2e." || input == "%2E." ||
 7489|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7490|       |  //  "%2e%2E";
 7491|    455|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7467|    786|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7468|    786|    uint16_t A, B;
 7469|    786|    memcpy(&A, a.data(), sizeof(A));
 7470|    786|    memcpy(&B, b.data(), sizeof(B));
 7471|    786|    return A == B;
 7472|    786|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7494|  7.90k|    std::string_view input) noexcept {
 7495|  7.90k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7495:10): [True: 503, False: 7.40k]
  |  Branch (7495:26): [True: 74, False: 7.33k]
  |  Branch (7495:44): [True: 4, False: 7.32k]
  ------------------
 7496|  7.90k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9891|  2.34k|                              bool& is_pure_decimal) noexcept {
 9892|  2.34k|  is_pure_decimal = false;
 9893|  2.34k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9893:7): [True: 0, False: 2.34k]
  ------------------
 9894|      0|    return false;
 9895|      0|  }
 9896|  2.34k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9896:7): [True: 2.00k, False: 338]
  |  Branch (9896:23): [True: 360, False: 1.64k]
  |  Branch (9896:38): [True: 203, False: 157]
  ------------------
 9897|    203|    p += 2;
 9898|    203|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9898:9): [True: 6, False: 197]
  |  Branch (9898:21): [True: 10, False: 187]
  ------------------
 9899|     16|      value = 0;
 9900|     16|      return true;
 9901|     16|    }
 9902|    187|    uint64_t v = 0;
 9903|    187|    int digits = 0;
 9904|  1.18k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9904:12): [True: 1.06k, False: 121]
  |  Branch (9904:23): [True: 1.04k, False: 21]
  ------------------
 9905|  1.04k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9906|  1.04k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9906:11): [True: 5, False: 1.04k]
  ------------------
 9907|      5|        return false;
 9908|      5|      }
 9909|  1.04k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9909:11): [True: 40, False: 1.00k]
  ------------------
 9910|     40|        return false;
 9911|     40|      }
 9912|  1.00k|      v = (v << 4) | nib;
 9913|  1.00k|      ++p;
 9914|  1.00k|      ++digits;
 9915|  1.00k|    }
 9916|    142|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9916:9): [True: 0, False: 142]
  ------------------
 9917|      0|      return false;
 9918|      0|    }
 9919|    142|    value = v;
 9920|    142|    return true;
 9921|    142|  }
 9922|  2.13k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9922:7): [True: 1.80k, False: 338]
  |  Branch (9922:23): [True: 157, False: 1.64k]
  |  Branch (9922:38): [True: 100, False: 57]
  |  Branch (9922:53): [True: 94, False: 6]
  ------------------
 9923|     94|    ++p;
 9924|     94|    uint64_t v = 0;
 9925|    607|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9925:12): [True: 546, False: 61]
  |  Branch (9925:23): [True: 536, False: 10]
  ------------------
 9926|    536|      const char c = *p;
 9927|    536|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9927:11): [True: 3, False: 533]
  |  Branch (9927:22): [True: 14, False: 519]
  ------------------
 9928|     17|        return false;
 9929|     17|      }
 9930|    519|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9930:11): [True: 6, False: 513]
  ------------------
 9931|      6|        return false;
 9932|      6|      }
 9933|    513|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9934|    513|      ++p;
 9935|    513|    }
 9936|     71|    value = v;
 9937|     71|    return true;
 9938|     94|  }
 9939|  2.04k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9939:7): [True: 291, False: 1.75k]
  |  Branch (9939:19): [True: 1.07k, False: 675]
  ------------------
 9940|  1.36k|    return false;
 9941|  1.36k|  }
 9942|    675|  is_pure_decimal = true;
 9943|    675|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9944|    675|  ++p;
 9945|  1.49k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9945:10): [True: 1.04k, False: 450]
  |  Branch (9945:21): [True: 857, False: 184]
  ------------------
 9946|    857|    const char c = *p;
 9947|    857|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9947:9): [True: 6, False: 851]
  |  Branch (9947:20): [True: 20, False: 831]
  ------------------
 9948|     26|      return false;
 9949|     26|    }
 9950|    831|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9950:9): [True: 13, False: 818]
  ------------------
 9951|     13|      return false;
 9952|     13|    }
 9953|    818|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9954|    818|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9954:9): [True: 2, False: 816]
  ------------------
 9955|      2|      return false;
 9956|      2|    }
 9957|    816|    ++p;
 9958|    816|  }
 9959|    634|  value = v;
 9960|    634|  return true;
 9961|    675|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9965|  7.23k|                           uint16_t& value) noexcept {
 9966|  7.23k|  if (pointer == end) {
  ------------------
  |  Branch (9966:7): [True: 0, False: 7.23k]
  ------------------
 9967|      0|    return 0;
 9968|      0|  }
 9969|  7.23k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9970|  7.23k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9970:7): [True: 6.97k, False: 253]
  ------------------
 9971|  6.97k|    return 0;
 9972|  6.97k|  }
 9973|    253|  uint32_t v = n0;
 9974|    253|  ++pointer;
 9975|    253|  int length = 1;
 9976|    253|  if (pointer != end) {
  ------------------
  |  Branch (9976:7): [True: 236, False: 17]
  ------------------
 9977|    236|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9978|    236|    if (n1 != 0xff) {
  ------------------
  |  Branch (9978:9): [True: 105, False: 131]
  ------------------
 9979|    105|      v = (v << 4) | n1;
 9980|    105|      ++pointer;
 9981|    105|      ++length;
 9982|    105|      if (pointer != end) {
  ------------------
  |  Branch (9982:11): [True: 102, False: 3]
  ------------------
 9983|    102|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9984|    102|        if (n2 != 0xff) {
  ------------------
  |  Branch (9984:13): [True: 69, False: 33]
  ------------------
 9985|     69|          v = (v << 4) | n2;
 9986|     69|          ++pointer;
 9987|     69|          ++length;
 9988|     69|          if (pointer != end) {
  ------------------
  |  Branch (9988:15): [True: 67, False: 2]
  ------------------
 9989|     67|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9990|     67|            if (n3 != 0xff) {
  ------------------
  |  Branch (9990:17): [True: 24, False: 43]
  ------------------
 9991|     24|              v = (v << 4) | n3;
 9992|     24|              ++pointer;
 9993|     24|              ++length;
 9994|     24|            }
 9995|     67|          }
 9996|     69|        }
 9997|    102|      }
 9998|    105|    }
 9999|    236|  }
10000|    253|  value = static_cast<uint16_t>(v);
10001|    253|  return length;
10002|  7.23k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  102|  6.96k|    std::string_view input) noexcept {
  103|  6.96k|  if (input.empty()) return false;
  ------------------
  |  Branch (103:7): [True: 880, False: 6.08k]
  ------------------
  104|  6.08k|  if (input.back() == '.') {
  ------------------
  |  Branch (104:7): [True: 107, False: 5.98k]
  ------------------
  105|    107|    if (input.size() > 254) return false;
  ------------------
  |  Branch (105:9): [True: 0, False: 107]
  ------------------
  106|  5.98k|  } else if (input.size() > 253)
  ------------------
  |  Branch (106:14): [True: 0, False: 5.98k]
  ------------------
  107|      0|    return false;
  108|       |
  109|  6.08k|  size_t start = 0;
  110|  21.4k|  while (start < input.size()) {
  ------------------
  |  Branch (110:10): [True: 16.3k, False: 5.10k]
  ------------------
  111|  16.3k|    auto dot_location = input.find('.', start);
  112|       |    // If not found, it's likely the end of the domain
  113|  16.3k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (113:9): [True: 5.06k, False: 11.2k]
  ------------------
  114|       |
  115|  16.3k|    auto label_size = dot_location - start;
  116|  16.3k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (116:9): [True: 239, False: 16.0k]
  |  Branch (116:28): [True: 742, False: 15.3k]
  ------------------
  117|       |
  118|  15.3k|    start = dot_location + 1;
  119|  15.3k|  }
  120|       |
  121|  5.10k|  return true;
  122|  6.08k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7409|  47.2k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7410|  47.2k|  return is_alnum_plus_table[uint8_t(c)];
 7411|       |  // A table is almost surely much faster than the
 7412|       |  // following under most compilers: return
 7413|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7414|  47.2k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 7086|  8.03k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 7087|  8.03k|  uint64_t broadcast_80 = broadcast(0x80);
 7088|  8.03k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 7089|  8.03k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 7090|  8.03k|  uint64_t non_ascii = 0;
 7091|  8.03k|  size_t i = 0;
 7092|       |
 7093|  23.9k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (7093:10): [True: 15.8k, False: 8.03k]
  ------------------
 7094|  15.8k|    uint64_t word{};
 7095|  15.8k|    memcpy(&word, input + i, sizeof(word));
 7096|  15.8k|    non_ascii |= (word & broadcast_80);
 7097|  15.8k|    word ^=
 7098|  15.8k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7099|  15.8k|    memcpy(input + i, &word, sizeof(word));
 7100|  15.8k|  }
 7101|  8.03k|  if (i < length) {
  ------------------
  |  Branch (7101:7): [True: 6.25k, False: 1.77k]
  ------------------
 7102|  6.25k|    uint64_t word{};
 7103|  6.25k|    memcpy(&word, input + i, length - i);
 7104|  6.25k|    non_ascii |= (word & broadcast_80);
 7105|  6.25k|    word ^=
 7106|  6.25k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7107|  6.25k|    memcpy(input + i, &word, length - i);
 7108|  6.25k|  }
 7109|  8.03k|  return non_ascii == 0;
 7110|  8.03k|}
_ZN3ada7unicode9broadcastEh:
 7082|  24.0k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 7083|  24.0k|  return 0x101010101010101ull * v;
 7084|  24.0k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12591|    657|    auto apply_query_and_hash = [&]() {
12592|    657|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12592:11): [True: 95, False: 562]
  ------------------
12593|     95|        const size_t q_end =
12594|     95|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12594:13): [True: 11, False: 84]
  ------------------
12595|     95|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|     95|                                                q_end - query_start - 1),
12597|     95|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|     95|      }
12599|    657|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12599:11): [True: 98, False: 559]
  ------------------
12600|     98|        out.update_unencoded_base_hash(std::string_view(
12601|     98|            input.data() + hash_start + 1, len - hash_start - 1));
12602|     98|      }
12603|    657|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12205|    263|    auto apply_query_and_hash = [&]() {
12206|    263|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12206:11): [True: 74, False: 189]
  ------------------
12207|     74|        const size_t q_end =
12208|     74|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12208:13): [True: 12, False: 62]
  ------------------
12209|     74|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|     74|                                                q_end - query_start - 1),
12211|     74|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|     74|      }
12213|    263|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12213:11): [True: 52, False: 211]
  ------------------
12214|     52|        out.update_unencoded_base_hash(std::string_view(
12215|     52|            input.data() + hash_start + 1, len - hash_start - 1));
12216|     52|      }
12217|    263|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8844|  11.8k|    std::string_view& input) noexcept {
 8845|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8846|       |  // function). this function should be quite fast.
 8847|  11.8k|  size_t location_of_first = input.find('#');
 8848|  11.8k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8848:7): [True: 11.6k, False: 162]
  ------------------
 8849|  11.6k|    return std::nullopt;
 8850|  11.6k|  }
 8851|    162|  std::string_view hash = input;
 8852|    162|  hash.remove_prefix(location_of_first + 1);
 8853|    162|  input.remove_suffix(input.size() - location_of_first);
 8854|    162|  return hash;
 8855|  11.8k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9802|  1.86k|find_authority_delimiter_special(std::string_view view) noexcept {
 9803|       |  // performance note: we might be able to gain further performance
 9804|       |  // with SIMD intrinsics.
 9805|  7.50k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9805:33): [True: 7.48k, False: 28]
  ------------------
 9806|  7.48k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9806:9): [True: 1.83k, False: 5.64k]
  ------------------
 9807|  1.83k|      return pos - view.begin();
 9808|  1.83k|    }
 9809|  7.48k|  }
 9810|     28|  return size_t(view.size());
 9811|  1.86k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8857|    325|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8858|       |  // Let path be url's path.
 8859|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8860|       |  // Windows drive letter, then return.
 8861|    325|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8861:7): [True: 0, False: 325]
  ------------------
 8862|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8862:7): [True: 0, False: 0]
  |  Branch (8862:54): [True: 0, False: 0]
  ------------------
 8863|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8863:9): [True: 0, False: 0]
  ------------------
 8864|      0|            helpers::substring(path, 1))) {
 8865|      0|      return false;
 8866|      0|    }
 8867|      0|  }
 8868|       |
 8869|       |  // Remove path's last item, if any.
 8870|    325|  size_t last_delimiter = path.rfind('/');
 8871|    325|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8871:7): [True: 149, False: 176]
  ------------------
 8872|    149|    path.erase(last_delimiter);
 8873|    149|    return true;
 8874|    149|  }
 8875|       |
 8876|    176|  return false;
 8877|    325|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9518|  11.8k|    const bool is_special, std::string_view& view) noexcept {
 9519|       |  /**
 9520|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9521|       |   * compute a variable called insideBrackets but this variable is only used
 9522|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9523|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9524|       |   * It is conceptually simpler and arguably more efficient to just return a
 9525|       |   * Boolean indicating whether ':' was found outside brackets.
 9526|       |   */
 9527|  11.8k|  const size_t view_size = view.size();
 9528|  11.8k|  size_t location = 0;
 9529|  11.8k|  bool found_colon = false;
 9530|       |  /**
 9531|       |   * Performance analysis:
 9532|       |   *
 9533|       |   * We are basically seeking the end of the hostname which can be indicated
 9534|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9535|       |   * (where '\\' is only applicable for special URLs). However, these must
 9536|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9537|       |   * '?' does not count.
 9538|       |   *
 9539|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9540|       |   * the set of delimiters, and that we handle it first.
 9541|       |   *
 9542|       |   * So the trick is to have a fast function that locates the next delimiter.
 9543|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9544|       |   * function would be provided by the C++ standard library, but it seems that
 9545|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9546|       |   *
 9547|       |   * We do not break into two loops for speed, but for clarity.
 9548|       |   */
 9549|  11.8k|  if (is_special) {
  ------------------
  |  Branch (9549:7): [True: 11.8k, False: 0]
  ------------------
 9550|       |    // We move to the next delimiter.
 9551|  11.8k|    location = find_next_host_delimiter_special(view, location);
 9552|       |    // Unless we find '[' then we are going only going to have to call
 9553|       |    // find_next_host_delimiter_special once.
 9554|  19.1k|    for (; location < view_size;
  ------------------
  |  Branch (9554:12): [True: 19.0k, False: 101]
  ------------------
 9555|  19.0k|         location = find_next_host_delimiter_special(view, location)) {
 9556|  19.0k|      if (view[location] == '[') {
  ------------------
  |  Branch (9556:11): [True: 7.47k, False: 11.5k]
  ------------------
 9557|  7.47k|        location = view.find(']', location);
 9558|  7.47k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9558:13): [True: 130, False: 7.34k]
  ------------------
 9559|       |          // performance: view.find might get translated to a memchr, which
 9560|       |          // has no notion of std::string_view::npos, so the code does not
 9561|       |          // reflect the assembly.
 9562|    130|          location = view_size;
 9563|    130|          break;
 9564|    130|        }
 9565|  11.5k|      } else {
 9566|  11.5k|        found_colon = view[location] == ':';
 9567|  11.5k|        break;
 9568|  11.5k|      }
 9569|  19.0k|    }
 9570|  11.8k|  } else {
 9571|       |    // We move to the next delimiter.
 9572|      0|    location = find_next_host_delimiter(view, location);
 9573|       |    // Unless we find '[' then we are going only going to have to call
 9574|       |    // find_next_host_delimiter_special once.
 9575|      0|    for (; location < view_size;
  ------------------
  |  Branch (9575:12): [True: 0, False: 0]
  ------------------
 9576|      0|         location = find_next_host_delimiter(view, location)) {
 9577|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (9577:11): [True: 0, False: 0]
  ------------------
 9578|      0|        location = view.find(']', location);
 9579|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9579:13): [True: 0, False: 0]
  ------------------
 9580|       |          // performance: view.find might get translated to a memchr, which
 9581|       |          // has no notion of std::string_view::npos, so the code does not
 9582|       |          // reflect the assembly.
 9583|      0|          location = view_size;
 9584|      0|          break;
 9585|      0|        }
 9586|      0|      } else {
 9587|      0|        found_colon = view[location] == ':';
 9588|      0|        break;
 9589|      0|      }
 9590|      0|    }
 9591|      0|  }
 9592|       |  // performance: remove_suffix may translate into a single instruction.
 9593|  11.8k|  view.remove_suffix(view_size - location);
 9594|  11.8k|  return {location, found_colon};
 9595|  11.8k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9108|  19.1k|    std::string_view view, size_t location) noexcept {
 9109|       |  // first check for short strings in which case we do it naively.
 9110|  19.1k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9110:7): [True: 10.3k, False: 8.79k]
  ------------------
 9111|  40.5k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9111:31): [True: 40.5k, False: 69]
  ------------------
 9112|  40.5k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (9112:11): [True: 593, False: 39.9k]
  |  Branch (9112:29): [True: 9.15k, False: 30.7k]
  |  Branch (9112:47): [True: 1, False: 30.7k]
  ------------------
 9113|  30.7k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (9113:11): [True: 68, False: 30.6k]
  |  Branch (9113:29): [True: 470, False: 30.2k]
  ------------------
 9114|  10.2k|        return i;
 9115|  10.2k|      }
 9116|  40.5k|    }
 9117|     69|    return size_t(view.size());
 9118|  10.3k|  }
 9119|       |  // fast path for long strings (expected to be common)
 9120|  8.79k|  size_t i = location;
 9121|  8.79k|  const __m128i mask1 = _mm_set1_epi8(':');
 9122|  8.79k|  const __m128i mask2 = _mm_set1_epi8('/');
 9123|  8.79k|  const __m128i mask3 = _mm_set1_epi8('\\');
 9124|  8.79k|  const __m128i mask4 = _mm_set1_epi8('?');
 9125|  8.79k|  const __m128i mask5 = _mm_set1_epi8('[');
 9126|       |
 9127|  11.6k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9127:10): [True: 10.4k, False: 1.14k]
  ------------------
 9128|  10.4k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9129|  10.4k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9130|  10.4k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9131|  10.4k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9132|  10.4k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9133|  10.4k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9134|  10.4k|    __m128i m = _mm_or_si128(
 9135|  10.4k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9136|  10.4k|    int mask = _mm_movemask_epi8(m);
 9137|  10.4k|    if (mask != 0) {
  ------------------
  |  Branch (9137:9): [True: 7.65k, False: 2.83k]
  ------------------
 9138|  7.65k|      return i + trailing_zeroes(mask);
 9139|  7.65k|    }
 9140|  10.4k|  }
 9141|  1.14k|  if (i < view.size()) {
  ------------------
  |  Branch (9141:7): [True: 1.13k, False: 5]
  ------------------
 9142|  1.13k|    __m128i word =
 9143|  1.13k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9144|  1.13k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9145|  1.13k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9146|  1.13k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9147|  1.13k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9148|  1.13k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9149|  1.13k|    __m128i m = _mm_or_si128(
 9150|  1.13k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9151|  1.13k|    int mask = _mm_movemask_epi8(m);
 9152|  1.13k|    if (mask != 0) {
  ------------------
  |  Branch (9152:9): [True: 1.10k, False: 27]
  ------------------
 9153|  1.10k|      return view.length() - 16 + trailing_zeroes(mask);
 9154|  1.10k|    }
 9155|  1.13k|  }
 9156|     32|  return size_t(view.length());
 9157|  1.14k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8930|  8.76k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8931|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8932|       |  unsigned long ret;
 8933|       |  // Search the mask data from least significant bit (LSB)
 8934|       |  // to the most significant bit (MSB) for a set bit (1).
 8935|       |  _BitScanForward(&ret, input_num);
 8936|       |  return (int)ret;
 8937|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8938|  8.76k|  return __builtin_ctzl(input_num);
 8939|  8.76k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8940|  8.76k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7338|  49.7k|    const char c) noexcept {
 7339|  49.7k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7340|  49.7k|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12914|  1.19k|  const auto enforce_max_input_length = [&]() {
12915|  1.19k|    if constexpr (store_values) {
12916|  1.19k|      if (url.is_valid) {
  ------------------
  |  Branch (12916:11): [True: 1.19k, False: 0]
  ------------------
12917|  1.19k|        if constexpr (result_type_is_ada_url_aggregator) {
12918|  1.19k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12918:15): [True: 0, False: 1.19k]
  ------------------
12919|      0|            url.is_valid = false;
12920|      0|          }
12921|       |        } else {
12922|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12923|       |            url.is_valid = false;
12924|       |          }
12925|       |        }
12926|  1.19k|      }
12927|  1.19k|    }
12928|  1.19k|  };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
11252|     89|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
11253|     89|  uint32_t digits = 1;
11254|    284|  while (port >= 10) {
  ------------------
  |  Branch (11254:10): [True: 195, False: 89]
  ------------------
11255|    195|    port /= 10;
11256|    195|    ++digits;
11257|    195|  }
11258|     89|  return digits;
11259|     89|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
11262|     81|                                             uint32_t port) {
11263|     81|  buffer += ':';
11264|     81|  char port_buf[5];
11265|     81|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
11266|     81|  (void)ec;
11267|     81|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
11268|     81|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11412|  4.78k|                                        size_t n) noexcept {
11413|  4.78k|  const size_t rem = n - host_start;
11414|       |#if ADA_NEON
11415|       |  if (rem >= 16) {
11416|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11417|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11418|       |    if (at == 0) {
11419|       |      return false;
11420|       |    }
11421|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11422|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11423|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11424|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11425|       |  }
11426|       |#elif ADA_SSE2
11427|  4.78k|  if (rem >= 16) {
  ------------------
  |  Branch (11427:7): [True: 2.30k, False: 2.48k]
  ------------------
11428|  2.30k|    const __m128i w =
11429|  2.30k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11430|  2.30k|    const uint16_t at = static_cast<uint16_t>(
11431|  2.30k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11432|  2.30k|    if (at == 0) {
  ------------------
  |  Branch (11432:9): [True: 2.17k, False: 126]
  ------------------
11433|  2.17k|      return false;
11434|  2.17k|    }
11435|    126|    const uint16_t delim = static_cast<uint16_t>(
11436|    126|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11437|    126|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11438|    126|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11439|    126|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11439:12): [True: 80, False: 46]
  |  Branch (11439:26): [True: 8, False: 38]
  ------------------
11440|  2.30k|  }
11441|       |#else
11442|       |  (void)p;
11443|       |  (void)rem;
11444|       |#endif
11445|  2.48k|  return false;
11446|  4.78k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11467|  4.67k|                                     bool& has_x) noexcept {
11468|  4.67k|  has_upper = false;
11469|  4.67k|  has_x = false;
11470|  4.67k|  size_t i = start;
11471|  4.67k|#if ADA_PARSER_SSSE3
11472|  4.67k|  if (parser_use_ssse3() && (len - start >= 16)) {
  ------------------
  |  Branch (11472:7): [True: 4.67k, False: 0]
  |  Branch (11472:29): [True: 2.20k, False: 2.47k]
  ------------------
11473|  2.20k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11474|  2.20k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11475|  2.20k|    const __m128i x_splat = _mm_set1_epi8('x');
11476|  2.20k|    auto visit = [&](size_t at) noexcept -> bool {
11477|  2.20k|      const __m128i w =
11478|  2.20k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11479|  2.20k|      const int up = sse2_uppercase(w);
11480|  2.20k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11481|  2.20k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11482|  2.20k|      if (mask == 0) {
11483|  2.20k|        if (up != 0) {
11484|  2.20k|          has_upper = true;
11485|  2.20k|        }
11486|  2.20k|        if (xs != 0) {
11487|  2.20k|          has_x = true;
11488|  2.20k|        }
11489|  2.20k|        return false;
11490|  2.20k|      }
11491|  2.20k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11492|  2.20k|      const int valid = (1 << hit) - 1;
11493|  2.20k|      if ((up & valid) != 0) {
11494|  2.20k|        has_upper = true;
11495|  2.20k|      }
11496|  2.20k|      if ((xs & valid) != 0) {
11497|  2.20k|        has_x = true;
11498|  2.20k|      }
11499|  2.20k|      end = at + static_cast<size_t>(hit);
11500|  2.20k|      return true;
11501|  2.20k|    };
11502|  2.50k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11502:12): [True: 1.32k, False: 1.17k]
  ------------------
11503|  1.32k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11503:11): [True: 915, False: 412]
  |  Branch (11503:23): [True: 114, False: 298]
  ------------------
11504|  1.02k|        return k_host_class[b[end]] == 1;
11505|  1.02k|      }
11506|  1.32k|    }
11507|  1.35k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11507:12): [True: 1.08k, False: 276]
  ------------------
11508|  1.08k|      if (visit(i)) {
  ------------------
  |  Branch (11508:11): [True: 900, False: 181]
  ------------------
11509|    900|        return k_host_class[b[end]] == 1;
11510|    900|      }
11511|  1.08k|    }
11512|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11513|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11514|    276|    if (i > start && i < len) {
  ------------------
  |  Branch (11514:9): [True: 276, False: 0]
  |  Branch (11514:22): [True: 276, False: 0]
  ------------------
11515|    276|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11515:11): [True: 276, False: 0]
  |  Branch (11515:30): [True: 276, False: 0]
  ------------------
11516|    276|        return k_host_class[b[end]] == 1;
11517|    276|      }
11518|      0|      end = len;
11519|      0|      return true;
11520|    276|    }
11521|    276|  }
11522|       |#elif ADA_SSE2
11523|       |  const __m128i x_splat = _mm_set1_epi8('x');
11524|       |  for (; i + 32 <= len; i += 32) {
11525|       |    for (size_t off = 0; off < 32; off += 16) {
11526|       |      const __m128i w =
11527|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11528|       |      const int up = sse2_uppercase(w);
11529|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11530|       |      const int mask = sse2_host_stop(w);
11531|       |      if (mask != 0) {
11532|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11533|       |        const int valid = (1 << hit) - 1;
11534|       |        if ((up & valid) != 0) {
11535|       |          has_upper = true;
11536|       |        }
11537|       |        if ((xs & valid) != 0) {
11538|       |          has_x = true;
11539|       |        }
11540|       |        end = i + off + static_cast<size_t>(hit);
11541|       |        return k_host_class[b[end]] == 1;
11542|       |      }
11543|       |      if (up != 0) {
11544|       |        has_upper = true;
11545|       |      }
11546|       |      if (xs != 0) {
11547|       |        has_x = true;
11548|       |      }
11549|       |    }
11550|       |  }
11551|       |  for (; i + 16 <= len; i += 16) {
11552|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11553|       |    const int up = sse2_uppercase(w);
11554|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11555|       |    const int mask = sse2_host_stop(w);
11556|       |    if (mask != 0) {
11557|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11558|       |      const int valid = (1 << hit) - 1;
11559|       |      if ((up & valid) != 0) {
11560|       |        has_upper = true;
11561|       |      }
11562|       |      if ((xs & valid) != 0) {
11563|       |        has_x = true;
11564|       |      }
11565|       |      end = i + static_cast<size_t>(hit);
11566|       |      return k_host_class[b[end]] == 1;
11567|       |    }
11568|       |    if (up != 0) {
11569|       |      has_upper = true;
11570|       |    }
11571|       |    if (xs != 0) {
11572|       |      has_x = true;
11573|       |    }
11574|       |  }
11575|       |#elif ADA_NEON
11576|       |  if (len - start >= 16) {
11577|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11578|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11579|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11580|       |    auto visit = [&](size_t at) noexcept -> bool {
11581|       |      const uint8x16_t w = vld1q_u8(b + at);
11582|       |      const uint64_t up = neon_uppercase(w);
11583|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11584|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11585|       |      if (bits == 0) {
11586|       |        if (up != 0) {
11587|       |          has_upper = true;
11588|       |        }
11589|       |        if (xs != 0) {
11590|       |          has_x = true;
11591|       |        }
11592|       |        return false;
11593|       |      }
11594|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11595|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11596|       |      if ((up & valid) != 0) {
11597|       |        has_upper = true;
11598|       |      }
11599|       |      if ((xs & valid) != 0) {
11600|       |        has_x = true;
11601|       |      }
11602|       |      end = at + hit;
11603|       |      return true;
11604|       |    };
11605|       |    for (; i + 32 <= len; i += 32) {
11606|       |      if (visit(i) || visit(i + 16)) {
11607|       |        return k_host_class[b[end]] == 1;
11608|       |      }
11609|       |    }
11610|       |    for (; i + 16 <= len; i += 16) {
11611|       |      if (visit(i)) {
11612|       |        return k_host_class[b[end]] == 1;
11613|       |      }
11614|       |    }
11615|       |    if (i > start && i < len) {
11616|       |      if (visit(len - 16) && end >= i) {
11617|       |        return k_host_class[b[end]] == 1;
11618|       |      }
11619|       |      end = len;
11620|       |      return true;
11621|       |    }
11622|       |  }
11623|       |#endif
11624|  5.76k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11624:10): [True: 5.76k, False: 0]
  ------------------
11625|  5.76k|    const uint8_t c = b[i];
11626|  5.76k|    const uint8_t cls = k_host_class[c];
11627|  5.76k|    if (cls == 1) {
  ------------------
  |  Branch (11627:9): [True: 879, False: 4.88k]
  ------------------
11628|    879|      end = i;
11629|    879|      return true;
11630|    879|    }
11631|  4.88k|    if (cls == 2) {
  ------------------
  |  Branch (11631:9): [True: 1.59k, False: 3.29k]
  ------------------
11632|  1.59k|      return false;
11633|  1.59k|    }
11634|  3.29k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11634:9): [True: 1.94k, False: 1.34k]
  |  Branch (11634:21): [True: 408, False: 1.54k]
  ------------------
11635|    408|      has_upper = true;
11636|  2.88k|    } else if (c == 'x') {
  ------------------
  |  Branch (11636:16): [True: 521, False: 2.36k]
  ------------------
11637|    521|      has_x = true;
11638|    521|    }
11639|  3.29k|  }
11640|      0|  end = len;
11641|      0|  return true;
11642|  2.47k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116parser_use_ssse3Ev:
11452|  6.21k|ada_really_inline bool parser_use_ssse3() noexcept {
11453|  6.21k|#ifdef ADA_PARSER_NEED_SSSE3_TARGET
11454|  6.21k|  static const bool supported = __builtin_cpu_supports("ssse3") != 0;
11455|  6.21k|  return supported;
11456|       |#else
11457|       |  return true;
11458|       |#endif
11459|  6.21k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
11291|  6.06k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
11292|  6.06k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
11293|  6.06k|}
serializers.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENKUlmE_clEm:
11476|  3.09k|    auto visit = [&](size_t at) noexcept -> bool {
11477|  3.09k|      const __m128i w =
11478|  3.09k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11479|  3.09k|      const int up = sse2_uppercase(w);
11480|  3.09k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11481|  3.09k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11482|  3.09k|      if (mask == 0) {
  ------------------
  |  Branch (11482:11): [True: 891, False: 2.20k]
  ------------------
11483|    891|        if (up != 0) {
  ------------------
  |  Branch (11483:13): [True: 527, False: 364]
  ------------------
11484|    527|          has_upper = true;
11485|    527|        }
11486|    891|        if (xs != 0) {
  ------------------
  |  Branch (11486:13): [True: 481, False: 410]
  ------------------
11487|    481|          has_x = true;
11488|    481|        }
11489|    891|        return false;
11490|    891|      }
11491|  2.20k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11492|  2.20k|      const int valid = (1 << hit) - 1;
11493|  2.20k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11493:11): [True: 515, False: 1.69k]
  ------------------
11494|    515|        has_upper = true;
11495|    515|      }
11496|  2.20k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11496:11): [True: 571, False: 1.63k]
  ------------------
11497|    571|        has_x = true;
11498|    571|      }
11499|  2.20k|      end = at + static_cast<size_t>(hit);
11500|  2.20k|      return true;
11501|  3.09k|    };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11378|  3.09k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11379|  3.09k|  return _mm_movemask_epi8(_mm_and_si128(
11380|  3.09k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11381|  3.09k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11382|  3.09k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
11298|  4.88k|                                          __m128i hi_tbl) noexcept {
11299|  4.88k|  const __m128i nibble = _mm_set1_epi8(0x0F);
11300|  4.88k|  const __m128i lo = _mm_and_si128(w, nibble);
11301|  4.88k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
11302|  4.88k|  const __m128i hit =
11303|  4.88k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
11304|  4.88k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
11305|  4.88k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
11270|  2.79k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
11271|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
11272|       |  unsigned long ret;
11273|       |  _BitScanForward(&ret, input_num);
11274|       |  return static_cast<int>(ret);
11275|       |#else
11276|  2.79k|  return __builtin_ctz(input_num);
11277|  2.79k|#endif
11278|  2.79k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11702|  1.08k|                                   bool& maybe_dot_segment) noexcept {
11703|  1.08k|  const size_t run_start = i;
11704|  1.08k|#if ADA_PARSER_SSSE3
11705|  1.08k|  if (parser_use_ssse3() && (i + 16 <= len)) {
  ------------------
  |  Branch (11705:7): [True: 1.08k, False: 0]
  |  Branch (11705:29): [True: 646, False: 441]
  ------------------
11706|    646|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11707|    646|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11708|    944|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11708:12): [True: 503, False: 441]
  ------------------
11709|    503|      const __m128i w0 =
11710|    503|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11711|    503|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11712|    503|      if (m0 != 0) {
  ------------------
  |  Branch (11712:11): [True: 142, False: 361]
  ------------------
11713|    142|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11714|    142|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11715|    142|                            maybe_dot_segment);
11716|    142|        i += static_cast<size_t>(hit_bit);
11717|    142|        return;
11718|    142|      }
11719|    361|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11720|    361|      const __m128i w1 =
11721|    361|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11722|    361|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11723|    361|      if (m1 != 0) {
  ------------------
  |  Branch (11723:11): [True: 63, False: 298]
  ------------------
11724|     63|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11725|     63|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11726|     63|                            maybe_dot_segment);
11727|     63|        i += 16 + static_cast<size_t>(hit_bit);
11728|     63|        return;
11729|     63|      }
11730|    298|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11731|    298|    }
11732|    640|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11732:12): [True: 330, False: 310]
  ------------------
11733|    330|      const __m128i w =
11734|    330|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11735|    330|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11736|    330|      if (mask != 0) {
  ------------------
  |  Branch (11736:11): [True: 131, False: 199]
  ------------------
11737|    131|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11738|    131|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11739|    131|                            maybe_dot_segment);
11740|    131|        i += static_cast<size_t>(hit_bit);
11741|    131|        return;
11742|    131|      }
11743|    199|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11744|    199|    }
11745|    310|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11745:9): [True: 310, False: 0]
  |  Branch (11745:26): [True: 224, False: 86]
  ------------------
11746|    224|      const __m128i w =
11747|    224|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11748|    224|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11749|    224|      if (mask != 0) {
  ------------------
  |  Branch (11749:11): [True: 106, False: 118]
  ------------------
11750|    106|        const size_t hit =
11751|    106|            len - 16 +
11752|    106|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11753|    106|        if (hit >= i) {
  ------------------
  |  Branch (11753:13): [True: 106, False: 0]
  ------------------
11754|    467|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11754:30): [True: 361, False: 106]
  ------------------
11755|    361|            if (b[j] == '.') {
  ------------------
  |  Branch (11755:17): [True: 154, False: 207]
  ------------------
11756|    154|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11757|    154|            }
11758|    361|          }
11759|    106|          i = hit;
11760|    106|          return;
11761|    106|        }
11762|    106|      }
11763|    690|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11763:26): [True: 572, False: 118]
  ------------------
11764|    572|        if (b[j] == '.') {
  ------------------
  |  Branch (11764:13): [True: 189, False: 383]
  ------------------
11765|    189|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11766|    189|        }
11767|    572|      }
11768|    118|      i = len;
11769|    118|      return;
11770|    224|    }
11771|    310|  }
11772|       |#elif ADA_SSE2
11773|       |  for (; i + 16 <= len; i += 16) {
11774|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11775|       |    const int mask = sse2_path_stop(w);
11776|       |    if (mask != 0) {
11777|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11778|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11779|       |                          maybe_dot_segment);
11780|       |      i += static_cast<size_t>(hit_bit);
11781|       |      return;
11782|       |    }
11783|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11784|       |  }
11785|       |#elif ADA_NEON
11786|       |  if (i + 16 <= len) {
11787|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11788|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11789|       |    for (; i + 32 <= len; i += 32) {
11790|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11791|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11792|       |      if (bits0 != 0) {
11793|       |        const size_t hit_off =
11794|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11795|       |        const uint64_t valid =
11796|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11797|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11798|       |        i += hit_off;
11799|       |        return;
11800|       |      }
11801|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11802|       |                               maybe_dot_segment);
11803|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11804|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11805|       |      if (bits1 != 0) {
11806|       |        const size_t hit_off =
11807|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11808|       |        const uint64_t valid =
11809|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11810|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11811|       |                                 maybe_dot_segment);
11812|       |        i += 16 + hit_off;
11813|       |        return;
11814|       |      }
11815|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11816|       |                               maybe_dot_segment);
11817|       |    }
11818|       |    for (; i + 16 <= len; i += 16) {
11819|       |      const uint8x16_t w = vld1q_u8(b + i);
11820|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11821|       |      if (bits != 0) {
11822|       |        const size_t hit_off =
11823|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11824|       |        const uint64_t valid =
11825|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11826|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11827|       |        i += hit_off;
11828|       |        return;
11829|       |      }
11830|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11831|       |                               maybe_dot_segment);
11832|       |    }
11833|       |    if (i > run_start && i < len) {
11834|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11835|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11836|       |      if (bits != 0) {
11837|       |        const size_t hit =
11838|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11839|       |        if (hit >= i) {
11840|       |          for (size_t j = i; j < hit; ++j) {
11841|       |            if (b[j] == '.') {
11842|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11843|       |            }
11844|       |          }
11845|       |          i = hit;
11846|       |          return;
11847|       |        }
11848|       |      }
11849|       |      for (size_t j = i; j < len; ++j) {
11850|       |        if (b[j] == '.') {
11851|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11852|       |        }
11853|       |      }
11854|       |      i = len;
11855|       |      return;
11856|       |    }
11857|       |  }
11858|       |#endif
11859|  1.80k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11859:10): [True: 1.57k, False: 230]
  ------------------
11860|  1.57k|    const uint8_t c = b[i];
11861|  1.57k|    const uint8_t cls = k_path[c];
11862|  1.57k|    if (cls != 0) {
  ------------------
  |  Branch (11862:9): [True: 297, False: 1.28k]
  ------------------
11863|    297|      return;
11864|    297|    }
11865|  1.28k|    if (c == '.') {
  ------------------
  |  Branch (11865:9): [True: 433, False: 847]
  ------------------
11866|    433|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11867|    433|    }
11868|  1.28k|  }
11869|    527|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11659|  1.19k|                                           bool& maybe_dot_segment) noexcept {
11660|  1.19k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11660:7): [True: 203, False: 991]
  |  Branch (11660:28): [True: 111, False: 880]
  ------------------
11661|    314|    return;
11662|    314|  }
11663|    880|  const int dots =
11664|    880|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11665|    880|  if (dots == 0) {
  ------------------
  |  Branch (11665:7): [True: 226, False: 654]
  ------------------
11666|    226|    return;
11667|    226|  }
11668|    654|  const int slashes =
11669|    654|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11670|    654|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11670:8): [True: 216, False: 438]
  |  Branch (11670:28): [True: 110, False: 106]
  |  Branch (11670:46): [True: 21, False: 85]
  ------------------
11671|    523|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11671:7): [True: 166, False: 357]
  ------------------
11672|    297|    maybe_dot_segment = true;
11673|    297|  }
11674|    654|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11646|    776|    bool& maybe_dot_segment) noexcept {
11647|    776|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11647:7): [True: 98, False: 678]
  |  Branch (11647:27): [True: 291, False: 387]
  ------------------
11648|    389|    maybe_dot_segment = true;
11649|    389|  }
11650|    776|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
12012|    230|                                    size_t len) noexcept {
12013|    230|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11875|    230|  do {                                                                       \
  |  |11876|    230|    const size_t scan_start = i;                                             \
  |  |11877|    230|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11877:9): [True: 230, False: 0]
  |  |  |  Branch (11877:31): [True: 83, False: 147]
  |  |  ------------------
  |  |11878|     83|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11879|     83|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11880|    117|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11880:14): [True: 66, False: 51]
  |  |  ------------------
  |  |11881|     66|        const __m128i w0 =                                                   \
  |  |11882|     66|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11883|     66|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11884|     66|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11884:13): [True: 12, False: 54]
  |  |  ------------------
  |  |11885|     12|          i += static_cast<size_t>(                                          \
  |  |11886|     12|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11887|     12|          return;                                                            \
  |  |11888|     12|        }                                                                    \
  |  |11889|     66|        const __m128i w1 =                                                   \
  |  |11890|     54|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11891|     54|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11892|     54|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11892:13): [True: 20, False: 34]
  |  |  ------------------
  |  |11893|     20|          i += 16 + static_cast<size_t>(                                     \
  |  |11894|     20|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11895|     20|          return;                                                            \
  |  |11896|     20|        }                                                                    \
  |  |11897|     54|      }                                                                      \
  |  |11898|     83|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11898:14): [True: 42, False: 34]
  |  |  ------------------
  |  |11899|     42|        const __m128i w =                                                    \
  |  |11900|     42|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11901|     42|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11902|     42|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11902:13): [True: 17, False: 25]
  |  |  ------------------
  |  |11903|     17|          i += static_cast<size_t>(                                          \
  |  |11904|     17|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11905|     17|          return;                                                            \
  |  |11906|     17|        }                                                                    \
  |  |11907|     42|      }                                                                      \
  |  |11908|     51|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11908:11): [True: 34, False: 0]
  |  |  |  Branch (11908:29): [True: 26, False: 8]
  |  |  ------------------
  |  |11909|     26|        const __m128i w =                                                    \
  |  |11910|     26|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11911|     26|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11912|     26|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11912:13): [True: 18, False: 8]
  |  |  ------------------
  |  |11913|     18|          const size_t hit = len - 16 +                                      \
  |  |11914|     18|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11915|     18|                                 static_cast<uint32_t>(mask)));              \
  |  |11916|     18|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11916:15): [True: 18, False: 0]
  |  |  ------------------
  |  |11917|     18|            i = hit;                                                         \
  |  |11918|     18|            return;                                                          \
  |  |11919|     18|          }                                                                  \
  |  |11920|     18|        }                                                                    \
  |  |11921|     26|        i = len;                                                             \
  |  |11922|      8|        return;                                                              \
  |  |11923|     26|      }                                                                      \
  |  |11924|     34|    }                                                                        \
  |  |11925|    500|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11925:12): [True: 405, False: 95]
  |  |  ------------------
  |  |11926|    405|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11926:11): [True: 60, False: 345]
  |  |  ------------------
  |  |11927|     60|        return;                                                              \
  |  |11928|     60|      }                                                                      \
  |  |11929|    405|    }                                                                        \
  |  |11930|    155|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11930:12): [Folded, False: 95]
  |  |  ------------------
  ------------------
12014|    230|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
12017|    223|                                   size_t len) noexcept {
12018|    223|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11875|    223|  do {                                                                       \
  |  |11876|    223|    const size_t scan_start = i;                                             \
  |  |11877|    223|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11877:9): [True: 223, False: 0]
  |  |  |  Branch (11877:31): [True: 97, False: 126]
  |  |  ------------------
  |  |11878|     97|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11879|     97|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11880|    121|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11880:14): [True: 62, False: 59]
  |  |  ------------------
  |  |11881|     62|        const __m128i w0 =                                                   \
  |  |11882|     62|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11883|     62|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11884|     62|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11884:13): [True: 21, False: 41]
  |  |  ------------------
  |  |11885|     21|          i += static_cast<size_t>(                                          \
  |  |11886|     21|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11887|     21|          return;                                                            \
  |  |11888|     21|        }                                                                    \
  |  |11889|     62|        const __m128i w1 =                                                   \
  |  |11890|     41|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11891|     41|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11892|     41|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11892:13): [True: 17, False: 24]
  |  |  ------------------
  |  |11893|     17|          i += 16 + static_cast<size_t>(                                     \
  |  |11894|     17|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11895|     17|          return;                                                            \
  |  |11896|     17|        }                                                                    \
  |  |11897|     41|      }                                                                      \
  |  |11898|     97|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11898:14): [True: 52, False: 36]
  |  |  ------------------
  |  |11899|     52|        const __m128i w =                                                    \
  |  |11900|     52|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11901|     52|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11902|     52|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11902:13): [True: 23, False: 29]
  |  |  ------------------
  |  |11903|     23|          i += static_cast<size_t>(                                          \
  |  |11904|     23|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11905|     23|          return;                                                            \
  |  |11906|     23|        }                                                                    \
  |  |11907|     52|      }                                                                      \
  |  |11908|     59|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11908:11): [True: 36, False: 0]
  |  |  |  Branch (11908:29): [True: 28, False: 8]
  |  |  ------------------
  |  |11909|     28|        const __m128i w =                                                    \
  |  |11910|     28|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11911|     28|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11912|     28|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11912:13): [True: 19, False: 9]
  |  |  ------------------
  |  |11913|     19|          const size_t hit = len - 16 +                                      \
  |  |11914|     19|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11915|     19|                                 static_cast<uint32_t>(mask)));              \
  |  |11916|     19|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11916:15): [True: 19, False: 0]
  |  |  ------------------
  |  |11917|     19|            i = hit;                                                         \
  |  |11918|     19|            return;                                                          \
  |  |11919|     19|          }                                                                  \
  |  |11920|     19|        }                                                                    \
  |  |11921|     28|        i = len;                                                             \
  |  |11922|      9|        return;                                                              \
  |  |11923|     28|      }                                                                      \
  |  |11924|     36|    }                                                                        \
  |  |11925|    550|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11925:12): [True: 432, False: 118]
  |  |  ------------------
  |  |11926|    432|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11926:11): [True: 16, False: 416]
  |  |  ------------------
  |  |11927|     16|        return;                                                              \
  |  |11928|     16|      }                                                                      \
  |  |11929|    432|    }                                                                        \
  |  |11930|    134|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11930:12): [Folded, False: 118]
  |  |  ------------------
  ------------------
12019|    223|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
12023|    313|bool path_has_dot_segment(std::string_view path) noexcept {
12024|    313|  if (path.empty()) {
  ------------------
  |  Branch (12024:7): [True: 0, False: 313]
  ------------------
12025|      0|    return false;
12026|      0|  }
12027|       |  // "." / ".." at the start, with or without a leading '/'.
12028|    313|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (12028:20): [True: 313, False: 0]
  ------------------
12029|    313|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (12029:7): [True: 313, False: 0]
  |  Branch (12029:26): [True: 112, False: 201]
  ------------------
12030|    112|    const size_t after = i + 1;
12031|    112|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (12031:9): [True: 2, False: 110]
  |  Branch (12031:33): [True: 16, False: 94]
  ------------------
12032|     94|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (12032:10): [True: 94, False: 0]
  |  Branch (12032:33): [True: 41, False: 53]
  ------------------
12033|     41|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (12033:11): [True: 1, False: 40]
  |  Branch (12033:39): [True: 14, False: 26]
  ------------------
12034|     33|      return true;
12035|     33|    }
12036|    112|  }
12037|    280|  static constexpr std::string_view slash_dot{"/.", 2};
12038|    280|  size_t p = i;
12039|    536|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (12039:10): [True: 403, False: 133]
  ------------------
12040|    403|    const size_t after = p + 2;
12041|    403|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (12041:9): [True: 1, False: 402]
  |  Branch (12041:33): [True: 61, False: 341]
  ------------------
12042|    341|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (12042:10): [True: 341, False: 0]
  |  Branch (12042:33): [True: 140, False: 201]
  ------------------
12043|    147|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (12043:11): [True: 20, False: 120]
  |  Branch (12043:39): [True: 65, False: 55]
  ------------------
12044|    147|      return true;
12045|    147|    }
12046|    256|    p = after;
12047|    256|  }
12048|    133|  return false;
12049|    280|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
14010|  11.8k|    ada::url_components& components, uint32_t new_difference) {
14011|  11.8k|  components.username_end += new_difference;
14012|  11.8k|  components.host_start += new_difference;
14013|  11.8k|  components.host_end += new_difference;
14014|  11.8k|  components.pathname_start += new_difference;
14015|  11.8k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (14015:7): [True: 0, False: 11.8k]
  ------------------
14016|      0|    components.search_start += new_difference;
14017|      0|  }
14018|  11.8k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (14018:7): [True: 0, False: 11.8k]
  ------------------
14019|      0|    components.hash_start += new_difference;
14020|      0|  }
14021|  11.8k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14389|    920|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14390|    920|  ada_log("url_aggregator::parse_path ", input);
14391|    920|  ADA_ASSERT_TRUE(validate());
14392|    920|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14393|    920|  std::string tmp_buffer;
14394|    920|  std::string_view internal_input;
14395|    920|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14395:7): [True: 0, False: 920]
  ------------------
14396|      0|    tmp_buffer = input;
14397|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14398|       |    // just directly build the string from user_input.
14399|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14400|      0|    internal_input = tmp_buffer;
14401|    920|  } else {
14402|    920|    internal_input = input;
14403|    920|  }
14404|       |
14405|       |  // If url is special, then:
14406|    920|  if (is_special()) {
  ------------------
  |  Branch (14406:7): [True: 920, False: 0]
  ------------------
14407|    920|    if (internal_input.empty()) {
  ------------------
  |  Branch (14407:9): [True: 148, False: 772]
  ------------------
14408|    148|      update_base_pathname("/");
14409|    772|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14409:16): [True: 772, False: 0]
  |  Branch (14409:46): [True: 0, False: 0]
  ------------------
14410|    772|      consume_prepared_path(internal_input.substr(1));
14411|    772|    } else {
14412|      0|      consume_prepared_path(internal_input);
14413|      0|    }
14414|    920|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14414:14): [True: 0, False: 0]
  ------------------
14415|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14415:9): [True: 0, False: 0]
  ------------------
14416|      0|      consume_prepared_path(internal_input.substr(1));
14417|      0|    } else {
14418|      0|      consume_prepared_path(internal_input);
14419|      0|    }
14420|      0|  } else {
14421|       |    // Non-special URLs with an empty host can have their paths erased
14422|       |    // Path-only URLs cannot have their paths erased
14423|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14423:9): [True: 0, False: 0]
  |  Branch (14423:57): [True: 0, False: 0]
  ------------------
14424|      0|      update_base_pathname("/");
14425|      0|    }
14426|      0|  }
14427|    920|  ADA_ASSERT_TRUE(validate());
14428|    920|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14530|  11.7k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14531|  11.7k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14532|  11.7k|          " bytes]");
14533|  11.7k|  ADA_ASSERT_TRUE(validate());
14534|  11.7k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14535|  11.7k|  if (input.empty()) {
  ------------------
  |  Branch (14535:7): [True: 2, False: 11.7k]
  ------------------
14536|      2|    return is_valid = false;
14537|      2|  }  // technically unnecessary.
14538|       |  // If input starts with U+005B ([), then:
14539|  11.7k|  if (input[0] == '[') {
  ------------------
  |  Branch (14539:7): [True: 7.17k, False: 4.61k]
  ------------------
14540|       |    // If input does not end with U+005D (]), validation error, return failure.
14541|  7.17k|    if (input.back() != ']') {
  ------------------
  |  Branch (14541:9): [True: 68, False: 7.11k]
  ------------------
14542|     68|      return is_valid = false;
14543|     68|    }
14544|  7.11k|    ada_log("parse_host ipv6");
14545|       |
14546|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14547|       |    // trailing U+005D (]) removed.
14548|  7.11k|    input.remove_prefix(1);
14549|  7.11k|    input.remove_suffix(1);
14550|  7.11k|    return parse_ipv6(input);
14551|  7.17k|  }
14552|       |
14553|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14554|       |  // input.
14555|  4.61k|  if (!is_special()) {
  ------------------
  |  Branch (14555:7): [True: 0, False: 4.61k]
  ------------------
14556|      0|    return parse_opaque_host(input);
14557|      0|  }
14558|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14559|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14560|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14561|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14562|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14563|       |
14564|       |  // Often, the input does not contain any forbidden code points, and no upper
14565|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14566|       |  // optimize for such a common case.
14567|       |
14568|       |  // Fast path: try to parse as pure decimal IPv4 first.
14569|  4.61k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14570|  4.61k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14570:7): [True: 307, False: 4.30k]
  ------------------
14571|    307|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14571:9): [True: 307, False: 0]
  |  Branch (14571:27): [True: 2, False: 305]
  ------------------
14572|      2|      update_base_hostname(input.substr(0, input.size() - 1));
14573|    305|    } else {
14574|    305|      update_base_hostname(input);
14575|    305|    }
14576|    307|    host_type = IPV4;
14577|    307|    is_valid = true;
14578|    307|    ada_log("parse_host fast path decimal ipv4");
14579|    307|    ADA_ASSERT_TRUE(validate());
14580|    307|    return true;
14581|    307|  }
14582|  4.30k|  uint8_t is_forbidden_or_upper =
14583|  4.30k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14584|  4.30k|                                                             input.size());
14585|  4.30k|  static constexpr std::string_view xn_dash{"xn-", 3};
14586|  4.30k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14586:7): [True: 1.55k, False: 2.75k]
  ------------------
14587|  1.55k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14587:9): [True: 344, False: 1.20k]
  ------------------
14588|    344|      std::string lowered(input);
14589|    344|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14590|    344|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14590:11): [True: 249, False: 95]
  ------------------
14591|    308|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14591:11): [True: 59, False: 36]
  ------------------
14592|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14593|       |        // This also avoids a double buffer rewrite for hex/octal IPv4.
14594|    308|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14594:13): [True: 178, False: 130]
  ------------------
14595|    178|          ada_log("parse_host fast path ipv4");
14596|    178|          return parse_ipv4(lowered, false);
14597|    178|        }
14598|    130|        update_base_hostname(lowered);
14599|    130|        ada_log("parse_host fast path ", get_hostname());
14600|    130|        is_valid = true;
14601|    130|        return true;
14602|    308|      }
14603|  1.20k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14603:16): [True: 1.11k, False: 91]
  ------------------
14604|  1.18k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14604:16): [True: 65, False: 26]
  ------------------
14605|       |      // Check IPv4 before mutating so failures leave the buffer untouched.
14606|  1.18k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14606:11): [True: 919, False: 264]
  ------------------
14607|    919|        ada_log("parse_host fast path ipv4");
14608|    919|        return parse_ipv4(input, false);
14609|    919|      }
14610|    264|      update_base_hostname(input);
14611|    264|      ada_log("parse_host fast path ", get_hostname());
14612|    264|      is_valid = true;
14613|    264|      return true;
14614|  1.18k|    }
14615|  2.75k|  } else if (const size_t first_percent = input.find('%');
14616|  2.75k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14616:14): [True: 306, False: 2.44k]
  ------------------
14617|    306|    std::string decoded = unicode::percent_decode(input, first_percent);
14618|    306|    const uint8_t decoded_flags =
14619|    306|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14620|    306|                                                               decoded.size());
14621|    306|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14621:9): [True: 206, False: 100]
  ------------------
14622|    206|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14622:11): [True: 79, False: 127]
  ------------------
14623|     79|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14624|     79|      }
14625|    206|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14625:11): [True: 173, False: 33]
  ------------------
14626|    187|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14626:11): [True: 14, False: 19]
  ------------------
14627|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14628|    187|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14628:13): [True: 90, False: 97]
  ------------------
14629|     90|          return parse_ipv4(decoded, false);
14630|     90|        }
14631|     97|        update_base_hostname(decoded);
14632|     97|        is_valid = true;
14633|     97|        return true;
14634|    187|      }
14635|    206|    }
14636|    306|  }
14637|       |  // We have encountered at least one forbidden code point or the input contains
14638|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14639|       |  // conversion.
14640|       |
14641|  2.62k|  ada_log("parse_host calling to_ascii");
14642|  2.62k|  std::optional<std::string> host = std::string(get_hostname());
14643|  2.62k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14644|  2.62k|  if (!is_valid) {
  ------------------
  |  Branch (14644:7): [True: 1.40k, False: 1.22k]
  ------------------
14645|  1.40k|    ada_log("parse_host to_ascii returns false");
14646|  1.40k|    return is_valid = false;
14647|  1.40k|  }
14648|  1.22k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14649|  1.22k|          " bytes]");
14650|       |
14651|  1.22k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14651:7): [True: 0, False: 1.22k]
  ------------------
14652|  1.22k|                          ada::unicode::is_forbidden_domain_code_point)) {
14653|      0|    return is_valid = false;
14654|      0|  }
14655|       |
14656|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14657|       |  // asciiDomain.
14658|  1.22k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14658:7): [True: 964, False: 264]
  ------------------
14659|    964|    ada_log("parse_host got ipv4 ", *host);
14660|    964|    return parse_ipv4(host.value(), false);
14661|    964|  }
14662|       |
14663|    264|  update_base_hostname(host.value());
14664|    264|  ADA_ASSERT_TRUE(validate());
14665|    264|  return true;
14666|  1.22k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15541|  1.85k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15542|  1.85k|  ada_log("url_aggregator::consume_prepared_path ", input);
15543|       |  /***
15544|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15545|       |   * unfortunate. This particular function is nearly identical, except that it
15546|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15547|       |   * very common) merely appends to the buffer. This is the same trivial path as
15548|       |   * with helpers::parse_prepared_path, except that we have the additional check
15549|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15550|       |   * modify it, and then insert it back into the buffer.
15551|       |   */
15552|  1.85k|  uint8_t accumulator = checkers::path_signature(input);
15553|       |  // Let us first detect a trivial case.
15554|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15555|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15556|       |  // no dot, and no character needing percent encoding.
15557|  1.85k|  constexpr uint8_t need_encoding = 1;
15558|  1.85k|  constexpr uint8_t backslash_char = 2;
15559|  1.85k|  constexpr uint8_t dot_char = 4;
15560|  1.85k|  constexpr uint8_t percent_char = 8;
15561|  1.85k|  bool special = type != ada::scheme::NOT_SPECIAL;
15562|  1.85k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15562:39): [True: 0, False: 1.85k]
  ------------------
15563|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15563:39): [True: 0, False: 0]
  ------------------
15564|  1.85k|  bool trivial_path =
15565|  1.85k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15565:7): [True: 698, False: 1.16k]
  |  Branch (15565:8): [True: 1.85k, False: 0]
  ------------------
15566|  1.85k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15567|      0|                  0)) &&
15568|    698|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15568:7): [True: 698, False: 0]
  ------------------
15569|  1.85k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15569:7): [True: 525, False: 1.33k]
  |  Branch (15569:34): [True: 525, False: 0]
  ------------------
15570|       |    // '4' means that we have at least one dot, but nothing that requires
15571|       |    // percent encoding or decoding. The only part that is not trivial is
15572|       |    // that we may have single dots and double dots path segments.
15573|       |    // If we have such segments, then we either have a path that begins
15574|       |    // with '.' (easy to check), or we have the sequence './'.
15575|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15576|       |    // Note: we know that '\' is not present.
15577|    525|    if (input[0] != '.') {
  ------------------
  |  Branch (15577:9): [True: 249, False: 276]
  ------------------
15578|    249|      size_t slashdot = 0;
15579|    249|      bool dot_is_file = true;
15580|  1.04k|      for (;;) {
15581|  1.04k|        slashdot = input.find("/.", slashdot);
15582|  1.04k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15582:13): [True: 249, False: 798]
  ------------------
15583|    249|          break;
15584|    798|        } else {  // uncommon
15585|       |          // only three cases matter: /./, /.. or a final /
15586|    798|          slashdot += 2;
15587|    798|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15587:28): [True: 2, False: 796]
  |  Branch (15587:56): [True: 367, False: 429]
  ------------------
15588|    429|                           input[slashdot] == '/');
  ------------------
  |  Branch (15588:28): [True: 214, False: 215]
  ------------------
15589|    798|        }
15590|  1.04k|      }
15591|    249|      trivial_path = dot_is_file;
15592|    249|    }
15593|    525|  }
15594|  1.85k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15594:7): [True: 755, False: 1.10k]
  |  Branch (15594:23): [True: 755, False: 0]
  ------------------
15595|    755|    ada_log("parse_path trivial");
15596|    755|    buffer += '/';
15597|    755|    buffer += input;
15598|    755|    return;
15599|    755|  }
15600|  1.10k|  std::string path = std::string(get_pathname());
15601|       |  // We are going to need to look a bit at the path, but let us see if we can
15602|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15603|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15604|       |  // there.
15605|  1.10k|  bool fast_path =
15606|  1.10k|      (special &&
  ------------------
  |  Branch (15606:8): [True: 1.10k, False: 0]
  ------------------
15607|  1.10k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15607:8): [True: 468, False: 636]
  ------------------
15608|    468|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15608:7): [True: 468, False: 0]
  ------------------
15609|  1.10k|  if (fast_path) {
  ------------------
  |  Branch (15609:7): [True: 468, False: 636]
  ------------------
15610|    468|    ada_log("parse_prepared_path fast");
15611|       |    // Here we don't need to worry about \ or percent encoding.
15612|       |    // We also do not have a file protocol. We might have dots, however,
15613|       |    // but dots must as appear as '.', and they cannot be encoded because
15614|       |    // the symbol '%' is not present.
15615|    468|    size_t previous_location = 0;  // We start at 0.
15616|  3.02k|    do {
15617|  3.02k|      size_t new_location = input.find('/', previous_location);
15618|       |      // std::string_view path_view = input;
15619|       |      //  We process the last segment separately:
15620|  3.02k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15620:11): [True: 468, False: 2.55k]
  ------------------
15621|    468|        std::string_view path_view = input.substr(previous_location);
15622|    468|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15622:13): [True: 24, False: 444]
  ------------------
15623|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15624|     24|          if (path.empty()) {
  ------------------
  |  Branch (15624:15): [True: 2, False: 22]
  ------------------
15625|      2|            path = '/';
15626|      2|            update_base_pathname(path);
15627|      2|            return;
15628|      2|          }
15629|       |          // Fast case where we have nothing to do:
15630|     22|          if (path.back() == '/') {
  ------------------
  |  Branch (15630:15): [True: 3, False: 19]
  ------------------
15631|      3|            update_base_pathname(path);
15632|      3|            return;
15633|      3|          }
15634|       |          // If you have the path "/joe/myfriend",
15635|       |          // then you delete 'myfriend'.
15636|     19|          path.resize(path.rfind('/') + 1);
15637|     19|          update_base_pathname(path);
15638|     19|          return;
15639|     22|        }
15640|    444|        path += '/';
15641|    444|        if (path_view != ".") {
  ------------------
  |  Branch (15641:13): [True: 440, False: 4]
  ------------------
15642|    440|          path.append(path_view);
15643|    440|        }
15644|    444|        update_base_pathname(path);
15645|    444|        return;
15646|  2.55k|      } else {
15647|       |        // This is a non-final segment.
15648|  2.55k|        std::string_view path_view =
15649|  2.55k|            input.substr(previous_location, new_location - previous_location);
15650|  2.55k|        previous_location = new_location + 1;
15651|  2.55k|        if (path_view == "..") {
  ------------------
  |  Branch (15651:13): [True: 390, False: 2.16k]
  ------------------
15652|    390|          size_t last_delimiter = path.rfind('/');
15653|    390|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15653:15): [True: 195, False: 195]
  ------------------
15654|    195|            path.erase(last_delimiter);
15655|    195|          }
15656|  2.16k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15656:20): [True: 1.86k, False: 305]
  ------------------
15657|  1.86k|          path += '/';
15658|  1.86k|          path.append(path_view);
15659|  1.86k|        }
15660|  2.55k|      }
15661|  3.02k|    } while (true);
  ------------------
  |  Branch (15661:14): [True: 2.55k, Folded]
  ------------------
15662|    636|  } else {
15663|    636|    ada_log("parse_path slow");
15664|       |    // we have reached the general case
15665|    636|    bool needs_percent_encoding = (accumulator & 1);
15666|  4.28k|    do {
15667|  4.28k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15667:26): [True: 4.28k, False: 0]
  |  Branch (15667:37): [True: 121, False: 4.16k]
  ------------------
15668|  4.28k|                            ? input.find_first_of("/\\")
15669|  4.28k|                            : input.find('/');
15670|  4.28k|      std::string_view path_view = input;
15671|  4.28k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15671:11): [True: 3.64k, False: 636]
  ------------------
15672|  3.64k|        path_view.remove_suffix(path_view.size() - location);
15673|  3.64k|        input.remove_prefix(location + 1);
15674|  3.64k|      }
15675|       |      // Path encoding preserves dots and percent signs, so normalize first.
15676|  4.28k|      if (unicode::is_double_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15676:11): [True: 325, False: 3.95k]
  ------------------
15677|    325|        helpers::shorten_path(path, type);
15678|    325|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15678:13): [True: 14, False: 311]
  ------------------
15679|     14|          path += '/';
15680|     14|        }
15681|  3.95k|      } else if (unicode::is_single_dot_path_segment(path_view) &&
  ------------------
  |  Branch (15681:18): [True: 296, False: 3.66k]
  ------------------
15682|    296|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15682:18): [True: 11, False: 285]
  ------------------
15683|     11|        path += '/';
15684|     11|      }
15685|       |      // Otherwise, if path_view is not a single-dot path segment, then:
15686|  3.94k|      else if (!unicode::is_single_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15686:16): [True: 3.66k, False: 285]
  ------------------
15687|       |        // If url's scheme is "file", url's path is empty, and path_view is a
15688|       |        // Windows drive letter, then replace the second code point in
15689|       |        // path_view with U+003A (:).
15690|  3.66k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15690:13): [True: 0, False: 3.66k]
  |  Branch (15690:48): [True: 0, False: 0]
  ------------------
15691|      0|            path_view.size() == 2 &&
  ------------------
  |  Branch (15691:13): [True: 0, False: 0]
  ------------------
15692|      0|            checkers::is_windows_drive_letter(path_view)) {
  ------------------
  |  Branch (15692:13): [True: 0, False: 0]
  ------------------
15693|      0|          path += '/';
15694|      0|          path += path_view[0];
15695|      0|          path += ':';
15696|      0|          path_view.remove_prefix(2);
15697|      0|          path.append(path_view);
15698|  3.66k|        } else {
15699|       |          // Append encoded bytes directly to the pathname.
15700|  3.66k|          path += '/';
15701|  3.66k|          if (!needs_percent_encoding ||
  ------------------
  |  Branch (15701:15): [True: 410, False: 3.25k]
  ------------------
15702|  3.25k|              !ada::unicode::percent_encode<true>(
  ------------------
  |  Branch (15702:15): [True: 2.30k, False: 951]
  ------------------
15703|  3.25k|                  path_view, character_sets::PATH_PERCENT_ENCODE, path)) {
15704|  2.71k|            path.append(path_view);
15705|  2.71k|          }
15706|  3.66k|        }
15707|  3.66k|      }
15708|  4.28k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15708:11): [True: 636, False: 3.64k]
  ------------------
15709|    636|        update_base_pathname(path);
15710|    636|        return;
15711|    636|      }
15712|  4.28k|    } while (true);
  ------------------
  |  Branch (15712:14): [True: 3.64k, Folded]
  ------------------
15713|    636|  }
15714|  1.10k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   14|  8.99k|ada_really_inline constexpr bool is_ipv4(std::string_view view) noexcept {
   15|       |  // The string is not empty and does not contain upper case ASCII characters.
   16|  8.99k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (16:7): [True: 895, False: 8.09k]
  ------------------
   17|    895|    return false;
   18|    895|  }
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|  8.09k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 112, False: 7.98k]
  ------------------
   21|    112|    view.remove_suffix(1);
   22|    112|  }
   23|       |  // From the last character, find the last dot.
   24|  8.09k|  size_t last_dot = view.rfind('.');
   25|  8.09k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (25:7): [True: 7.21k, False: 889]
  ------------------
   26|       |    // We have at least one dot.
   27|  7.21k|    view.remove_prefix(last_dot + 1);
   28|  7.21k|  }
   29|       |  /** Optimization opportunity: we have basically identified the last number of
   30|       |     the ipv4 if we return true here. We might as well parse it and have at
   31|       |     least one number parsed when we get to parse_ipv4. */
   32|  8.09k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (32:7): [True: 7.53k, False: 569]
  ------------------
   33|  7.53k|    return true;
   34|  7.53k|  }
   35|       |  // It could be hex (0x), but not if there is a single character.
   36|    569|  if (view.size() == 1) {
  ------------------
  |  Branch (36:7): [True: 0, False: 569]
  ------------------
   37|      0|    return false;
   38|      0|  }
   39|       |  // It must start with 0x.
   40|    569|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (40:7): [True: 72, False: 497]
  ------------------
   41|     72|    return false;
   42|     72|  }
   43|       |  // We must allow "0x".
   44|    497|  if (view.size() == 2) {
  ------------------
  |  Branch (44:7): [True: 39, False: 458]
  ------------------
   45|     39|    return true;
   46|     39|  }
   47|       |  // We have 0x followed by some characters, we need to check that they are
   48|       |  // hexadecimals.
   49|    458|  view.remove_prefix(2);
   50|    458|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   51|    497|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7498|  4.00k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7499|  4.00k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7499:11): [True: 4.00k, False: 0]
  |  Branch (7499:23): [True: 1.82k, False: 2.17k]
  |  Branch (7499:37): [True: 2.17k, False: 2]
  |  Branch (7499:49): [True: 2.16k, False: 15]
  ------------------
 7500|  4.00k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   77|  8.82k|    std::string_view input) noexcept {
   78|       |  // The path percent-encode set is the query percent-encode set and U+003F (?),
   79|       |  // U+0060 (`), U+007B ({), and U+007D (}). The query percent-encode set is the
   80|       |  // C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#),
   81|       |  // U+003C (<), and U+003E (>). The C0 control percent-encode set are the C0
   82|       |  // controls and all code points greater than U+007E (~).
   83|  8.82k|  size_t i = 0;
   84|  8.82k|  uint8_t accumulator{};
   85|  26.2k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (85:10): [True: 17.3k, False: 8.82k]
  ------------------
   86|  17.3k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   87|  17.3k|                           path_signature_table[uint8_t(input[i + 1])] |
   88|  17.3k|                           path_signature_table[uint8_t(input[i + 2])] |
   89|  17.3k|                           path_signature_table[uint8_t(input[i + 3])] |
   90|  17.3k|                           path_signature_table[uint8_t(input[i + 4])] |
   91|  17.3k|                           path_signature_table[uint8_t(input[i + 5])] |
   92|  17.3k|                           path_signature_table[uint8_t(input[i + 6])] |
   93|  17.3k|                           path_signature_table[uint8_t(input[i + 7])]);
   94|  17.3k|  }
   95|  35.7k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (95:10): [True: 26.9k, False: 8.82k]
  ------------------
   96|  26.9k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   97|  26.9k|  }
   98|  8.82k|  return accumulator;
   99|  8.82k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7379|  11.5k|                                              size_t length) noexcept {
 7380|  11.5k|  size_t i = 0;
 7381|  11.5k|  uint8_t accumulator{};
 7382|  61.0k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7382:10): [True: 49.4k, False: 11.5k]
  ------------------
 7383|  49.4k|    accumulator |=
 7384|  49.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7385|  49.4k|    accumulator |=
 7386|  49.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7387|  49.4k|    accumulator |=
 7388|  49.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7389|  49.4k|    accumulator |=
 7390|  49.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7391|  49.4k|  }
 7392|  27.6k|  for (; i < length; i++) {
  ------------------
  |  Branch (7392:10): [True: 16.1k, False: 11.5k]
  ------------------
 7393|  16.1k|    accumulator |=
 7394|  16.1k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7395|  16.1k|  }
 7396|  11.5k|  return accumulator;
 7397|  11.5k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
14028|  11.8k|    const std::string_view input_with_colon) {
14029|  11.8k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
14030|  11.8k|  ADA_ASSERT_TRUE(validate());
14031|  11.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
14032|  11.8k|  std::string_view input{input_with_colon};
14033|  11.8k|  input.remove_suffix(1);
14034|  11.8k|  auto parsed_type = ada::scheme::get_scheme_type(input);
14035|  11.8k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
14036|       |  /**
14037|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
14038|       |   *http, https), in which case, we can go really fast.
14039|       |   **/
14040|  11.8k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (14040:7): [True: 11.8k, False: 0]
  ------------------
14041|       |    if constexpr (has_state_override) {
14042|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
14043|       |      // then return.
14044|       |      if (is_special() != is_input_special) {
14045|       |        return false;
14046|       |      }
14047|       |
14048|       |      // If url includes credentials or has a non-null port, and buffer is
14049|       |      // "file", then return.
14050|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14051|       |          parsed_type == ada::scheme::type::FILE) {
14052|       |        return false;
14053|       |      }
14054|       |
14055|       |      // If url's scheme is "file" and its host is an empty host, then return.
14056|       |      // An empty host is the empty string.
14057|       |      if (type == ada::scheme::type::FILE &&
14058|       |          components.host_start == components.host_end) {
14059|       |        return false;
14060|       |      }
14061|       |    }
14062|       |
14063|  11.8k|    type = parsed_type;
14064|  11.8k|    set_scheme_from_view_with_colon(input_with_colon);
14065|       |
14066|       |    if constexpr (has_state_override) {
14067|       |      // This is uncommon.
14068|       |      uint16_t urls_scheme_port = get_special_port();
14069|       |
14070|       |      if (urls_scheme_port) {
14071|       |        // If url's port is url's scheme's default port, then set url's port to
14072|       |        // null.
14073|       |        if (components.port == urls_scheme_port) {
14074|       |          clear_port();
14075|       |        }
14076|       |      }
14077|       |    }
14078|  11.8k|  } else {  // slow path
14079|      0|    std::string _buffer(input);
14080|       |    // Next function is only valid if the input is ASCII and returns false
14081|       |    // otherwise, but it seems that we always have ascii content so we do not
14082|       |    // need to check the return value.
14083|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
14084|       |
14085|       |    if constexpr (has_state_override) {
14086|       |      // The state-override validation errors below ("return" in the WHATWG URL
14087|       |      // parser) leave the URL unchanged. The setter contract is
14088|       |      // "true on success, false if the scheme is invalid" -- the fast path
14089|       |      // above already returns false here, so the slow path must agree.
14090|       |
14091|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
14092|       |      // then return. If url's scheme is not a special scheme and buffer is a
14093|       |      // special scheme, then return.
14094|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
14095|       |        return false;
14096|       |      }
14097|       |
14098|       |      // If url includes credentials or has a non-null port, and buffer is
14099|       |      // "file", then return.
14100|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14101|       |          _buffer == "file") {
14102|       |        return false;
14103|       |      }
14104|       |
14105|       |      // If url's scheme is "file" and its host is an empty host, then return.
14106|       |      // An empty host is the empty string.
14107|       |      if (type == ada::scheme::type::FILE &&
14108|       |          components.host_start == components.host_end) {
14109|       |        return false;
14110|       |      }
14111|       |    }
14112|       |
14113|      0|    set_scheme(_buffer);
14114|       |
14115|       |    if constexpr (has_state_override) {
14116|       |      // This is uncommon.
14117|       |      uint16_t urls_scheme_port = get_special_port();
14118|       |
14119|       |      if (urls_scheme_port) {
14120|       |        // If url's port is url's scheme's default port, then set url's port to
14121|       |        // null.
14122|       |        if (components.port == urls_scheme_port) {
14123|       |          clear_port();
14124|       |        }
14125|       |      }
14126|       |    }
14127|      0|  }
14128|  11.8k|  ADA_ASSERT_TRUE(validate());
14129|  11.8k|  return true;
14130|  11.8k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14154|  11.8k|    std::string_view new_scheme_with_colon) {
14155|  11.8k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
14156|  11.8k|          new_scheme_with_colon);
14157|  11.8k|  ADA_ASSERT_TRUE(validate());
14158|  11.8k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
14159|  11.8k|                  new_scheme_with_colon.back() == ':');
14160|       |  // next line could overflow but unsigned arithmetic has well-defined
14161|       |  // overflows.
14162|  11.8k|  uint32_t new_difference =
14163|  11.8k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
14164|       |
14165|  11.8k|  if (buffer.empty()) {
  ------------------
  |  Branch (14165:7): [True: 11.8k, False: 0]
  ------------------
14166|  11.8k|    buffer.append(new_scheme_with_colon);
14167|  11.8k|  } else {
14168|      0|    buffer.erase(0, components.protocol_end);
14169|      0|    buffer.insert(0, new_scheme_with_colon);
14170|      0|  }
14171|  11.8k|  components.protocol_end += new_difference;
14172|       |
14173|  11.8k|  apply_shifted_non_scheme_offsets(components, new_difference);
14174|  11.8k|  ADA_ASSERT_TRUE(validate());
14175|  11.8k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 6341|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1086|   245k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1087|   245k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1088|   245k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2688|  21.2k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2702|  10.6k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 2184|  15.6k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 4174|  10.6k|      : impl_base(unexpect, std::move(e.value())),
 4175|  10.6k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 3160|  10.6k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3778|  13.1k|  constexpr explicit expected_default_ctor_base(default_constructor_tag) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS2_TnPNSt3__19enable_ifIXsr3std14is_convertibleIOT_S2_EE5valueEvE4typeELPv0ETnPNS7_IXaaaaaasr3std16is_constructibleIS2_S9_EE5valuentsr3std7is_sameINS6_5decayIS8_E4typeENS_10in_place_tEEE5valuentsr3std7is_sameIS4_SG_EE5valuentsr3std7is_sameINS_10unexpectedIS3_EESG_EE5valueEvE4typeELSD_0EEES9_:
 4260|  2.51k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 4133|  2.51k|      : impl_base(in_place, std::forward<Args>(args)...),
 4134|  2.51k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 3148|  2.51k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 8424|  2.51k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 8427|  15.6k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7425|  11.8k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 7426|  11.8k|  if (scheme.empty()) {
  ------------------
  |  Branch (7426:7): [True: 0, False: 11.8k]
  ------------------
 7427|      0|    return ada::scheme::NOT_SPECIAL;
 7428|      0|  }
 7429|  11.8k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 7430|  11.8k|  const std::string_view target = details::is_special_list[hash_value];
 7431|  11.8k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (7431:7): [True: 11.8k, False: 0]
  ------------------
 7432|  11.8k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (7432:7): [True: 11.8k, False: 0]
  ------------------
 7433|  11.8k|          details::scheme_keys[hash_value]) {
 7434|  11.8k|    return ada::scheme::type(hash_value);
 7435|  11.8k|  } else {
 7436|      0|    return ada::scheme::NOT_SPECIAL;
 7437|      0|  }
 7438|  11.8k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 7366|  11.8k|inline uint64_t branchless_load5(const char* p, size_t n) {
 7367|  11.8k|  uint64_t input = (uint8_t)p[0];
 7368|  11.8k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 7369|  11.8k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 7370|  11.8k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 7371|  11.8k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 7372|  11.8k|  return input;
 7373|  11.8k|}
_ZN3ada14url_aggregatorC2Ev:
 8422|  13.1k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 5489|  13.1k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1930|  13.8k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1931|  13.8k|  const size_t len = input.size();
 1932|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1933|  13.8k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1933:7): [True: 9.43k, False: 4.37k]
  |  Branch (1933:18): [True: 1.81k, False: 2.55k]
  ------------------
 1934|  11.2k|    return ipv4_fast_fail;
 1935|  11.2k|  }
 1936|  2.55k|  const char* data = input.data();
 1937|       |
 1938|       |#if defined(ADA_AVX512_IPV4)
 1939|       |  return detail::try_parse_ipv4_avx512(data, len);
 1940|       |#elif defined(ADA_HYBRID_IPV4)
 1941|       |  return detail::try_parse_ipv4_hybrid(data, len);
 1942|       |#else
 1943|  2.55k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1944|  13.8k|#endif
 1945|  13.8k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1579|  2.55k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1580|  2.55k|  uint32_t ipv4 = 0;
 1581|  4.68k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1581:19): [True: 4.18k, False: 491]
  ------------------
 1582|  4.18k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1582:9): [True: 6, False: 4.18k]
  ------------------
 1583|      6|      return ipv4_fast_fail;
 1584|      6|    }
 1585|  4.18k|    uint32_t val;
 1586|  4.18k|    char c = *p;
 1587|  4.18k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1587:9): [True: 3.61k, False: 569]
  |  Branch (1587:21): [True: 2.63k, False: 980]
  ------------------
 1588|  2.63k|      val = static_cast<uint32_t>(c - '0');
 1589|  2.63k|      ++p;
 1590|  2.63k|    } else {
 1591|  1.54k|      return ipv4_fast_fail;
 1592|  1.54k|    }
 1593|  2.63k|    if (p < pend) {
  ------------------
  |  Branch (1593:9): [True: 2.41k, False: 215]
  ------------------
 1594|  2.41k|      c = *p;
 1595|  2.41k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1595:11): [True: 1.51k, False: 909]
  |  Branch (1595:23): [True: 1.33k, False: 177]
  ------------------
 1596|  1.33k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1596:13): [True: 90, False: 1.24k]
  ------------------
 1597|     90|          return ipv4_fast_fail;
 1598|     90|        }
 1599|  1.24k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1600|  1.24k|        ++p;
 1601|  1.24k|        if (p < pend) {
  ------------------
  |  Branch (1601:13): [True: 1.08k, False: 158]
  ------------------
 1602|  1.08k|          c = *p;
 1603|  1.08k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1603:15): [True: 737, False: 348]
  |  Branch (1603:27): [True: 723, False: 14]
  ------------------
 1604|    723|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1605|    723|            ++p;
 1606|    723|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1606:17): [True: 126, False: 597]
  ------------------
 1607|    126|              return ipv4_fast_fail;
 1608|    126|            }
 1609|    723|          }
 1610|  1.08k|        }
 1611|  1.24k|      }
 1612|  2.41k|    }
 1613|  2.41k|    ipv4 = (ipv4 << 8) | val;
 1614|  2.41k|    if (i < 3) {
  ------------------
  |  Branch (1614:9): [True: 1.92k, False: 491]
  ------------------
 1615|  1.92k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1615:11): [True: 34, False: 1.89k]
  |  Branch (1615:24): [True: 257, False: 1.63k]
  ------------------
 1616|    291|        return ipv4_fast_fail;
 1617|    291|      }
 1618|  1.63k|      ++p;
 1619|  1.63k|    }
 1620|  2.41k|  }
 1621|    491|  if (p != pend) {
  ------------------
  |  Branch (1621:7): [True: 36, False: 455]
  ------------------
 1622|     36|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1622:9): [True: 21, False: 15]
  |  Branch (1622:26): [True: 4, False: 17]
  ------------------
 1623|      4|      return ipv4;
 1624|      4|    }
 1625|     32|    return ipv4_fast_fail;
 1626|     36|  }
 1627|    455|  return ipv4;
 1628|    491|}
_ZNK3ada8url_base10is_specialEv:
 7913|  44.9k|    const noexcept {
 7914|  44.9k|  return type != ada::scheme::NOT_SPECIAL;
 7915|  44.9k|}
_ZN3ada8checkers8is_alphaEc:
 1559|  17.9k|constexpr bool is_alpha(char x) noexcept {
 1560|  17.9k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1560:10): [True: 14.6k, False: 3.32k]
  |  Branch (1560:34): [True: 14.3k, False: 250]
  ------------------
 1561|  17.9k|}
_ZN3ada8checkers8to_lowerEc:
 1557|  32.5k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1532|  10.9k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1533|  10.9k|  if (view.empty()) {
  ------------------
  |  Branch (1533:7): [True: 0, False: 10.9k]
  ------------------
 1534|      0|    return false;
 1535|      0|  }
 1536|  10.9k|  const char* start = view.data();
 1537|  10.9k|  const char* end = start + view.size();
 1538|  10.9k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1538:7): [True: 411, False: 10.4k]
  ------------------
 1539|    411|    --end;
 1540|    411|    if (end == start) {
  ------------------
  |  Branch (1540:9): [True: 249, False: 162]
  ------------------
 1541|    249|      return false;
 1542|    249|    }
 1543|    411|  }
 1544|  10.6k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1544:7): [True: 1.48k, False: 9.17k]
  ------------------
 1545|  1.48k|    return false;
 1546|  1.48k|  }
 1547|  9.17k|  const char* label = end;
 1548|  32.2k|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1548:10): [True: 30.8k, False: 1.36k]
  |  Branch (1548:28): [True: 23.0k, False: 7.81k]
  ------------------
 1549|  23.0k|    --label;
 1550|  23.0k|  }
 1551|  9.17k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1551:7): [True: 7.81k, False: 1.36k]
  |  Branch (1551:25): [True: 332, False: 7.47k]
  ------------------
 1552|    332|    return false;
 1553|    332|  }
 1554|  8.83k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1554:10): [True: 8.83k, False: 0]
  |  Branch (1554:26): [True: 8.36k, False: 477]
  ------------------
 1555|  9.17k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1526|  41.4k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1527|  41.4k|  const unsigned char c = static_cast<unsigned char>(x);
 1528|  41.4k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1528:11): [True: 33.6k, False: 7.85k]
  |  Branch (1528:23): [True: 24.3k, False: 9.27k]
  |  Branch (1528:37): [True: 8.60k, False: 8.52k]
  |  Branch (1528:49): [True: 5.03k, False: 3.56k]
  ------------------
 1529|  12.0k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1529:11): [True: 4.12k, False: 7.96k]
  |  Branch (1529:23): [True: 274, False: 3.85k]
  |  Branch (1529:36): [True: 2.30k, False: 9.52k]
  |  Branch (1529:48): [True: 227, False: 9.29k]
  ------------------
 1530|  41.4k|}
_ZN3ada8checkers8is_digitEc:
 1524|  22.5k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 7422|    573|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 7423|    573|  return details::special_ports[int(type)];
 7424|    573|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9155|  1.36k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 9156|  1.36k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 9157|  1.36k|          " bytes] \n", to_diagram());
 9158|  1.36k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9159|  1.36k|  ADA_ASSERT_TRUE(validate());
 9160|       |
 9161|  1.36k|  const bool begins_with_dashdash = input.starts_with("//");
 9162|  1.36k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (9162:7): [True: 1.13k, False: 229]
  |  Branch (9162:32): [True: 0, False: 1.13k]
  ------------------
 9163|       |    // We must delete the ./
 9164|      0|    delete_dash_dot();
 9165|      0|  }
 9166|       |
 9167|  1.36k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (9167:7): [True: 229, False: 1.13k]
  |  Branch (9167:31): [True: 229, False: 0]
  |  Branch (9167:51): [True: 0, False: 229]
  ------------------
 9168|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (9168:7): [True: 0, False: 0]
  ------------------
 9169|       |    // If url's host is null, url does not have an opaque path, url's path's
 9170|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 9171|       |    // output.
 9172|      0|    buffer.insert(components.pathname_start, "/.");
 9173|      0|    components.pathname_start += 2;
 9174|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9174:9): [True: 0, False: 0]
  ------------------
 9175|      0|      components.search_start += 2;
 9176|      0|    }
 9177|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9177:9): [True: 0, False: 0]
  ------------------
 9178|      0|      components.hash_start += 2;
 9179|      0|    }
 9180|      0|  }
 9181|       |
 9182|  1.36k|  uint32_t difference = replace_and_resize(
 9183|  1.36k|      components.pathname_start,
 9184|  1.36k|      components.pathname_start + get_pathname_length(), input);
 9185|  1.36k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9185:7): [True: 0, False: 1.36k]
  ------------------
 9186|      0|    components.search_start += difference;
 9187|      0|  }
 9188|  1.36k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9188:7): [True: 0, False: 1.36k]
  ------------------
 9189|      0|    components.hash_start += difference;
 9190|      0|  }
 9191|  1.36k|  ADA_ASSERT_TRUE(validate());
 9192|  1.36k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8997|  3.07k|    uint32_t start, uint32_t end, std::string_view input) {
 8998|  3.07k|  uint32_t current_length = end - start;
 8999|  3.07k|  uint32_t input_size = uint32_t(input.size());
 9000|  3.07k|  uint32_t new_difference = input_size - current_length;
 9001|       |
 9002|  3.07k|  if (current_length == 0) {
  ------------------
  |  Branch (9002:7): [True: 2.99k, False: 88]
  ------------------
 9003|  2.99k|    buffer.insert(start, input);
 9004|  2.99k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (9004:14): [True: 8, False: 80]
  ------------------
 9005|      8|    if (input_size != 0) {
  ------------------
  |  Branch (9005:9): [True: 8, False: 0]
  ------------------
 9006|      8|      std::memmove(buffer.data() + start, input.data(), input_size);
 9007|      8|    }
 9008|     80|  } else if (input_size < current_length) {
  ------------------
  |  Branch (9008:14): [True: 0, False: 80]
  ------------------
 9009|      0|    buffer.erase(start, current_length - input_size);
 9010|      0|    buffer.replace(start, input_size, input);
 9011|     80|  } else {
 9012|     80|    buffer.replace(start, current_length, input.substr(0, current_length));
 9013|     80|    buffer.insert(start + current_length, input.substr(current_length));
 9014|     80|  }
 9015|       |
 9016|  3.07k|  return new_difference;
 9017|  3.07k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 9048|  1.36k|url_aggregator::get_pathname_length() const noexcept {
 9049|  1.36k|  ada_log("url_aggregator::get_pathname_length");
 9050|  1.36k|  uint32_t ending_index = uint32_t(buffer.size());
 9051|  1.36k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9051:7): [True: 0, False: 1.36k]
  ------------------
 9052|      0|    ending_index = components.search_start;
 9053|  1.36k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9053:14): [True: 0, False: 1.36k]
  ------------------
 9054|      0|    ending_index = components.hash_start;
 9055|      0|  }
 9056|  1.36k|  return ending_index - components.pathname_start;
 9057|  1.36k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9990|  1.10k|    ada_lifetime_bound {
 9991|  1.10k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9992|  1.10k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9993|  1.10k|          " components.search_start = ", components.search_start,
 9994|  1.10k|          " components.hash_start = ", components.hash_start);
 9995|  1.10k|  auto ending_index = uint32_t(buffer.size());
 9996|  1.10k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9996:7): [True: 0, False: 1.10k]
  ------------------
 9997|      0|    ending_index = components.search_start;
 9998|  1.10k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9998:14): [True: 0, False: 1.10k]
  ------------------
 9999|      0|    ending_index = components.hash_start;
10000|      0|  }
10001|  1.10k|  return helpers::substring(buffer, components.pathname_start, ending_index);
10002|  1.10k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8973|    289|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8974|    289|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8975|    289|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8976|    289|          " bytes] components.hash_start = ", components.hash_start);
 8977|    289|  ADA_ASSERT_TRUE(validate());
 8978|    289|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8979|    289|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8979:7): [True: 0, False: 289]
  ------------------
 8980|      0|    buffer.resize(components.hash_start);
 8981|      0|  }
 8982|    289|  components.hash_start = uint32_t(buffer.size());
 8983|    289|  buffer += "#";
 8984|    289|  bool encoding_required = unicode::percent_encode<true>(
 8985|    289|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8986|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8987|       |  // encoding was not deemed required.
 8988|    289|  if (!encoding_required) {
  ------------------
  |  Branch (8988:7): [True: 183, False: 106]
  ------------------
 8989|    183|    buffer.append(input);
 8990|    183|  }
 8991|    289|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8992|    289|          buffer, "' [", buffer.size(), " bytes]");
 8993|    289|  ADA_ASSERT_TRUE(validate());
 8994|    289|}
_ZNK3ada8url_base19scheme_default_portEv:
 7922|     85|url_base::scheme_default_port() const noexcept {
 7923|     85|  return scheme::get_special_port(type);
 7924|     85|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1563|  6.96k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1564|  6.96k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1564:10): [True: 6.01k, False: 949]
  ------------------
 1565|  6.01k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1565:11): [True: 2.51k, False: 3.50k]
  |  Branch (1565:34): [True: 490, False: 2.02k]
  |  Branch (1565:55): [True: 4, False: 2.01k]
  ------------------
 1566|    494|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1566:11): [True: 2, False: 492]
  |  Branch (1566:35): [True: 233, False: 259]
  |  Branch (1566:54): [True: 1, False: 258]
  ------------------
 1567|    258|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1567:35): [True: 52, False: 206]
  |  Branch (1567:54): [True: 35, False: 171]
  ------------------
 1568|  6.96k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1571|  6.96k|    std::string_view input) noexcept {
 1572|  6.96k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1572:10): [True: 97, False: 6.87k]
  |  Branch (1572:32): [True: 32, False: 65]
  |  Branch (1572:54): [True: 1, False: 31]
  ------------------
 1573|  6.96k|}
_ZN3ada7helpers14leading_zeroesEj:
 2473|  11.9k|inline int leading_zeroes(uint32_t input_num) noexcept {
 2474|       |#if ADA_REGULAR_VISUAL_STUDIO
 2475|       |  unsigned long leading_zero(0);
 2476|       |  unsigned long in(input_num);
 2477|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 2478|       |#else
 2479|  11.9k|  return __builtin_clz(input_num);
 2480|  11.9k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 2481|  11.9k|}
_ZN3ada14url_aggregator7reserveEj:
 9663|  11.8k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9664|  11.8k|  buffer.reserve(capacity);
 9665|  11.8k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9381|    985|inline void url_aggregator::append_base_password(const std::string_view input) {
 9382|    985|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 9383|    985|          "\n", to_diagram());
 9384|    985|  ADA_ASSERT_TRUE(validate());
 9385|    985|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9386|       |#if ADA_DEVELOPMENT_CHECKS
 9387|       |  // computing the expected password.
 9388|       |  std::string password_expected = std::string(get_password());
 9389|       |  password_expected.append(input);
 9390|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9391|    985|  add_authority_slashes_if_needed();
 9392|       |
 9393|       |  // If input is empty, do nothing.
 9394|    985|  if (input.empty()) {
  ------------------
  |  Branch (9394:7): [True: 447, False: 538]
  ------------------
 9395|    447|    return;
 9396|    447|  }
 9397|       |
 9398|    538|  uint32_t difference = uint32_t(input.size());
 9399|    538|  if (has_password()) {
  ------------------
  |  Branch (9399:7): [True: 482, False: 56]
  ------------------
 9400|    482|    buffer.insert(components.host_start, input);
 9401|    482|  } else {
 9402|     56|    difference++;  // Increment for ":"
 9403|     56|    buffer.insert(components.username_end, ":");
 9404|     56|    buffer.insert(components.username_end + 1, input);
 9405|     56|  }
 9406|    538|  components.host_start += difference;
 9407|       |
 9408|       |  // The following line is required to add "@" to hostname. When updating
 9409|       |  // password if hostname does not start with "@", it is "append_base_password"s
 9410|       |  // responsibility to set it.
 9411|    538|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9411:7): [True: 42, False: 496]
  ------------------
 9412|     42|    buffer.insert(components.host_start, "@");
 9413|     42|    difference++;
 9414|     42|  }
 9415|       |
 9416|    538|  components.host_end += difference;
 9417|    538|  components.pathname_start += difference;
 9418|    538|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9418:7): [True: 0, False: 538]
  ------------------
 9419|      0|    components.search_start += difference;
 9420|      0|  }
 9421|    538|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9421:7): [True: 0, False: 538]
  ------------------
 9422|      0|    components.hash_start += difference;
 9423|      0|  }
 9424|       |#if ADA_DEVELOPMENT_CHECKS
 9425|       |  std::string password_after(get_password());
 9426|       |  ADA_ASSERT_EQUAL(
 9427|       |      password_expected, password_after,
 9428|       |      "append_base_password problem after inserting " + std::string(input));
 9429|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9430|    538|  ADA_ASSERT_TRUE(validate());
 9431|    538|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9637|  4.77k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9638|  4.77k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9639|  4.77k|  ADA_ASSERT_TRUE(validate());
 9640|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9641|       |  // to insert
 9642|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9643|  4.77k|  if (has_authority()) {
  ------------------
  |  Branch (9643:7): [True: 2.92k, False: 1.84k]
  ------------------
 9644|  2.92k|    return;
 9645|  2.92k|  }
 9646|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9647|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9648|       |  // the insert could be fused with another insert.
 9649|  1.84k|  buffer.insert(components.protocol_end, "//");
 9650|  1.84k|  components.username_end += 2;
 9651|  1.84k|  components.host_start += 2;
 9652|  1.84k|  components.host_end += 2;
 9653|  1.84k|  components.pathname_start += 2;
 9654|  1.84k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9654:7): [True: 0, False: 1.84k]
  ------------------
 9655|      0|    components.search_start += 2;
 9656|      0|  }
 9657|  1.84k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9657:7): [True: 0, False: 1.84k]
  ------------------
 9658|      0|    components.hash_start += 2;
 9659|      0|  }
 9660|  1.84k|  ADA_ASSERT_TRUE(validate());
 9661|  1.84k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9265|  2.07k|inline void url_aggregator::append_base_username(const std::string_view input) {
 9266|  2.07k|  ada_log("url_aggregator::append_base_username ", input);
 9267|  2.07k|  ADA_ASSERT_TRUE(validate());
 9268|  2.07k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9269|       |#if ADA_DEVELOPMENT_CHECKS
 9270|       |  // computing the expected password.
 9271|       |  std::string username_expected(get_username());
 9272|       |  username_expected.append(input);
 9273|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9274|  2.07k|  add_authority_slashes_if_needed();
 9275|       |
 9276|       |  // If input is empty, do nothing.
 9277|  2.07k|  if (input.empty()) {
  ------------------
  |  Branch (9277:7): [True: 849, False: 1.22k]
  ------------------
 9278|    849|    return;
 9279|    849|  }
 9280|       |
 9281|  1.22k|  uint32_t difference = uint32_t(input.size());
 9282|  1.22k|  buffer.insert(components.username_end, input);
 9283|  1.22k|  components.username_end += difference;
 9284|  1.22k|  components.host_start += difference;
 9285|       |
 9286|  1.22k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (9286:7): [True: 165, False: 1.06k]
  ------------------
 9287|    165|      components.host_start != components.host_end) {
  ------------------
  |  Branch (9287:7): [True: 165, False: 0]
  ------------------
 9288|    165|    buffer.insert(components.host_start, "@");
 9289|    165|    difference++;
 9290|    165|  }
 9291|       |
 9292|  1.22k|  components.host_end += difference;
 9293|  1.22k|  components.pathname_start += difference;
 9294|  1.22k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9294:7): [True: 0, False: 1.22k]
  ------------------
 9295|      0|    components.search_start += difference;
 9296|      0|  }
 9297|  1.22k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9297:7): [True: 0, False: 1.22k]
  ------------------
 9298|      0|    components.hash_start += difference;
 9299|      0|  }
 9300|       |#if ADA_DEVELOPMENT_CHECKS
 9301|       |  std::string username_after(get_username());
 9302|       |  ADA_ASSERT_EQUAL(
 9303|       |      username_expected, username_after,
 9304|       |      "append_base_username problem after inserting " + std::string(input));
 9305|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9306|  1.22k|  ADA_ASSERT_TRUE(validate());
 9307|  1.22k|}
_ZN3ada14url_aggregator16update_base_portEj:
 9433|     47|inline void url_aggregator::update_base_port(uint32_t input) {
 9434|     47|  ada_log("url_aggregator::update_base_port");
 9435|     47|  ADA_ASSERT_TRUE(validate());
 9436|     47|  if (input == url_components::omitted) {
  ------------------
  |  Branch (9436:7): [True: 0, False: 47]
  ------------------
 9437|      0|    clear_port();
 9438|      0|    return;
 9439|      0|  }
 9440|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 9441|       |  // value is probably already available as a string.
 9442|     47|  std::string value = helpers::concat(":", std::to_string(input));
 9443|     47|  uint32_t difference = uint32_t(value.size());
 9444|       |
 9445|     47|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (9445:7): [True: 0, False: 47]
  ------------------
 9446|      0|    difference -= components.pathname_start - components.host_end;
 9447|      0|    buffer.erase(components.host_end,
 9448|      0|                 components.pathname_start - components.host_end);
 9449|      0|  }
 9450|       |
 9451|     47|  buffer.insert(components.host_end, value);
 9452|     47|  components.pathname_start += difference;
 9453|     47|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9453:7): [True: 0, False: 47]
  ------------------
 9454|      0|    components.search_start += difference;
 9455|      0|  }
 9456|     47|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9456:7): [True: 0, False: 47]
  ------------------
 9457|      0|    components.hash_start += difference;
 9458|      0|  }
 9459|     47|  components.port = input;
 9460|     47|  ADA_ASSERT_TRUE(validate());
 9461|     47|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 2463|     47|std::string concat(Args... args) {
 2464|     47|  std::string answer;
 2465|     47|  inner_concat(answer, args...);
 2466|     47|  return answer;
 2467|     47|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 2452|     47|inline void inner_concat(std::string& buffer, T t, Args... args) {
 2453|     47|  buffer.append(t);
 2454|     47|  return inner_concat(buffer, args...);
 2455|     47|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 2444|     47|inline void inner_concat(std::string& buffer, T t) {
 2445|     47|  buffer.append(t);
 2446|     47|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 9104|    596|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 9105|    596|  ada_log("url_aggregator::update_base_search ", input,
 9106|    596|          " with encoding parameter ", to_string(), "\n", to_diagram());
 9107|    596|  ADA_ASSERT_TRUE(validate());
 9108|    596|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9109|       |
 9110|    596|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (9110:7): [True: 596, False: 0]
  ------------------
 9111|    596|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (9111:9): [True: 596, False: 0]
  ------------------
 9112|    596|      components.search_start = uint32_t(buffer.size());
 9113|    596|      buffer += "?";
 9114|    596|    } else {
 9115|      0|      buffer.resize(components.search_start + 1);
 9116|      0|    }
 9117|       |
 9118|    596|    bool encoding_required =
 9119|    596|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 9120|       |    // When encoding_required is false, then buffer is left unchanged, and
 9121|       |    // percent encoding was not deemed required.
 9122|    596|    if (!encoding_required) {
  ------------------
  |  Branch (9122:9): [True: 477, False: 119]
  ------------------
 9123|    477|      buffer.append(input);
 9124|    477|    }
 9125|    596|  } else {
 9126|      0|    const size_t idx =
 9127|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 9128|      0|    std::string encoded;
 9129|      0|    std::string_view replacement = input;
 9130|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (9130:9): [True: 0, False: 0]
  ------------------
 9131|      0|      encoded =
 9132|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 9133|      0|      replacement = encoded;
 9134|      0|    }
 9135|       |
 9136|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9136:9): [True: 0, False: 0]
  ------------------
 9137|      0|      const uint32_t difference = replace_and_resize(
 9138|      0|          components.search_start + 1, components.hash_start, replacement);
 9139|      0|      components.hash_start += difference;
 9140|      0|    } else {
 9141|      0|      components.search_start = components.hash_start;
 9142|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 9143|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (9143:11): [True: 0, False: 0]
  ------------------
 9144|      0|        std::memmove(buffer.data() + components.search_start + 1,
 9145|      0|                     replacement.data(), replacement.size());
 9146|      0|      }
 9147|      0|      components.hash_start +=
 9148|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 9149|      0|    }
 9150|      0|  }
 9151|       |
 9152|    596|  ADA_ASSERT_TRUE(validate());
 9153|    596|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9019|  1.71k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 9020|  1.71k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 9021|  1.71k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 9022|  1.71k|  ADA_ASSERT_TRUE(validate());
 9023|  1.71k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9024|       |
 9025|       |  // This next line is required for when parsing a URL like `foo://`
 9026|  1.71k|  add_authority_slashes_if_needed();
 9027|       |
 9028|  1.71k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 9029|  1.71k|  uint32_t new_difference =
 9030|  1.71k|      replace_and_resize(components.host_start, components.host_end, input);
 9031|       |
 9032|  1.71k|  if (has_credentials) {
  ------------------
  |  Branch (9032:7): [True: 88, False: 1.62k]
  ------------------
 9033|     88|    buffer.insert(components.host_start, "@");
 9034|     88|    new_difference++;
 9035|     88|  }
 9036|  1.71k|  components.host_end += new_difference;
 9037|  1.71k|  components.pathname_start += new_difference;
 9038|  1.71k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9038:7): [True: 0, False: 1.71k]
  ------------------
 9039|      0|    components.search_start += new_difference;
 9040|      0|  }
 9041|  1.71k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9041:7): [True: 0, False: 1.71k]
  ------------------
 9042|      0|    components.hash_start += new_difference;
 9043|      0|  }
 9044|  1.71k|  ADA_ASSERT_TRUE(validate());
 9045|  1.71k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9751|    603|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9752|    603|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9753|    603|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9753:7): [True: 597, False: 6]
  |  Branch (9753:24): [True: 1, False: 596]
  ------------------
 9754|      1|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9755|      1|    is_valid = false;
 9756|      1|    return 0;
 9757|      1|  }
 9758|    602|  uint16_t parsed_port{};
 9759|    602|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9760|    602|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9760:7): [True: 21, False: 581]
  ------------------
 9761|     21|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9762|     21|    is_valid = false;
 9763|     21|    return 0;
 9764|     21|  }
 9765|    581|  ada_log("parse_port: ", parsed_port);
 9766|    581|  const size_t consumed = size_t(r.ptr - view.data());
 9767|    581|  ada_log("parse_port: consumed ", consumed);
 9768|    581|  if (check_trailing_content) {
  ------------------
  |  Branch (9768:7): [True: 581, False: 0]
  ------------------
 9769|    581|    is_valid &=
 9770|    581|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9770:10): [True: 26, False: 555]
  |  Branch (9770:37): [True: 43, False: 512]
  ------------------
 9771|    512|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9771:10): [True: 16, False: 496]
  |  Branch (9771:36): [True: 496, False: 0]
  |  Branch (9771:52): [True: 0, False: 496]
  ------------------
 9772|    581|  }
 9773|    581|  ada_log("parse_port: is_valid = ", is_valid);
 9774|    581|  if (is_valid) {
  ------------------
  |  Branch (9774:7): [True: 85, False: 496]
  ------------------
 9775|     85|    ada_log("parse_port", r.ec == std::errc());
 9776|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9777|     85|    auto default_port = scheme_default_port();
 9778|     85|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9778:27): [True: 0, False: 85]
  |  Branch (9778:48): [True: 0, False: 0]
  ------------------
 9779|     85|                         (default_port != parsed_port);
  ------------------
  |  Branch (9779:26): [True: 84, False: 1]
  ------------------
 9780|     85|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9780:9): [True: 48, False: 37]
  |  Branch (9780:32): [True: 47, False: 1]
  ------------------
 9781|     47|      update_base_port(parsed_port);
 9782|     47|    } else {
 9783|     38|      clear_port();
 9784|     38|    }
 9785|     85|  }
 9786|    581|  return consumed;
 9787|    602|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8871|  6.96k|                                              const uint8_t character_set[]) {
 8872|  6.96k|  const char* data = input.data();
 8873|  6.96k|  const size_t size = input.size();
 8874|       |
 8875|       |  // Process 8 bytes at a time using unrolled loop
 8876|  6.96k|  size_t i = 0;
 8877|  7.36k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8877:10): [True: 598, False: 6.76k]
  ------------------
 8878|    598|    unsigned char chunk[8];
 8879|    598|    std::memcpy(&chunk, data + i,
 8880|    598|                8);  // entices compiler to unconditionally process 8 characters
 8881|       |
 8882|       |    // Check 8 characters at once
 8883|  4.12k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8883:24): [True: 3.72k, False: 399]
  ------------------
 8884|  3.72k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8884:11): [True: 199, False: 3.52k]
  ------------------
 8885|    199|        return i + j;
 8886|    199|      }
 8887|  3.72k|    }
 8888|    598|  }
 8889|       |
 8890|       |  // Handle remaining bytes
 8891|  7.16k|  for (; i < size; i++) {
  ------------------
  |  Branch (8891:10): [True: 554, False: 6.60k]
  ------------------
 8892|    554|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8892:9): [True: 161, False: 393]
  ------------------
 8893|    161|      return i;
 8894|    161|    }
 8895|    554|  }
 8896|       |
 8897|  6.60k|  return size;
 8898|  6.76k|}
_ZN3ada14url_aggregator10clear_portEv:
 9463|     38|inline void url_aggregator::clear_port() {
 9464|     38|  ada_log("url_aggregator::clear_port");
 9465|     38|  ADA_ASSERT_TRUE(validate());
 9466|     38|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (9466:7): [True: 38, False: 0]
  ------------------
 9467|     38|    return;
 9468|     38|  }
 9469|      0|  uint32_t length = components.pathname_start - components.host_end;
 9470|      0|  buffer.erase(components.host_end, length);
 9471|      0|  components.pathname_start -= length;
 9472|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9472:7): [True: 0, False: 0]
  ------------------
 9473|      0|    components.search_start -= length;
 9474|      0|  }
 9475|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9475:7): [True: 0, False: 0]
  ------------------
 9476|      0|    components.hash_start -= length;
 9477|      0|  }
 9478|      0|  components.port = url_components::omitted;
 9479|      0|  ADA_ASSERT_TRUE(validate());
 9480|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9628|  5.00k|    const noexcept {
 9629|  5.00k|  ada_log("url_aggregator::has_authority");
 9630|       |  // Performance: instead of doing this potentially expensive check, we could
 9631|       |  // have a boolean in the struct.
 9632|  5.00k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9632:10): [True: 3.15k, False: 1.84k]
  ------------------
 9633|  3.15k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9633:10): [True: 3.15k, False: 0]
  ------------------
 9634|  3.15k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9634:10): [True: 3.15k, False: 0]
  ------------------
 9635|  5.00k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9708|  1.13k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9709|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9710|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9711|       |  // U+002F (/) followed by U+002E (.) to output.
 9712|  1.13k|  ada_log("url_aggregator::has_dash_dot");
 9713|       |#if ADA_DEVELOPMENT_CHECKS
 9714|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9715|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9716|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9717|       |  if (components.pathname_start == components.host_end + 2) {
 9718|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9719|       |                     buffer[components.host_end + 1] == '.') ||
 9720|       |                    (buffer[components.host_end] == ':' &&
 9721|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9722|       |  }
 9723|       |  if (components.pathname_start == components.host_end + 2 &&
 9724|       |      buffer[components.host_end] == '/' &&
 9725|       |      buffer[components.host_end + 1] == '.') {
 9726|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9727|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9728|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9729|       |  }
 9730|       |#endif
 9731|       |  // Performance: it should be uncommon for components.pathname_start ==
 9732|       |  // components.host_end + 2 to be true. So we put this check first in the
 9733|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9734|       |  // more expensive, but should be uncommon.
 9735|  1.13k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9735:10): [True: 15, False: 1.11k]
  ------------------
 9736|     15|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9736:10): [True: 15, False: 0]
  |  Branch (9736:30): [True: 0, False: 15]
  ------------------
 9737|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9737:10): [True: 0, False: 0]
  ------------------
 9738|  1.13k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4573|  13.1k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4542|  2.81k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4543|  2.81k|    TL_ASSERT(has_value());
  ------------------
  |  | 2595|  2.81k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4543:5): [True: 2.81k, False: 0]
  ------------------
 4544|  2.81k|    return valptr();
 4545|  2.81k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3838|  2.81k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4572|  2.81k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 3170|  13.1k|  ~expected_storage_base() {
 3171|  13.1k|    if (m_has_val) {
  ------------------
  |  Branch (3171:9): [True: 2.51k, False: 10.6k]
  ------------------
 3172|  2.51k|      m_val.~T();
 3173|  2.51k|    }
 3174|  13.1k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 2385|  4.05k|                                                       size_t pos2) {
 2386|       |#if ADA_DEVELOPMENT_CHECKS
 2387|       |  if (pos2 < pos1) {
 2388|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 2389|       |              << std::endl;
 2390|       |    abort();
 2391|       |  }
 2392|       |#endif
 2393|  4.05k|  return input.substr(pos1, pos2 - pos1);
 2394|  4.05k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 9060|    755|    const noexcept {
 9061|    755|  return buffer.size() == components.pathname_start;
 9062|    755|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9677|    538|constexpr bool url_aggregator::has_password() const noexcept {
 9678|    538|  ada_log("url_aggregator::has_password");
 9679|       |  // This function does not care about the length of the password
 9680|    538|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9680:10): [True: 482, False: 56]
  ------------------
 9681|    482|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9681:10): [True: 482, False: 0]
  ------------------
 9682|    538|}
_ZNK3ada14url_aggregator8validateEv:
 9819|  2.51k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9820|  2.51k|  if (!is_valid) {
  ------------------
  |  Branch (9820:7): [True: 0, False: 2.51k]
  ------------------
 9821|      0|    return true;
 9822|      0|  }
 9823|  2.51k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9823:7): [True: 0, False: 2.51k]
  ------------------
 9824|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9825|      0|            to_diagram());
 9826|      0|    return false;
 9827|      0|  }
 9828|       |  // We have a credible components struct, but let us investivate more
 9829|       |  // carefully:
 9830|       |  /**
 9831|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9832|       |   *       |     |    |          | ^^^^|       |   |
 9833|       |   *       |     |    |          | |   |       |   `----- hash_start
 9834|       |   *       |     |    |          | |   |       `--------- search_start
 9835|       |   *       |     |    |          | |   `----------------- pathname_start
 9836|       |   *       |     |    |          | `--------------------- port
 9837|       |   *       |     |    |          `----------------------- host_end
 9838|       |   *       |     |    `---------------------------------- host_start
 9839|       |   *       |     `--------------------------------------- username_end
 9840|       |   *       `--------------------------------------------- protocol_end
 9841|       |   */
 9842|  2.51k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9842:7): [True: 0, False: 2.51k]
  ------------------
 9843|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9844|      0|    return false;
 9845|      0|  }
 9846|  2.51k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9846:7): [True: 0, False: 2.51k]
  ------------------
 9847|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9848|      0|    return false;
 9849|      0|  }
 9850|  2.51k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9850:7): [True: 0, False: 2.51k]
  ------------------
 9851|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9852|      0|    return false;
 9853|      0|  }
 9854|  2.51k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9854:7): [True: 0, False: 2.51k]
  ------------------
 9855|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9856|      0|    return false;
 9857|      0|  }
 9858|  2.51k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9858:7): [True: 0, False: 2.51k]
  ------------------
 9859|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9860|      0|    return false;
 9861|      0|  }
 9862|       |
 9863|  2.51k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9863:7): [True: 0, False: 2.51k]
  ------------------
 9864|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9865|      0|    return false;
 9866|      0|  }
 9867|  2.51k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9867:7): [True: 0, False: 2.51k]
  ------------------
 9868|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9869|      0|    return false;
 9870|      0|  }
 9871|  2.51k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9871:7): [True: 0, False: 2.51k]
  ------------------
 9872|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9873|      0|    return false;
 9874|      0|  }
 9875|  2.51k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9875:7): [True: 0, False: 2.51k]
  ------------------
 9876|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9877|      0|    return false;
 9878|      0|  }
 9879|  2.51k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9879:7): [True: 0, False: 2.51k]
  ------------------
 9880|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9881|      0|            to_diagram());
 9882|      0|    return false;
 9883|      0|  }
 9884|       |
 9885|  2.51k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9885:7): [True: 2.51k, False: 0]
  ------------------
 9886|  2.51k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9886:9): [True: 0, False: 2.51k]
  ------------------
 9887|      0|      ada_log(
 9888|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9889|      0|          to_diagram());
 9890|      0|      return false;
 9891|      0|    }
 9892|  2.51k|  }
 9893|       |
 9894|  2.51k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9894:7): [True: 2.51k, False: 0]
  ------------------
 9895|  2.51k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9895:7): [True: 78, False: 2.43k]
  ------------------
 9896|     78|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9896:9): [True: 72, False: 6]
  ------------------
 9897|     72|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9897:9): [True: 0, False: 72]
  ------------------
 9898|      0|      ada_log(
 9899|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9900|      0|          "\n",
 9901|      0|          to_diagram());
 9902|      0|      return false;
 9903|      0|    }
 9904|     78|  }
 9905|       |
 9906|  2.51k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9906:7): [True: 2.51k, False: 0]
  ------------------
 9907|  2.51k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9907:9): [True: 15, False: 2.50k]
  ------------------
 9908|     15|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9908:11): [True: 0, False: 15]
  ------------------
 9909|      0|        ada_log(
 9910|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9911|      0|            to_diagram());
 9912|      0|        return false;
 9913|      0|      }
 9914|  2.50k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9914:16): [True: 2.50k, False: 0]
  ------------------
 9915|  2.50k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9915:16): [True: 2.50k, False: 0]
  ------------------
 9916|  2.50k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9916:11): [True: 2.42k, False: 72]
  ------------------
 9917|  2.42k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9917:13): [True: 0, False: 2.42k]
  ------------------
 9918|  2.42k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9918:13): [True: 0, False: 2.42k]
  ------------------
 9919|      0|          ada_log(
 9920|      0|              "url_aggregator::validate missing // between protocol and host "
 9921|      0|              "\n",
 9922|      0|              to_diagram());
 9923|      0|          return false;
 9924|      0|        }
 9925|  2.42k|      } else {
 9926|     72|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9926:13): [True: 72, False: 0]
  ------------------
 9927|     72|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9927:13): [True: 0, False: 72]
  ------------------
 9928|      0|          ada_log(
 9929|      0|              "url_aggregator::validate missing @ at the end of the username "
 9930|      0|              "\n",
 9931|      0|              to_diagram());
 9932|      0|          return false;
 9933|      0|        }
 9934|     72|      }
 9935|  2.50k|    } else {
 9936|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9936:11): [True: 0, False: 0]
  ------------------
 9937|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9938|      0|                to_diagram());
 9939|      0|        return false;
 9940|      0|      }
 9941|      0|    }
 9942|  2.51k|  }
 9943|  2.51k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9943:7): [True: 2.51k, False: 0]
  ------------------
 9944|  2.51k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9944:7): [True: 136, False: 2.38k]
  ------------------
 9945|    136|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9945:9): [True: 28, False: 108]
  ------------------
 9946|     28|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9946:9): [True: 0, False: 28]
  ------------------
 9947|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9947:9): [True: 0, False: 0]
  ------------------
 9948|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9948:11): [True: 0, False: 0]
  ------------------
 9949|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9949:11): [True: 0, False: 0]
  ------------------
 9950|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9950:11): [True: 0, False: 0]
  ------------------
 9951|      0|        ada_log(
 9952|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9953|      0|            to_diagram());
 9954|      0|        return false;
 9955|      0|      }
 9956|    136|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9956:16): [True: 0, False: 136]
  ------------------
 9957|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9958|      0|              to_diagram());
 9959|      0|      return false;
 9960|      0|    }
 9961|    136|  }
 9962|  2.51k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9962:7): [True: 2.51k, False: 0]
  ------------------
 9963|  2.51k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9963:7): [True: 2.51k, False: 0]
  ------------------
 9964|  2.51k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9964:7): [True: 2.51k, False: 0]
  |  Branch (9964:60): [True: 2.51k, False: 0]
  ------------------
 9965|  2.51k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9965:9): [True: 0, False: 2.51k]
  ------------------
 9966|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9967|      0|              to_diagram());
 9968|      0|      return false;
 9969|      0|    }
 9970|  2.51k|  }
 9971|  2.51k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9971:7): [True: 690, False: 1.82k]
  ------------------
 9972|    690|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9972:9): [True: 0, False: 690]
  ------------------
 9973|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9974|      0|              to_diagram());
 9975|      0|      return false;
 9976|      0|    }
 9977|    690|  }
 9978|  2.51k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9978:7): [True: 397, False: 2.11k]
  ------------------
 9979|    397|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9979:9): [True: 0, False: 397]
  ------------------
 9980|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9981|      0|              to_diagram());
 9982|      0|      return false;
 9983|      0|    }
 9984|    397|  }
 9985|       |
 9986|  2.51k|  return true;
 9987|  2.51k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 8303|  2.51k|    const noexcept {
 8304|       |  /**
 8305|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 8306|       |   *       |     |    |          | ^^^^|       |   |
 8307|       |   *       |     |    |          | |   |       |   `----- hash_start
 8308|       |   *       |     |    |          | |   |       `--------- search_start
 8309|       |   *       |     |    |          | |   `----------------- pathname_start
 8310|       |   *       |     |    |          | `--------------------- port
 8311|       |   *       |     |    |          `----------------------- host_end
 8312|       |   *       |     |    `---------------------------------- host_start
 8313|       |   *       |     `--------------------------------------- username_end
 8314|       |   *       `--------------------------------------------- protocol_end
 8315|       |   */
 8316|       |  // These conditions can be made more strict.
 8317|  2.51k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (8317:7): [True: 0, False: 2.51k]
  ------------------
 8318|      0|    return false;
 8319|      0|  }
 8320|  2.51k|  uint32_t index = protocol_end;
 8321|       |
 8322|  2.51k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (8322:7): [True: 0, False: 2.51k]
  ------------------
 8323|      0|    return false;
 8324|      0|  }
 8325|  2.51k|  if (username_end < index) {
  ------------------
  |  Branch (8325:7): [True: 0, False: 2.51k]
  ------------------
 8326|      0|    return false;
 8327|      0|  }
 8328|  2.51k|  index = username_end;
 8329|       |
 8330|  2.51k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (8330:7): [True: 0, False: 2.51k]
  ------------------
 8331|      0|    return false;
 8332|      0|  }
 8333|  2.51k|  if (host_start < index) {
  ------------------
  |  Branch (8333:7): [True: 0, False: 2.51k]
  ------------------
 8334|      0|    return false;
 8335|      0|  }
 8336|  2.51k|  index = host_start;
 8337|       |
 8338|  2.51k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (8338:7): [True: 136, False: 2.38k]
  ------------------
 8339|    136|    if (port > 0xffff) {
  ------------------
  |  Branch (8339:9): [True: 0, False: 136]
  ------------------
 8340|      0|      return false;
 8341|      0|    }
 8342|    136|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 8343|    136|    if (index + port_length < index) {
  ------------------
  |  Branch (8343:9): [True: 0, False: 136]
  ------------------
 8344|      0|      return false;
 8345|      0|    }
 8346|    136|    index += port_length;
 8347|    136|  }
 8348|       |
 8349|  2.51k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (8349:7): [True: 0, False: 2.51k]
  ------------------
 8350|      0|    return false;
 8351|      0|  }
 8352|  2.51k|  if (pathname_start < index) {
  ------------------
  |  Branch (8352:7): [True: 0, False: 2.51k]
  ------------------
 8353|      0|    return false;
 8354|      0|  }
 8355|  2.51k|  index = pathname_start;
 8356|       |
 8357|  2.51k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (8357:7): [True: 690, False: 1.82k]
  ------------------
 8358|    690|    if (search_start < index) {
  ------------------
  |  Branch (8358:9): [True: 0, False: 690]
  ------------------
 8359|      0|      return false;
 8360|      0|    }
 8361|    690|    index = search_start;
 8362|    690|  }
 8363|       |
 8364|  2.51k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (8364:7): [True: 397, False: 2.11k]
  ------------------
 8365|    397|    if (hash_start < index) {
  ------------------
  |  Branch (8365:9): [True: 0, False: 397]
  ------------------
 8366|      0|      return false;
 8367|      0|    }
 8368|    397|  }
 8369|       |
 8370|  2.51k|  return true;
 8371|  2.51k|}
_ZN3ada7helpers16fast_digit_countEj:
 2489|    136|inline int fast_digit_count(uint32_t x) noexcept {
 2490|    136|  auto int_log2 = [](uint32_t z) -> int {
 2491|    136|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2492|    136|  };
 2493|       |  // Compiles to very few instructions. Note that the
 2494|       |  // table is static and thus effectively a constant.
 2495|       |  // We leave it inside the function because it is meaningless
 2496|       |  // outside of it (this comes at no performance cost).
 2497|    136|  const static uint64_t table[] = {
 2498|    136|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2499|    136|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2500|    136|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2501|    136|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2502|    136|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2503|    136|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2504|    136|      42949672960, 42949672960};
 2505|    136|  return int((x + table[int_log2(x)]) >> 32);
 2506|    136|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2490|    136|  auto int_log2 = [](uint32_t z) -> int {
 2491|    136|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2492|    136|  };

LLVMFuzzerTestOneInput:
   21|  6.96k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   22|  6.96k|  FuzzedDataProvider fdp(data, size);
   23|       |
   24|       |  // ===== IPv4 Serialization =====
   25|       |  // ipv4() takes a uint64_t (valid addresses are 0..0xFFFFFFFF, but the
   26|       |  // function accepts any value – out-of-range inputs should still be safe).
   27|  6.96k|  uint64_t ipv4_addr = fdp.ConsumeIntegral<uint64_t>();
   28|  6.96k|  std::string ipv4_str = ada::serializers::ipv4(ipv4_addr);
   29|  6.96k|  volatile size_t ipv4_len = ipv4_str.size();
   30|  6.96k|  (void)ipv4_len;
   31|       |
   32|       |  // ===== IPv6 Serialization =====
   33|  6.96k|  std::array<uint16_t, 8> ipv6_addr{};
   34|  55.7k|  for (auto& piece : ipv6_addr) {
  ------------------
  |  Branch (34:20): [True: 55.7k, False: 6.96k]
  ------------------
   35|  55.7k|    piece = fdp.ConsumeIntegral<uint16_t>();
   36|  55.7k|  }
   37|       |
   38|       |  // find_longest_sequence_of_ipv6_pieces: basic invariants must hold.
   39|  6.96k|  size_t compress = 0, compress_length = 0;
   40|  6.96k|  ada::serializers::find_longest_sequence_of_ipv6_pieces(ipv6_addr, compress,
   41|  6.96k|                                                         compress_length);
   42|       |  // The longest run cannot exceed 8 pieces.
   43|  6.96k|  assert(compress_length <= 8);
  ------------------
  |  Branch (43:3): [True: 6.96k, False: 0]
  ------------------
   44|       |  // If a run was found (length > 0) its start index must be in-bounds.
   45|  6.96k|  if (compress_length > 0) {
  ------------------
  |  Branch (45:7): [True: 2.06k, False: 4.90k]
  ------------------
   46|  2.06k|    assert(compress < 8);
  ------------------
  |  Branch (46:5): [True: 2.06k, False: 0]
  ------------------
   47|  2.06k|    assert(compress + compress_length <= 8);
  ------------------
  |  Branch (47:5): [True: 2.06k, False: 0]
  ------------------
   48|  2.06k|  }
   49|       |
   50|  6.96k|  std::string ipv6_str = ada::serializers::ipv6(ipv6_addr);
   51|  6.96k|  volatile size_t ipv6_len = ipv6_str.size();
   52|  6.96k|  (void)ipv6_len;
   53|       |
   54|       |  // Serialized IPv6 must always be a non-empty string.
   55|  6.96k|  assert(!ipv6_str.empty());
  ------------------
  |  Branch (55:3): [True: 6.96k, False: 0]
  ------------------
   56|       |
   57|       |  // ===== Fast IPv4 Parser =====
   58|       |  // try_parse_ipv4_fast() should agree with the full parsing pipeline on its
   59|       |  // output: if it succeeds (result <= 0xFFFFFFFF), re-serializing with
   60|       |  // ipv4() and parsing again must yield the same address value.
   61|  6.96k|  {
   62|  6.96k|    std::string ip_candidate = fdp.ConsumeRandomLengthString(32);
   63|  6.96k|    uint64_t fast_result = ada::checkers::try_parse_ipv4_fast(ip_candidate);
   64|  6.96k|    if (fast_result <= 0xFFFFFFFF) {
  ------------------
  |  Branch (64:9): [True: 75, False: 6.89k]
  ------------------
   65|       |      // Serialize the parsed address and re-parse.
   66|     75|      std::string canonical = ada::serializers::ipv4(fast_result);
   67|     75|      uint64_t recheck = ada::checkers::try_parse_ipv4_fast(canonical);
   68|     75|      if (recheck != fast_result) {
  ------------------
  |  Branch (68:11): [True: 0, False: 75]
  ------------------
   69|      0|        printf(
   70|      0|            "try_parse_ipv4_fast round-trip failure:\n"
   71|      0|            "  input='%s' result=%llu canonical='%s' recheck=%llu\n",
   72|      0|            ip_candidate.c_str(), (unsigned long long)fast_result,
   73|      0|            canonical.c_str(), (unsigned long long)recheck);
   74|      0|        abort();
   75|      0|      }
   76|     75|    }
   77|  6.96k|  }
   78|       |
   79|       |  // ===== Percent Encode / Decode =====
   80|  6.96k|  {
   81|  6.96k|    std::string source = fdp.ConsumeRandomLengthString(128);
   82|       |
   83|       |    // Exercise all six standard character sets used by the URL parser.
   84|  6.96k|    const uint8_t* sets[] = {
   85|  6.96k|        ada::character_sets::C0_CONTROL_PERCENT_ENCODE,
   86|  6.96k|        ada::character_sets::PATH_PERCENT_ENCODE,
   87|  6.96k|        ada::character_sets::QUERY_PERCENT_ENCODE,
   88|  6.96k|        ada::character_sets::FRAGMENT_PERCENT_ENCODE,
   89|  6.96k|        ada::character_sets::USERINFO_PERCENT_ENCODE,
   90|  6.96k|        ada::character_sets::SPECIAL_QUERY_PERCENT_ENCODE,
   91|  6.96k|    };
   92|       |
   93|  41.8k|    for (const uint8_t* charset : sets) {
  ------------------
  |  Branch (93:33): [True: 41.8k, False: 6.96k]
  ------------------
   94|       |      // Two-argument percent_encode: returns the encoded string.
   95|  41.8k|      std::string encoded = ada::unicode::percent_encode(source, charset);
   96|  41.8k|      volatile size_t enc_len = encoded.size();
   97|  41.8k|      (void)enc_len;
   98|       |
   99|       |      // Encoded output must be at least as long as the input (each byte
  100|       |      // either stays the same or expands to %XX – three bytes).
  101|  41.8k|      assert(encoded.size() >= source.size());
  ------------------
  |  Branch (101:7): [True: 41.8k, False: 0]
  ------------------
  102|       |
  103|       |      // Three-argument percent_encode: starts encoding from a given index.
  104|  41.8k|      size_t start_idx = fdp.ConsumeIntegralInRange<size_t>(0, source.size());
  105|  41.8k|      std::string encoded_from =
  106|  41.8k|          ada::unicode::percent_encode(source, charset, start_idx);
  107|  41.8k|      volatile size_t enf_len = encoded_from.size();
  108|  41.8k|      (void)enf_len;
  109|       |
  110|       |      // Template form: percent_encode<false> (replace).
  111|  41.8k|      {
  112|  41.8k|        std::string out;
  113|  41.8k|        bool changed =
  114|  41.8k|            ada::unicode::percent_encode<false>(source, charset, out);
  115|  41.8k|        volatile bool c = changed;
  116|  41.8k|        (void)c;
  117|       |        // When encoding was needed 'out' holds the encoded string; when not,
  118|       |        // 'out' is unchanged (empty). If changed, 'out' must not be shorter.
  119|  41.8k|        if (changed) {
  ------------------
  |  Branch (119:13): [True: 2.07k, False: 39.7k]
  ------------------
  120|  2.07k|          assert(out.size() >= source.size());
  ------------------
  |  Branch (120:11): [True: 2.07k, False: 0]
  ------------------
  121|  2.07k|        }
  122|  41.8k|      }
  123|       |
  124|       |      // Template form: percent_encode<true> (append).
  125|  41.8k|      {
  126|  41.8k|        std::string out = "prefix_";
  127|  41.8k|        size_t prefix_len = out.size();
  128|  41.8k|        ada::unicode::percent_encode<true>(source, charset, out);
  129|       |        // Append mode: 'out' must grow by at least source.size() bytes if
  130|       |        // encoding was needed, or stay unchanged if it wasn't.
  131|  41.8k|        assert(out.size() >= prefix_len);
  ------------------
  |  Branch (131:9): [True: 41.8k, False: 0]
  ------------------
  132|  41.8k|      }
  133|  41.8k|    }
  134|       |
  135|       |    // Percent decode: feed raw fuzz input (may contain invalid sequences).
  136|  6.96k|    {
  137|  6.96k|      size_t pct_pos = source.find('%');
  138|  6.96k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (138:11): [True: 202, False: 6.76k]
  ------------------
  139|    202|        std::string decoded = ada::unicode::percent_decode(source, pct_pos);
  140|       |        // Decoded output can't be longer than the input.
  141|    202|        assert(decoded.size() <= source.size());
  ------------------
  |  Branch (141:9): [True: 202, False: 0]
  ------------------
  142|    202|        volatile size_t dec_len = decoded.size();
  143|    202|        (void)dec_len;
  144|    202|      }
  145|  6.96k|    }
  146|       |
  147|       |    // Round-trip: encode with PATH set, then decode the result; the decoded
  148|       |    // form must equal the original (encoding then decoding is an identity).
  149|  6.96k|    {
  150|  6.96k|      std::string encoded = ada::unicode::percent_encode(
  151|  6.96k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  152|  6.96k|      size_t pct_pos = encoded.find('%');
  153|  6.96k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (153:11): [True: 433, False: 6.53k]
  ------------------
  154|    433|        std::string decoded = ada::unicode::percent_decode(encoded, pct_pos);
  155|       |        // PATH percent-encode does not encode '%', so a source that already
  156|       |        // contains %HH is decoded and the round-trip is not an identity.
  157|    433|        if (source.find('%') == std::string::npos && decoded != source) {
  ------------------
  |  Branch (157:13): [True: 231, False: 202]
  |  Branch (157:54): [True: 0, False: 231]
  ------------------
  158|      0|          printf(
  159|      0|              "percent_encode/decode round-trip failure!\n"
  160|      0|              "  source='%s'\n  encoded='%s'\n  decoded='%s'\n",
  161|      0|              source.c_str(), encoded.c_str(), decoded.c_str());
  162|      0|          abort();
  163|      0|        }
  164|  6.53k|      } else {
  165|       |        // No encoding was needed; the output should equal the input.
  166|  6.53k|        assert(encoded == source);
  ------------------
  |  Branch (166:9): [True: 6.53k, False: 0]
  ------------------
  167|  6.53k|      }
  168|  6.96k|    }
  169|       |
  170|       |    // percent_encode_index: the returned index must be within [0, size].
  171|  6.96k|    {
  172|  6.96k|      size_t idx = ada::unicode::percent_encode_index(
  173|  6.96k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  174|  6.96k|      assert(idx <= source.size());
  ------------------
  |  Branch (174:7): [True: 6.96k, False: 0]
  ------------------
  175|  6.96k|    }
  176|  6.96k|  }
  177|       |
  178|       |  // ===== Checker and Unicode Utility Functions =====
  179|       |  // These are internal helpers used throughout the parser. Fuzzing them
  180|       |  // directly (rather than only through the URL parsing pipeline) ensures
  181|       |  // every edge case is reachable without a valid URL structure.
  182|  6.96k|  {
  183|  6.96k|    std::string util_input = fdp.ConsumeRandomLengthString(128);
  184|       |
  185|       |    // has_tabs_or_newline: any string is valid input.
  186|  6.96k|    volatile bool has_tn = ada::unicode::has_tabs_or_newline(util_input);
  187|  6.96k|    (void)has_tn;
  188|       |
  189|       |    // is_ipv4 assumes a non-empty, lower-cased input, so honor that
  190|       |    // precondition here. Cross-check against URL parsing: if is_ipv4 reports
  191|       |    // true, embedding the string as a hostname in an http:// URL must succeed
  192|       |    // (it must be a parseable IPv4 address).
  193|  6.96k|    if (!util_input.empty()) {
  ------------------
  |  Branch (193:9): [True: 6.08k, False: 880]
  ------------------
  194|  6.08k|      volatile bool is_v4 = ada::checkers::is_ipv4(util_input);
  195|  6.08k|      (void)is_v4;
  196|  6.08k|      if (is_v4) {
  ------------------
  |  Branch (196:11): [True: 5.85k, False: 229]
  ------------------
  197|  5.85k|        std::string ipv4_url = "http://" + util_input + "/";
  198|  5.85k|        auto parsed = ada::parse<ada::url_aggregator>(ipv4_url);
  199|       |        // is_ipv4 reports true only for strings that look like IPv4 addresses;
  200|       |        // the full parser may still reject them (e.g. out-of-range octets), but
  201|       |        // if it accepts them the host type must be IPv4.
  202|  5.85k|        if (parsed) {
  ------------------
  |  Branch (202:13): [True: 2.21k, False: 3.64k]
  ------------------
  203|  2.21k|          volatile bool v = parsed->validate();
  204|  2.21k|          (void)v;
  205|  2.21k|        }
  206|  5.85k|      }
  207|  6.08k|    }
  208|       |
  209|       |    // path_signature: returns a bitmask; must not crash.
  210|  6.96k|    volatile uint8_t sig = ada::checkers::path_signature(util_input);
  211|  6.96k|    (void)sig;
  212|       |
  213|       |    // is_windows_drive_letter: must not crash on short or long inputs.
  214|  6.96k|    volatile bool is_wdl = ada::checkers::is_windows_drive_letter(util_input);
  215|  6.96k|    (void)is_wdl;
  216|       |
  217|       |    // is_normalized_windows_drive_letter
  218|  6.96k|    volatile bool is_nwdl =
  219|  6.96k|        ada::checkers::is_normalized_windows_drive_letter(util_input);
  220|  6.96k|    (void)is_nwdl;
  221|       |
  222|       |    // Consistency: a normalised Windows drive letter is a subset of
  223|       |    // Windows drive letters.
  224|  6.96k|    if (is_nwdl && !is_wdl) {
  ------------------
  |  Branch (224:9): [True: 1, False: 6.96k]
  |  Branch (224:20): [True: 0, False: 1]
  ------------------
  225|      0|      printf(
  226|      0|          "is_normalized_windows_drive_letter implies is_windows_drive_letter"
  227|      0|          " but got inconsistent results for '%s'\n",
  228|      0|          util_input.c_str());
  229|      0|      abort();
  230|      0|    }
  231|       |
  232|       |    // to_lower_ascii: works in-place; must not crash.
  233|  6.96k|    {
  234|  6.96k|      std::string lower_copy = util_input;
  235|  6.96k|      volatile bool all_ascii =
  236|  6.96k|          ada::unicode::to_lower_ascii(lower_copy.data(), lower_copy.size());
  237|  6.96k|      (void)all_ascii;
  238|       |      // The result should be at most as long as the input.
  239|  6.96k|      assert(lower_copy.size() == util_input.size());
  ------------------
  |  Branch (239:7): [True: 6.96k, False: 0]
  ------------------
  240|  6.96k|    }
  241|       |
  242|       |    // contains_forbidden_domain_code_point: must not crash.
  243|  6.96k|    volatile bool has_forbidden =
  244|  6.96k|        ada::unicode::contains_forbidden_domain_code_point(util_input.data(),
  245|  6.96k|                                                           util_input.size());
  246|  6.96k|    (void)has_forbidden;
  247|       |
  248|       |    // contains_forbidden_domain_code_point_or_upper: must not crash.
  249|  6.96k|    volatile uint8_t forbidden_or_upper =
  250|  6.96k|        ada::unicode::contains_forbidden_domain_code_point_or_upper(
  251|  6.96k|            util_input.data(), util_input.size());
  252|  6.96k|    (void)forbidden_or_upper;
  253|       |
  254|       |    // verify_dns_length: must not crash; also check consistency with
  255|       |    // to_ascii output.
  256|  6.96k|    volatile bool dns_ok = ada::checkers::verify_dns_length(util_input);
  257|  6.96k|    (void)dns_ok;
  258|  6.96k|  }
  259|       |
  260|       |  // ===== Integration: embed serialized addresses into real URLs =====
  261|       |  // This exercises the full parsing pipeline with our synthetic addresses
  262|       |  // and verifies that serialization output is always round-trip safe.
  263|      0|  {
  264|       |    // Only valid IPv4 address range (0..0xFFFFFFFF) should embed cleanly.
  265|  6.96k|    if (ipv4_addr <= 0xFFFFFFFF) {
  ------------------
  |  Branch (265:9): [True: 301, False: 6.66k]
  ------------------
  266|    301|      std::string url_str = "http://" + ipv4_str + "/path?q=1";
  267|    301|      auto parsed = ada::parse<ada::url_aggregator>(url_str);
  268|    301|      if (parsed) {
  ------------------
  |  Branch (268:11): [True: 301, False: 0]
  ------------------
  269|    301|        volatile bool v = parsed->validate();
  270|    301|        (void)v;
  271|       |        // The URL's hostname must be the canonical dotted-decimal address.
  272|    301|        std::string host = std::string(parsed->get_hostname());
  273|       |        // host == ipv4_str  (not asserted here because the URL parser may
  274|       |        // normalise the address differently for non-standard values, but it
  275|       |        // must always successfully parse our serialized form).
  276|    301|        (void)host;
  277|    301|      }
  278|    301|    }
  279|       |
  280|       |    // IPv6: wrap in brackets.
  281|  6.96k|    std::string ipv6_url_str = "http://[" + ipv6_str + "]/path";
  282|  6.96k|    auto parsed_ipv6 = ada::parse<ada::url_aggregator>(ipv6_url_str);
  283|  6.96k|    if (parsed_ipv6) {
  ------------------
  |  Branch (283:9): [True: 0, False: 6.96k]
  ------------------
  284|      0|      volatile bool v = parsed_ipv6->validate();
  285|      0|      (void)v;
  286|       |      // Re-parse the href – must be idempotent.
  287|      0|      std::string href = std::string(parsed_ipv6->get_href());
  288|      0|      auto reparsed = ada::parse<ada::url_aggregator>(href);
  289|      0|      if (!reparsed) {
  ------------------
  |  Branch (289:11): [True: 0, False: 0]
  ------------------
  290|      0|        printf("IPv6 URL re-parse failure: '%s'\n", href.c_str());
  291|      0|        abort();
  292|      0|      }
  293|      0|      if (std::string(reparsed->get_href()) != href) {
  ------------------
  |  Branch (293:11): [True: 0, False: 0]
  ------------------
  294|      0|        printf("IPv6 URL re-parse href mismatch: '%s' vs '%s'\n", href.c_str(),
  295|      0|               std::string(reparsed->get_href()).c_str());
  296|      0|        abort();
  297|      0|      }
  298|      0|    }
  299|  6.96k|  }
  300|       |
  301|  6.96k|  return 0;
  302|  6.96k|}

