_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  162|  2.53k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  163|  2.53k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  164|  2.53k|  size_t pos = 0;
  165|  2.53k|  const char32_t* start{utf32_output};
  166|  27.8k|  while (pos < len) {
  ------------------
  |  Branch (166:10): [True: 25.4k, False: 2.38k]
  ------------------
  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.49k, False: 15.9k]
  ------------------
  169|       |                            // bytes, check that they are ascii
  170|  9.49k|      uint64_t v1;
  171|  9.49k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  172|  9.49k|      uint64_t v2;
  173|  9.49k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  174|  9.49k|      uint64_t v{v1 | v2};
  175|  9.49k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (175:11): [True: 813, False: 8.68k]
  ------------------
  176|    813|        size_t final_pos = pos + 16;
  177|  13.8k|        while (pos < final_pos) {
  ------------------
  |  Branch (177:16): [True: 13.0k, False: 813]
  ------------------
  178|  13.0k|          *utf32_output++ = char32_t(buf[pos]);
  179|  13.0k|          pos++;
  180|  13.0k|        }
  181|    813|        continue;
  182|    813|      }
  183|  9.49k|    }
  184|  24.6k|    uint8_t leading_byte = data[pos];  // leading byte
  185|  24.6k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (185:9): [True: 15.6k, False: 8.93k]
  ------------------
  186|       |      // converting one ASCII byte !!!
  187|  15.6k|      *utf32_output++ = char32_t(leading_byte);
  188|  15.6k|      pos++;
  189|  15.6k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (189:16): [True: 3.02k, False: 5.90k]
  ------------------
  190|       |      // We have a two-byte UTF-8
  191|  3.02k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (191:11): [True: 3, False: 3.02k]
  ------------------
  192|      3|        return 0;
  193|      3|      }  // minimal bound checking
  194|  3.02k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (194:11): [True: 34, False: 2.98k]
  ------------------
  195|     34|        return 0;
  196|     34|      }
  197|       |      // range check
  198|  2.98k|      uint32_t code_point =
  199|  2.98k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  200|  2.98k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (200:11): [True: 4, False: 2.98k]
  |  Branch (200:32): [True: 0, False: 2.98k]
  ------------------
  201|      4|        return 0;
  202|      4|      }
  203|  2.98k|      *utf32_output++ = char32_t(code_point);
  204|  2.98k|      pos += 2;
  205|  5.90k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (205:16): [True: 5.50k, False: 403]
  ------------------
  206|       |      // We have a three-byte UTF-8
  207|  5.50k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (207:11): [True: 2, False: 5.50k]
  ------------------
  208|      2|        return 0;
  209|      2|      }  // minimal bound checking
  210|       |
  211|  5.50k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (211:11): [True: 6, False: 5.49k]
  ------------------
  212|      6|        return 0;
  213|      6|      }
  214|  5.49k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (214:11): [True: 3, False: 5.49k]
  ------------------
  215|      3|        return 0;
  216|      3|      }
  217|       |      // range check
  218|  5.49k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  219|  5.49k|                            (data[pos + 1] & 0b00111111) << 6 |
  220|  5.49k|                            (data[pos + 2] & 0b00111111);
  221|  5.49k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (221:11): [True: 6, False: 5.48k]
  |  Branch (221:33): [True: 0, False: 5.48k]
  ------------------
  222|  5.48k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (222:12): [True: 1.02k, False: 4.46k]
  |  Branch (222:35): [True: 1, False: 1.02k]
  ------------------
  223|      7|        return 0;
  224|      7|      }
  225|  5.48k|      *utf32_output++ = char32_t(code_point);
  226|  5.48k|      pos += 3;
  227|  5.48k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (227:16): [True: 339, False: 64]
  ------------------
  228|       |      // we have a 4-byte UTF-8 word.
  229|    339|      if (pos + 3 >= len) {
  ------------------
  |  Branch (229:11): [True: 10, False: 329]
  ------------------
  230|     10|        return 0;
  231|     10|      }  // minimal bound checking
  232|    329|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (232:11): [True: 5, False: 324]
  ------------------
  233|      5|        return 0;
  234|      5|      }
  235|    324|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (235:11): [True: 3, False: 321]
  ------------------
  236|      3|        return 0;
  237|      3|      }
  238|    321|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (238:11): [True: 3, False: 318]
  ------------------
  239|      3|        return 0;
  240|      3|      }
  241|       |
  242|       |      // range check
  243|    318|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  244|    318|                            (data[pos + 1] & 0b00111111) << 12 |
  245|    318|                            (data[pos + 2] & 0b00111111) << 6 |
  246|    318|                            (data[pos + 3] & 0b00111111);
  247|    318|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (247:11): [True: 5, False: 313]
  |  Branch (247:35): [True: 1, False: 312]
  ------------------
  248|      6|        return 0;
  249|      6|      }
  250|    312|      *utf32_output++ = char32_t(code_point);
  251|    312|      pos += 4;
  252|    312|    } else {
  253|     64|      return 0;
  254|     64|    }
  255|  24.6k|  }
  256|  2.38k|  return utf32_output - start;
  257|  2.53k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  272|  2.53k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  273|  2.53k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  274|  2.53k|  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.53k|    return c > -65;
  278|  2.53k|  });
  279|  2.53k|}
_ZN3ada4idna9ascii_mapEPcm:
 5338|    158|void ascii_map(char* input, size_t length) {
 5339|    158|  auto broadcast = [](uint8_t v) -> uint64_t {
 5340|    158|    return 0x101010101010101ull * v;
 5341|    158|  };
 5342|    158|  uint64_t broadcast_80 = broadcast(0x80);
 5343|    158|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5344|    158|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5345|    158|  size_t i = 0;
 5346|       |
 5347|    543|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5347:10): [True: 385, False: 158]
  ------------------
 5348|    385|    uint64_t word{};
 5349|    385|    std::memcpy(&word, input + i, sizeof(word));
 5350|    385|    word ^=
 5351|    385|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5352|    385|    std::memcpy(input + i, &word, sizeof(word));
 5353|    385|  }
 5354|    158|  if (i < length) {
  ------------------
  |  Branch (5354:7): [True: 129, False: 29]
  ------------------
 5355|    129|    uint64_t word{};
 5356|    129|    std::memcpy(&word, input + i, length - i);
 5357|    129|    word ^=
 5358|    129|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5359|    129|    std::memcpy(input + i, &word, length - i);
 5360|    129|  }
 5361|    158|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5365|  3.39k|bool map(std::u32string_view input, std::u32string& out) {
 5366|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5367|  3.39k|  out.clear();
 5368|  3.39k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5368:7): [True: 0, False: 3.39k]
  ------------------
 5369|      0|    return false;
 5370|      0|  }
 5371|       |
 5372|       |  // Pass 1: validate and compute exact output length.
 5373|  3.39k|  size_t out_size = 0;
 5374|  45.1k|  for (char32_t x : input) {
  ------------------
  |  Branch (5374:19): [True: 45.1k, False: 3.22k]
  ------------------
 5375|  45.1k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5376|  45.1k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5376:9): [True: 177, False: 44.9k]
  ------------------
 5377|    177|      return false;
 5378|    177|    }
 5379|  44.9k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5379:9): [True: 34.4k, False: 10.5k]
  ------------------
 5380|  34.4k|      ++out_size;
 5381|  34.4k|      continue;
 5382|  34.4k|    }
 5383|  10.5k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5383:9): [True: 0, False: 10.5k]
  ------------------
 5384|      0|      return false;
 5385|      0|    }
 5386|  10.5k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5387|  10.5k|  }
 5388|       |
 5389|       |  // Pass 2: write into a single allocation.
 5390|  3.22k|  out.resize(out_size);
 5391|  3.22k|  size_t w = 0;
 5392|  44.8k|  for (char32_t x : input) {
  ------------------
  |  Branch (5392:19): [True: 44.8k, False: 3.22k]
  ------------------
 5393|  44.8k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5394|  44.8k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5394:9): [True: 34.3k, False: 10.5k]
  ------------------
 5395|  34.3k|      out[w++] = x;
 5396|  34.3k|      continue;
 5397|  34.3k|    }
 5398|       |    // IGNORED or mapped (status already validated in pass 1).
 5399|  10.5k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5400|  56.6k|    while (*ptr != 0) {
  ------------------
  |  Branch (5400:12): [True: 46.1k, False: 10.5k]
  ------------------
 5401|  46.1k|      out[w++] = utf8_next(ptr);
 5402|  46.1k|    }
 5403|  10.5k|  }
 5404|  3.22k|  return true;
 5405|  3.39k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5499|    842|    const std::u32string_view input) noexcept {
 5500|    842|  bool decomposition_needed{false};
 5501|    842|  size_t additional_elements{0};
 5502|  16.2k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5502:35): [True: 16.2k, False: 842]
  ------------------
 5503|  16.2k|    size_t decomposition_length{0};
 5504|       |
 5505|  16.2k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5505:9): [True: 1.80k, False: 14.4k]
  ------------------
 5506|  1.80k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5506:9): [True: 727, False: 1.07k]
  ------------------
 5507|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5508|    727|      decomposition_length = 2;
 5509|    727|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5509:11): [True: 413, False: 314]
  ------------------
 5510|    413|        decomposition_length = 3;
 5511|    413|      }
 5512|  15.5k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5512:16): [True: 15.5k, False: 0]
  ------------------
 5513|  15.5k|      const uint8_t di = decomposition_index[current_character >> 8];
 5514|  15.5k|      const uint16_t* const decomposition =
 5515|  15.5k|          decomposition_block_row(di) + (current_character % 256);
 5516|  15.5k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5517|  15.5k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5517:11): [True: 2.02k, False: 13.4k]
  |  Branch (5517:41): [True: 0, False: 2.02k]
  ------------------
 5518|      0|        decomposition_length = 0;
 5519|      0|      }
 5520|  15.5k|    }
 5521|  16.2k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5521:9): [True: 2.75k, False: 13.4k]
  ------------------
 5522|  2.75k|      decomposition_needed = true;
 5523|  2.75k|      additional_elements += decomposition_length - 1;
 5524|  2.75k|    }
 5525|  16.2k|  }
 5526|    842|  return {decomposition_needed, additional_elements};
 5527|    842|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5529|    572|void decompose(std::u32string& input, size_t additional_elements) {
 5530|    572|  input.resize(input.size() + additional_elements);
 5531|    572|  for (size_t descending_idx = input.size(),
 5532|    572|              input_count = descending_idx - additional_elements;
 5533|  11.5k|       input_count--;) {
  ------------------
  |  Branch (5533:8): [True: 11.0k, False: 572]
  ------------------
 5534|  11.0k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5534:9): [True: 1.40k, False: 9.61k]
  ------------------
 5535|  1.40k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5535:9): [True: 727, False: 675]
  ------------------
 5536|       |      // Hangul decomposition.
 5537|    727|      char32_t s_index = input[input_count] - hangul_sbase;
 5538|    727|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5538:11): [True: 413, False: 314]
  ------------------
 5539|    413|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5540|    413|      }
 5541|    727|      input[--descending_idx] =
 5542|    727|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5543|    727|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5544|  10.2k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5544:16): [True: 10.2k, False: 0]
  ------------------
 5545|  10.2k|      const uint16_t* decomposition =
 5546|  10.2k|          decomposition_block_row(
 5547|  10.2k|              decomposition_index[input[input_count] >> 8]) +
 5548|  10.2k|          (input[input_count] % 256);
 5549|  10.2k|      uint16_t decomposition_length =
 5550|  10.2k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5551|  10.2k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5551:11): [True: 2.02k, False: 8.25k]
  |  Branch (5551:39): [True: 0, False: 2.02k]
  ------------------
 5552|      0|        decomposition_length = 0;
 5553|      0|      }
 5554|  10.2k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5554:11): [True: 2.02k, False: 8.25k]
  ------------------
 5555|  2.02k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5556|  2.02k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5556:13): [True: 0, False: 2.02k]
  ------------------
 5557|      0|          input[--descending_idx] = input[input_count];
 5558|  2.02k|        } else {
 5559|  6.65k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5559:18): [True: 4.62k, False: 2.02k]
  ------------------
 5560|  4.62k|            input[--descending_idx] =
 5561|  4.62k|                decomposition_data[base + decomposition_length];
 5562|  4.62k|          }
 5563|  2.02k|        }
 5564|  8.25k|      } else {
 5565|  8.25k|        input[--descending_idx] = input[input_count];
 5566|  8.25k|      }
 5567|  10.2k|    } else {
 5568|      0|      input[--descending_idx] = input[input_count];
 5569|      0|    }
 5570|  11.0k|  }
 5571|    572|}
_ZN3ada4idna7get_cccEDi:
 5573|   238k|uint8_t get_ccc(char32_t c) noexcept {
 5574|   238k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5574:7): [True: 0, False: 238k]
  ------------------
 5575|      0|    return 0;
 5576|      0|  }
 5577|   238k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5578|   238k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5580|    842|void sort_marks(std::u32string& input) {
 5581|  19.9k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5581:24): [True: 19.1k, False: 842]
  ------------------
 5582|  19.1k|    uint8_t ccc = get_ccc(input[idx]);
 5583|  19.1k|    if (ccc == 0) {
  ------------------
  |  Branch (5583:9): [True: 14.6k, False: 4.48k]
  ------------------
 5584|  14.6k|      continue;
 5585|  14.6k|    }
 5586|  4.48k|    auto current_character = input[idx];
 5587|  4.48k|    size_t back_idx = idx;
 5588|  15.1k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5588:12): [True: 15.0k, False: 77]
  |  Branch (5588:29): [True: 10.6k, False: 4.41k]
  ------------------
 5589|  10.6k|      input[back_idx] = input[back_idx - 1];
 5590|  10.6k|      back_idx--;
 5591|  10.6k|    }
 5592|  4.48k|    input[back_idx] = current_character;
 5593|  4.48k|  }
 5594|    842|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5596|    842|void decompose_nfc(std::u32string& input) {
 5597|       |  /**
 5598|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5599|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5600|       |   */
 5601|    842|  auto [decomposition_needed, additional_elements] =
 5602|    842|      compute_decomposition_length(input);
 5603|    842|  if (decomposition_needed) {
  ------------------
  |  Branch (5603:7): [True: 572, False: 270]
  ------------------
 5604|    572|    decompose(input, additional_elements);
 5605|    572|  }
 5606|    842|  sort_marks(input);
 5607|    842|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5742|  3.46k|bool is_already_nfc(std::u32string_view input) noexcept {
 5743|  3.46k|  if (input.empty()) {
  ------------------
  |  Branch (5743:7): [True: 0, False: 3.46k]
  ------------------
 5744|      0|    return true;
 5745|      0|  }
 5746|  3.46k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5746:7): [True: 0, False: 3.46k]
  |  Branch (5746:30): [True: 0, False: 0]
  ------------------
 5747|      0|    return false;
 5748|      0|  }
 5749|       |  // 1) A character whose canonical decomposition does not compose back to it is
 5750|       |  //    not NFC: singletons (e.g. U+212B), composition exclusions (e.g. U+0958)
 5751|       |  //    and non-starter decompositions (e.g. U+0344), or one whose
 5752|       |  //    decomposition starts with a code point that composes with the previous
 5753|       |  //    character (e.g. U+1611E U+16121).
 5754|  3.46k|  char32_t previous = 0x110000;  // none
 5755|  71.2k|  for (char32_t c : input) {
  ------------------
  |  Branch (5755:19): [True: 71.2k, False: 3.44k]
  ------------------
 5756|  71.2k|    if (decomposition_is_not_nfc(previous, c)) {
  ------------------
  |  Branch (5756:9): [True: 22, False: 71.2k]
  ------------------
 5757|     22|      return false;
 5758|     22|    }
 5759|  71.2k|    previous = c;
 5760|  71.2k|  }
 5761|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5762|       |  //    trailing class of the previous character's canonical decomposition so a
 5763|       |  //    composite starter followed by a lower-class mark is caught.
 5764|  3.44k|  uint8_t prev_ccc = 0;
 5765|  65.3k|  for (char32_t c : input) {
  ------------------
  |  Branch (5765:19): [True: 65.3k, False: 2.38k]
  ------------------
 5766|  65.3k|    uint8_t ccc = get_ccc(c);
 5767|  65.3k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5767:9): [True: 3.79k, False: 61.5k]
  |  Branch (5767:21): [True: 1.05k, False: 2.74k]
  ------------------
 5768|  1.05k|      return false;
 5769|  1.05k|    }
 5770|  64.3k|    prev_ccc = trailing_ccc(c);
 5771|  64.3k|  }
 5772|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5773|  2.38k|  return !would_compose(input);
 5774|  3.44k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5776|  5.46k|void compose(std::u32string& input) {
 5777|       |  /**
 5778|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5779|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5780|       |   */
 5781|  5.46k|  size_t input_count{0};
 5782|  5.46k|  size_t composition_count{0};
 5783|  23.9k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5783:10): [True: 18.5k, False: 5.46k]
  ------------------
 5784|  18.5k|    input[composition_count] = input[input_count];
 5785|  18.5k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5785:9): [True: 3.65k, False: 14.8k]
  ------------------
 5786|  3.65k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5786:9): [True: 1.02k, False: 2.63k]
  ------------------
 5787|  1.02k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5787:11): [True: 1.00k, False: 23]
  ------------------
 5788|  1.00k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5788:11): [True: 830, False: 171]
  ------------------
 5789|    830|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5789:11): [True: 742, False: 88]
  ------------------
 5790|    742|        input[composition_count] =
 5791|    742|            hangul_sbase +
 5792|    742|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5793|    742|             input[input_count + 1] - hangul_vbase) *
 5794|    742|                hangul_tcount;
 5795|    742|        input_count++;
 5796|    742|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5796:13): [True: 727, False: 15]
  ------------------
 5797|    727|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5797:13): [True: 485, False: 242]
  ------------------
 5798|    485|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5798:13): [True: 440, False: 45]
  ------------------
 5799|    440|          input[composition_count] += input[++input_count] - hangul_tbase;
 5800|    440|        }
 5801|    742|      }
 5802|  17.5k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5802:16): [True: 1.59k, False: 15.9k]
  ------------------
 5803|  1.59k|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5803:16): [True: 0, False: 1.59k]
  ------------------
 5804|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5804:11): [True: 0, False: 0]
  ------------------
 5805|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5805:11): [True: 0, False: 0]
  ------------------
 5806|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5806:11): [True: 0, False: 0]
  ------------------
 5807|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5807:11): [True: 0, False: 0]
  ------------------
 5808|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5809|      0|      }
 5810|  17.5k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5810:16): [True: 17.5k, False: 0]
  ------------------
 5811|  17.5k|      const uint16_t* composition =
 5812|  17.5k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5813|  17.5k|          (input[input_count] % 256);
 5814|  17.5k|      size_t initial_composition_count = composition_count;
 5815|  28.2k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5815:39): [True: 22.8k, False: 5.41k]
  ------------------
 5816|  22.8k|           input_count++) {
 5817|  22.8k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5818|       |
 5819|  22.8k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5819:13): [True: 12.7k, False: 10.0k]
  |  Branch (5819:49): [True: 12.3k, False: 427]
  ------------------
 5820|  12.3k|          int left = composition[0];
 5821|  12.3k|          int right = composition[1];
 5822|  12.3k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5822:15): [True: 0, False: 12.3k]
  |  Branch (5822:27): [True: 0, False: 12.3k]
  ------------------
 5823|  12.3k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5823:15): [True: 0, False: 12.3k]
  ------------------
 5824|      0|            break;
 5825|      0|          }
 5826|  30.3k|          while (left + 2 < right) {
  ------------------
  |  Branch (5826:18): [True: 18.0k, False: 12.3k]
  ------------------
 5827|  18.0k|            int middle = left + (((right - left) >> 1) & ~1);
 5828|  18.0k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5828:17): [True: 8.81k, False: 9.21k]
  ------------------
 5829|  18.0k|                input[input_count + 1]) {
 5830|  8.81k|              left = middle;
 5831|  8.81k|            }
 5832|  18.0k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5832:17): [True: 15.5k, False: 2.48k]
  ------------------
 5833|  18.0k|                input[input_count + 1]) {
 5834|  15.5k|              right = middle;
 5835|  15.5k|            }
 5836|  18.0k|          }
 5837|  12.3k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5837:15): [True: 12.3k, False: 0]
  ------------------
 5838|  12.3k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5838:15): [True: 8.70k, False: 3.60k]
  ------------------
 5839|  12.3k|                  input[input_count + 1]) {
 5840|  8.70k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5841|  8.70k|            input[initial_composition_count] = composed;
 5842|  8.70k|            composition =
 5843|  8.70k|                composition_block_row(composition_index[composed >> 8]) +
 5844|  8.70k|                (composed % 256);
 5845|  8.70k|            continue;
 5846|  8.70k|          }
 5847|  12.3k|        }
 5848|       |
 5849|  14.1k|        if (ccc == 0) {
  ------------------
  |  Branch (5849:13): [True: 12.0k, False: 2.03k]
  ------------------
 5850|  12.0k|          break;
 5851|  12.0k|        }
 5852|  2.03k|        previous_ccc = ccc;
 5853|  2.03k|        input[++composition_count] = input[input_count + 1];
 5854|  2.03k|      }
 5855|  17.5k|    }
 5856|  18.5k|  }
 5857|       |
 5858|  5.46k|  if (composition_count < input_count) {
  ------------------
  |  Branch (5858:7): [True: 5.38k, False: 84]
  ------------------
 5859|  5.38k|    input.resize(composition_count);
 5860|  5.38k|  }
 5861|  5.46k|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5863|    842|bool normalize(std::u32string& input) {
 5864|       |  /**
 5865|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5866|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5867|       |   */
 5868|    842|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5868:7): [True: 0, False: 842]
  |  Branch (5868:27): [True: 0, False: 842]
  ------------------
 5869|    842|      composition_index == nullptr) {
  ------------------
  |  Branch (5869:7): [True: 0, False: 842]
  ------------------
 5870|      0|    return false;
 5871|      0|  }
 5872|    842|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5872:7): [True: 0, False: 842]
  ------------------
 5873|      0|    return true;
 5874|      0|  }
 5875|    842|  decompose_nfc(input);
 5876|    842|  compose(input);
 5877|    842|  return true;
 5878|    842|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5938|  1.13k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5939|  1.13k|  int32_t written_out{0};
 5940|  1.13k|  out.reserve(out.size() + input.size());
 5941|  1.13k|  uint32_t n = initial_n;
 5942|  1.13k|  int32_t i = 0;
 5943|  1.13k|  int32_t bias = initial_bias;
 5944|       |  // grab ascii content
 5945|       |  // RFC 3492 section 6.2: copy the code points before the last delimiter,
 5946|       |  // then consume the delimiter only "if more than zero code points were
 5947|       |  // consumed". With a leading delimiter, b == 0, decoding starts at the
 5948|       |  // delimiter itself, which is not a digit, and fails. This matches the
 5949|       |  // reference implementation in appendix C (`in = b > 0 ? b + 1 : 0`).
 5950|  1.13k|  size_t end_of_ascii = input.find_last_of('-');
 5951|  1.13k|  if (end_of_ascii != std::string_view::npos && end_of_ascii > 0) {
  ------------------
  |  Branch (5951:7): [True: 205, False: 929]
  |  Branch (5951:49): [True: 203, False: 2]
  ------------------
 5952|  1.53k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5952:20): [True: 1.53k, False: 203]
  ------------------
 5953|  1.53k|      if (c >= 0x80) {
  ------------------
  |  Branch (5953:11): [True: 0, False: 1.53k]
  ------------------
 5954|      0|        return false;
 5955|      0|      }
 5956|  1.53k|      out.push_back(c);
 5957|  1.53k|      written_out++;
 5958|  1.53k|    }
 5959|    203|    input.remove_prefix(end_of_ascii + 1);
 5960|    203|  }
 5961|  10.0k|  while (!input.empty()) {
  ------------------
  |  Branch (5961:10): [True: 8.97k, False: 1.06k]
  ------------------
 5962|  8.97k|    int32_t oldi = i;
 5963|  8.97k|    int32_t w = 1;
 5964|  13.1k|    for (int32_t k = base;; k += base) {
 5965|  13.1k|      if (input.empty()) {
  ------------------
  |  Branch (5965:11): [True: 34, False: 13.1k]
  ------------------
 5966|     34|        return false;
 5967|     34|      }
 5968|  13.1k|      uint8_t code_point = input.front();
 5969|  13.1k|      input.remove_prefix(1);
 5970|  13.1k|      int32_t digit = char_to_digit_value(code_point);
 5971|  13.1k|      if (digit < 0) {
  ------------------
  |  Branch (5971:11): [True: 11, False: 13.1k]
  ------------------
 5972|     11|        return false;
 5973|     11|      }
 5974|  13.1k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5974:11): [True: 7, False: 13.1k]
  ------------------
 5975|      7|        return false;
 5976|      7|      }
 5977|  13.1k|      i = i + digit * w;
 5978|  13.1k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5978:19): [True: 2.74k, False: 10.3k]
  |  Branch (5978:38): [True: 9.80k, False: 570]
  ------------------
 5979|  13.1k|      if (digit < t) {
  ------------------
  |  Branch (5979:11): [True: 8.92k, False: 4.20k]
  ------------------
 5980|  8.92k|        break;
 5981|  8.92k|      }
 5982|  4.20k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5982:11): [True: 0, False: 4.20k]
  ------------------
 5983|      0|        return false;
 5984|      0|      }
 5985|  4.20k|      w = w * (base - t);
 5986|  4.20k|    }
 5987|  8.92k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5988|  8.92k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5988:9): [True: 17, False: 8.90k]
  ------------------
 5989|     17|      return false;
 5990|     17|    }
 5991|  8.90k|    n = n + i / (written_out + 1);
 5992|  8.90k|    i = i % (written_out + 1);
 5993|  8.90k|    if (n < 0x80) {
  ------------------
  |  Branch (5993:9): [True: 0, False: 8.90k]
  ------------------
 5994|      0|      return false;
 5995|      0|    }
 5996|  8.90k|    out.insert(out.begin() + i, n);
 5997|  8.90k|    written_out++;
 5998|  8.90k|    ++i;
 5999|  8.90k|  }
 6000|       |  // See https://github.com/whatwg/url/issues/803
 6001|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 6002|  1.06k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (6002:7): [True: 471, False: 594]
  |  Branch (6002:26): [True: 128, False: 343]
  |  Branch (6002:44): [True: 82, False: 46]
  |  Branch (6002:62): [True: 45, False: 37]
  ------------------
 6003|     45|      out[3] == U'-') {
  ------------------
  |  Branch (6003:7): [True: 1, False: 44]
  ------------------
 6004|      1|    return false;
 6005|      1|  }
 6006|  1.06k|  return true;
 6007|  1.06k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 6087|  2.94k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 6088|  2.94k|  out.reserve(input.size() + out.size());
 6089|  2.94k|  uint32_t n = initial_n;
 6090|  2.94k|  int32_t d = 0;
 6091|  2.94k|  int32_t bias = initial_bias;
 6092|  2.94k|  size_t h = 0;
 6093|       |  // first push the ascii content
 6094|  16.2k|  for (uint32_t c : input) {
  ------------------
  |  Branch (6094:19): [True: 16.2k, False: 2.94k]
  ------------------
 6095|  16.2k|    if (c < 0x80) {
  ------------------
  |  Branch (6095:9): [True: 2.51k, False: 13.6k]
  ------------------
 6096|  2.51k|      ++h;
 6097|  2.51k|      out.push_back(char(c));
 6098|  2.51k|    }
 6099|  16.2k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (6099:9): [True: 0, False: 16.2k]
  |  Branch (6099:26): [True: 301, False: 15.9k]
  |  Branch (6099:41): [True: 0, False: 301]
  ------------------
 6100|      0|      return false;
 6101|      0|    }
 6102|  16.2k|  }
 6103|  2.94k|  size_t b = h;
 6104|  2.94k|  if (b > 0) {
  ------------------
  |  Branch (6104:7): [True: 542, False: 2.40k]
  ------------------
 6105|    542|    out.push_back('-');
 6106|    542|  }
 6107|  13.5k|  while (h < input.size()) {
  ------------------
  |  Branch (6107:10): [True: 10.6k, False: 2.94k]
  ------------------
 6108|  10.6k|    uint32_t m = 0x10FFFF;
 6109|  80.5k|    for (auto code_point : input) {
  ------------------
  |  Branch (6109:26): [True: 80.5k, False: 10.6k]
  ------------------
 6110|  80.5k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (6110:11): [True: 45.5k, False: 35.0k]
  |  Branch (6110:30): [True: 17.1k, False: 28.3k]
  ------------------
 6111|  80.5k|    }
 6112|       |
 6113|  10.6k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (6113:9): [True: 0, False: 10.6k]
  ------------------
 6114|      0|      return false;
 6115|      0|    }
 6116|  10.6k|    d = d + int32_t((m - n) * (h + 1));
 6117|  10.6k|    n = m;
 6118|  80.5k|    for (auto c : input) {
  ------------------
  |  Branch (6118:17): [True: 80.5k, False: 10.6k]
  ------------------
 6119|  80.5k|      if (c < n) {
  ------------------
  |  Branch (6119:11): [True: 35.0k, False: 45.5k]
  ------------------
 6120|  35.0k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (6120:13): [True: 0, False: 35.0k]
  ------------------
 6121|      0|          return false;
 6122|      0|        }
 6123|  35.0k|        ++d;
 6124|  35.0k|      }
 6125|  80.5k|      if (c == n) {
  ------------------
  |  Branch (6125:11): [True: 13.6k, False: 66.8k]
  ------------------
 6126|  13.6k|        int32_t q = d;
 6127|  29.7k|        for (int32_t k = base;; k += base) {
 6128|  29.7k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (6128:23): [True: 7.19k, False: 22.5k]
  |  Branch (6128:42): [True: 16.6k, False: 5.93k]
  ------------------
 6129|       |
 6130|  29.7k|          if (q < t) {
  ------------------
  |  Branch (6130:15): [True: 13.6k, False: 16.0k]
  ------------------
 6131|  13.6k|            break;
 6132|  13.6k|          }
 6133|  16.0k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 6134|  16.0k|          q = (q - t) / (base - t);
 6135|  16.0k|        }
 6136|  13.6k|        out.push_back(digit_to_char(q));
 6137|  13.6k|        bias = adapt(d, int32_t(h + 1), h == b);
 6138|  13.6k|        d = 0;
 6139|  13.6k|        ++h;
 6140|  13.6k|      }
 6141|  80.5k|    }
 6142|  10.6k|    ++d;
 6143|  10.6k|    ++n;
 6144|  10.6k|  }
 6145|  2.94k|  return true;
 6146|  2.94k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  4.13k|bool is_label_valid(const std::u32string_view label) {
 6293|  4.13k|  if (label.empty()) {
  ------------------
  |  Branch (6293:7): [True: 0, False: 4.13k]
  ------------------
 6294|      0|    return true;
 6295|      0|  }
 6296|  4.13k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (6296:7): [True: 0, False: 4.13k]
  |  Branch (6296:27): [True: 0, False: 4.13k]
  |  Branch (6296:58): [True: 0, False: 4.13k]
  ------------------
 6297|  4.13k|      dir_final == nullptr || dir_value == nullptr ||
  ------------------
  |  Branch (6297:7): [True: 0, False: 4.13k]
  |  Branch (6297:31): [True: 0, False: 4.13k]
  ------------------
 6298|  4.13k|      joining_start == nullptr || joining_final == nullptr ||
  ------------------
  |  Branch (6298:7): [True: 0, False: 4.13k]
  |  Branch (6298:35): [True: 0, False: 4.13k]
  ------------------
 6299|  4.13k|      joining_value == nullptr) {
  ------------------
  |  Branch (6299:7): [True: 0, False: 4.13k]
  ------------------
 6300|      0|    return false;
 6301|      0|  }
 6302|       |
 6303|       |  ///////////////
 6304|       |  // We have a normalization step which ensures that we are in NFC.
 6305|       |  // If we receive punycode, we normalize and check that the normalized
 6306|       |  // version matches the original.
 6307|       |  // --------------------------------------
 6308|       |  // The label must be in Unicode Normalization Form NFC.
 6309|       |
 6310|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 6311|       |  // ---------------------------------------
 6312|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 6313|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 6314|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 6315|       |
 6316|       |  // This is not necessary because we segment the
 6317|       |  // labels by '.'.
 6318|       |  // ---------------------------------------
 6319|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 6320|       |  // if (label.find('.') != std::string_view::npos) return false;
 6321|       |
 6322|       |  // The label must not begin with a combining mark.
 6323|       |  // Range membership via lower_bound on range end.
 6324|  4.13k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 6325|  4.13k|                                               combining_range_count};
 6326|  4.13k|  const auto comb_it = std::ranges::lower_bound(
 6327|  4.13k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 6328|  4.13k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (6328:7): [True: 4.13k, False: 0]
  |  Branch (6328:7): [True: 87, False: 4.04k]
  |  Branch (6328:37): [True: 87, False: 4.04k]
  ------------------
 6329|     87|    return false;
 6330|     87|  }
 6331|       |  // We verify this next step as part of the mapping:
 6332|       |  // ---------------------------------------------
 6333|       |  // Each code point in the label must only have certain status values
 6334|       |  // according to Section 5, IDNA Mapping Table:
 6335|       |  // - For Transitional Processing, each value must be valid.
 6336|       |  // - For Nontransitional Processing, each value must be either valid or
 6337|       |  // deviation.
 6338|       |
 6339|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6340|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6341|       |  // Applications (IDNA) [IDNA2008].
 6342|  4.04k|  if (!is_contextj_valid(label)) {
  ------------------
  |  Branch (6342:7): [True: 133, False: 3.91k]
  ------------------
 6343|    133|    return false;
 6344|    133|  }
 6345|       |
 6346|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6347|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6348|       |  // Section 2.
 6349|       |
 6350|       |  // The following rule, consisting of six conditions, applies to labels
 6351|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6352|       |  // described in Section 3.  All of the conditions must be satisfied for
 6353|       |  // the rule to be satisfied.
 6354|       |  //
 6355|       |  //  1.  The first character must be a character with Bidi property L, R,
 6356|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6357|       |  //     has the L property, it is an LTR label.
 6358|       |  //
 6359|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6360|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6361|       |  //
 6362|       |  //   3.  In an RTL label, the end of the label must be a character with
 6363|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6364|       |  //       characters with Bidi property NSM.
 6365|       |  //
 6366|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6367|       |  //       vice versa.
 6368|       |  //
 6369|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6370|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6371|       |  //
 6372|       |  //   6.  In an LTR label, the end of the label must be a character with
 6373|       |  //       Bidi property L or EN, followed by zero or more characters with
 6374|       |  //       Bidi property NSM.
 6375|       |
 6376|  3.91k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6377|  3.91k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6377:7): [True: 0, False: 3.91k]
  ------------------
 6378|      0|    return false;
 6379|      0|  }
 6380|       |
 6381|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6382|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6383|       |  // domain names.
 6384|  3.91k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6384:7): [True: 914, False: 3.00k]
  ------------------
 6385|       |    // The first character must be a character with Bidi property L, R,
 6386|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6387|       |    // has the L property, it is an LTR label.
 6388|       |
 6389|    914|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6389:9): [True: 109, False: 805]
  ------------------
 6390|       |      // Eval as LTR
 6391|       |
 6392|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6393|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6394|  1.31k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6394:26): [True: 1.31k, False: 0]
  ------------------
 6395|  1.31k|        const direction d = find_direction(label[i]);
 6396|  1.31k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6396:15): [True: 481, False: 831]
  |  Branch (6396:36): [True: 176, False: 655]
  |  Branch (6396:58): [True: 80, False: 575]
  ------------------
 6397|    575|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6397:15): [True: 87, False: 488]
  |  Branch (6397:37): [True: 77, False: 411]
  |  Branch (6397:59): [True: 114, False: 297]
  ------------------
 6398|    297|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6398:15): [True: 115, False: 182]
  |  Branch (6398:37): [True: 73, False: 109]
  ------------------
 6399|    109|          return false;
 6400|    109|        }
 6401|  1.31k|      }
 6402|       |
 6403|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6404|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6404:13): [True: 0, False: 0]
  |  Branch (6404:41): [True: 0, False: 0]
  ------------------
 6405|      0|        return false;
 6406|      0|      }
 6407|       |
 6408|      0|      return true;
 6409|       |
 6410|    805|    } else {
 6411|       |      // Eval as RTL
 6412|       |
 6413|       |      // The first character must be R or AL; a leading AN (or any other
 6414|       |      // direction) does not start a valid RTL label.
 6415|    805|      const direction first_dir = find_direction(label[0]);
 6416|    805|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6416:11): [True: 544, False: 261]
  |  Branch (6416:40): [True: 24, False: 520]
  ------------------
 6417|     24|        return false;
 6418|     24|      }
 6419|       |
 6420|    781|      bool has_an = false;
 6421|    781|      bool has_en = false;
 6422|  3.81k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6422:26): [True: 3.15k, False: 655]
  ------------------
 6423|  3.15k|        const direction d = find_direction(label[i]);
 6424|       |
 6425|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6426|       |        // versa.
 6427|  3.15k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6427:14): [True: 146, False: 3.01k]
  |  Branch (6427:37): [True: 146, False: 0]
  |  Branch (6427:56): [True: 1, False: 145]
  ------------------
 6428|  3.15k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6428:14): [True: 106, False: 3.05k]
  |  Branch (6428:37): [True: 106, False: 0]
  |  Branch (6428:56): [True: 1, False: 105]
  ------------------
 6429|      2|          return false;
 6430|      2|        }
 6431|       |
 6432|  3.15k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6432:15): [True: 456, False: 2.69k]
  |  Branch (6432:36): [True: 1.63k, False: 1.06k]
  |  Branch (6432:58): [True: 105, False: 957]
  ------------------
 6433|    957|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6433:15): [True: 145, False: 812]
  |  Branch (6433:37): [True: 95, False: 717]
  |  Branch (6433:59): [True: 102, False: 615]
  ------------------
 6434|    615|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6434:15): [True: 93, False: 522]
  |  Branch (6434:37): [True: 104, False: 418]
  |  Branch (6434:59): [True: 192, False: 226]
  ------------------
 6435|    226|              d == direction::NSM)) {
  ------------------
  |  Branch (6435:15): [True: 147, False: 79]
  ------------------
 6436|     79|          return false;
 6437|     79|        }
 6438|       |
 6439|  3.07k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6439:13): [True: 700, False: 2.37k]
  ------------------
 6440|    700|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6440:15): [True: 215, False: 485]
  |  Branch (6440:36): [True: 353, False: 132]
  |  Branch (6440:58): [True: 40, False: 92]
  ------------------
 6441|     92|              d == direction::EN)) {
  ------------------
  |  Branch (6441:15): [True: 47, False: 45]
  ------------------
 6442|     45|          return false;
 6443|     45|        }
 6444|  3.07k|      }
 6445|       |
 6446|    655|      return true;
 6447|    781|    }
 6448|    914|  }
 6449|       |
 6450|  3.00k|  return true;
 6451|  3.91k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6610|  2.69k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6611|  2.69k|  out.clear();
 6612|       |  // The ASCII path is a single same-size copy, so it needs no length bound.
 6613|       |  // Checking first would reject the (longer) ASCII output of a non-ASCII input
 6614|       |  // that was accepted, breaking to_ascii(to_ascii(x)) == to_ascii(x).
 6615|  2.69k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6615:7): [True: 158, False: 2.53k]
  ------------------
 6616|    158|    from_ascii_to_ascii(ut8_string, out);
 6617|    158|    return true;
 6618|    158|  }
 6619|  2.53k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6619:7): [True: 0, False: 2.53k]
  ------------------
 6620|      0|    return false;
 6621|      0|  }
 6622|       |
 6623|       |#ifdef ADA_USE_SIMDUTF
 6624|       |  size_t utf32_length =
 6625|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6626|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6627|       |    return false;
 6628|       |  }
 6629|       |  std::u32string working(utf32_length, U'\0');
 6630|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6631|       |      ut8_string.data(), ut8_string.size(), working.data());
 6632|       |#else
 6633|  2.53k|  size_t utf32_length =
 6634|  2.53k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6635|  2.53k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6635:7): [True: 5, False: 2.53k]
  |  Branch (6635:28): [True: 5, False: 0]
  ------------------
 6636|      5|    return false;
 6637|      5|  }
 6638|  2.53k|  std::u32string working(utf32_length, U'\0');
 6639|  2.53k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6640|  2.53k|      ut8_string.data(), ut8_string.size(), working.data());
 6641|  2.53k|#endif
 6642|  2.53k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6642:7): [True: 150, False: 2.38k]
  |  Branch (6642:35): [True: 0, False: 2.38k]
  ------------------
 6643|    150|    return false;
 6644|    150|  }
 6645|  2.38k|  working.resize(actual_utf32_length);
 6646|       |
 6647|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6648|  2.38k|  std::u32string mapped;
 6649|  2.38k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6649:7): [True: 24, False: 2.35k]
  ------------------
 6650|     24|    return false;
 6651|     24|  }
 6652|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6653|  2.35k|  working.clear();
 6654|       |
 6655|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6656|  2.35k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6656:7): [True: 1.81k, False: 545]
  |  Branch (6656:28): [True: 431, False: 1.38k]
  ------------------
 6657|    431|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6657:9): [True: 0, False: 431]
  ------------------
 6658|      0|      return false;
 6659|      0|    }
 6660|    431|  }
 6661|       |
 6662|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6663|  2.35k|  out.reserve(mapped.size() + 8);
 6664|       |
 6665|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6666|  2.35k|  const char32_t* p = mapped.data();
 6667|  2.35k|  const char32_t* const end = p + mapped.size();
 6668|  2.35k|  std::u32string post_map;
 6669|       |
 6670|  7.75k|  while (p < end) {
  ------------------
  |  Branch (6670:10): [True: 6.29k, False: 1.45k]
  ------------------
 6671|  6.29k|    const char32_t* label_begin = p;
 6672|  62.5k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6672:12): [True: 61.0k, False: 1.45k]
  |  Branch (6672:23): [True: 56.2k, False: 4.84k]
  ------------------
 6673|  56.2k|      ++p;
 6674|  56.2k|    }
 6675|  6.29k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6676|  6.29k|    std::u32string_view label_view(label_begin, label_size);
 6677|  6.29k|    const bool is_last_label = (p == end);
 6678|  6.29k|    if (p < end) {
  ------------------
  |  Branch (6678:9): [True: 4.84k, False: 1.45k]
  ------------------
 6679|  4.84k|      ++p;  // skip dot
 6680|  4.84k|    }
 6681|       |
 6682|  6.29k|    if (label_size == 0) {
  ------------------
  |  Branch (6682:9): [True: 188, False: 6.11k]
  ------------------
 6683|       |      // empty label
 6684|  6.11k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6684:16): [True: 1.14k, False: 4.96k]
  ------------------
 6685|  19.5k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6685:23): [True: 19.5k, False: 1.13k]
  ------------------
 6686|  19.5k|        if (c >= 0x80) {
  ------------------
  |  Branch (6686:13): [True: 10, False: 19.5k]
  ------------------
 6687|     10|          out.clear();
 6688|     10|          return false;
 6689|     10|        }
 6690|  19.5k|      }
 6691|  1.13k|      append_ascii_label(out, label_view);
 6692|  1.13k|      std::string_view puny_segment_ascii(
 6693|  1.13k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6694|  1.13k|      working.clear();
 6695|  1.13k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6695:11): [True: 70, False: 1.06k]
  ------------------
 6696|     70|        out.clear();
 6697|     70|        return false;
 6698|     70|      }
 6699|  1.06k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6699:11): [True: 50, False: 1.01k]
  ------------------
 6700|     50|        out.clear();
 6701|     50|        return false;
 6702|     50|      }
 6703|  1.01k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6703:11): [True: 153, False: 861]
  |  Branch (6703:49): [True: 53, False: 808]
  ------------------
 6704|    206|        out.clear();
 6705|    206|        return false;
 6706|    206|      }
 6707|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6708|    808|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6708:11): [True: 808, False: 0]
  |  Branch (6708:34): [True: 411, False: 397]
  ------------------
 6709|    411|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6709:13): [True: 0, False: 411]
  |  Branch (6709:37): [True: 86, False: 325]
  ------------------
 6710|     86|          out.clear();
 6711|     86|          return false;
 6712|     86|        }
 6713|    411|      }
 6714|    722|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6714:11): [True: 0, False: 722]
  |  Branch (6714:31): [True: 16, False: 706]
  ------------------
 6715|     16|        out.clear();
 6716|     16|        return false;
 6717|     16|      }
 6718|  4.96k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6718:16): [True: 1.55k, False: 3.41k]
  ------------------
 6719|  1.55k|      append_ascii_label(out, label_view);
 6720|  3.41k|    } else {
 6721|  3.41k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6721:11): [True: 463, False: 2.94k]
  ------------------
 6722|    463|        out.clear();
 6723|    463|        return false;
 6724|    463|      }
 6725|  2.94k|      out.append("xn--");
 6726|  2.94k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6726:11): [True: 0, False: 2.94k]
  ------------------
 6727|      0|        out.clear();
 6728|      0|        return false;
 6729|      0|      }
 6730|  2.94k|    }
 6731|  5.39k|    if (!is_last_label) {
  ------------------
  |  Branch (6731:9): [True: 3.95k, False: 1.44k]
  ------------------
 6732|  3.95k|      out.push_back('.');
 6733|  3.95k|    }
 6734|  5.39k|  }
 6735|  1.45k|  return true;
 6736|  2.35k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6738|  2.69k|std::string to_ascii(std::string_view ut8_string) {
 6739|  2.69k|  std::string out;
 6740|  2.69k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6740:7): [True: 1.08k, False: 1.61k]
  ------------------
 6741|  1.08k|    return {};
 6742|  1.08k|  }
 6743|  1.61k|  return out;
 6744|  2.69k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7617|  46.2k|                    std::string& out) {
 7618|  46.2k|  ada_log("percent_encode ", input, " to output string while ",
 7619|  46.2k|          append ? "appending" : "overwriting");
 7620|  46.2k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|  46.2k|    return character_sets::bit_at(character_set, c);
 7622|  46.2k|  });
 7623|  46.2k|  ada_log("percent_encode done checking, moved to ",
 7624|  46.2k|          std::distance(input.begin(), pointer));
 7625|       |
 7626|       |  // Optimization: Don't iterate if percent encode is not required
 7627|  46.2k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7627:7): [True: 43.0k, False: 3.19k]
  ------------------
 7628|  43.0k|    ada_log("percent_encode encoding not needed.");
 7629|  43.0k|    return false;
 7630|  43.0k|  }
 7631|       |  if constexpr (!append) {
 7632|       |    out.clear();
 7633|       |  }
 7634|  3.19k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7635|  3.19k|          " bytes");
 7636|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7637|  3.19k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7638|  3.19k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7639|  3.19k|          " bytes");
 7640|  63.4k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7640:10): [True: 60.3k, False: 3.19k]
  ------------------
 7641|  60.3k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7641:9): [True: 31.5k, False: 28.7k]
  ------------------
 7642|  31.5k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7643|  31.5k|    } else {
 7644|  28.7k|      out += *pointer;
 7645|  28.7k|    }
 7646|  60.3k|  }
 7647|  3.19k|  return true;
 7648|  46.2k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7617|  42.3k|                    std::string& out) {
 7618|  42.3k|  ada_log("percent_encode ", input, " to output string while ",
 7619|  42.3k|          append ? "appending" : "overwriting");
 7620|  42.3k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|  42.3k|    return character_sets::bit_at(character_set, c);
 7622|  42.3k|  });
 7623|  42.3k|  ada_log("percent_encode done checking, moved to ",
 7624|  42.3k|          std::distance(input.begin(), pointer));
 7625|       |
 7626|       |  // Optimization: Don't iterate if percent encode is not required
 7627|  42.3k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7627:7): [True: 40.2k, False: 2.02k]
  ------------------
 7628|  40.2k|    ada_log("percent_encode encoding not needed.");
 7629|  40.2k|    return false;
 7630|  40.2k|  }
 7631|  2.02k|  if constexpr (!append) {
 7632|  2.02k|    out.clear();
 7633|  2.02k|  }
 7634|  2.02k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7635|  2.02k|          " bytes");
 7636|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7637|  2.02k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7638|  2.02k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7639|  2.02k|          " bytes");
 7640|  52.8k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7640:10): [True: 50.8k, False: 2.02k]
  ------------------
 7641|  50.8k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7641:9): [True: 25.2k, False: 25.6k]
  ------------------
 7642|  25.2k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7643|  25.6k|    } else {
 7644|  25.6k|      out += *pointer;
 7645|  25.6k|    }
 7646|  50.8k|  }
 7647|  2.02k|  return true;
 7648|  42.3k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7448|  1.03k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7449|       |  // next line is for safety only, we expect users to avoid calling
 7450|       |  // percent_decode when first_percent is outside the range.
 7451|  1.03k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7451:7): [True: 0, False: 1.03k]
  ------------------
 7452|      0|    return std::string(input);
 7453|      0|  }
 7454|       |
 7455|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7456|  1.03k|  const char* const src = input.data();
 7457|  1.03k|  const char* const end = src + input.size();
 7458|       |
 7459|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7460|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7461|       |  // byte-at-a-time appends of the naive version.
 7462|  1.03k|  std::string out(input.size(), '\0');
 7463|  1.03k|  char* d = out.data();
 7464|  1.03k|  char* const d0 = d;
 7465|       |
 7466|  1.03k|  std::memcpy(d, src, first_percent);
 7467|  1.03k|  d += first_percent;
 7468|       |
 7469|  1.03k|  const char* p = src + first_percent;
 7470|  6.35k|  while (p < end) {
  ------------------
  |  Branch (7470:10): [True: 5.31k, False: 1.03k]
  ------------------
 7471|  5.31k|    if (*p == '%') {
  ------------------
  |  Branch (7471:9): [True: 3.25k, False: 2.06k]
  ------------------
 7472|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7473|  8.16k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7473:14): [True: 7.58k, False: 575]
  |  Branch (7473:29): [True: 6.73k, False: 846]
  ------------------
 7474|  6.73k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7474:13): [True: 1.04k, False: 5.69k]
  |  Branch (7474:42): [True: 790, False: 4.90k]
  ------------------
 7475|  1.83k|          break;
 7476|  1.83k|        }
 7477|  4.90k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7478|  4.90k|                                 convert_hex_to_binary(p[2]));
 7479|  4.90k|        p += 3;
 7480|  4.90k|      }
 7481|  3.25k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7481:11): [True: 2.93k, False: 315]
  |  Branch (7481:22): [True: 1.97k, False: 963]
  ------------------
 7482|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7483|       |        // literally and keep scanning after it.
 7484|  1.97k|        *d++ = *p++;
 7485|  1.97k|      }
 7486|  3.25k|    } else {
 7487|  2.06k|      const char* q = static_cast<const char*>(
 7488|  2.06k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7489|  2.06k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7489:29): [True: 1.43k, False: 631]
  ------------------
 7490|  2.06k|      const size_t n = static_cast<size_t>(run_end - p);
 7491|  2.06k|      std::memcpy(d, p, n);
 7492|  2.06k|      d += n;
 7493|  2.06k|      p = run_end;
 7494|  2.06k|    }
 7495|  5.31k|  }
 7496|       |
 7497|  1.03k|  out.resize(static_cast<size_t>(d - d0));
 7498|  1.03k|  return out;
 7499|  1.03k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7587|  50.8k|                           const uint8_t character_set[]) {
 7588|  50.8k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7589|  50.8k|    return character_sets::bit_at(character_set, c);
 7590|  50.8k|  });
 7591|       |  // Optimization: Don't iterate if percent encode is not required
 7592|  50.8k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7592:7): [True: 48.1k, False: 2.67k]
  ------------------
 7593|  48.1k|    return std::string(input);
 7594|  48.1k|  }
 7595|       |
 7596|  2.67k|  std::string result;
 7597|  2.67k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7598|       |                                   // produce 3 characters.
 7599|  2.67k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7600|  2.67k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7600:7): [True: 556, False: 2.11k]
  ------------------
 7601|    556|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7602|    556|                          result);
 7603|  2.11k|  } else {
 7604|  26.1k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7604:12): [True: 23.9k, False: 2.11k]
  ------------------
 7605|  23.9k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7605:11): [True: 13.8k, False: 10.1k]
  ------------------
 7606|  13.8k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7607|  13.8k|      } else {
 7608|  10.1k|        result += *pointer;
 7609|  10.1k|      }
 7610|  23.9k|    }
 7611|  2.11k|  }
 7612|  2.67k|  return result;
 7613|  50.8k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7658|  2.69k|              size_t first_percent) {
 7659|  2.69k|  std::string percent_decoded_buffer;
 7660|  2.69k|  std::string_view input = plain;
 7661|  2.69k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7661:7): [True: 124, False: 2.57k]
  ------------------
 7662|    124|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7663|    124|    input = percent_decoded_buffer;
 7664|    124|  }
 7665|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7666|  2.69k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7667|  2.69k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7667:7): [True: 1.08k, False: 1.61k]
  |  Branch (7667:29): [True: 202, False: 1.41k]
  ------------------
 7668|  1.61k|                                idna_ascii.data(), idna_ascii.size())) {
 7669|  1.28k|    return false;
 7670|  1.28k|  }
 7671|  1.41k|  out = std::move(idna_ascii);
 7672|  1.41k|  return true;
 7673|  2.69k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7676|  42.3k|                           const uint8_t character_set[], size_t index) {
 7677|  42.3k|  std::string out;
 7678|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7679|  42.3k|  out.append(input.data(), index);
 7680|  42.3k|  auto pointer = input.begin() + index;
 7681|  42.3k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7681:7): [True: 794, False: 41.5k]
  ------------------
 7682|    794|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7683|    794|                          out);
 7684|  41.5k|  } else {
 7685|  59.1k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7685:12): [True: 17.6k, False: 41.5k]
  ------------------
 7686|  17.6k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7686:11): [True: 7.27k, False: 10.3k]
  ------------------
 7687|  7.27k|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7688|  10.3k|      } else {
 7689|  10.3k|        out += *pointer;
 7690|  10.3k|      }
 7691|  17.6k|    }
 7692|  41.5k|  }
 7693|  42.3k|  return out;
 7694|  42.3k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7992|  1.35k|                           const uint8_t character_set[], std::string& out) {
 7993|  1.35k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7994|  1.35k|#ifdef ADA_UNICODE_NEED_SSSE3_TARGET
 7995|  1.35k|  static const bool ssse3_supported = __builtin_cpu_supports("ssse3") != 0;
 7996|  1.35k|  const bool use_wide = ssse3_supported;
 7997|       |#else
 7998|       |  const bool use_wide = true;
 7999|       |#endif
 8000|  1.35k|  if (use_wide && static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (8000:7): [True: 1.35k, False: 0]
  |  Branch (8000:19): [True: 1.35k, False: 0]
  ------------------
 8001|  1.35k|    percent_encode_to_wide(p, end, character_set, out);
 8002|  1.35k|    return;
 8003|  1.35k|  }
 8004|      0|#endif
 8005|      0|  percent_encode_to_scalar(p, end, character_set, out);
 8006|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 8071|  14.1k|    size_t& compress_length) noexcept {
 8072|  14.1k|  compress = 0;
 8073|  14.1k|  compress_length = 0;
 8074|  14.1k|  size_t i = 0;
 8075|   120k|  while (i < 8) {
  ------------------
  |  Branch (8075:10): [True: 106k, False: 14.1k]
  ------------------
 8076|   106k|    if (address[i] != 0) {
  ------------------
  |  Branch (8076:9): [True: 102k, False: 4.78k]
  ------------------
 8077|   102k|      ++i;
 8078|   102k|      continue;
 8079|   102k|    }
 8080|  4.78k|    size_t next = i + 1;
 8081|  10.9k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (8081:12): [True: 10.1k, False: 796]
  |  Branch (8081:24): [True: 6.16k, False: 3.98k]
  ------------------
 8082|  6.16k|      ++next;
 8083|  6.16k|    }
 8084|  4.78k|    const size_t count = next - i;
 8085|  4.78k|    if (count > compress_length) {
  ------------------
  |  Branch (8085:9): [True: 4.26k, False: 515]
  ------------------
 8086|  4.26k|      compress_length = count;
 8087|  4.26k|      compress = i;
 8088|  4.26k|    }
 8089|  4.78k|    i = next;
 8090|  4.78k|  }
 8091|  14.1k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 8093|  7.07k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 8094|  7.07k|  size_t compress = 0;
 8095|  7.07k|  size_t compress_length = 0;
 8096|  7.07k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 8097|       |
 8098|       |  // Skip compression when the longest zero run is a single piece.
 8099|  7.07k|  if (compress_length <= 1) {
  ------------------
  |  Branch (8099:7): [True: 6.04k, False: 1.02k]
  ------------------
 8100|  6.04k|    compress = compress_length = 8;
 8101|  6.04k|  }
 8102|       |
 8103|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 8104|  7.07k|  char output[4 * 8 + 7 + 2];
 8105|  7.07k|  char* point = output;
 8106|  7.07k|  *point++ = '[';
 8107|  7.07k|  size_t piece_index = 0;
 8108|  52.8k|  while (true) {
  ------------------
  |  Branch (8108:10): [True: 52.8k, Folded]
  ------------------
 8109|  52.8k|    if (piece_index == compress) {
  ------------------
  |  Branch (8109:9): [True: 1.02k, False: 51.7k]
  ------------------
 8110|  1.02k|      *point++ = ':';
 8111|       |      // If we skip a value initially, we need to write '::'.
 8112|  1.02k|      if (piece_index == 0) {
  ------------------
  |  Branch (8112:11): [True: 423, False: 605]
  ------------------
 8113|    423|        *point++ = ':';
 8114|    423|      }
 8115|  1.02k|      piece_index += compress_length;
 8116|  1.02k|      if (piece_index == 8) {
  ------------------
  |  Branch (8116:11): [True: 336, False: 692]
  ------------------
 8117|    336|        break;
 8118|    336|      }
 8119|  1.02k|    }
 8120|  52.4k|    point = write_hex_u16(point, address[piece_index]);
 8121|  52.4k|    ++piece_index;
 8122|  52.4k|    if (piece_index == 8) {
  ------------------
  |  Branch (8122:9): [True: 6.74k, False: 45.7k]
  ------------------
 8123|  6.74k|      break;
 8124|  6.74k|    }
 8125|  45.7k|    *point++ = ':';
 8126|  45.7k|  }
 8127|  7.07k|  *point++ = ']';
 8128|  7.07k|  return std::string(output, static_cast<size_t>(point - output));
 8129|  7.07k|}
_ZN3ada11serializers4ipv4Em:
 8131|  7.77k|std::string ipv4(const uint64_t address) {
 8132|  7.77k|  std::string output(15, '\0');
 8133|  7.77k|  char* point = output.data();
 8134|  7.77k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 8135|  7.77k|  *point++ = '.';
 8136|  7.77k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 8137|  7.77k|  *point++ = '.';
 8138|  7.77k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 8139|  7.77k|  *point++ = '.';
 8140|  7.77k|  point = write_u8(point, static_cast<uint8_t>(address));
 8141|  7.77k|  output.resize(static_cast<size_t>(point - output.data()));
 8142|  7.77k|  return output;
 8143|  7.77k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8547|  13.3k|    std::string_view input, const result_type* base_url) {
 8548|  13.3k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8549|  13.3k|  if (!u.is_valid) {
  ------------------
  |  Branch (8549:7): [True: 10.7k, False: 2.57k]
  ------------------
 8550|  10.7k|    return tl::unexpected(errors::type_error);
 8551|  10.7k|  }
 8552|  2.57k|  return u;
 8553|  13.3k|}
_ZN3ada20get_max_input_lengthEv:
 8168|  13.3k|uint32_t get_max_input_length() {
 8169|  13.3k|  return max_input_length_.load(std::memory_order_relaxed);
 8170|  13.3k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9535|  11.9k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9536|  11.9k|  while (!input.empty() &&
  ------------------
  |  Branch (9536:10): [True: 11.9k, False: 0]
  ------------------
 9537|  11.9k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9537:10): [True: 0, False: 11.9k]
  ------------------
 9538|      0|    input.remove_prefix(1);
 9539|      0|  }
 9540|  11.9k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9540:10): [True: 11.9k, False: 0]
  |  Branch (9540:28): [True: 0, False: 11.9k]
  ------------------
 9541|      0|    input.remove_suffix(1);
 9542|      0|  }
 9543|  11.9k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9707|      7|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9708|      7|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9709|      7|          input1.size(), " bytes] is part of string '", input2, "' [",
 9710|      7|          input2.size(), " bytes]");
 9711|      7|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9711:10): [True: 7, False: 0]
  |  Branch (9711:29): [True: 7, False: 0]
  |  Branch (9711:48): [True: 7, False: 0]
  ------------------
 9712|      7|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9712:10): [True: 0, False: 7]
  ------------------
 9713|      7|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12262|  4.68k|                                                result_type& out) {
12263|  4.68k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12264|  4.68k|  constexpr bool is_aggregator =
12265|  4.68k|      std::is_same_v<result_type, ada::url_aggregator>;
12266|  4.68k|  static_assert(is_ada_url || is_aggregator);
12267|       |
12268|  4.68k|  const size_t len = input.size();
12269|       |  // Shortest accepted form is "ws://x" (6).
12270|  4.68k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12270:7): [True: 0, False: 4.68k]
  ------------------
12271|      0|    return false;
12272|      0|  }
12273|  4.68k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12274|       |
12275|  4.68k|  size_t pos = 0;
12276|  4.68k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12277|  4.68k|  uint32_t protocol_end = 0;
12278|  4.68k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12279|  4.68k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12280|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12281|       |  // Masked compares cover the shorter special schemes without extra loads.
12282|  4.68k|  if (len >= 8) {
  ------------------
  |  Branch (12282:7): [True: 4.68k, False: 0]
  ------------------
12283|  4.68k|    uint64_t first8 = 0;
12284|  4.68k|    std::memcpy(&first8, b, 8);
12285|  4.68k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12285:9): [True: 0, False: 4.68k]
  ------------------
12286|      0|      pos = 8;
12287|      0|      scheme_type = ada::scheme::type::HTTPS;
12288|      0|      protocol_end = 6;
12289|  4.68k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12289:16): [True: 4.68k, False: 0]
  ------------------
12290|  4.68k|               0x002f2f3a70747468ull) {  // "http://"
12291|  4.68k|      pos = 7;
12292|  4.68k|      scheme_type = ada::scheme::type::HTTP;
12293|  4.68k|      protocol_end = 5;
12294|  4.68k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12294:16): [True: 0, False: 0]
  ------------------
12295|      0|               0x00002f2f3a737377ull) {  // "wss://"
12296|      0|      pos = 6;
12297|      0|      scheme_type = ada::scheme::type::WSS;
12298|      0|      protocol_end = 4;
12299|      0|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12299:16): [True: 0, False: 0]
  ------------------
12300|      0|               0x00002f2f3a707466ull) {  // "ftp://"
12301|      0|      pos = 6;
12302|      0|      scheme_type = ada::scheme::type::FTP;
12303|      0|      protocol_end = 4;
12304|      0|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12304:16): [True: 0, False: 0]
  ------------------
12305|      0|               0x0000002f2f3a7377ull) {  // "ws://"
12306|      0|      pos = 5;
12307|      0|      scheme_type = ada::scheme::type::WS;
12308|      0|      protocol_end = 3;
12309|      0|    } else {
12310|      0|      return false;
12311|      0|    }
12312|  4.68k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12312:14): [True: 0, False: 0]
  |  Branch (12312:29): [True: 0, False: 0]
  ------------------
12313|      0|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12313:9): [True: 0, False: 0]
  |  Branch (12313:24): [True: 0, False: 0]
  |  Branch (12313:39): [True: 0, False: 0]
  ------------------
12314|      0|      pos = 5;
12315|      0|      scheme_type = ada::scheme::type::WS;
12316|      0|      protocol_end = 3;
12317|      0|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12317:16): [True: 0, False: 0]
  |  Branch (12317:31): [True: 0, False: 0]
  |  Branch (12317:46): [True: 0, False: 0]
  |  Branch (12317:61): [True: 0, False: 0]
  ------------------
12318|      0|      pos = 6;
12319|      0|      scheme_type = ada::scheme::type::WSS;
12320|      0|      protocol_end = 4;
12321|      0|    } else {
12322|      0|      return false;
12323|      0|    }
12324|      0|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12324:14): [True: 0, False: 0]
  |  Branch (12324:29): [True: 0, False: 0]
  |  Branch (12324:44): [True: 0, False: 0]
  |  Branch (12324:59): [True: 0, False: 0]
  ------------------
12325|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12325:14): [True: 0, False: 0]
  |  Branch (12325:29): [True: 0, False: 0]
  ------------------
12326|      0|    pos = 6;
12327|      0|    scheme_type = ada::scheme::type::FTP;
12328|      0|    protocol_end = 4;
12329|      0|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12329:14): [True: 0, False: 0]
  |  Branch (12329:26): [True: 0, False: 0]
  |  Branch (12329:41): [True: 0, False: 0]
  |  Branch (12329:56): [True: 0, False: 0]
  ------------------
12330|      0|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12330:14): [True: 0, False: 0]
  |  Branch (12330:29): [True: 0, False: 0]
  |  Branch (12330:44): [True: 0, False: 0]
  |  Branch (12330:59): [True: 0, False: 0]
  ------------------
12331|      0|    pos = 7;
12332|      0|    scheme_type = ada::scheme::type::HTTP;
12333|      0|    protocol_end = 5;
12334|      0|  } else {
12335|      0|    return false;
12336|      0|  }
12337|       |#else
12338|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12339|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12340|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12341|       |    pos = 8;
12342|       |    scheme_type = ada::scheme::type::HTTPS;
12343|       |    protocol_end = 6;
12344|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12345|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12346|       |    pos = 7;
12347|       |    scheme_type = ada::scheme::type::HTTP;
12348|       |    protocol_end = 5;
12349|       |  } else if (b[0] == 'w' && b[1] == 's') {
12350|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12351|       |      pos = 5;
12352|       |      scheme_type = ada::scheme::type::WS;
12353|       |      protocol_end = 3;
12354|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12355|       |               b[5] == '/') {
12356|       |      pos = 6;
12357|       |      scheme_type = ada::scheme::type::WSS;
12358|       |      protocol_end = 4;
12359|       |    } else {
12360|       |      return false;
12361|       |    }
12362|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12363|       |             b[4] == '/' && b[5] == '/') {
12364|       |    pos = 6;
12365|       |    scheme_type = ada::scheme::type::FTP;
12366|       |    protocol_end = 4;
12367|       |  } else {
12368|       |    return false;
12369|       |  }
12370|       |#endif
12371|  4.68k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12371:7): [True: 4.68k, False: 0]
  |  Branch (12371:21): [True: 21, False: 4.66k]
  |  Branch (12371:38): [True: 6, False: 4.65k]
  ------------------
12372|     27|    return false;
12373|     27|  }
12374|       |
12375|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12376|  4.65k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12376:7): [True: 4.65k, False: 0]
  |  Branch (12376:22): [True: 3.85k, False: 804]
  |  Branch (12376:39): [True: 0, False: 3.85k]
  |  Branch (12376:57): [True: 0, False: 4.65k]
  ------------------
12377|      0|    return false;
12378|      0|  }
12379|       |
12380|  4.65k|  const size_t host_start = pos;
12381|  4.65k|  bool has_upper = false;
12382|  4.65k|  bool has_x = false;
12383|  4.65k|  size_t host_end = pos;
12384|  4.65k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12384:7): [True: 2.72k, False: 1.92k]
  ------------------
12385|  2.72k|    return false;
12386|  2.72k|  }
12387|  1.92k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12387:7): [True: 10, False: 1.91k]
  ------------------
12388|     10|    return false;
12389|     10|  }
12390|  1.91k|  const size_t host_len = host_end - host_start;
12391|  1.91k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12391:7): [True: 0, False: 1.91k]
  ------------------
12392|      0|    return false;
12393|      0|  }
12394|  1.91k|  {
12395|  1.91k|    std::string_view hv(input.data() + host_start, host_len);
12396|  1.91k|    char host_buf[256];
12397|  1.91k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12397:9): [True: 440, False: 1.47k]
  ------------------
12398|    440|      std::memcpy(host_buf, input.data() + host_start, host_len);
12399|    440|      unicode::to_lower_ascii(host_buf, host_len);
12400|    440|      hv = std::string_view(host_buf, host_len);
12401|    440|    }
12402|  1.91k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12402:9): [True: 242, False: 1.67k]
  ------------------
12403|    242|      return false;
12404|    242|    }
12405|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12406|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12407|  1.67k|    static constexpr std::string_view xn{"xn-", 3};
12408|  1.67k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12408:10): [True: 200, False: 1.47k]
  |  Branch (12408:19): [True: 261, False: 1.21k]
  |  Branch (12408:33): [True: 22, False: 439]
  ------------------
12409|     22|        [[unlikely]] {
12410|     22|      return false;
12411|     22|    }
12412|  1.67k|  }
12413|       |
12414|  1.65k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12414:7): [True: 1.65k, False: 0]
  |  Branch (12414:25): [True: 693, False: 962]
  ------------------
12415|    693|    return finish_simple_absolute_with_port(input, out, scheme_type,
12416|    693|                                            protocol_end, host_start, host_end,
12417|    693|                                            host_len, has_upper);
12418|    693|  }
12419|       |
12420|    962|  size_t i = host_end;
12421|    962|  size_t path_start = host_end;
12422|    962|  size_t path_end = host_end;
12423|    962|  size_t query_start = std::string_view::npos;
12424|    962|  size_t hash_start = std::string_view::npos;
12425|    962|  bool has_path = false;
12426|    962|  bool maybe_dot_segment = false;
12427|    962|  bool rest_simple = true;
12428|       |
12429|    962|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12429:7): [True: 962, False: 0]
  |  Branch (12429:18): [True: 796, False: 166]
  ------------------
12430|    796|    has_path = true;
12431|    796|    path_start = i;
12432|    796|    ++i;
12433|    796|    scan_path_run(b, i, len, maybe_dot_segment);
12434|    796|    if (i < len) {
  ------------------
  |  Branch (12434:9): [True: 561, False: 235]
  ------------------
12435|    561|      const uint8_t cls = k_path[b[i]];
12436|    561|      if (cls == 1) {
  ------------------
  |  Branch (12436:11): [True: 101, False: 460]
  ------------------
12437|    101|        path_end = i;
12438|    101|        if (b[i] == '?') {
  ------------------
  |  Branch (12438:13): [True: 62, False: 39]
  ------------------
12439|     62|          query_start = i;
12440|     62|          ++i;
12441|     62|          goto scan_query;
12442|     62|        }
12443|     39|        hash_start = i;
12444|     39|        ++i;
12445|     39|        goto scan_hash;
12446|    101|      }
12447|    460|      rest_simple = false;
12448|    460|      hash_start = input.find('#', i);
12449|    460|      query_start = input.substr(0, hash_start).find('?', i);
12450|    460|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12450:11): [True: 30, False: 430]
  ------------------
12451|     30|        path_end = query_start;
12452|    430|      } else {
12453|    430|        path_end = hash_start != std::string_view::npos ? hash_start : len;
  ------------------
  |  Branch (12453:20): [True: 26, False: 404]
  ------------------
12454|    430|      }
12455|    460|      goto after_rest;
12456|    561|    }
12457|    235|    path_end = i;
12458|    235|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12458:14): [True: 166, False: 0]
  |  Branch (12458:25): [True: 98, False: 68]
  ------------------
12459|     98|    query_start = i;
12460|     98|    ++i;
12461|     98|    goto scan_query;
12462|     98|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12462:14): [True: 68, False: 0]
  |  Branch (12462:25): [True: 68, False: 0]
  ------------------
12463|     68|    hash_start = i;
12464|     68|    ++i;
12465|     68|    goto scan_hash;
12466|     68|  }
12467|    235|  goto after_rest;
12468|       |
12469|    235|scan_query:
12470|    160|  scan_query_run(b, i, len);
12471|    160|  if (i < len) {
  ------------------
  |  Branch (12471:7): [True: 84, False: 76]
  ------------------
12472|     84|    if (b[i] == '#') {
  ------------------
  |  Branch (12472:9): [True: 10, False: 74]
  ------------------
12473|     10|      hash_start = i;
12474|     10|      ++i;
12475|     10|      goto scan_hash;
12476|     10|    }
12477|     74|    rest_simple = false;
12478|     74|    goto scan_query_boundary;
12479|     84|  }
12480|     76|  goto after_rest;
12481|       |
12482|     76|scan_query_boundary:
12483|     74|  hash_start = input.find('#', i);
12484|     74|  goto after_rest;
12485|       |
12486|    117|scan_hash:
12487|    117|  scan_hash_run(b, i, len);
12488|    117|  if (i < len) {
  ------------------
  |  Branch (12488:7): [True: 49, False: 68]
  ------------------
12489|     49|    rest_simple = false;
12490|     49|  }
12491|       |
12492|    962|after_rest:
12493|    962|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12493:7): [True: 379, False: 583]
  |  Branch (12493:22): [True: 254, False: 125]
  ------------------
12494|    254|    const std::string_view path_body(input.data() + path_start,
12495|    254|                                     path_end - path_start);
12496|    254|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12496:9): [True: 154, False: 100]
  ------------------
12497|    154|      rest_simple = false;
12498|    154|    }
12499|    254|  }
12500|       |
12501|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12502|       |  // trailing C0 control or space; this fast path does neither. A query or
12503|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12504|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12505|       |  // inputs back to the slow path.
12506|    962|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12506:7): [True: 737, False: 225]
  |  Branch (12506:24): [True: 0, False: 737]
  ------------------
12507|    737|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12507:24): [True: 53, False: 684]
  ------------------
12508|     53|    return false;
12509|     53|  }
12510|       |
12511|    909|  out.type = scheme_type;
12512|    909|  out.is_valid = true;
12513|    909|  out.has_opaque_path = false;
12514|    909|  out.host_type = DEFAULT;
12515|       |
12516|    909|  if (!rest_simple) {
  ------------------
  |  Branch (12516:7): [True: 684, False: 225]
  ------------------
12517|       |    // Host is a plain domain. Finish path/query/hash with
12518|       |    // the regular helpers
12519|       |    // so percent-encoding and dot segments do not re-parse the authority.
12520|    684|    const std::string_view path_view =
12521|    684|        has_path
  ------------------
  |  Branch (12521:9): [True: 603, False: 81]
  ------------------
12522|    684|            ? std::string_view(input.data() + path_start, path_end - path_start)
12523|    684|            : std::string_view{};
12524|    684|    auto apply_query_and_hash = [&]() {
12525|    684|      if (query_start != std::string_view::npos) {
12526|    684|        const size_t q_end =
12527|    684|            (hash_start != std::string_view::npos) ? hash_start : len;
12528|    684|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12529|    684|                                                q_end - query_start - 1),
12530|    684|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12531|    684|      }
12532|    684|      if (hash_start != std::string_view::npos) {
12533|    684|        out.update_unencoded_base_hash(std::string_view(
12534|    684|            input.data() + hash_start + 1, len - hash_start - 1));
12535|    684|      }
12536|    684|    };
12537|    684|    if constexpr (is_aggregator) {
12538|    684|      out.buffer.assign(input.substr(0, host_end));
12539|    684|      if (has_upper) {
  ------------------
  |  Branch (12539:11): [True: 61, False: 623]
  ------------------
12540|     61|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12541|     61|      }
12542|    684|      out.components.protocol_end = protocol_end;
12543|    684|      out.components.username_end = protocol_end + 2;
12544|    684|      out.components.host_start = protocol_end + 2;
12545|    684|      out.components.host_end = static_cast<uint32_t>(host_end);
12546|    684|      out.components.port = url_components::omitted;
12547|    684|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12548|    684|      out.components.search_start = url_components::omitted;
12549|    684|      out.components.hash_start = url_components::omitted;
12550|    684|      out.parse_path(path_view);
12551|    684|      apply_query_and_hash();
12552|       |    } else {
12553|       |      std::string host_str(input.substr(host_start, host_len));
12554|       |      if (has_upper) {
12555|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12556|       |      }
12557|       |      out.host = std::move(host_str);
12558|       |      out.parse_path(path_view);
12559|       |      apply_query_and_hash();
12560|       |    }
12561|    684|    return true;
12562|    684|  }
12563|       |
12564|    225|  const bool need_slash = !has_path;
12565|    225|  if constexpr (is_aggregator) {
12566|    225|    if (!need_slash) {
  ------------------
  |  Branch (12566:9): [True: 164, False: 61]
  ------------------
12567|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12568|    164|      out.buffer.assign(input);
12569|    164|      if (has_upper) {
  ------------------
  |  Branch (12569:11): [True: 30, False: 134]
  ------------------
12570|     30|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12571|     30|      }
12572|    164|      out.components.protocol_end = protocol_end;
12573|    164|      out.components.username_end = protocol_end + 2;
12574|    164|      out.components.host_start = protocol_end + 2;
12575|    164|      out.components.host_end = static_cast<uint32_t>(host_end);
12576|    164|      out.components.port = url_components::omitted;
12577|    164|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12578|    164|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12578:37): [True: 15, False: 149]
  ------------------
12579|    164|                                        ? static_cast<uint32_t>(query_start)
12580|    164|                                        : url_components::omitted;
12581|    164|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12581:35): [True: 14, False: 150]
  ------------------
12582|    164|                                      ? static_cast<uint32_t>(hash_start)
12583|    164|                                      : url_components::omitted;
12584|    164|    } else {
12585|     61|      out.buffer.clear();
12586|     61|      out.buffer.reserve(len + 1);
12587|     61|      out.buffer.append(input.substr(0, host_end));
12588|     61|      out.buffer.push_back('/');
12589|     61|      if (host_end < len) {
  ------------------
  |  Branch (12589:11): [True: 61, False: 0]
  ------------------
12590|     61|        out.buffer.append(input.substr(host_end));
12591|     61|      }
12592|     61|      if (has_upper) {
  ------------------
  |  Branch (12592:11): [True: 22, False: 39]
  ------------------
12593|     22|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12594|     22|      }
12595|     61|      out.components.protocol_end = protocol_end;
12596|     61|      out.components.username_end = protocol_end + 2;
12597|     61|      out.components.host_start = protocol_end + 2;
12598|     61|      out.components.host_end = static_cast<uint32_t>(host_end);
12599|     61|      out.components.port = url_components::omitted;
12600|     61|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12601|     61|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12601:37): [True: 37, False: 24]
  ------------------
12602|     61|                                        ? static_cast<uint32_t>(query_start + 1)
12603|     61|                                        : url_components::omitted;
12604|     61|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12604:35): [True: 31, False: 30]
  ------------------
12605|     61|                                      ? static_cast<uint32_t>(hash_start + 1)
12606|     61|                                      : url_components::omitted;
12607|     61|    }
12608|       |  } else {
12609|       |    std::string host_str(input.substr(host_start, host_len));
12610|       |    if (has_upper) {
12611|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12612|       |    }
12613|       |    out.host = std::move(host_str);
12614|       |    if (need_slash) {
12615|       |      out.path = "/";
12616|       |    } else {
12617|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12618|       |    }
12619|       |    if (query_start != std::string_view::npos) {
12620|       |      const size_t q_end =
12621|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12622|       |      out.query.emplace(input.data() + query_start + 1,
12623|       |                        q_end - query_start - 1);
12624|       |    }
12625|       |    if (hash_start != std::string_view::npos) {
12626|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12627|       |    }
12628|       |  }
12629|    225|  return true;
12630|    909|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11990|    693|    bool has_upper) {
11991|    693|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11992|    693|  constexpr bool is_aggregator =
11993|    693|      std::is_same_v<result_type, ada::url_aggregator>;
11994|    693|  static_assert(is_ada_url || is_aggregator);
11995|       |
11996|    693|  const size_t len = input.size();
11997|    693|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11998|    693|  size_t p = host_end + 1;
11999|    693|  uint32_t port_value = 0;
12000|    693|  bool any_digit = false;
12001|  1.27k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12001:10): [True: 1.27k, False: 0]
  |  Branch (12001:21): [True: 726, False: 552]
  |  Branch (12001:36): [True: 596, False: 130]
  ------------------
12002|    596|    any_digit = true;
12003|    596|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12004|    596|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12004:9): [True: 11, False: 585]
  ------------------
12005|     11|      return false;
12006|     11|    }
12007|    585|    ++p;
12008|    585|  }
12009|    682|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12009:7): [True: 682, False: 0]
  |  Branch (12009:18): [True: 349, False: 333]
  |  Branch (12009:33): [True: 246, False: 103]
  |  Branch (12009:48): [True: 172, False: 74]
  ------------------
12010|    172|    return false;
12011|    172|  }
12012|    510|  uint32_t parsed_port = url_components::omitted;
12013|    510|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12014|    510|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12014:7): [True: 120, False: 390]
  |  Branch (12014:20): [True: 118, False: 2]
  ------------------
12015|    118|    parsed_port = port_value;
12016|    118|  }
12017|    510|  const size_t authority_end = p;
12018|       |
12019|    510|  size_t i = authority_end;
12020|    510|  size_t path_start = host_end;
12021|    510|  size_t path_end = host_end;
12022|    510|  size_t query_start = std::string_view::npos;
12023|    510|  size_t hash_start = std::string_view::npos;
12024|    510|  bool has_path = false;
12025|    510|  bool maybe_dot_segment = false;
12026|    510|  bool rest_simple = true;
12027|       |
12028|    510|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12028:7): [True: 510, False: 0]
  |  Branch (12028:18): [True: 333, False: 177]
  ------------------
12029|    333|    has_path = true;
12030|    333|    path_start = i;
12031|    333|    ++i;
12032|    333|    scan_path_run(b, i, len, maybe_dot_segment);
12033|    333|    if (i < len) {
  ------------------
  |  Branch (12033:9): [True: 222, False: 111]
  ------------------
12034|    222|      const uint8_t cls = k_path[b[i]];
12035|    222|      if (cls == 1) {
  ------------------
  |  Branch (12035:11): [True: 64, False: 158]
  ------------------
12036|     64|        path_end = i;
12037|     64|        if (b[i] == '?') {
  ------------------
  |  Branch (12037:13): [True: 40, False: 24]
  ------------------
12038|     40|          query_start = i;
12039|     40|          ++i;
12040|     40|          goto scan_query;
12041|     40|        }
12042|     24|        hash_start = i;
12043|     24|        ++i;
12044|     24|        goto scan_hash;
12045|     64|      }
12046|    158|      rest_simple = false;
12047|  2.00k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12047:14): [True: 1.86k, False: 143]
  ------------------
12048|  1.86k|        if (b[i] == '?') {
  ------------------
  |  Branch (12048:13): [True: 10, False: 1.85k]
  ------------------
12049|     10|          path_end = i;
12050|     10|          query_start = i;
12051|     10|          ++i;
12052|     10|          goto scan_query_boundary;
12053|     10|        }
12054|  1.85k|        if (b[i] == '#') {
  ------------------
  |  Branch (12054:13): [True: 5, False: 1.84k]
  ------------------
12055|      5|          path_end = i;
12056|      5|          hash_start = i;
12057|      5|          ++i;
12058|      5|          goto after_rest;
12059|      5|        }
12060|  1.85k|      }
12061|    143|      path_end = i;
12062|    143|      goto after_rest;
12063|    158|    }
12064|    111|    path_end = i;
12065|    177|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12065:14): [True: 177, False: 0]
  |  Branch (12065:25): [True: 103, False: 74]
  ------------------
12066|    103|    query_start = i;
12067|    103|    ++i;
12068|    103|    goto scan_query;
12069|    103|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12069:14): [True: 74, False: 0]
  |  Branch (12069:25): [True: 74, False: 0]
  ------------------
12070|     74|    hash_start = i;
12071|     74|    ++i;
12072|     74|    goto scan_hash;
12073|     74|  }
12074|    111|  goto after_rest;
12075|       |
12076|    143|scan_query:
12077|    143|  scan_query_run(b, i, len);
12078|    143|  if (i < len) {
  ------------------
  |  Branch (12078:7): [True: 66, False: 77]
  ------------------
12079|     66|    if (b[i] == '#') {
  ------------------
  |  Branch (12079:9): [True: 8, False: 58]
  ------------------
12080|      8|      hash_start = i;
12081|      8|      ++i;
12082|      8|      goto scan_hash;
12083|      8|    }
12084|     58|    rest_simple = false;
12085|     58|    goto scan_query_boundary;
12086|     66|  }
12087|     77|  goto after_rest;
12088|       |
12089|     77|scan_query_boundary:
12090|    791|  for (; i < len; ++i) {
  ------------------
  |  Branch (12090:10): [True: 733, False: 58]
  ------------------
12091|    733|    if (b[i] == '#') {
  ------------------
  |  Branch (12091:9): [True: 10, False: 723]
  ------------------
12092|     10|      hash_start = i;
12093|     10|      ++i;
12094|     10|      goto after_rest;
12095|     10|    }
12096|    733|  }
12097|     58|  goto after_rest;
12098|       |
12099|    106|scan_hash:
12100|    106|  scan_hash_run(b, i, len);
12101|    106|  if (i < len) {
  ------------------
  |  Branch (12101:7): [True: 38, False: 68]
  ------------------
12102|     38|    rest_simple = false;
12103|     38|  }
12104|       |
12105|    510|after_rest:
12106|    510|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12106:7): [True: 256, False: 254]
  |  Branch (12106:22): [True: 93, False: 163]
  ------------------
12107|     93|    const std::string_view path_body(input.data() + path_start,
12108|     93|                                     path_end - path_start);
12109|     93|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12109:9): [True: 30, False: 63]
  ------------------
12110|     30|      rest_simple = false;
12111|     30|    }
12112|     93|  }
12113|       |
12114|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12115|       |  // trailing C0 control or space; this fast path does neither. A query or
12116|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12117|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12118|       |  // inputs back to the slow path.
12119|    510|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12119:7): [True: 284, False: 226]
  |  Branch (12119:24): [True: 0, False: 284]
  ------------------
12120|    284|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12120:24): [True: 29, False: 255]
  ------------------
12121|     29|    return false;
12122|     29|  }
12123|       |
12124|    481|  out.type = scheme_type;
12125|    481|  out.is_valid = true;
12126|    481|  out.has_opaque_path = false;
12127|    481|  out.host_type = DEFAULT;
12128|       |
12129|    481|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12129:31): [True: 115, False: 366]
  ------------------
12130|    481|                                  ? (1 + port_decimal_digit_count(parsed_port))
12131|    481|                                  : 0;
12132|       |
12133|    481|  if (!rest_simple) {
  ------------------
  |  Branch (12133:7): [True: 255, False: 226]
  ------------------
12134|    255|    const std::string_view path_view =
12135|    255|        has_path
  ------------------
  |  Branch (12135:9): [True: 187, False: 68]
  ------------------
12136|    255|            ? std::string_view(input.data() + path_start, path_end - path_start)
12137|    255|            : std::string_view{};
12138|    255|    auto apply_query_and_hash = [&]() {
12139|    255|      if (query_start != std::string_view::npos) {
12140|    255|        const size_t q_end =
12141|    255|            (hash_start != std::string_view::npos) ? hash_start : len;
12142|    255|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12143|    255|                                                q_end - query_start - 1),
12144|    255|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12145|    255|      }
12146|    255|      if (hash_start != std::string_view::npos) {
12147|    255|        out.update_unencoded_base_hash(std::string_view(
12148|    255|            input.data() + hash_start + 1, len - hash_start - 1));
12149|    255|      }
12150|    255|    };
12151|    255|    if constexpr (is_aggregator) {
12152|    255|      out.buffer.assign(input.substr(0, host_end));
12153|    255|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12153:11): [True: 26, False: 229]
  ------------------
12154|     26|        append_canonical_port(out.buffer, parsed_port);
12155|     26|      }
12156|    255|      if (has_upper) {
  ------------------
  |  Branch (12156:11): [True: 44, False: 211]
  ------------------
12157|     44|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12158|     44|      }
12159|    255|      out.components.protocol_end = protocol_end;
12160|    255|      out.components.username_end = protocol_end + 2;
12161|    255|      out.components.host_start = protocol_end + 2;
12162|    255|      out.components.host_end = static_cast<uint32_t>(host_end);
12163|    255|      out.components.port = parsed_port;
12164|    255|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12165|    255|      out.components.search_start = url_components::omitted;
12166|    255|      out.components.hash_start = url_components::omitted;
12167|    255|      out.parse_path(path_view);
12168|    255|      apply_query_and_hash();
12169|       |    } else {
12170|       |      std::string host_str(input.substr(host_start, host_len));
12171|       |      if (has_upper) {
12172|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12173|       |      }
12174|       |      out.host = std::move(host_str);
12175|       |      if (parsed_port != url_components::omitted) {
12176|       |        out.port = static_cast<uint16_t>(parsed_port);
12177|       |      }
12178|       |      out.parse_path(path_view);
12179|       |      apply_query_and_hash();
12180|       |    }
12181|    255|    return true;
12182|    255|  }
12183|       |
12184|    226|  const bool insert_slash = !has_path;
12185|    226|  if constexpr (is_aggregator) {
12186|    226|    const size_t out_len =
12187|    226|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (12187:34): [True: 97, False: 129]
  ------------------
12188|    226|    const bool omit_port_bytes = parsed_port == url_components::omitted;
12189|    226|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (12189:9): [True: 41, False: 185]
  |  Branch (12189:27): [True: 16, False: 25]
  |  Branch (12189:44): [True: 16, False: 0]
  ------------------
12190|     16|      out.buffer.assign(input);
12191|    210|    } else {
12192|    210|      out.buffer.clear();
12193|    210|      out.buffer.reserve(out_len);
12194|    210|      out.buffer.append(input.substr(0, host_end));
12195|    210|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12195:11): [True: 73, False: 137]
  ------------------
12196|     73|        append_canonical_port(out.buffer, parsed_port);
12197|     73|      }
12198|    210|      if (insert_slash) {
  ------------------
  |  Branch (12198:11): [True: 97, False: 113]
  ------------------
12199|     97|        out.buffer.push_back('/');
12200|     97|      }
12201|    210|      if (authority_end < len) {
  ------------------
  |  Branch (12201:11): [True: 210, False: 0]
  ------------------
12202|    210|        out.buffer.append(input.substr(authority_end));
12203|    210|      }
12204|    210|    }
12205|    226|    if (has_upper) {
  ------------------
  |  Branch (12205:9): [True: 42, False: 184]
  ------------------
12206|     42|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12207|     42|    }
12208|    226|    const uint32_t pathname_start =
12209|    226|        static_cast<uint32_t>(host_end) + port_bytes;
12210|    226|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12211|    226|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (12211:33): [True: 97, False: 129]
  ------------------
12212|    226|                               static_cast<int32_t>(authority_end);
12213|    226|    out.components.protocol_end = protocol_end;
12214|    226|    out.components.username_end = protocol_end + 2;
12215|    226|    out.components.host_start = protocol_end + 2;
12216|    226|    out.components.host_end = static_cast<uint32_t>(host_end);
12217|    226|    out.components.port = parsed_port;
12218|    226|    out.components.pathname_start = pathname_start;
12219|    226|    out.components.search_start =
12220|    226|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (12220:9): [True: 69, False: 157]
  ------------------
12221|    226|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12222|     69|                                    tail_delta)
12223|    226|            : url_components::omitted;
12224|    226|    out.components.hash_start =
12225|    226|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12225:9): [True: 62, False: 164]
  ------------------
12226|    226|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12227|     62|                                    tail_delta)
12228|    226|            : url_components::omitted;
12229|       |  } else {
12230|       |    std::string host_str(input.substr(host_start, host_len));
12231|       |    if (has_upper) {
12232|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12233|       |    }
12234|       |    out.host = std::move(host_str);
12235|       |    if (parsed_port != url_components::omitted) {
12236|       |      out.port = static_cast<uint16_t>(parsed_port);
12237|       |    }
12238|       |    if (insert_slash) {
12239|       |      out.path = "/";
12240|       |    } else {
12241|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12242|       |    }
12243|       |    if (query_start != std::string_view::npos) {
12244|       |      const size_t q_end =
12245|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12246|       |      out.query.emplace(input.data() + query_start + 1,
12247|       |                        q_end - query_start - 1);
12248|       |    }
12249|       |    if (hash_start != std::string_view::npos) {
12250|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12251|       |    }
12252|       |  }
12253|    226|  return true;
12254|    481|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12819|  13.3k|                           const result_type* base_url) {
12820|       |  // We can specialize the implementation per type.
12821|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12822|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12823|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12824|       |  // and ada::url **do not have to support the exact same API**.
12825|  13.3k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12826|  13.3k|  constexpr bool result_type_is_ada_url_aggregator =
12827|  13.3k|      std::is_same_v<url_aggregator, result_type>;
12828|  13.3k|  static_assert(result_type_is_ada_url ||
12829|  13.3k|                result_type_is_ada_url_aggregator);  // We don't support
12830|       |                                                     // anything else for now.
12831|       |
12832|  13.3k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12833|  13.3k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12834|  13.3k|          ")");
12835|       |
12836|  13.3k|  result_type url{};
12837|       |
12838|  13.3k|  const uint32_t max_input_length = ada::get_max_input_length();
12839|       |
12840|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12841|       |  // max_input_length even when the input fit under it. The check at the end of
12842|       |  // the state machine covers URLs that run to completion, but several states
12843|       |  // return early after appending a query or fragment, so run the same check on
12844|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12845|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12846|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12847|  13.3k|  const auto enforce_max_input_length = [&]() {
12848|  13.3k|    if constexpr (store_values) {
12849|  13.3k|      if (url.is_valid) {
12850|  13.3k|        if constexpr (result_type_is_ada_url_aggregator) {
12851|  13.3k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12852|  13.3k|            url.is_valid = false;
12853|  13.3k|          }
12854|  13.3k|        } else {
12855|  13.3k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12856|  13.3k|            url.is_valid = false;
12857|  13.3k|          }
12858|  13.3k|        }
12859|  13.3k|      }
12860|  13.3k|    }
12861|  13.3k|  };
12862|       |
12863|       |  // We refuse to parse URL strings that exceed the maximum input length.
12864|       |  // By default, this is 4GB but can be configured via
12865|       |  // ada::set_max_input_length().
12866|  13.3k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12866:7): [True: 0, False: 13.3k]
  ------------------
12867|      0|    url.is_valid = false;
12868|      0|  }
12869|       |  // Going forward, user_input.size() is in [0,
12870|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12871|       |  // base, or the optional_url was invalid, we must return.
12872|  13.3k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12872:7): [True: 0, False: 13.3k]
  ------------------
12873|      0|    url.is_valid &= base_url->is_valid;
12874|      0|  }
12875|  13.3k|  if (!url.is_valid) {
  ------------------
  |  Branch (12875:7): [True: 0, False: 13.3k]
  ------------------
12876|      0|    return url;
12877|      0|  }
12878|       |
12879|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12880|  13.3k|  if constexpr (store_values) {
12881|  13.3k|    bool hit_fast_path = false;
12882|  13.3k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12882:9): [True: 13.3k, False: 0]
  ------------------
12883|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12884|       |      // call so those URLs (including SetHref) do not pay for a miss.
12885|  13.3k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12886|  13.3k|      const size_t n = user_input.size();
12887|  13.3k|      size_t host_start = 0;
12888|  13.3k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12888:11): [True: 13.3k, False: 0]
  |  Branch (12888:21): [True: 13.3k, False: 0]
  |  Branch (12888:36): [True: 13.3k, False: 0]
  |  Branch (12888:51): [True: 13.3k, False: 0]
  ------------------
12889|  13.3k|        host_start = 7;
12890|  13.3k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12890:18): [True: 0, False: 0]
  |  Branch (12890:28): [True: 0, False: 0]
  |  Branch (12890:43): [True: 0, False: 0]
  |  Branch (12890:58): [True: 0, False: 0]
  ------------------
12891|      0|        host_start = 8;
12892|      0|      }
12893|  13.3k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12893:34): [True: 13.3k, False: 0]
  ------------------
12894|  13.3k|      const bool skip_ip =
12895|  13.3k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12895:11): [True: 7.23k, False: 6.06k]
  |  Branch (12895:33): [True: 5.21k, False: 850]
  |  Branch (12895:54): [True: 1.21k, False: 4.00k]
  ------------------
12896|  13.3k|      const bool skip_userinfo =
12897|  13.3k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12897:11): [True: 13.3k, False: 0]
  |  Branch (12897:30): [True: 179, False: 13.1k]
  ------------------
12898|  13.3k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12898:23): [True: 4.85k, False: 8.45k]
  |  Branch (12898:35): [True: 4.68k, False: 171]
  ------------------
12899|  4.68k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12899:23): [True: 1.39k, False: 3.29k]
  ------------------
12900|  13.3k|    } else {
12901|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12902|      0|    }
12903|  13.3k|    if (hit_fast_path) {
  ------------------
  |  Branch (12903:9): [True: 1.39k, False: 11.9k]
  ------------------
12904|  1.39k|      if constexpr (result_type_is_ada_url_aggregator) {
12905|  1.39k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12905:13): [True: 0, False: 1.39k]
  ------------------
12906|      0|          url.is_valid = false;
12907|      0|        }
12908|       |      } else {
12909|       |        // For a small absolute input, even worst-case normalization cannot
12910|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12911|       |        // most 4.5x. Avoid traversing every stored component on the common
12912|       |        // default-limit path.
12913|       |        if ((base_url != nullptr ||
12914|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12915|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12916|       |          url.is_valid = false;
12917|       |        }
12918|       |      }
12919|  1.39k|      return url;
12920|  1.39k|    }
12921|  13.3k|  }
12922|       |
12923|  11.9k|  state state = state::SCHEME_START;
12924|       |
12925|  13.3k|  std::string tmp_buffer;
12926|  13.3k|  std::string_view url_data;
12927|  13.3k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12927:7): [True: 141, False: 13.1k]
  ------------------
12928|    141|    tmp_buffer = user_input;
12929|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12930|       |    // just directly build the string from user_input.
12931|    141|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12932|    141|    url_data = tmp_buffer;
12933|  13.1k|  } else [[likely]] {
12934|  13.1k|    url_data = user_input;
12935|  13.1k|  }
12936|       |
12937|       |  // Leading and trailing control characters are uncommon and easy to deal with
12938|       |  // (no performance concern).
12939|  13.3k|  helpers::trim_c0_whitespace(url_data);
12940|       |
12941|  13.3k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12942|       |    // Most of the time, we just need user_input.size().
12943|       |    // In some instances, we may need a bit more.
12944|       |    ///////////////////////////
12945|       |    // This is *very* important. This line should *not* be removed
12946|       |    // hastily. There are principled reasons why reserve is important
12947|       |    // for performance. If you have a benchmark with small inputs,
12948|       |    // it may not matter, but in other instances, it could.
12949|       |    ////
12950|       |    // This rounds up to the next power of two.
12951|       |    // We know that user_input.size() is in [0,
12952|       |    // std::numeric_limits<uint32_t>::max).
12953|  13.3k|    uint32_t reserve_capacity =
12954|  13.3k|        (0xFFFFFFFF >>
12955|  13.3k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12956|  13.3k|        1;
12957|  13.3k|    url.reserve(reserve_capacity);
12958|  13.3k|  }
12959|       |
12960|       |  // Optimization opportunity. Most websites do not have fragment.
12961|  13.3k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12962|       |  // We add it last so that an implementation like ada::url_aggregator
12963|       |  // can append it last to its internal buffer, thus improving performance.
12964|       |
12965|       |  // Here url_data no longer has its fragment.
12966|       |  // We are going to access the data from url_data (it is immutable).
12967|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12968|       |  // The input_position variable should range from 0 to input_size.
12969|       |  // It is illegal to access url_data at input_size.
12970|  13.3k|  size_t input_position = 0;
12971|  13.3k|  const size_t input_size = url_data.size();
12972|       |  // Keep running the following state machine by switching on state.
12973|       |  // If after a run pointer points to the EOF code point, go to the next step.
12974|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12975|       |  // We never decrement input_position.
12976|  64.8k|  while (input_position <= input_size) {
  ------------------
  |  Branch (12976:10): [True: 62.7k, False: 2.04k]
  ------------------
12977|  62.7k|    ada_log("In parsing at ", input_position, " out of ", input_size,
12978|  62.7k|            " in state ", ada::to_string(state));
12979|  62.7k|    switch (state) {
12980|  11.9k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12980:7): [True: 11.9k, False: 50.8k]
  ------------------
12981|  11.9k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12982|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12983|       |        // state to scheme state.
12984|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12984:13): [True: 11.9k, False: 0]
  ------------------
12985|  11.9k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12985:13): [True: 11.9k, False: 0]
  ------------------
12986|  11.9k|          state = state::SCHEME;
12987|  11.9k|          input_position++;
12988|  11.9k|        } else {
12989|       |          // Otherwise, if state override is not given, set state to no scheme
12990|       |          // state and decrease pointer by 1.
12991|      0|          state = state::NO_SCHEME;
12992|      0|        }
12993|  11.9k|        break;
12994|      0|      }
12995|  11.9k|      case state::SCHEME: {
  ------------------
  |  Branch (12995:7): [True: 11.9k, False: 50.8k]
  ------------------
12996|  11.9k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12997|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12998|       |        // append c, lowercased, to buffer.
12999|  47.6k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12999:16): [True: 47.6k, False: 0]
  ------------------
13000|  47.6k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13000:16): [True: 35.7k, False: 11.9k]
  ------------------
13001|  35.7k|          input_position++;
13002|  35.7k|        }
13003|       |        // Otherwise, if c is U+003A (:), then:
13004|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13004:13): [True: 11.9k, False: 0]
  ------------------
13005|  11.9k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13005:13): [True: 11.9k, False: 0]
  ------------------
13006|  11.9k|          ada_log("SCHEME the scheme should be ",
13007|  11.9k|                  url_data.substr(0, input_position));
13008|       |          if constexpr (result_type_is_ada_url) {
13009|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
13010|       |              return url;
13011|       |            }
13012|  11.9k|          } else {
13013|       |            // we pass the colon along instead of painfully adding it back.
13014|  11.9k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (13014:17): [True: 0, False: 11.9k]
  ------------------
13015|  11.9k|                    url_data.substr(0, input_position + 1))) {
13016|      0|              return url;
13017|      0|            }
13018|  11.9k|          }
13019|  11.9k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13020|       |
13021|       |          // If url's scheme is "file", then:
13022|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13023|  11.9k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13023:15): [True: 0, False: 11.9k]
  ------------------
13024|       |            // Set state to file state.
13025|      0|            state = state::FILE;
13026|      0|          }
13027|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13028|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13029|       |          // != nullptr is false.
13030|  11.9k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13030:20): [True: 11.9k, False: 0]
  |  Branch (13030:40): [True: 0, False: 11.9k]
  ------------------
13031|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13031:20): [True: 0, False: 0]
  ------------------
13032|       |            // Set state to special relative or authority state.
13033|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13034|      0|          }
13035|       |          // Otherwise, if url is special, set state to special authority
13036|       |          // slashes state.
13037|  11.9k|          else if (url.is_special()) {
  ------------------
  |  Branch (13037:20): [True: 11.9k, False: 0]
  ------------------
13038|  11.9k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13039|  11.9k|          }
13040|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13041|       |          // path or authority state and increase pointer by 1.
13042|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13042:20): [True: 0, False: 0]
  ------------------
13043|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13043:20): [True: 0, False: 0]
  ------------------
13044|      0|            state = state::PATH_OR_AUTHORITY;
13045|      0|            input_position++;
13046|      0|          }
13047|       |          // Otherwise, set url's path to the empty string and set state to
13048|       |          // opaque path state.
13049|      0|          else {
13050|      0|            state = state::OPAQUE_PATH;
13051|      0|          }
13052|  11.9k|        }
13053|       |        // Otherwise, if state override is not given, set buffer to the empty
13054|       |        // string, state to no scheme state, and start over (from the first code
13055|       |        // point in input).
13056|      0|        else {
13057|      0|          state = state::NO_SCHEME;
13058|      0|          input_position = 0;
13059|      0|          break;
13060|      0|        }
13061|  11.9k|        input_position++;
13062|  11.9k|        break;
13063|  11.9k|      }
13064|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13064:7): [True: 0, False: 62.7k]
  ------------------
13065|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13066|       |        // The fragment was pruned from url_data before the state machine ran,
13067|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13068|       |        // nothing else remains in front of it.
13069|      0|        const bool c_is_hash =
13070|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13070:13): [True: 0, False: 0]
  |  Branch (13070:37): [True: 0, False: 0]
  ------------------
13071|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13072|       |        // validation error, return failure.
13073|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13073:13): [True: 0, False: 0]
  |  Branch (13073:37): [True: 0, False: 0]
  |  Branch (13073:66): [True: 0, False: 0]
  ------------------
13074|      0|          ada_log("NO_SCHEME validation error");
13075|      0|          url.is_valid = false;
13076|      0|          return url;
13077|      0|        }
13078|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13079|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13080|       |        // query to base's query, and set state to fragment state.
13081|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13081:18): [True: 0, False: 0]
  |  Branch (13081:47): [True: 0, False: 0]
  ------------------
13082|      0|          ada_log("NO_SCHEME opaque base with fragment");
13083|      0|          url.copy_scheme(*base_url);
13084|      0|          url.has_opaque_path = base_url->has_opaque_path;
13085|       |
13086|       |          if constexpr (result_type_is_ada_url) {
13087|       |            url.path = base_url->path;
13088|       |            url.query = base_url->query;
13089|      0|          } else {
13090|      0|            url.update_base_pathname(base_url->get_pathname());
13091|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13091:17): [True: 0, False: 0]
  ------------------
13092|       |              // get_search() returns "" for an empty query string (URL ends
13093|       |              // with '?'). update_base_search("") would incorrectly clear the
13094|       |              // query, so pass "?" to preserve the empty query distinction.
13095|      0|              auto s = base_url->get_search();
13096|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13096:38): [True: 0, False: 0]
  ------------------
13097|      0|            }
13098|      0|          }
13099|      0|          url.update_unencoded_base_hash(*fragment);
13100|      0|          enforce_max_input_length();
13101|      0|          return url;
13102|      0|        }
13103|       |        // Otherwise, if base's scheme is not "file", set state to relative
13104|       |        // state and decrease pointer by 1.
13105|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13106|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13106:18): [True: 0, False: 0]
  ------------------
13107|      0|          ada_log("NO_SCHEME non-file relative path");
13108|      0|          state = state::RELATIVE_SCHEME;
13109|      0|        }
13110|       |        // Otherwise, set state to file state and decrease pointer by 1.
13111|      0|        else {
13112|      0|          ada_log("NO_SCHEME file base type");
13113|      0|          state = state::FILE;
13114|      0|        }
13115|      0|        break;
13116|      0|      }
13117|  11.9k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13117:7): [True: 11.9k, False: 50.8k]
  ------------------
13118|  11.9k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13119|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13120|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13121|       |        // worry about AUTHORITY.
13122|       |        // TODO: Instead of just collecting a bool, collect the location of the
13123|       |        // '@' and do something useful with it.
13124|       |        // TODO: We could do various processing early on, using a single pass
13125|       |        // over the string to collect information about it, e.g., telling us
13126|       |        // whether there is a @ and if so, where (or how many).
13127|       |
13128|       |        // Check if url data contains an @.
13129|  11.9k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13129:13): [True: 11.6k, False: 240]
  ------------------
13130|  11.6k|          state = state::HOST;
13131|  11.6k|          break;
13132|  11.6k|        }
13133|    240|        bool at_sign_seen{false};
13134|    240|        bool password_token_seen{false};
13135|       |        /**
13136|       |         * We expect something of the sort...
13137|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13138|       |         * --------^
13139|       |         */
13140|  1.66k|        do {
13141|  1.66k|          std::string_view view = url_data.substr(input_position);
13142|       |          // The delimiters are @, /, ? \\.
13143|  1.66k|          size_t location =
13144|  1.66k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13144:15): [True: 1.66k, False: 0]
  ------------------
13145|  1.66k|                               : helpers::find_authority_delimiter(view);
13146|  1.66k|          std::string_view authority_view = view.substr(0, location);
13147|  1.66k|          size_t end_of_authority = input_position + authority_view.size();
13148|       |          // If c is U+0040 (@), then:
13149|  1.66k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13149:15): [True: 1.64k, False: 19]
  ------------------
13150|  1.64k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13150:15): [True: 1.42k, False: 221]
  ------------------
13151|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13152|  1.42k|            if (at_sign_seen) {
  ------------------
  |  Branch (13152:17): [True: 1.20k, False: 221]
  ------------------
13153|  1.20k|              if (password_token_seen) {
  ------------------
  |  Branch (13153:19): [True: 502, False: 703]
  ------------------
13154|       |                if constexpr (result_type_is_ada_url) {
13155|       |                  url.password += "%40";
13156|    502|                } else {
13157|    502|                  url.append_base_password("%40");
13158|    502|                }
13159|    703|              } else {
13160|       |                if constexpr (result_type_is_ada_url) {
13161|       |                  url.username += "%40";
13162|    703|                } else {
13163|    703|                  url.append_base_username("%40");
13164|    703|                }
13165|    703|              }
13166|  1.20k|            }
13167|       |
13168|  1.42k|            at_sign_seen = true;
13169|       |
13170|  1.42k|            if (!password_token_seen) {
  ------------------
  |  Branch (13170:17): [True: 924, False: 502]
  ------------------
13171|    924|              size_t password_token_location = authority_view.find(':');
13172|    924|              password_token_seen =
13173|    924|                  password_token_location != std::string_view::npos;
13174|       |
13175|    924|              if constexpr (store_values) {
13176|    924|                if (!password_token_seen) {
  ------------------
  |  Branch (13176:21): [True: 857, False: 67]
  ------------------
13177|       |                  if constexpr (result_type_is_ada_url) {
13178|       |                    url.username += unicode::percent_encode(
13179|       |                        authority_view,
13180|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13181|    857|                  } else {
13182|    857|                    url.append_base_username(unicode::percent_encode(
13183|    857|                        authority_view,
13184|    857|                        character_sets::USERINFO_PERCENT_ENCODE));
13185|    857|                  }
13186|    857|                } else {
13187|       |                  if constexpr (result_type_is_ada_url) {
13188|       |                    url.username += unicode::percent_encode(
13189|       |                        authority_view.substr(0, password_token_location),
13190|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13191|       |                    url.password += unicode::percent_encode(
13192|       |                        authority_view.substr(password_token_location + 1),
13193|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13194|     67|                  } else {
13195|     67|                    url.append_base_username(unicode::percent_encode(
13196|     67|                        authority_view.substr(0, password_token_location),
13197|     67|                        character_sets::USERINFO_PERCENT_ENCODE));
13198|     67|                    url.append_base_password(unicode::percent_encode(
13199|     67|                        authority_view.substr(password_token_location + 1),
13200|     67|                        character_sets::USERINFO_PERCENT_ENCODE));
13201|     67|                  }
13202|     67|                }
13203|    924|              }
13204|    924|            } else if constexpr (store_values) {
13205|       |              if constexpr (result_type_is_ada_url) {
13206|       |                url.password += unicode::percent_encode(
13207|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13208|    502|              } else {
13209|    502|                url.append_base_password(unicode::percent_encode(
13210|    502|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13211|    502|              }
13212|    502|            }
13213|  1.42k|          }
13214|       |          // Otherwise, if one of the following is true:
13215|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13216|       |          // - url is special and c is U+005C (\)
13217|    240|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13217:20): [True: 19, False: 221]
  ------------------
13218|    221|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13218:20): [True: 205, False: 16]
  ------------------
13219|     16|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13219:20): [True: 15, False: 1]
  ------------------
13220|    240|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13220:21): [True: 1, False: 0]
  |  Branch (13220:41): [True: 1, False: 0]
  ------------------
13221|       |            // If atSignSeen is true and authority_view is the empty string,
13222|       |            // validation error, return failure.
13223|    240|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13223:17): [True: 221, False: 19]
  |  Branch (13223:33): [True: 5, False: 216]
  ------------------
13224|      5|              url.is_valid = false;
13225|      5|              return url;
13226|      5|            }
13227|    235|            state = state::HOST;
13228|    235|            break;
13229|    240|          }
13230|  1.42k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13230:15): [True: 0, False: 1.42k]
  ------------------
13231|      0|            if constexpr (store_values) {
13232|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13232:19): [True: 0, False: 0]
  ------------------
13233|      0|                url.update_unencoded_base_hash(*fragment);
13234|      0|              }
13235|      0|            }
13236|      0|            enforce_max_input_length();
13237|      0|            return url;
13238|      0|          }
13239|  1.42k|          input_position = end_of_authority + 1;
13240|  1.42k|        } while (true);
  ------------------
  |  Branch (13240:18): [True: 1.42k, Folded]
  ------------------
13241|       |
13242|    235|        break;
13243|    240|      }
13244|    235|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13244:7): [True: 0, False: 62.7k]
  ------------------
13245|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13246|      0|                helpers::substring(url_data, input_position));
13247|       |
13248|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13249|       |        // then set state to special authority ignore slashes state and increase
13250|       |        // pointer by 1.
13251|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13251:13): [True: 0, False: 0]
  ------------------
13252|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13253|      0|          input_position += 2;
13254|      0|        } else {
13255|       |          // Otherwise, validation error, set state to relative state and
13256|       |          // decrease pointer by 1.
13257|      0|          state = state::RELATIVE_SCHEME;
13258|      0|        }
13259|       |
13260|      0|        break;
13261|    240|      }
13262|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13262:7): [True: 0, False: 62.7k]
  ------------------
13263|      0|        ada_log("PATH_OR_AUTHORITY ",
13264|      0|                helpers::substring(url_data, input_position));
13265|       |
13266|       |        // If c is U+002F (/), then set state to authority state.
13267|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13267:13): [True: 0, False: 0]
  ------------------
13268|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13268:13): [True: 0, False: 0]
  ------------------
13269|      0|          state = state::AUTHORITY;
13270|      0|          input_position++;
13271|      0|        } else {
13272|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13273|      0|          state = state::PATH;
13274|      0|        }
13275|       |
13276|      0|        break;
13277|    240|      }
13278|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13278:7): [True: 0, False: 62.7k]
  ------------------
13279|      0|        ada_log("RELATIVE_SCHEME ",
13280|      0|                helpers::substring(url_data, input_position));
13281|       |
13282|       |        // Set url's scheme to base's scheme.
13283|      0|        url.copy_scheme(*base_url);
13284|       |
13285|       |        // If c is U+002F (/), then set state to relative slash state.
13286|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13286:13): [True: 0, False: 0]
  ------------------
13287|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13288|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13288:13): [True: 0, False: 0]
  ------------------
13289|      0|          ada_log(
13290|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13291|      0|              "slash state");
13292|      0|          state = state::RELATIVE_SLASH;
13293|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13293:20): [True: 0, False: 0]
  |  Branch (13293:40): [True: 0, False: 0]
  ------------------
13294|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13294:20): [True: 0, False: 0]
  ------------------
13295|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13296|       |          // set state to relative slash state.
13297|      0|          ada_log(
13298|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13299|      0|              "error, set state to relative slash state");
13300|      0|          state = state::RELATIVE_SLASH;
13301|      0|        } else {
13302|      0|          ada_log("RELATIVE_SCHEME otherwise");
13303|       |          // Set url's username to base's username, url's password to base's
13304|       |          // password, url's host to base's host, url's port to base's port,
13305|       |          // url's path to a clone of base's path, and url's query to base's
13306|       |          // query.
13307|       |          if constexpr (result_type_is_ada_url) {
13308|       |            url.username = base_url->username;
13309|       |            url.password = base_url->password;
13310|       |            url.host = base_url->host;
13311|       |            url.port = base_url->port;
13312|       |            // cloning the base path includes cloning the has_opaque_path flag
13313|       |            url.has_opaque_path = base_url->has_opaque_path;
13314|       |            url.path = base_url->path;
13315|       |            url.query = base_url->query;
13316|      0|          } else {
13317|      0|            url.update_base_authority(base_url->get_href(),
13318|      0|                                      base_url->get_components());
13319|      0|            url.update_host_to_base_host(base_url->get_hostname());
13320|      0|            url.update_base_port(base_url->retrieve_base_port());
13321|       |            // cloning the base path includes cloning the has_opaque_path flag
13322|      0|            url.has_opaque_path = base_url->has_opaque_path;
13323|      0|            url.update_base_pathname(base_url->get_pathname());
13324|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13324:17): [True: 0, False: 0]
  ------------------
13325|       |              // get_search() returns "" for an empty query string (URL ends
13326|       |              // with '?'). update_base_search("") would incorrectly clear the
13327|       |              // query, so pass "?" to preserve the empty query distinction.
13328|      0|              auto s = base_url->get_search();
13329|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13329:38): [True: 0, False: 0]
  ------------------
13330|      0|            }
13331|      0|          }
13332|       |
13333|      0|          url.has_opaque_path = base_url->has_opaque_path;
13334|       |
13335|       |          // If c is U+003F (?), then set url's query to the empty string, and
13336|       |          // state to query state.
13337|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13337:15): [True: 0, False: 0]
  ------------------
13338|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13338:15): [True: 0, False: 0]
  ------------------
13339|      0|            state = state::QUERY;
13340|      0|          }
13341|       |          // Otherwise, if c is not the EOF code point:
13342|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13342:20): [True: 0, False: 0]
  ------------------
13343|       |            // Set url's query to null.
13344|      0|            url.clear_search();
13345|       |            if constexpr (result_type_is_ada_url) {
13346|       |              // Shorten url's path.
13347|       |              helpers::shorten_path(url.path, url.type);
13348|      0|            } else {
13349|      0|              std::string_view path = url.get_pathname();
13350|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13350:19): [True: 0, False: 0]
  ------------------
13351|      0|                url.update_base_pathname(std::move(std::string(path)));
13352|      0|              }
13353|      0|            }
13354|       |            // Set state to path state and decrease pointer by 1.
13355|      0|            state = state::PATH;
13356|      0|            break;
13357|      0|          }
13358|      0|        }
13359|      0|        input_position++;
13360|      0|        break;
13361|      0|      }
13362|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13362:7): [True: 0, False: 62.7k]
  ------------------
13363|      0|        ada_log("RELATIVE_SLASH ",
13364|      0|                helpers::substring(url_data, input_position));
13365|       |
13366|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13367|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13368|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13368:13): [True: 0, False: 0]
  |  Branch (13368:33): [True: 0, False: 0]
  ------------------
13369|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13369:14): [True: 0, False: 0]
  ------------------
13370|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13370:14): [True: 0, False: 0]
  ------------------
13371|       |          // Set state to special authority ignore slashes state.
13372|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13373|      0|        }
13374|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13375|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13375:18): [True: 0, False: 0]
  ------------------
13376|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13376:18): [True: 0, False: 0]
  ------------------
13377|      0|          state = state::AUTHORITY;
13378|      0|        }
13379|       |        // Otherwise, set
13380|       |        // - url's username to base's username,
13381|       |        // - url's password to base's password,
13382|       |        // - url's host to base's host,
13383|       |        // - url's port to base's port,
13384|       |        // - state to path state, and then, decrease pointer by 1.
13385|      0|        else {
13386|       |          if constexpr (result_type_is_ada_url) {
13387|       |            url.username = base_url->username;
13388|       |            url.password = base_url->password;
13389|       |            url.host = base_url->host;
13390|       |            url.port = base_url->port;
13391|      0|          } else {
13392|      0|            url.update_base_authority(base_url->get_href(),
13393|      0|                                      base_url->get_components());
13394|      0|            url.update_host_to_base_host(base_url->get_hostname());
13395|      0|            url.update_base_port(base_url->retrieve_base_port());
13396|      0|          }
13397|      0|          state = state::PATH;
13398|      0|          break;
13399|      0|        }
13400|       |
13401|      0|        input_position++;
13402|      0|        break;
13403|      0|      }
13404|  11.9k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13404:7): [True: 11.9k, False: 50.8k]
  ------------------
13405|  11.9k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13406|  11.9k|                helpers::substring(url_data, input_position));
13407|       |
13408|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13409|       |        // then set state to special authority ignore slashes state and increase
13410|       |        // pointer by 1.
13411|  11.9k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13411:13): [True: 11.9k, False: 0]
  ------------------
13412|  11.9k|          input_position += 2;
13413|  11.9k|        }
13414|       |
13415|  11.9k|        [[fallthrough]];
13416|  11.9k|      }
13417|  11.9k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13417:7): [True: 0, False: 62.7k]
  ------------------
13418|  11.9k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13419|  11.9k|                helpers::substring(url_data, input_position));
13420|       |
13421|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13422|       |        // authority state and decrease pointer by 1.
13423|  12.1k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13423:16): [True: 12.1k, False: 2]
  ------------------
13424|  12.1k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13424:17): [True: 83, False: 12.0k]
  ------------------
13425|  12.0k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13425:17): [True: 174, False: 11.9k]
  ------------------
13426|    257|          input_position++;
13427|    257|        }
13428|  11.9k|        state = state::AUTHORITY;
13429|       |
13430|  11.9k|        break;
13431|  11.9k|      }
13432|    449|      case state::QUERY: {
  ------------------
  |  Branch (13432:7): [True: 449, False: 62.3k]
  ------------------
13433|    449|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13434|    449|        if constexpr (store_values) {
13435|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13436|       |          // if url is special; otherwise the query percent-encode set.
13437|    449|          const uint8_t* query_percent_encode_set =
13438|    449|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13438:15): [True: 449, False: 0]
  ------------------
13439|    449|                               : character_sets::QUERY_PERCENT_ENCODE;
13440|       |
13441|       |          // Percent-encode after encoding, with encoding, buffer, and
13442|       |          // queryPercentEncodeSet, and append the result to url's query.
13443|    449|          url.update_base_search(url_data.substr(input_position),
13444|    449|                                 query_percent_encode_set);
13445|    449|          ada_log("QUERY update_base_search completed ");
13446|    449|          if (fragment.has_value()) {
  ------------------
  |  Branch (13446:15): [True: 9, False: 440]
  ------------------
13447|      9|            url.update_unencoded_base_hash(*fragment);
13448|      9|          }
13449|    449|        }
13450|    449|        enforce_max_input_length();
13451|    449|        return url;
13452|  11.9k|      }
13453|  11.9k|      case state::HOST: {
  ------------------
  |  Branch (13453:7): [True: 11.9k, False: 50.8k]
  ------------------
13454|  11.9k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13455|       |
13456|  11.9k|        std::string_view host_view = url_data.substr(input_position);
13457|  11.9k|        auto [location, found_colon] =
13458|  11.9k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13459|  11.9k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13459:26): [True: 11.9k, False: 0]
  ------------------
13460|  11.9k|                             ? input_position + location
13461|  11.9k|                             : input_size;
13462|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13463|       |        // Note: the 'found_colon' value is true if and only if a colon was
13464|       |        // encountered while not inside brackets.
13465|  11.9k|        if (found_colon) {
  ------------------
  |  Branch (13465:13): [True: 698, False: 11.2k]
  ------------------
13466|       |          // If buffer is the empty string, validation error, return failure.
13467|       |          // Let host be the result of host parsing buffer with url is not
13468|       |          // special.
13469|    698|          ada_log("HOST parsing ", host_view);
13470|    698|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13470:15): [True: 142, False: 556]
  ------------------
13471|    142|            return url;
13472|    142|          }
13473|    556|          ada_log("HOST parsing results in ", url.get_hostname());
13474|       |          // Set url's host to host, buffer to the empty string, and state to
13475|       |          // port state.
13476|    556|          state = state::PORT;
13477|    556|          input_position++;
13478|    556|        }
13479|       |        // Otherwise, if one of the following is true:
13480|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13481|       |        // - url is special and c is U+005C (\)
13482|       |        // The get_host_delimiter_location function either brings us to
13483|       |        // the colon outside of the bracket, or to one of those characters.
13484|  11.2k|        else {
13485|       |          // If url is special and host_view is the empty string, validation
13486|       |          // error, return failure.
13487|  11.2k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13487:15): [True: 8, False: 11.2k]
  |  Branch (13487:36): [True: 8, False: 0]
  ------------------
13488|      8|            url.is_valid = false;
13489|      8|            return url;
13490|      8|          }
13491|  11.2k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13492|       |          // Let host be the result of host parsing host_view with url is not
13493|       |          // special.
13494|  11.2k|          if (host_view.empty()) {
  ------------------
  |  Branch (13494:15): [True: 0, False: 11.2k]
  ------------------
13495|      0|            url.update_base_hostname("");
13496|  11.2k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13496:22): [True: 10.0k, False: 1.11k]
  ------------------
13497|  10.0k|            return url;
13498|  10.0k|          }
13499|  1.11k|          ada_log("HOST parsing results in ", url.get_hostname(),
13500|  1.11k|                  " href=", url.get_href());
13501|       |
13502|       |          // Set url's host to host, and state to path start state.
13503|  1.11k|          state = state::PATH_START;
13504|  1.11k|        }
13505|       |
13506|  1.66k|        break;
13507|  11.9k|      }
13508|  1.66k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13508:7): [True: 0, False: 62.7k]
  ------------------
13509|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13510|       |        // Opaque path, query, and fragment are structurally always valid:
13511|       |        // the parser would just percent-encode whatever is there. When we
13512|       |        // are not storing values (can_parse), we can return immediately.
13513|       |        // We must set has_opaque_path = true before returning so that when
13514|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13515|       |        // correctly rejects relative inputs against an opaque-path base
13516|       |        // (e.g. can_parse("", &"W:") must return false).
13517|       |        if constexpr (!store_values) {
13518|       |          url.has_opaque_path = true;
13519|       |          return url;
13520|       |        }
13521|      0|        std::string_view view = url_data.substr(input_position);
13522|       |        // If c is U+003F (?), then set url's query to the empty string and
13523|       |        // state to query state.
13524|      0|        size_t location = view.find('?');
13525|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13525:13): [True: 0, False: 0]
  ------------------
13526|      0|          view.remove_suffix(view.size() - location);
13527|      0|          state = state::QUERY;
13528|      0|          input_position += location + 1;
13529|      0|        } else {
13530|      0|          input_position = input_size + 1;
13531|      0|        }
13532|      0|        url.has_opaque_path = true;
13533|       |
13534|       |        // This is a really unlikely scenario in real world. We should not seek
13535|       |        // to optimize it.
13536|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13536:13): [True: 0, False: 0]
  ------------------
13537|      0|          std::string modified_view =
13538|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
13539|      0|          url.update_base_pathname(unicode::percent_encode(
13540|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13541|      0|        } else {
13542|      0|          url.update_base_pathname(unicode::percent_encode(
13543|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13544|      0|        }
13545|      0|        break;
13546|  11.9k|      }
13547|    556|      case state::PORT: {
  ------------------
  |  Branch (13547:7): [True: 556, False: 62.2k]
  ------------------
13548|    556|        ada_log("PORT ", helpers::substring(url_data, input_position));
13549|    556|        std::string_view port_view = url_data.substr(input_position);
13550|    556|        input_position += url.parse_port(port_view, true);
13551|    556|        if (!url.is_valid) {
  ------------------
  |  Branch (13551:13): [True: 480, False: 76]
  ------------------
13552|    480|          return url;
13553|    480|        }
13554|     76|        state = state::PATH_START;
13555|     76|        [[fallthrough]];
13556|     76|      }
13557|  1.18k|      case state::PATH_START: {
  ------------------
  |  Branch (13557:7): [True: 1.11k, False: 61.6k]
  ------------------
13558|  1.18k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13559|       |        // Path, query, and fragment are structurally always valid: the
13560|       |        // parser would just percent-encode whatever is there. When we are
13561|       |        // not storing values (can_parse), we can return immediately since
13562|       |        // no subsequent state can invalidate the URL.
13563|       |        if constexpr (!store_values) {
13564|       |          return url;
13565|       |        }
13566|       |
13567|       |        // If url is special, then:
13568|  1.18k|        if (url.is_special()) {
  ------------------
  |  Branch (13568:13): [True: 1.18k, False: 0]
  ------------------
13569|       |          // Set state to path state.
13570|  1.18k|          state = state::PATH;
13571|       |
13572|       |          // Optimization: Avoiding going into PATH state improves the
13573|       |          // performance of urls ending with /.
13574|  1.18k|          if (input_position == input_size) {
  ------------------
  |  Branch (13574:15): [True: 89, False: 1.09k]
  ------------------
13575|     89|            if constexpr (store_values) {
13576|     89|              url.update_base_pathname("/");
13577|     89|              if (fragment.has_value()) {
  ------------------
  |  Branch (13577:19): [True: 89, False: 0]
  ------------------
13578|     89|                url.update_unencoded_base_hash(*fragment);
13579|     89|              }
13580|     89|            }
13581|     89|            enforce_max_input_length();
13582|     89|            return url;
13583|     89|          }
13584|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13585|       |          // by 1. We know that (input_position == input_size) is impossible
13586|       |          // here, because of the previous if-check.
13587|  1.09k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13587:15): [True: 115, False: 984]
  ------------------
13588|    115|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13588:15): [True: 110, False: 5]
  ------------------
13589|    110|            break;
13590|    110|          }
13591|  1.09k|        }
13592|       |        // Otherwise, if state override is not given and c is U+003F (?),
13593|       |        // set url's query to the empty string and state to query state.
13594|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13594:18): [True: 0, False: 0]
  ------------------
13595|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13595:18): [True: 0, False: 0]
  ------------------
13596|      0|          state = state::QUERY;
13597|      0|        }
13598|       |        // Otherwise, if c is not the EOF code point:
13599|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (13599:18): [True: 0, False: 0]
  ------------------
13600|       |          // Set state to path state.
13601|      0|          state = state::PATH;
13602|       |
13603|       |          // If c is not U+002F (/), then decrease pointer by 1.
13604|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13604:15): [True: 0, False: 0]
  ------------------
13605|      0|            break;
13606|      0|          }
13607|      0|        }
13608|       |
13609|    989|        input_position++;
13610|    989|        break;
13611|  1.18k|      }
13612|  1.09k|      case state::PATH: {
  ------------------
  |  Branch (13612:7): [True: 1.09k, False: 61.6k]
  ------------------
13613|  1.09k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13614|       |        // Path, query, and fragment are structurally always valid: the
13615|       |        // parser would just percent-encode whatever is there. When we are
13616|       |        // not storing values (can_parse), we can return immediately since
13617|       |        // no subsequent state can invalidate the URL.
13618|       |        if constexpr (!store_values) {
13619|       |          return url;
13620|       |        }
13621|  1.09k|        std::string_view view = url_data.substr(input_position);
13622|       |
13623|       |        // Most time, we do not need percent encoding.
13624|       |        // Furthermore, we can immediately locate the '?'.
13625|  1.09k|        size_t locofquestionmark = view.find('?');
13626|  1.09k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13626:13): [True: 449, False: 650]
  ------------------
13627|    449|          state = state::QUERY;
13628|    449|          view.remove_suffix(view.size() - locofquestionmark);
13629|    449|          input_position += locofquestionmark + 1;
13630|    650|        } else {
13631|    650|          input_position = input_size + 1;
13632|    650|        }
13633|  1.09k|        if constexpr (store_values) {
13634|       |          if constexpr (result_type_is_ada_url) {
13635|       |            helpers::parse_prepared_path(view, url.type, url.path);
13636|  1.09k|          } else {
13637|  1.09k|            url.consume_prepared_path(view);
13638|  1.09k|            ADA_ASSERT_TRUE(url.validate());
13639|  1.09k|          }
13640|  1.09k|        }
13641|  1.09k|        break;
13642|  1.18k|      }
13643|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13643:7): [True: 0, False: 62.7k]
  ------------------
13644|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13645|       |
13646|       |        // If c is U+002F (/) or U+005C (\), then:
13647|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13647:13): [True: 0, False: 0]
  ------------------
13648|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13648:14): [True: 0, False: 0]
  ------------------
13649|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13649:14): [True: 0, False: 0]
  ------------------
13650|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
13651|       |          // Set state to file host state.
13652|      0|          state = state::FILE_HOST;
13653|      0|          input_position++;
13654|      0|        } else {
13655|      0|          ada_log("FILE_SLASH otherwise");
13656|       |          // If base is non-null and base's scheme is "file", then:
13657|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13658|       |          // base_url_has_value() is true.
13659|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13659:15): [True: 0, False: 0]
  |  Branch (13659:38): [True: 0, False: 0]
  ------------------
13660|       |            // Set url's host to base's host.
13661|       |            if constexpr (result_type_is_ada_url) {
13662|       |              url.host = base_url->host;
13663|      0|            } else {
13664|      0|              url.update_host_to_base_host(base_url->get_host());
13665|      0|            }
13666|       |            // If the code point substring from pointer to the end of input does
13667|       |            // not start with a Windows drive letter and base's path[0] is a
13668|       |            // normalized Windows drive letter, then append base's path[0] to
13669|       |            // url's path.
13670|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13670:17): [True: 0, False: 0]
  ------------------
13671|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13671:19): [True: 0, False: 0]
  ------------------
13672|      0|                      url_data.substr(input_position))) {
13673|      0|                std::string_view first_base_url_path =
13674|      0|                    base_url->get_pathname().substr(1);
13675|      0|                size_t loc = first_base_url_path.find('/');
13676|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13676:21): [True: 0, False: 0]
  ------------------
13677|      0|                  helpers::resize(first_base_url_path, loc);
13678|      0|                }
13679|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13679:21): [True: 0, False: 0]
  ------------------
13680|      0|                        first_base_url_path)) {
13681|       |                  if constexpr (result_type_is_ada_url) {
13682|       |                    url.path += '/';
13683|       |                    url.path += first_base_url_path;
13684|      0|                  } else {
13685|      0|                    url.append_base_pathname(
13686|      0|                        helpers::concat("/", first_base_url_path));
13687|      0|                  }
13688|      0|                }
13689|      0|              }
13690|      0|            }
13691|      0|          }
13692|       |
13693|       |          // Set state to path state, and decrease pointer by 1.
13694|      0|          state = state::PATH;
13695|      0|        }
13696|       |
13697|      0|        break;
13698|  1.18k|      }
13699|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13699:7): [True: 0, False: 62.7k]
  ------------------
13700|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13701|      0|        std::string_view view = url_data.substr(input_position);
13702|       |
13703|      0|        size_t location = view.find_first_of("/\\?");
13704|      0|        std::string_view file_host_buffer = view.substr(
13705|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13705:16): [True: 0, False: 0]
  ------------------
13706|       |
13707|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13707:13): [True: 0, False: 0]
  ------------------
13708|      0|          state = state::PATH;
13709|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13709:20): [True: 0, False: 0]
  ------------------
13710|       |          // Set url's host to the empty string.
13711|       |          if constexpr (result_type_is_ada_url) {
13712|       |            url.host = "";
13713|      0|          } else {
13714|      0|            url.update_base_hostname("");
13715|      0|          }
13716|       |          // Set state to path start state.
13717|      0|          state = state::PATH_START;
13718|      0|        } else {
13719|      0|          size_t consumed_bytes = file_host_buffer.size();
13720|      0|          input_position += consumed_bytes;
13721|       |          // Let host be the result of host parsing buffer with url is not
13722|       |          // special.
13723|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13723:15): [True: 0, False: 0]
  ------------------
13724|      0|            return url;
13725|      0|          }
13726|       |
13727|       |          if constexpr (result_type_is_ada_url) {
13728|       |            // If host is "localhost", then set host to the empty string.
13729|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13730|       |              url.host = "";
13731|       |            }
13732|      0|          } else {
13733|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13733:17): [True: 0, False: 0]
  ------------------
13734|      0|              url.update_base_hostname("");
13735|      0|            }
13736|      0|          }
13737|       |
13738|       |          // Set buffer to the empty string and state to path start state.
13739|      0|          state = state::PATH_START;
13740|      0|        }
13741|       |
13742|      0|        break;
13743|      0|      }
13744|      0|      case state::FILE: {
  ------------------
  |  Branch (13744:7): [True: 0, False: 62.7k]
  ------------------
13745|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
13746|      0|        std::string_view file_view = url_data.substr(input_position);
13747|       |
13748|      0|        url.set_protocol_as_file();
13749|       |        if constexpr (result_type_is_ada_url) {
13750|       |          // Set url's host to the empty string.
13751|       |          url.host = "";
13752|      0|        } else {
13753|      0|          url.update_base_hostname("");
13754|      0|        }
13755|       |        // If c is U+002F (/) or U+005C (\), then:
13756|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (13756:13): [True: 0, False: 0]
  ------------------
13757|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13757:14): [True: 0, False: 0]
  ------------------
13758|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13758:14): [True: 0, False: 0]
  ------------------
13759|      0|          ada_log("FILE c is U+002F or U+005C");
13760|       |          // Set state to file slash state.
13761|      0|          state = state::FILE_SLASH;
13762|      0|        }
13763|       |        // Otherwise, if base is non-null and base's scheme is "file":
13764|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13764:18): [True: 0, False: 0]
  |  Branch (13764:41): [True: 0, False: 0]
  ------------------
13765|       |          // Set url's host to base's host, url's path to a clone of base's
13766|       |          // path, and url's query to base's query.
13767|      0|          ada_log("FILE base non-null");
13768|       |          if constexpr (result_type_is_ada_url) {
13769|       |            url.host = base_url->host;
13770|       |            url.path = base_url->path;
13771|       |            url.query = base_url->query;
13772|      0|          } else {
13773|      0|            url.update_host_to_base_host(base_url->get_hostname());
13774|      0|            url.update_base_pathname(base_url->get_pathname());
13775|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13775:17): [True: 0, False: 0]
  ------------------
13776|       |              // get_search() returns "" for an empty query string (URL ends
13777|       |              // with '?'). update_base_search("") would incorrectly clear the
13778|       |              // query, so pass "?" to preserve the empty query distinction.
13779|      0|              auto s = base_url->get_search();
13780|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13780:38): [True: 0, False: 0]
  ------------------
13781|      0|            }
13782|      0|          }
13783|      0|          url.has_opaque_path = base_url->has_opaque_path;
13784|       |
13785|       |          // If c is U+003F (?), then set url's query to the empty string and
13786|       |          // state to query state.
13787|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13787:15): [True: 0, False: 0]
  |  Branch (13787:47): [True: 0, False: 0]
  ------------------
13788|      0|            state = state::QUERY;
13789|      0|          }
13790|       |          // Otherwise, if c is not the EOF code point:
13791|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13791:20): [True: 0, False: 0]
  ------------------
13792|       |            // Set url's query to null.
13793|      0|            url.clear_search();
13794|       |            // If the code point substring from pointer to the end of input does
13795|       |            // not start with a Windows drive letter, then shorten url's path.
13796|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13796:17): [True: 0, False: 0]
  ------------------
13797|       |              if constexpr (result_type_is_ada_url) {
13798|       |                helpers::shorten_path(url.path, url.type);
13799|      0|              } else {
13800|      0|                std::string_view path = url.get_pathname();
13801|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13801:21): [True: 0, False: 0]
  ------------------
13802|      0|                  url.update_base_pathname(std::move(std::string(path)));
13803|      0|                }
13804|      0|              }
13805|      0|            }
13806|       |            // Otherwise:
13807|      0|            else {
13808|       |              // Set url's path to an empty list.
13809|      0|              url.clear_pathname();
13810|      0|              url.has_opaque_path = true;
13811|      0|            }
13812|       |
13813|       |            // Set state to path state and decrease pointer by 1.
13814|      0|            state = state::PATH;
13815|      0|            break;
13816|      0|          }
13817|      0|        }
13818|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13819|      0|        else {
13820|      0|          ada_log("FILE go to path");
13821|      0|          state = state::PATH;
13822|      0|          break;
13823|      0|        }
13824|       |
13825|      0|        input_position++;
13826|      0|        break;
13827|      0|      }
13828|      0|      default:
  ------------------
  |  Branch (13828:7): [True: 0, False: 62.7k]
  ------------------
13829|      0|        unreachable();
13830|  62.7k|    }
13831|  62.7k|  }
13832|  2.04k|  if constexpr (store_values) {
13833|  2.04k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13833:9): [True: 18, False: 2.02k]
  ------------------
13834|     18|      url.update_unencoded_base_hash(*fragment);
13835|     18|    }
13836|  2.04k|  }
13837|  2.04k|  enforce_max_input_length();
13838|  2.04k|  return url;
13839|  13.3k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14855|  3.03k|    ada_lifetime_bound {
14856|  3.03k|  ada_log("url_aggregator::get_hostname");
14857|       |  // Technically, we should check if there is a hostname, but
14858|       |  // the code below works even if there isn't.
14859|       |  // if(!has_hostname()) { return ""; }
14860|  3.03k|  size_t start = components.host_start;
14861|       |  // So host_start is not where the host begins.
14862|  3.03k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14862:7): [True: 346, False: 2.68k]
  ------------------
14863|    346|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14863:7): [True: 36, False: 310]
  ------------------
14864|     36|    start++;
14865|     36|  }
14866|  3.03k|  return helpers::substring(buffer, start, components.host_end);
14867|  3.03k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
15000|  2.37k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
15001|  2.37k|  ada_log("parse_ipv4 ", input, " [", input.size(),
15002|  2.37k|          " bytes], overlaps with buffer: ",
15003|  2.37k|          helpers::overlaps(input, buffer) ? "yes" : "no");
15004|  2.37k|  ADA_ASSERT_TRUE(validate());
15005|  2.37k|  if (input.empty()) {
  ------------------
  |  Branch (15005:7): [True: 0, False: 2.37k]
  ------------------
15006|      0|    return is_valid = false;
15007|      0|  }
15008|  2.37k|  const bool trailing_dot = (input.back() == '.');
15009|  2.37k|  if (trailing_dot) {
  ------------------
  |  Branch (15009:7): [True: 24, False: 2.35k]
  ------------------
15010|     24|    input.remove_suffix(1);
15011|     24|    if (input.empty()) {
  ------------------
  |  Branch (15011:9): [True: 0, False: 24]
  ------------------
15012|      0|      return is_valid = false;
15013|      0|    }
15014|     24|  }
15015|       |
15016|  2.37k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
15017|  2.37k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (15017:7): [True: 7, False: 2.37k]
  ------------------
15018|       |    // Pure decimal: keep the buffer when it already holds the address.
15019|       |    // Otherwise write the (trailing-dot-stripped) input.
15020|      7|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (15020:11): [True: 0, False: 7]
  |  Branch (15020:23): [True: 0, False: 0]
  ------------------
15021|      7|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (15021:11): [True: 0, False: 7]
  ------------------
15022|      0|        update_base_hostname(std::string(input));
15023|      7|      } else {
15024|      7|        update_base_hostname(input);
15025|      7|      }
15026|      7|    }
15027|      7|    host_type = IPV4;
15028|      7|    ADA_ASSERT_TRUE(validate());
15029|      7|    return true;
15030|      7|  }
15031|       |
15032|  2.37k|  const char* p = input.data();
15033|  2.37k|  const char* end = p + input.size();
15034|  2.37k|  uint64_t ipv4 = 0;
15035|  2.37k|  int digit_count = 0;
15036|  2.37k|  int pure_decimal_count = 0;
15037|       |
15038|  2.61k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (15038:10): [True: 2.60k, False: 4]
  |  Branch (15038:29): [True: 2.60k, False: 0]
  ------------------
15039|  2.60k|    uint64_t segment = 0;
15040|  2.60k|    bool pure = false;
15041|  2.60k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (15041:9): [True: 1.68k, False: 928]
  ------------------
15042|  1.68k|      return is_valid = false;
15043|  1.68k|    }
15044|    928|    if (pure) {
  ------------------
  |  Branch (15044:9): [True: 697, False: 231]
  ------------------
15045|    697|      ++pure_decimal_count;
15046|    697|    }
15047|    928|    if (p >= end) {
  ------------------
  |  Branch (15047:9): [True: 658, False: 270]
  ------------------
15048|    658|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
15049|    658|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (15049:11): [True: 19, False: 639]
  ------------------
15050|     19|        return is_valid = false;
15051|     19|      }
15052|    639|      ipv4 = (ipv4 << shift) | segment;
15053|    639|      goto ipv4_done;
15054|    658|    }
15055|    270|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (15055:9): [True: 30, False: 240]
  |  Branch (15055:26): [True: 0, False: 240]
  ------------------
15056|     30|      return is_valid = false;
15057|     30|    }
15058|    240|    ipv4 = (ipv4 << 8) | segment;
15059|    240|    ++p;
15060|    240|  }
15061|      4|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (15061:7): [True: 0, False: 4]
  |  Branch (15061:27): [True: 4, False: 0]
  ------------------
15062|      4|    return is_valid = false;
15063|      4|  }
15064|    639|ipv4_done:
15065|    639|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
15066|    639|          " host: ", get_host());
15067|    639|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (15067:7): [True: 0, False: 639]
  |  Branch (15067:19): [True: 0, False: 0]
  |  Branch (15067:46): [True: 0, False: 0]
  ------------------
15068|      0|    ada_log(
15069|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
15070|      0|        "buffer");
15071|    639|  } else {
15072|    639|    update_base_hostname(ada::serializers::ipv4(ipv4));
15073|    639|  }
15074|    639|  host_type = IPV4;
15075|    639|  ADA_ASSERT_TRUE(validate());
15076|    639|  return true;
15077|      4|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15079|  7.19k|bool url_aggregator::parse_ipv6(std::string_view input) {
15080|  7.19k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
15081|  7.19k|  ADA_ASSERT_TRUE(validate());
15082|  7.19k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15083|  7.19k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (15083:7): [True: 3, False: 7.18k]
  |  Branch (15083:24): [True: 3, False: 7.18k]
  ------------------
15084|      6|    return is_valid = false;
15085|      6|  }
15086|  7.18k|  std::array<uint16_t, 8> address{};
15087|       |#if defined(ADA_AVX512_IPV6)
15088|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
15089|       |                                                     address, simd_valid)) {
15090|       |    if (!simd_valid) [[unlikely]] {
15091|       |      return is_valid = false;
15092|       |    }
15093|       |    const std::string serialized = ada::serializers::ipv6(address);
15094|       |    if (get_hostname() != serialized) {
15095|       |      update_base_hostname(serialized);
15096|       |    }
15097|       |    host_type = IPV6;
15098|       |    return true;
15099|       |  }
15100|       |  address = {};
15101|       |#endif
15102|  7.18k|  const char* pointer = input.data();
15103|  7.18k|  const char* const end = pointer + input.size();
15104|  7.18k|  int piece_index = 0;
15105|  7.18k|  int compress = -1;
15106|       |
15107|  7.18k|  if (*pointer == ':') {
  ------------------
  |  Branch (15107:7): [True: 20, False: 7.16k]
  ------------------
15108|     20|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (15108:9): [True: 1, False: 19]
  |  Branch (15108:30): [True: 7, False: 12]
  ------------------
15109|      8|      return is_valid = false;
15110|      8|    }
15111|     12|    pointer += 2;
15112|     12|    compress = ++piece_index;
15113|     12|  }
15114|       |
15115|  7.38k|  while (pointer != end) {
  ------------------
  |  Branch (15115:10): [True: 7.34k, False: 37]
  ------------------
15116|  7.34k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (15116:9): [True: 2, False: 7.34k]
  ------------------
15117|      2|      return is_valid = false;
15118|      2|    }
15119|  7.34k|    if (*pointer == ':') {
  ------------------
  |  Branch (15119:9): [True: 13, False: 7.33k]
  ------------------
15120|     13|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (15120:11): [True: 1, False: 12]
  ------------------
15121|      1|        return is_valid = false;
15122|      1|      }
15123|     12|      ++pointer;
15124|     12|      compress = ++piece_index;
15125|     12|      continue;
15126|     13|    }
15127|       |
15128|  7.33k|    uint16_t value = 0;
15129|  7.33k|    const int length = detail::parse_hex_piece(pointer, end, value);
15130|       |
15131|  7.33k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (15131:9): [True: 7.30k, False: 27]
  |  Branch (15131:27): [True: 66, False: 7.23k]
  ------------------
15132|     66|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15132:11): [True: 2, False: 64]
  ------------------
15133|      2|        return is_valid = false;
15134|      2|      }
15135|     64|      pointer -= length;
15136|     64|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (15136:11): [True: 2, False: 62]
  ------------------
15137|      2|        return is_valid = false;
15138|      2|      }
15139|       |
15140|     62|      int numbers_seen = 0;
15141|    150|      while (pointer != end) {
  ------------------
  |  Branch (15141:14): [True: 142, False: 8]
  ------------------
15142|    142|        int ipv4_piece = -1;
15143|    142|        if (numbers_seen > 0) {
  ------------------
  |  Branch (15143:13): [True: 80, False: 62]
  ------------------
15144|     80|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (15144:15): [True: 62, False: 18]
  |  Branch (15144:34): [True: 61, False: 1]
  ------------------
15145|     61|            ++pointer;
15146|     61|          } else {
15147|     19|            return is_valid = false;
15148|     19|          }
15149|     80|        }
15150|    123|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (15150:13): [True: 21, False: 102]
  |  Branch (15150:31): [True: 1, False: 101]
  |  Branch (15150:49): [True: 4, False: 97]
  ------------------
15151|     26|          return is_valid = false;
15152|     26|        }
15153|     97|        ipv4_piece = *pointer - '0';
15154|     97|        ++pointer;
15155|     97|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15155:13): [True: 94, False: 3]
  |  Branch (15155:31): [True: 51, False: 43]
  |  Branch (15155:50): [True: 47, False: 4]
  ------------------
15156|     47|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (15156:15): [True: 2, False: 45]
  ------------------
15157|      2|            return is_valid = false;
15158|      2|          }
15159|     45|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15160|     45|          ++pointer;
15161|     45|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15161:15): [True: 43, False: 2]
  |  Branch (15161:33): [True: 30, False: 13]
  |  Branch (15161:52): [True: 25, False: 5]
  ------------------
15162|     25|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15163|     25|            ++pointer;
15164|     25|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (15164:17): [True: 7, False: 18]
  ------------------
15165|      7|              return is_valid = false;
15166|      7|            }
15167|     25|          }
15168|     45|        }
15169|     88|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
15170|     88|            address[static_cast<size_t>(piece_index)] * 0x100 +
15171|     88|            static_cast<uint16_t>(ipv4_piece));
15172|     88|        ++numbers_seen;
15173|     88|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (15173:13): [True: 24, False: 64]
  |  Branch (15173:34): [True: 5, False: 59]
  ------------------
15174|     29|          ++piece_index;
15175|     29|        }
15176|     88|      }
15177|      8|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (15177:11): [True: 5, False: 3]
  ------------------
15178|      5|        return is_valid = false;
15179|      5|      }
15180|      3|      break;
15181|      8|    }
15182|       |
15183|  7.26k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15183:9): [True: 7.05k, False: 208]
  ------------------
15184|  7.05k|      return is_valid = false;
15185|  7.05k|    }
15186|       |
15187|    208|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (15187:9): [True: 181, False: 27]
  |  Branch (15187:27): [True: 175, False: 6]
  ------------------
15188|    175|      ++pointer;
15189|    175|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (15189:11): [True: 7, False: 168]
  ------------------
15190|      7|        return is_valid = false;
15191|      7|      }
15192|    175|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (15192:16): [True: 6, False: 27]
  ------------------
15193|      6|      return is_valid = false;
15194|      6|    }
15195|       |
15196|    195|    address[static_cast<size_t>(piece_index)] = value;
15197|    195|    ++piece_index;
15198|    195|  }
15199|       |
15200|     40|  if (compress != -1) {
  ------------------
  |  Branch (15200:7): [True: 21, False: 19]
  ------------------
15201|     21|    const int right = piece_index - compress;
15202|     21|    if (right > 0) {
  ------------------
  |  Branch (15202:9): [True: 11, False: 10]
  ------------------
15203|     11|      const size_t dest = static_cast<size_t>(8 - right);
15204|     11|      const size_t src = static_cast<size_t>(compress);
15205|     11|      if (dest != src) {
  ------------------
  |  Branch (15205:11): [True: 7, False: 4]
  ------------------
15206|     24|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (15206:53): [True: 17, False: 7]
  ------------------
15207|     17|          address[dest + i] = address[src + i];
15208|     17|          address[src + i] = 0;
15209|     17|        }
15210|      7|      }
15211|     11|    }
15212|     21|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (15212:14): [True: 16, False: 3]
  ------------------
15213|     16|    return is_valid = false;
15214|     16|  }
15215|       |
15216|       |  // Serialize once; skip rewrite when hostname is already canonical.
15217|     24|  const std::string serialized = ada::serializers::ipv6(address);
15218|     24|  const std::string_view current = get_hostname();
15219|     24|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (15219:7): [True: 0, False: 24]
  ------------------
15220|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (15220:7): [True: 0, False: 0]
  ------------------
15221|      0|    ada_log("parse_ipv6 in-place canonical match");
15222|     24|  } else {
15223|     24|    update_base_hostname(serialized);
15224|     24|  }
15225|     24|  ada_log("parse_ipv6 ", get_hostname());
15226|     24|  ADA_ASSERT_TRUE(validate());
15227|     24|  host_type = IPV6;
15228|     24|  return true;
15229|     40|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  274|  54.0k|  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|  54.0k|    return c > -65;
  278|  54.0k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  480|      2|inline Huff make_fixed_litlen_huff() {
  481|      2|  Huff h;
  482|      2|  uint8_t lens[288];
  483|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  484|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (484:19): [True: 288, False: 2]
  ------------------
  485|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (485:21): [True: 224, False: 2]
  ------------------
  486|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (486:21): [True: 48, False: 2]
  ------------------
  487|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (487:21): [True: 16, False: 2]
  ------------------
  488|      2|  h.build(lens, 288);
  489|      2|  return h;
  490|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  429|     16|  bool build(const uint8_t* lens, int n) {
  430|     16|    std::memset(counts, 0, sizeof(counts));
  431|     16|    std::memset(first_code, 0, sizeof(first_code));
  432|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  433|     16|    nsymbols = n;
  434|     16|    max_bits = 0;
  435|  1.99k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (435:21): [True: 1.97k, False: 16]
  ------------------
  436|  1.97k|      lengths[i] = lens[i];
  437|  1.97k|      if (lens[i]) {
  ------------------
  |  Branch (437:11): [True: 1.93k, False: 42]
  ------------------
  438|  1.93k|        counts[lens[i]]++;
  439|  1.93k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (439:13): [True: 45, False: 1.88k]
  ------------------
  440|  1.93k|      }
  441|  1.97k|    }
  442|       |    // Canonical first code for each bit length (RFC 1951).
  443|     16|    int code = 0;
  444|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (444:24): [True: 240, False: 16]
  ------------------
  445|    240|      code = (code + counts[bits - 1]) << 1;
  446|    240|      first_code[bits] = code;
  447|    240|    }
  448|     16|    int idx = 0;
  449|    159|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (449:24): [True: 143, False: 16]
  ------------------
  450|    143|      base_idx[bits] = idx;
  451|       |      // assign symbols in symbol order for codes of this length
  452|  21.8k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (452:25): [True: 21.6k, False: 143]
  ------------------
  453|  21.6k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (453:13): [True: 1.93k, False: 19.7k]
  ------------------
  454|  1.93k|          symbols[idx++] = static_cast<int16_t>(sym);
  455|  1.93k|        }
  456|  21.6k|      }
  457|    143|    }
  458|     16|    return true;
  459|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  492|      2|inline Huff make_fixed_dist_huff() {
  493|      2|  Huff h;
  494|      2|  uint8_t lens[32];
  495|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (495:19): [True: 64, False: 2]
  ------------------
  496|      2|  h.build(lens, 32);
  497|      2|  return h;
  498|      2|}
serializers.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5339|    474|  auto broadcast = [](uint8_t v) -> uint64_t {
 5340|    474|    return 0x101010101010101ull * v;
 5341|    474|  };
_ZN3ada4idna13ensure_tablesEv:
 5085|  8.37k|[[nodiscard]] inline bool ensure_tables() noexcept {
 5086|  8.37k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 5087|  8.37k|  if (state == kTablesReady) {
  ------------------
  |  Branch (5087:7): [True: 8.37k, False: 1]
  ------------------
 5088|  8.37k|    return true;
 5089|  8.37k|  }
 5090|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (5090:7): [True: 0, False: 1]
  ------------------
 5091|      0|    return false;
 5092|      0|  }
 5093|       |
 5094|      1|  uint8_t expected = kTablesUninit;
 5095|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (5095:7): [True: 1, False: 0]
  ------------------
 5096|      1|                                                std::memory_order_acq_rel,
 5097|      1|                                                std::memory_order_acquire)) {
 5098|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 5099|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (5099:9): [True: 0, False: 1]
  ------------------
 5100|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5101|      0|      return false;
 5102|      0|    }
 5103|       |
 5104|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 5105|      1|                                          table_blob::compressed_size, buffer,
 5106|      1|                                          table_blob::uncompressed_size);
 5107|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (5107:9): [True: 0, False: 1]
  ------------------
 5108|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (5108:9): [True: 0, False: 1]
  ------------------
 5109|      0|      delete[] buffer;
 5110|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5111|      0|      return false;
 5112|      0|    }
 5113|       |
 5114|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 5115|      1|    detail::convert_table_blob_to_host_endian(buffer);
 5116|       |
 5117|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5118|      1|      return buffer + off;
 5119|      1|    };
 5120|       |
 5121|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 5122|       |    // acquire on tables_init_state and then observe these writes.
 5123|      1|    idna_stage1 =
 5124|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 5125|      1|    idna_stage2 =
 5126|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 5127|      1|    idna_bool_blocks =
 5128|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 5129|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 5130|       |
 5131|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 5132|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 5133|      1|        at(table_blob::off_decomposition_block));
 5134|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 5135|      1|        at(table_blob::off_decomposition_data));
 5136|      1|    ccc_index = at(table_blob::off_ccc_index);
 5137|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 5138|      1|    composition_index = at(table_blob::off_composition_index);
 5139|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 5140|      1|        at(table_blob::off_composition_block));
 5141|      1|    composition_data =
 5142|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 5143|       |
 5144|      1|    id_continue =
 5145|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 5146|      1|    id_start =
 5147|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 5148|       |
 5149|      1|    dir_start =
 5150|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 5151|      1|    dir_final =
 5152|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 5153|      1|    dir_value = at(table_blob::off_dir_value);
 5154|      1|    combining_ranges =
 5155|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 5156|      1|    joining_start =
 5157|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_start));
 5158|      1|    joining_final =
 5159|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_final));
 5160|      1|    joining_value = at(table_blob::off_joining_value);
 5161|       |
 5162|      1|    tables_buffer = buffer;
 5163|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 5164|      1|    return true;
 5165|      1|  }
 5166|       |
 5167|       |  // Another thread owns init (or finished between our loads).
 5168|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (5168:28): [True: 0, False: 0]
  ------------------
 5169|      0|    state = tables_init_state.load(std::memory_order_acquire);
 5170|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (5170:9): [True: 0, False: 0]
  ------------------
 5171|      0|      return true;
 5172|      0|    }
 5173|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (5173:9): [True: 0, False: 0]
  ------------------
 5174|      0|      return false;
 5175|      0|    }
 5176|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 5177|      0|    defined(_M_IX86)
 5178|      0|#if defined(__GNUC__) || defined(__clang__)
 5179|      0|    __builtin_ia32_pause();
 5180|      0|#endif
 5181|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 5182|       |#if defined(__GNUC__) || defined(__clang__)
 5183|       |    asm volatile("yield" ::: "memory");
 5184|       |#endif
 5185|       |#endif
 5186|      0|  }
 5187|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 5188|      0|  return false;
 5189|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  525|      1|                          size_t dst_cap) {
  526|      1|  BitReader br(src, src_len);
  527|      1|  size_t out = 0;
  528|      4|  for (;;) {
  529|      4|    uint32_t bfinal = br.get(1);
  530|      4|    uint32_t btype = br.get(2);
  531|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (531:9): [True: 0, False: 4]
  |  Branch (531:33): [True: 0, False: 4]
  ------------------
  532|      4|    if (btype == 0) {
  ------------------
  |  Branch (532:9): [True: 0, False: 4]
  ------------------
  533|       |      // stored
  534|      0|      br.align_byte();
  535|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (535:11): [True: 0, False: 0]
  ------------------
  536|       |      // read 16+16 from bit buffer awkwardly - use byte path
  537|       |      // Align: bits is multiple of 8
  538|       |      // Get len from remaining bits then bytes
  539|      0|      uint32_t len = br.get(16);
  540|      0|      uint32_t nlen = br.get(16);
  541|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (541:11): [True: 0, False: 0]
  |  Branch (541:32): [True: 0, False: 0]
  ------------------
  542|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  ------------------
  543|       |      // After get, may have bits in acc from previous - for stored, should be
  544|       |      // byte aligned Copy len bytes from p
  545|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |        // leftover bits should be 0 if aligned
  547|      0|      }
  548|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (548:11): [True: 0, False: 0]
  ------------------
  549|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|      std::memcpy(dst + out, br.p, len);
  551|      0|      br.p += len;
  552|      0|      out += len;
  553|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (553:16): [True: 0, False: 4]
  |  Branch (553:30): [True: 4, False: 0]
  ------------------
  554|      4|      Huff lit, dist;
  555|      4|      if (btype == 1) {
  ------------------
  |  Branch (555:11): [True: 0, False: 4]
  ------------------
  556|       |        // use fixed via functions
  557|      4|      } else {
  558|       |        // dynamic
  559|      4|        uint32_t hlit = br.get(5);
  560|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (560:13): [True: 0, False: 4]
  ------------------
  561|      4|        hlit += 257;
  562|      4|        uint32_t hdist = br.get(5);
  563|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (563:13): [True: 0, False: 4]
  ------------------
  564|      4|        hdist += 1;
  565|      4|        uint32_t hclen = br.get(4);
  566|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (566:13): [True: 0, False: 4]
  ------------------
  567|      4|        hclen += 4;
  568|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  569|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  570|      4|        uint8_t clen[19]{};
  571|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (571:30): [True: 65, False: 4]
  ------------------
  572|     65|          uint32_t v = br.get(3);
  573|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (573:15): [True: 0, False: 65]
  ------------------
  574|     65|          clen[order[i]] = uint8_t(v);
  575|     65|        }
  576|      4|        Huff cl;
  577|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (577:13): [True: 0, False: 4]
  ------------------
  578|      4|        uint8_t lens[288 + 32]{};
  579|      4|        uint32_t n = hlit + hdist;
  580|  1.04k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (580:30): [True: 1.03k, False: 4]
  ------------------
  581|  1.03k|          int sym = cl.decode(br);
  582|  1.03k|          if (sym < 0) return 0;
  ------------------
  |  Branch (582:15): [True: 0, False: 1.03k]
  ------------------
  583|  1.03k|          if (sym < 16) {
  ------------------
  |  Branch (583:15): [True: 973, False: 63]
  ------------------
  584|    973|            lens[i++] = uint8_t(sym);
  585|    973|          } else if (sym == 16) {
  ------------------
  |  Branch (585:22): [True: 63, False: 0]
  ------------------
  586|     63|            uint32_t rep = br.get(2);
  587|     63|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (587:17): [True: 0, False: 63]
  ------------------
  588|     63|            rep += 3;
  589|     63|            if (i == 0) return 0;
  ------------------
  |  Branch (589:17): [True: 0, False: 63]
  ------------------
  590|     63|            uint8_t v = lens[i - 1];
  591|    350|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (591:20): [True: 287, False: 63]
  ------------------
  592|     63|          } else if (sym == 17) {
  ------------------
  |  Branch (592:22): [True: 0, False: 0]
  ------------------
  593|      0|            uint32_t rep = br.get(3);
  594|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (594:17): [True: 0, False: 0]
  ------------------
  595|      0|            rep += 3;
  596|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (596:20): [True: 0, False: 0]
  ------------------
  597|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (597:22): [True: 0, False: 0]
  ------------------
  598|      0|            uint32_t rep = br.get(7);
  599|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|            rep += 11;
  601|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (601:20): [True: 0, False: 0]
  ------------------
  602|      0|          } else
  603|      0|            return 0;
  604|  1.03k|        }
  605|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (605:13): [True: 0, False: 4]
  ------------------
  606|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (606:13): [True: 0, False: 4]
  ------------------
  607|      4|      }
  608|  54.4k|      for (;;) {
  609|  54.4k|        int sym;
  610|  54.4k|        if (btype == 1)
  ------------------
  |  Branch (610:13): [True: 0, False: 54.4k]
  ------------------
  611|      0|          sym = fixed_litlen(br);
  612|  54.4k|        else
  613|  54.4k|          sym = lit.decode(br);
  614|  54.4k|        if (sym < 0) return 0;
  ------------------
  |  Branch (614:13): [True: 0, False: 54.4k]
  ------------------
  615|  54.4k|        if (sym < 256) {
  ------------------
  |  Branch (615:13): [True: 38.5k, False: 15.9k]
  ------------------
  616|  38.5k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (616:15): [True: 0, False: 38.5k]
  ------------------
  617|  38.5k|          dst[out++] = uint8_t(sym);
  618|  38.5k|        } else if (sym == 256) {
  ------------------
  |  Branch (618:20): [True: 4, False: 15.9k]
  ------------------
  619|      4|          break;
  620|  15.9k|        } else {
  621|  15.9k|          int len_code = sym - 257;
  622|  15.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (622:15): [True: 0, False: 15.9k]
  |  Branch (622:31): [True: 0, False: 15.9k]
  ------------------
  623|  15.9k|          uint32_t extra = br.get(len_extra[len_code]);
  624|  15.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (624:15): [True: 2.24k, False: 13.6k]
  |  Branch (624:38): [True: 0, False: 2.24k]
  ------------------
  625|  15.9k|          uint32_t length =
  626|  15.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (626:37): [True: 2.24k, False: 13.6k]
  ------------------
  627|  15.9k|          int dsym;
  628|  15.9k|          if (btype == 1)
  ------------------
  |  Branch (628:15): [True: 0, False: 15.9k]
  ------------------
  629|      0|            dsym = fixed_dist(br);
  630|  15.9k|          else
  631|  15.9k|            dsym = dist.decode(br);
  632|  15.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (632:15): [True: 0, False: 15.9k]
  |  Branch (632:27): [True: 0, False: 15.9k]
  ------------------
  633|  15.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  634|  15.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (634:15): [True: 10.7k, False: 5.16k]
  |  Branch (634:35): [True: 0, False: 10.7k]
  ------------------
  635|  15.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (635:50): [True: 10.7k, False: 5.16k]
  ------------------
  636|  15.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (636:15): [True: 0, False: 15.9k]
  |  Branch (636:33): [True: 0, False: 15.9k]
  ------------------
  637|   193k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (637:32): [True: 177k, False: 15.9k]
  ------------------
  638|   177k|            dst[out] = dst[out - distance];
  639|   177k|            out++;
  640|   177k|          }
  641|  15.9k|        }
  642|  54.4k|      }
  643|      4|    } else {
  644|      0|      return 0;  // reserved
  645|      0|    }
  646|      4|    if (bfinal) break;
  ------------------
  |  Branch (646:9): [True: 1, False: 3]
  ------------------
  647|      4|  }
  648|      1|  return out;
  649|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  392|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  402|   475k|  uint32_t get(int n) {
  403|   475k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (403:9): [True: 0, False: 475k]
  ------------------
  404|   475k|    uint32_t v = acc & ((1u << n) - 1);
  405|   475k|    acc >>= n;
  406|   475k|    bits -= n;
  407|   475k|    return v;
  408|   475k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  394|   475k|  bool ensure(int n) {
  395|   540k|    while (bits < n) {
  ------------------
  |  Branch (395:12): [True: 65.3k, False: 475k]
  ------------------
  396|  65.3k|      if (p >= end) return false;
  ------------------
  |  Branch (396:11): [True: 0, False: 65.3k]
  ------------------
  397|  65.3k|      acc |= uint32_t(*p++) << bits;
  398|  65.3k|      bits += 8;
  399|  65.3k|    }
  400|   475k|    return true;
  401|   475k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  461|  71.4k|  int decode(BitReader& br) const {
  462|  71.4k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (462:9): [True: 0, False: 71.4k]
  ------------------
  463|  71.4k|    int code = 0;
  464|   442k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (464:23): [True: 442k, False: 0]
  ------------------
  465|   442k|      uint32_t b = br.get(1);
  466|   442k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (466:11): [True: 0, False: 442k]
  ------------------
  467|   442k|      code = (code << 1) | int(b);
  468|   442k|      int first = first_code[len];
  469|   442k|      int cnt = counts[len];
  470|   442k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (470:11): [True: 276k, False: 166k]
  |  Branch (470:18): [True: 71.4k, False: 205k]
  ------------------
  471|  71.4k|        return symbols[base_idx[len] + (code - first)];
  472|  71.4k|      }
  473|   442k|    }
  474|      0|    return -1;
  475|  71.4k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 5068|      1|                                         size_t len) noexcept {
 5069|      1|  uint32_t c = 0xFFFFFFFFu;
 5070|   216k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (5070:22): [True: 216k, False: 1]
  ------------------
 5071|   216k|    c ^= data[i];
 5072|  1.94M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (5072:21): [True: 1.72M, False: 216k]
  ------------------
 5073|  1.72M|      const uint32_t mask = 0u - (c & 1u);
 5074|  1.72M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 5075|  1.72M|    }
 5076|   216k|  }
 5077|      1|  return ~c;
 5078|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4873|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4874|      1|  if constexpr (std::endian::native == std::endian::little) {
 4875|      1|    (void)buffer;
 4876|      1|    return;
 4877|      1|  }
 4878|      0|  auto u16 = [&](size_t off, size_t count) {
 4879|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4880|      1|  };
 4881|      1|  auto u32 = [&](size_t off, size_t count) {
 4882|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4883|      1|  };
 4884|      1|  auto u64 = [&](size_t off, size_t count) {
 4885|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4886|      1|  };
 4887|       |
 4888|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4889|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4890|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4891|      1|  u16(table_blob::off_decomposition_block,
 4892|      1|      table_blob::count_decomposition_block);
 4893|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4894|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4895|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4896|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4897|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4898|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4899|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4900|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4901|      1|  u32(table_blob::off_joining_start, table_blob::count_joining_start);
 4902|      1|  u32(table_blob::off_joining_final, table_blob::count_joining_final);
 4903|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 5117|     21|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5118|     21|      return buffer + off;
 5119|     21|    };
serializers.cc:_ZN3ada4idnaL11idna_lookupEj:
 5277|  89.9k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5278|  89.9k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5278:7): [True: 89.4k, False: 569]
  ------------------
 5279|  89.4k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5280|  89.4k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5280:9): [True: 43.3k, False: 46.0k]
  ------------------
 5281|  43.3k|      uint32_t bit_idx =
 5282|  43.3k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5283|  43.3k|          (cp & IDNA_BLOCK_MASK);
 5284|  43.3k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5285|  43.3k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5285:14): [True: 43.3k, False: 7]
  ------------------
 5286|  43.3k|    }
 5287|  46.0k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5288|  89.4k|  }
 5289|       |
 5290|    569|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5290:7): [True: 559, False: 10]
  |  Branch (5290:40): [True: 434, False: 125]
  ------------------
 5291|    434|    return IDNA_IGNORED;
 5292|    434|  }
 5293|       |
 5294|    135|  return IDNA_DISALLOWED;
 5295|    569|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5320|  10.5k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5321|  10.5k|  size_t n = 0;
 5322|  56.6k|  while (*ptr != 0) {
  ------------------
  |  Branch (5322:10): [True: 46.1k, False: 10.5k]
  ------------------
 5323|  46.1k|    ++n;
 5324|  46.1k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5324:9): [True: 13.5k, False: 32.5k]
  ------------------
 5325|  13.5k|      ++ptr;
 5326|  32.5k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5326:16): [True: 20.9k, False: 11.6k]
  ------------------
 5327|  20.9k|      ptr += 2;
 5328|  20.9k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5328:16): [True: 11.3k, False: 291]
  ------------------
 5329|  11.3k|      ptr += 3;
 5330|  11.3k|    } else {
 5331|    291|      ptr += 4;
 5332|    291|    }
 5333|  46.1k|  }
 5334|  10.5k|  return n;
 5335|  10.5k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5298|  46.1k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5299|  46.1k|  uint8_t b0 = *ptr++;
 5300|  46.1k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5300:7): [True: 13.5k, False: 32.5k]
  ------------------
 5301|  32.5k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5301:7): [True: 20.9k, False: 11.6k]
  ------------------
 5302|  20.9k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5303|  20.9k|    cp |= (*ptr++ & 0x3Fu);
 5304|  20.9k|    return static_cast<char32_t>(cp);
 5305|  20.9k|  }
 5306|  11.6k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5306:7): [True: 11.3k, False: 291]
  ------------------
 5307|  11.3k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5308|  11.3k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5309|  11.3k|    cp |= (*ptr++ & 0x3Fu);
 5310|  11.3k|    return static_cast<char32_t>(cp);
 5311|  11.3k|  }
 5312|    291|  uint32_t cp = (b0 & 0x07u) << 18;
 5313|    291|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5314|    291|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5315|    291|  cp |= (*ptr++ & 0x3Fu);
 5316|    291|  return static_cast<char32_t>(cp);
 5317|  11.6k|}
_ZN3ada4idna23decomposition_block_rowEh:
 5194|   162k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 5195|   162k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (5195:7): [True: 0, False: 162k]
  ------------------
 5196|      0|    bi = 0;
 5197|      0|  }
 5198|   162k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 5199|   162k|}
_ZN3ada4idna13ccc_block_rowEh:
 5201|   238k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 5202|   238k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (5202:7): [True: 0, False: 238k]
  ------------------
 5203|      0|    bi = 0;
 5204|      0|  }
 5205|   238k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5206|   238k|}
_ZN3ada4idna16tables_are_readyEv:
 5080|  3.46k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 5081|  3.46k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 5082|  3.46k|}
serializers.cc:_ZN3ada4idnaL24decomposition_is_not_nfcEDiDi:
 5707|  71.2k|static bool decomposition_is_not_nfc(char32_t previous, char32_t c) noexcept {
 5708|  71.2k|  if (c >= hangul_sbase && c < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5708:7): [True: 4.11k, False: 67.1k]
  |  Branch (5708:28): [True: 1.64k, False: 2.47k]
  ------------------
 5709|  1.64k|    return false;
 5710|  1.64k|  }
 5711|  69.5k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5711:7): [True: 0, False: 69.5k]
  ------------------
 5712|      0|    return false;
 5713|      0|  }
 5714|  69.5k|  const uint16_t* const decomposition =
 5715|  69.5k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5716|  69.5k|  const size_t length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5717|  69.5k|  if (length == 0 || (decomposition[0] & 1)) {
  ------------------
  |  Branch (5717:7): [True: 64.9k, False: 4.62k]
  |  Branch (5717:22): [True: 0, False: 4.62k]
  ------------------
 5718|  64.9k|    return false;  // no canonical decomposition (or compatibility-only)
 5719|  64.9k|  }
 5720|  4.62k|  if (length == 1) {
  ------------------
  |  Branch (5720:7): [True: 0, False: 4.62k]
  ------------------
 5721|      0|    return true;  // singleton
 5722|      0|  }
 5723|  4.62k|  const size_t base = decomposition[0] >> 2;
 5724|  4.62k|  if (base + length > decomposition_data_size) {
  ------------------
  |  Branch (5724:7): [True: 0, False: 4.62k]
  ------------------
 5725|      0|    return false;
 5726|      0|  }
 5727|       |  // Recompose the canonical decomposition; if it does not collapse back to c,
 5728|       |  // then c is an exclusion / non-starter decomposition and is not NFC.
 5729|  4.62k|  std::u32string decomposed(decomposition_data + base,
 5730|  4.62k|                            decomposition_data + base + length);
 5731|  4.62k|  compose(decomposed);
 5732|  4.62k|  if (!(decomposed.size() == 1 && decomposed[0] == c)) {
  ------------------
  |  Branch (5732:9): [True: 4.62k, False: 0]
  |  Branch (5732:35): [True: 4.62k, False: 0]
  ------------------
 5733|      0|    return true;
 5734|      0|  }
 5735|  4.62k|  return previous < 0x110000 &&
  ------------------
  |  Branch (5735:10): [True: 3.82k, False: 805]
  ------------------
 5736|  3.82k|         has_composition(
  ------------------
  |  Branch (5736:10): [True: 22, False: 3.80k]
  ------------------
 5737|  3.82k|             composition_block_row(composition_index[previous >> 8]) +
 5738|  3.82k|                 (previous % 256),
 5739|  3.82k|             decomposition_data[base]);
 5740|  4.62k|}
serializers.cc:_ZN3ada4idnaL15has_compositionEPKtDi:
 5611|  17.0k|                            char32_t second) noexcept {
 5612|  17.0k|  int left = composition[0];
 5613|  17.0k|  int right = composition[1];
 5614|  17.0k|  if (left < 0 || right <= left ||
  ------------------
  |  Branch (5614:7): [True: 0, False: 17.0k]
  |  Branch (5614:19): [True: 2.44k, False: 14.5k]
  ------------------
 5615|  14.5k|      static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5615:7): [True: 0, False: 14.5k]
  ------------------
 5616|  2.44k|    return false;
 5617|  2.44k|  }
 5618|  34.5k|  while (left + 2 < right) {
  ------------------
  |  Branch (5618:10): [True: 19.9k, False: 14.5k]
  ------------------
 5619|  19.9k|    int middle = left + (((right - left) >> 1) & ~1);
 5620|  19.9k|    if (composition_data[static_cast<size_t>(middle)] <= second) {
  ------------------
  |  Branch (5620:9): [True: 2.57k, False: 17.3k]
  ------------------
 5621|  2.57k|      left = middle;
 5622|  2.57k|    }
 5623|  19.9k|    if (composition_data[static_cast<size_t>(middle)] >= second) {
  ------------------
  |  Branch (5623:9): [True: 17.8k, False: 2.11k]
  ------------------
 5624|  17.8k|      right = middle;
 5625|  17.8k|    }
 5626|  19.9k|  }
 5627|  14.5k|  return static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5627:10): [True: 14.5k, False: 0]
  ------------------
 5628|  14.5k|         composition_data[static_cast<size_t>(left)] == second;
  ------------------
  |  Branch (5628:10): [True: 546, False: 14.0k]
  ------------------
 5629|  17.0k|}
serializers.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5684|  64.3k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5685|  64.3k|  const size_t length = canonical_decomp_length(c);
 5686|  64.3k|  if (length == 0) {
  ------------------
  |  Branch (5686:7): [True: 60.2k, False: 4.08k]
  ------------------
 5687|  60.2k|    return get_ccc(c);
 5688|  60.2k|  }
 5689|  4.08k|  const uint16_t* const decomposition =
 5690|  4.08k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5691|  4.08k|  const size_t base = decomposition[0] >> 2;
 5692|  4.08k|  return get_ccc(decomposition_data[base + length - 1]);
 5693|  64.3k|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5478|  64.3k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5479|  64.3k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5479:7): [True: 3.64k, False: 60.6k]
  ------------------
 5480|  3.64k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5480:7): [True: 1.60k, False: 2.04k]
  ------------------
 5481|       |    // Hangul precomposed syllables are NFC.
 5482|  1.60k|    return 0;
 5483|  1.60k|  }
 5484|  62.7k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5484:7): [True: 0, False: 62.7k]
  ------------------
 5485|      0|    return 0;
 5486|      0|  }
 5487|  62.7k|  const uint8_t di = decomposition_index[current_character >> 8];
 5488|  62.7k|  const uint16_t* const decomposition =
 5489|  62.7k|      decomposition_block_row(di) + (current_character % 256);
 5490|  62.7k|  size_t decomposition_length =
 5491|  62.7k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5492|  62.7k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5492:7): [True: 4.08k, False: 58.6k]
  |  Branch (5492:37): [True: 0, False: 4.08k]
  ------------------
 5493|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5494|      0|  }
 5495|  62.7k|  return decomposition_length;
 5496|  62.7k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5632|  2.38k|static bool would_compose(std::u32string_view input) noexcept {
 5633|  54.9k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5633:32): [True: 53.2k, False: 1.78k]
  ------------------
 5634|  53.2k|    const char32_t current = input[input_count];
 5635|  53.2k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5635:9): [True: 14.2k, False: 38.9k]
  |  Branch (5635:36): [True: 498, False: 13.7k]
  ------------------
 5636|    498|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5636:11): [True: 459, False: 39]
  ------------------
 5637|    459|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5637:11): [True: 183, False: 276]
  ------------------
 5638|    183|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5638:11): [True: 30, False: 153]
  ------------------
 5639|     30|        return true;
 5640|     30|      }
 5641|    468|      ++input_count;
 5642|    468|      continue;
 5643|    498|    }
 5644|  52.7k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5644:9): [True: 2.16k, False: 50.5k]
  |  Branch (5644:36): [True: 1.22k, False: 937]
  ------------------
 5645|  1.22k|      if ((current - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5645:11): [True: 633, False: 593]
  ------------------
 5646|    633|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5646:11): [True: 613, False: 20]
  ------------------
 5647|    613|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5647:11): [True: 479, False: 134]
  ------------------
 5648|    479|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5648:11): [True: 54, False: 425]
  ------------------
 5649|     54|        return true;
 5650|     54|      }
 5651|  1.17k|      ++input_count;
 5652|  1.17k|      continue;
 5653|  1.22k|    }
 5654|  51.4k|    if (current < 0x110000) {
  ------------------
  |  Branch (5654:9): [True: 51.4k, False: 0]
  ------------------
 5655|  51.4k|      const uint16_t* composition =
 5656|  51.4k|          composition_block_row(composition_index[current >> 8]) +
 5657|  51.4k|          (current % 256);
 5658|  51.4k|      int32_t previous_ccc = -1;
 5659|  51.4k|      size_t j = input_count;
 5660|  52.7k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5660:14): [True: 51.0k, False: 1.71k]
  ------------------
 5661|  51.0k|        uint8_t ccc = get_ccc(input[j + 1]);
 5662|  51.0k|        if (composition[1] != composition[0] && previous_ccc < ccc &&
  ------------------
  |  Branch (5662:13): [True: 13.6k, False: 37.4k]
  |  Branch (5662:49): [True: 13.2k, False: 406]
  ------------------
 5663|  13.2k|            has_composition(composition, input[j + 1])) {
  ------------------
  |  Branch (5663:13): [True: 524, False: 12.6k]
  ------------------
 5664|    524|          return true;
 5665|    524|        }
 5666|  50.5k|        if (ccc == 0) {
  ------------------
  |  Branch (5666:13): [True: 49.2k, False: 1.31k]
  ------------------
 5667|  49.2k|          break;
 5668|  49.2k|        }
 5669|  1.31k|        previous_ccc = ccc;
 5670|  1.31k|      }
 5671|  50.9k|      input_count = j + 1;
 5672|  50.9k|      continue;
 5673|  51.4k|    }
 5674|      0|    ++input_count;
 5675|      0|  }
 5676|  1.78k|  return false;
 5677|  2.38k|}
_ZN3ada4idna21composition_block_rowEh:
 5208|  81.5k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5209|  81.5k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5209:7): [True: 0, False: 81.5k]
  ------------------
 5210|      0|    bi = 0;
 5211|      0|  }
 5212|  81.5k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5213|  81.5k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5913|  13.1k|static constexpr int32_t char_to_digit_value(char value) {
 5914|  13.1k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5914:7): [True: 10.8k, False: 2.25k]
  |  Branch (5914:23): [True: 10.8k, False: 1]
  ------------------
 5915|  2.25k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5915:7): [True: 2.24k, False: 6]
  |  Branch (5915:23): [True: 2.24k, False: 5]
  ------------------
 5916|     11|  return -1;
 5917|  2.25k|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5923|  22.6k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5924|  22.6k|  if (firsttime) {
  ------------------
  |  Branch (5924:7): [True: 4.01k, False: 18.6k]
  ------------------
 5925|  4.01k|    d = d / damp;
 5926|  18.6k|  } else {
 5927|  18.6k|    d = d / 2;
 5928|  18.6k|  }
 5929|  22.6k|  d += d / n;
 5930|  22.6k|  int32_t k = 0;
 5931|  26.0k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5931:10): [True: 3.41k, False: 22.6k]
  ------------------
 5932|  3.41k|    d /= base - tmin;
 5933|  3.41k|    k += base;
 5934|  3.41k|  }
 5935|  22.6k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5936|  22.6k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5919|  29.7k|static constexpr char digit_to_char(int32_t digit) {
 5920|  29.7k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5920:10): [True: 23.4k, False: 6.28k]
  ------------------
 5921|  29.7k|}
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 6327|  34.5k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZN3ada4idnaL17is_contextj_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6232|  4.04k|inline static bool is_contextj_valid(std::u32string_view label) noexcept {
 6233|  4.04k|  constexpr uint8_t virama_ccc = 9;
 6234|  40.7k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6234:22): [True: 36.8k, False: 3.91k]
  ------------------
 6235|  36.8k|    if (label[i] != 0x200C && label[i] != 0x200D) {
  ------------------
  |  Branch (6235:9): [True: 36.5k, False: 276]
  |  Branch (6235:31): [True: 36.4k, False: 65]
  ------------------
 6236|  36.4k|      continue;
 6237|  36.4k|    }
 6238|       |    // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
 6239|    341|    if (i > 0 && get_ccc(label[i - 1]) == virama_ccc) {
  ------------------
  |  Branch (6239:9): [True: 339, False: 2]
  |  Branch (6239:18): [True: 62, False: 277]
  ------------------
 6240|     62|      continue;
 6241|     62|    }
 6242|    279|    if (label[i] == 0x200D) {
  ------------------
  |  Branch (6242:9): [True: 6, False: 273]
  ------------------
 6243|      6|      return false;
 6244|      6|    }
 6245|       |    // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
 6246|       |    //    (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
 6247|    273|    joining_type before = joining_type::U;
 6248|    492|    for (size_t j = i; j > 0;) {
  ------------------
  |  Branch (6248:24): [True: 490, False: 2]
  ------------------
 6249|    490|      before = find_joining_type(label[--j]);
 6250|    490|      if (before != joining_type::T) {
  ------------------
  |  Branch (6250:11): [True: 271, False: 219]
  ------------------
 6251|    271|        break;
 6252|    271|      }
 6253|    490|    }
 6254|    273|    if (before != joining_type::L && before != joining_type::D) {
  ------------------
  |  Branch (6254:9): [True: 255, False: 18]
  |  Branch (6254:38): [True: 52, False: 203]
  ------------------
 6255|     52|      return false;
 6256|     52|    }
 6257|    221|    joining_type after = joining_type::U;
 6258|    530|    for (size_t j = i + 1; j < label.size(); j++) {
  ------------------
  |  Branch (6258:28): [True: 495, False: 35]
  ------------------
 6259|    495|      after = find_joining_type(label[j]);
 6260|    495|      if (after != joining_type::T) {
  ------------------
  |  Branch (6260:11): [True: 186, False: 309]
  ------------------
 6261|    186|        break;
 6262|    186|      }
 6263|    495|    }
 6264|    221|    if (after != joining_type::R && after != joining_type::D) {
  ------------------
  |  Branch (6264:9): [True: 176, False: 45]
  |  Branch (6264:37): [True: 75, False: 101]
  ------------------
 6265|     75|      return false;
 6266|     75|    }
 6267|    221|  }
 6268|  3.91k|  return true;
 6269|  4.04k|}
serializers.cc:_ZN3ada4idnaL17find_joining_typeEj:
 6224|    985|inline static joining_type find_joining_type(uint32_t code_point) noexcept {
 6225|    985|  size_t i =
 6226|    985|      find_range(joining_start, joining_final, joining_table_count, code_point);
 6227|    985|  return i == joining_table_count ? joining_type::U
  ------------------
  |  Branch (6227:10): [True: 87, False: 898]
  ------------------
 6228|    985|                                  : static_cast<joining_type>(joining_value[i]);
 6229|    985|}
serializers.cc:_ZN3ada4idnaL10find_rangeEPKjS2_mj:
 6203|  46.1k|                                size_t count, uint32_t code_point) noexcept {
 6204|  46.1k|  size_t lo = 0, hi = count;
 6205|   533k|  while (lo < hi) {
  ------------------
  |  Branch (6205:10): [True: 487k, False: 46.1k]
  ------------------
 6206|   487k|    size_t mid = lo + (hi - lo) / 2;
 6207|   487k|    if (last[mid] < code_point) {
  ------------------
  |  Branch (6207:9): [True: 142k, False: 344k]
  ------------------
 6208|   142k|      lo = mid + 1;
 6209|   344k|    } else {
 6210|   344k|      hi = mid;
 6211|   344k|    }
 6212|   487k|  }
 6213|  46.1k|  return lo < count && code_point >= start[lo] ? lo : count;
  ------------------
  |  Branch (6213:10): [True: 46.1k, False: 0]
  |  Branch (6213:24): [True: 46.0k, False: 87]
  ------------------
 6214|  46.1k|}
serializers.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6272|  3.91k|    const std::u32string_view label) noexcept {
 6273|  4.86k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (6273:52): [True: 4.86k, False: 0]
  ------------------
 6274|  4.86k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (6274:9): [True: 3.91k, False: 950]
  ------------------
 6275|       |
 6276|      0|  return std::u32string_view::npos;
 6277|  3.91k|}
serializers.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6281|  3.91k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 6282|  3.91k|  const size_t mask =
 6283|  3.91k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 6284|       |
 6285|  3.91k|  size_t directions = 0;
 6286|  37.9k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6286:22): [True: 34.0k, False: 3.91k]
  ------------------
 6287|  34.0k|    directions |= 1u << find_direction(label[i]);
 6288|  34.0k|  }
 6289|  3.91k|  return (directions & mask) != 0;
 6290|  3.91k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 6217|  45.1k|inline static direction find_direction(uint32_t code_point) noexcept {
 6218|  45.1k|  size_t i = find_range(dir_start, dir_final, dir_table_count, code_point);
 6219|  45.1k|  return i == dir_table_count ? direction::NONE
  ------------------
  |  Branch (6219:10): [True: 0, False: 45.1k]
  ------------------
 6220|  45.1k|                              : static_cast<direction>(dir_value[i]);
 6221|  45.1k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6552|  2.69k|bool constexpr is_ascii(std::string_view view) {
 6553|  19.8k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6553:18): [True: 19.8k, False: 158]
  ------------------
 6554|  19.8k|    if (c >= 0x80) {
  ------------------
  |  Branch (6554:9): [True: 2.53k, False: 17.3k]
  ------------------
 6555|  2.53k|      return false;
 6556|  2.53k|    }
 6557|  19.8k|  }
 6558|    158|  return true;
 6559|  2.69k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6589|    158|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6590|    158|  out.assign(ut8_string);
 6591|    158|  ascii_map(out.data(), out.size());
 6592|    158|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6543|  9.19k|bool constexpr is_ascii(std::u32string_view view) {
 6544|  37.1k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6544:19): [True: 37.1k, False: 2.14k]
  ------------------
 6545|  37.1k|    if (c >= 0x80) {
  ------------------
  |  Branch (6545:9): [True: 7.04k, False: 30.1k]
  ------------------
 6546|  7.04k|      return false;
 6547|  7.04k|    }
 6548|  37.1k|  }
 6549|  2.14k|  return true;
 6550|  9.19k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6605|  6.11k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6606|  6.11k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6606:10): [True: 3.31k, False: 2.79k]
  |  Branch (6606:31): [True: 1.31k, False: 2.00k]
  |  Branch (6606:51): [True: 1.25k, False: 64]
  ------------------
 6607|  1.25k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6607:10): [True: 1.19k, False: 60]
  |  Branch (6607:30): [True: 1.14k, False: 46]
  ------------------
 6608|  6.11k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6595|  2.68k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6596|  2.68k|  const size_t old = out.size();
 6597|  2.68k|  out.resize(old + label.size());
 6598|  2.68k|  char* dest = out.data() + old;
 6599|  23.0k|  for (char32_t c : label) {
  ------------------
  |  Branch (6599:19): [True: 23.0k, False: 2.68k]
  ------------------
 6600|  23.0k|    *dest++ = static_cast<char>(c);
 6601|  23.0k|  }
 6602|  2.68k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7620|  37.4k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|  37.4k|    return character_sets::bit_at(character_set, c);
 7622|  37.4k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7620|  26.8k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|  26.8k|    return character_sets::bit_at(character_set, c);
 7622|  26.8k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7354|  12.4k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7355|  12.4k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7355:11): [True: 10.7k, False: 1.66k]
  |  Branch (7355:23): [True: 5.63k, False: 5.14k]
  |  Branch (7355:37): [True: 5.13k, False: 1.67k]
  |  Branch (7355:49): [True: 3.54k, False: 1.59k]
  ------------------
 7356|  3.26k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7356:11): [True: 1.53k, False: 1.72k]
  |  Branch (7356:23): [True: 1.43k, False: 109]
  ------------------
 7357|  12.4k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7444|  9.81k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7445|  9.81k|  return hex_to_binary_table[c - '0'];
 7446|  9.81k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7588|  31.8k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7589|  31.8k|    return character_sets::bit_at(character_set, c);
 7590|  31.8k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7281|  8.66k|    const char* input, size_t length) noexcept {
 7282|  8.66k|  size_t i = 0;
 7283|  8.66k|  uint8_t accumulator{};
 7284|  54.7k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7284:10): [True: 46.0k, False: 8.66k]
  ------------------
 7285|  46.0k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7286|  46.0k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7287|  46.0k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7288|  46.0k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7289|  46.0k|  }
 7290|  20.3k|  for (; i < length; i++) {
  ------------------
  |  Branch (7290:10): [True: 11.6k, False: 8.66k]
  ------------------
 7291|  11.6k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7292|  11.6k|  }
 7293|  8.66k|  return accumulator;
 7294|  8.66k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7974|  1.35k|                            const uint8_t character_set[], std::string& out) {
 7975|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7976|  1.35k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7977|  1.35k|#if ADA_UNICODE_SSSE3
 7978|  1.35k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7979|  1.35k|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7980|       |#elif ADA_NEON
 7981|       |  percent_encode_to_neon(p, end, character_set,
 7982|       |                         load_neon_percent_table(character_set), out);
 7983|       |#elif ADA_RVV
 7984|       |  percent_encode_to_rvv(p, end, character_set, out);
 7985|       |#endif
 7986|  1.35k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7801|  1.35k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7802|  1.35k|  ssse3_percent_tables t{};
 7803|  1.35k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7804|  1.35k|  t.cs_hi =
 7805|  1.35k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7806|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7807|  1.35k|  t.pow2 =
 7808|  1.35k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7809|  1.35k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7810|  1.35k|  t.mask_07 = _mm_set1_epi8(0x07);
 7811|  1.35k|  t.zero = _mm_setzero_si128();
 7812|  1.35k|  return t;
 7813|  1.35k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7832|  1.35k|    const ssse3_percent_tables& tables, std::string& out) {
 7833|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7834|  3.65k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7834:10): [True: 2.30k, False: 1.35k]
  ------------------
 7835|  2.30k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7836|  2.30k|    const __m128i word1 =
 7837|  2.30k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7838|  2.30k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7839|  2.30k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7840|  2.30k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7840:9): [True: 431, False: 1.87k]
  ------------------
 7841|    431|      out.append(p, 32);
 7842|  1.87k|    } else {
 7843|  1.87k|      if (mask0 == 0) {
  ------------------
  |  Branch (7843:11): [True: 191, False: 1.68k]
  ------------------
 7844|    191|        out.append(p, 16);
 7845|  1.68k|      } else {
 7846|  1.68k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7847|  1.68k|      }
 7848|  1.87k|      if (mask1 == 0) {
  ------------------
  |  Branch (7848:11): [True: 339, False: 1.53k]
  ------------------
 7849|    339|        out.append(p + 16, 16);
 7850|  1.53k|      } else {
 7851|  1.53k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7852|  1.53k|      }
 7853|  1.87k|    }
 7854|  2.30k|    p += 32;
 7855|  2.30k|  }
 7856|  1.35k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7856:7): [True: 909, False: 441]
  ------------------
 7857|    909|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7858|    909|    const int mask = ssse3_percent_mask(word, tables);
 7859|    909|    if (mask == 0) {
  ------------------
  |  Branch (7859:9): [True: 213, False: 696]
  ------------------
 7860|    213|      out.append(p, 16);
 7861|    696|    } else {
 7862|    696|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7863|    696|    }
 7864|    909|    p += 16;
 7865|    909|  }
 7866|  1.35k|  percent_encode_to_scalar(p, end, character_set, out);
 7867|  1.35k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7816|  5.51k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7817|  5.51k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7818|  5.51k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7819|  5.51k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7820|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7821|  5.51k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7822|  5.51k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7823|  5.51k|                                       _mm_andnot_si128(high_byte, lo));
 7824|  5.51k|  const __m128i bits =
 7825|  5.51k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7826|  5.51k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7827|  5.51k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7828|  5.51k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7756|  3.91k|                                          size_t width, std::string& out) {
 7757|  3.91k|  uint64_t bits = mask;
 7758|  3.91k|  size_t off = 0;
 7759|  37.7k|  while (bits != 0) {
  ------------------
  |  Branch (7759:10): [True: 33.8k, False: 3.91k]
  ------------------
 7760|  33.8k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7761|  33.8k|    if (zero_run != 0) {
  ------------------
  |  Branch (7761:9): [True: 5.00k, False: 28.8k]
  ------------------
 7762|  5.00k|      out.append(p + off, static_cast<size_t>(zero_run));
 7763|  5.00k|    }
 7764|  33.8k|    off += static_cast<size_t>(zero_run);
 7765|  33.8k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7766|  33.8k|    ++off;
 7767|  33.8k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7768|  33.8k|  }
 7769|  3.91k|  if (off < width) {
  ------------------
  |  Branch (7769:7): [True: 1.90k, False: 2.00k]
  ------------------
 7770|  1.90k|    out.append(p + off, width - off);
 7771|  1.90k|  }
 7772|  3.91k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7744|  33.8k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7745|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7746|       |  unsigned long ret;
 7747|       |  _BitScanForward(&ret, input_num);
 7748|       |  return static_cast<int>(ret);
 7749|       |#else
 7750|  33.8k|  return __builtin_ctz(input_num);
 7751|  33.8k|#endif
 7752|  33.8k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7777|  1.35k|                                                std::string& out) {
 7778|  4.93k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7778:10): [True: 3.58k, False: 1.35k]
  ------------------
 7779|  3.58k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7779:9): [True: 1.56k, False: 2.02k]
  ------------------
 7780|  1.56k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7781|  2.02k|    } else {
 7782|  2.02k|      out += *p;
 7783|  2.02k|    }
 7784|  3.58k|  }
 7785|  1.35k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 8047|  52.4k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 8048|  52.4k|  static constexpr char kHex[] = "0123456789abcdef";
 8049|  52.4k|  if (v >= 0x1000) {
  ------------------
  |  Branch (8049:7): [True: 46.9k, False: 5.53k]
  ------------------
 8050|  46.9k|    *p++ = kHex[(v >> 12) & 0xf];
 8051|  46.9k|    *p++ = kHex[(v >> 8) & 0xf];
 8052|  46.9k|    *p++ = kHex[(v >> 4) & 0xf];
 8053|  46.9k|    *p++ = kHex[v & 0xf];
 8054|  46.9k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (8054:14): [True: 1.39k, False: 4.13k]
  ------------------
 8055|  1.39k|    *p++ = kHex[(v >> 8) & 0xf];
 8056|  1.39k|    *p++ = kHex[(v >> 4) & 0xf];
 8057|  1.39k|    *p++ = kHex[v & 0xf];
 8058|  4.13k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (8058:14): [True: 2.16k, False: 1.97k]
  ------------------
 8059|  2.16k|    *p++ = kHex[(v >> 4) & 0xf];
 8060|  2.16k|    *p++ = kHex[v & 0xf];
 8061|  2.16k|  } else {
 8062|  1.97k|    *p++ = kHex[v & 0xf];
 8063|  1.97k|  }
 8064|  52.4k|  return p;
 8065|  52.4k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 8033|  31.0k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 8034|  31.0k|  if (v < 10) {
  ------------------
  |  Branch (8034:7): [True: 6.73k, False: 24.3k]
  ------------------
 8035|  6.73k|    *p++ = static_cast<char>('0' + v);
 8036|  24.3k|  } else if (v < 100) {
  ------------------
  |  Branch (8036:14): [True: 14.1k, False: 10.2k]
  ------------------
 8037|  14.1k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 8038|  14.1k|    p += 2;
 8039|  14.1k|  } else {
 8040|  10.2k|    *p++ = static_cast<char>('0' + v / 100);
 8041|  10.2k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 8042|  10.2k|    p += 2;
 8043|  10.2k|  }
 8044|  31.0k|  return p;
 8045|  31.0k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7130|  21.0k|    std::string_view user_input) noexcept {
 7131|       |  // first check for short strings in which case we do it naively.
 7132|  21.0k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (7132:7): [True: 6.82k, False: 14.2k]
  ------------------
 7133|  6.82k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 7134|  6.82k|  }
 7135|       |  // fast path for long strings (expected to be common)
 7136|  14.2k|  size_t i = 0;
 7137|  14.2k|  const __m128i mask1 = _mm_set1_epi8('\r');
 7138|  14.2k|  const __m128i mask2 = _mm_set1_epi8('\n');
 7139|  14.2k|  const __m128i mask3 = _mm_set1_epi8('\t');
 7140|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 7141|  14.2k|  __m128i running{0};
 7142|  48.6k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (7142:10): [True: 34.3k, False: 14.2k]
  ------------------
 7143|  34.3k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 7144|  34.3k|    running = _mm_or_si128(
 7145|  34.3k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7146|  34.3k|                                           _mm_cmpeq_epi8(word, mask2))),
 7147|  34.3k|        _mm_cmpeq_epi8(word, mask3));
 7148|  34.3k|  }
 7149|  14.2k|  if (i < user_input.size()) {
  ------------------
  |  Branch (7149:7): [True: 13.3k, False: 930]
  ------------------
 7150|  13.3k|    __m128i word = _mm_loadu_si128(
 7151|  13.3k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 7152|  13.3k|    running = _mm_or_si128(
 7153|  13.3k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7154|  13.3k|                                           _mm_cmpeq_epi8(word, mask2))),
 7155|  13.3k|        _mm_cmpeq_epi8(word, mask3));
 7156|  13.3k|  }
 7157|  14.2k|  return _mm_movemask_epi8(running) != 0;
 7158|  21.0k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 7016|  53.3k|constexpr bool is_tabs_or_newline(char c) noexcept {
 7017|  53.3k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (7017:10): [True: 55, False: 53.2k]
  |  Branch (7017:23): [True: 53, False: 53.2k]
  |  Branch (7017:36): [True: 62, False: 53.1k]
  ------------------
 7018|  53.3k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8842|    141|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8843|       |  // Fast path: inputs with no tab/newline (the common case) avoid the
 8844|       |  // per-character erase_if scan. has_tabs_or_newline uses SIMD for inputs
 8845|       |  // >= 16 bytes, making this check much cheaper than erase_if's scalar
 8846|       |  // predicate walk when there is nothing to remove.
 8847|    141|  if (!ada::unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (8847:7): [True: 0, False: 141]
  ------------------
 8848|      0|    return;
 8849|      0|  }
 8850|    141|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8851|    141|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7375|  4.47k|    const char c) noexcept {
 7376|  4.47k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7376:10): [True: 326, False: 4.15k]
  |  Branch (7376:23): [True: 183, False: 3.96k]
  |  Branch (7376:36): [True: 173, False: 3.79k]
  ------------------
 7377|  4.47k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7370|  24.8k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7371|  24.8k|  return (unsigned char)c <= ' ';
 7372|  24.8k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7383|  4.10k|    std::string_view input) noexcept {
 7384|       |  // This will catch most cases:
 7385|       |  // The length must be 2,4 or 6.
 7386|       |  // We divide by two and require
 7387|       |  // that the result be between 1 and 3 inclusively.
 7388|  4.10k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7389|  4.10k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7389:7): [True: 2.64k, False: 1.45k]
  ------------------
 7390|  2.64k|    return false;
 7391|  2.64k|  }
 7392|       |  // We have a string of length 2, 4 or 6.
 7393|       |  // We now check the first character:
 7394|  1.45k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7394:7): [True: 651, False: 806]
  |  Branch (7394:28): [True: 393, False: 258]
  ------------------
 7395|    393|    return false;
 7396|    393|  }
 7397|       |  // We are unlikely the get beyond this point.
 7398|  1.06k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7399|  1.06k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7400|  1.06k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7400:7): [True: 236, False: 828]
  ------------------
 7401|    236|    return false;
 7402|    236|  }
 7403|       |  // We almost never get here.
 7404|       |  // Optimizing the rest is relatively unimportant.
 7405|    828|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7406|    828|    uint16_t A, B;
 7407|    828|    memcpy(&A, a.data(), sizeof(A));
 7408|    828|    memcpy(&B, b.data(), sizeof(B));
 7409|    828|    return A == B;
 7410|    828|  };
 7411|    828|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7411:7): [True: 330, False: 498]
  ------------------
 7412|    330|    return false;
 7413|    330|  }
 7414|    738|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7414:22): [True: 347, False: 391]
  ------------------
 7415|    347|    char c = input[i];
 7416|    347|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7416:9): [True: 107, False: 240]
  |  Branch (7416:10): [True: 162, False: 185]
  ------------------
 7417|    107|      return false;
 7418|    107|    }
 7419|    347|  }
 7420|    391|  return true;
 7421|       |  // The above code might be a bit better than the code below. Compilers
 7422|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7423|       |  // 6 and other tricks.
 7424|       |  // return input == ".." ||
 7425|       |  //  input == ".%2e" || input == ".%2E" ||
 7426|       |  //  input == "%2e." || input == "%2E." ||
 7427|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7428|       |  //  "%2e%2E";
 7429|    498|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7405|    828|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7406|    828|    uint16_t A, B;
 7407|    828|    memcpy(&A, a.data(), sizeof(A));
 7408|    828|    memcpy(&B, b.data(), sizeof(B));
 7409|    828|    return A == B;
 7410|    828|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7432|  7.41k|    std::string_view input) noexcept {
 7433|  7.41k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7433:10): [True: 419, False: 6.99k]
  |  Branch (7433:26): [True: 74, False: 6.92k]
  |  Branch (7433:44): [True: 9, False: 6.91k]
  ------------------
 7434|  7.41k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9829|  2.60k|                              bool& is_pure_decimal) noexcept {
 9830|  2.60k|  is_pure_decimal = false;
 9831|  2.60k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9831:7): [True: 0, False: 2.60k]
  ------------------
 9832|      0|    return false;
 9833|      0|  }
 9834|  2.60k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9834:7): [True: 2.24k, False: 362]
  |  Branch (9834:23): [True: 393, False: 1.85k]
  |  Branch (9834:38): [True: 206, False: 187]
  ------------------
 9835|    206|    p += 2;
 9836|    206|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9836:9): [True: 6, False: 200]
  |  Branch (9836:21): [True: 10, False: 190]
  ------------------
 9837|     16|      value = 0;
 9838|     16|      return true;
 9839|     16|    }
 9840|    190|    uint64_t v = 0;
 9841|    190|    int digits = 0;
 9842|  1.35k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9842:12): [True: 1.24k, False: 108]
  |  Branch (9842:23): [True: 1.22k, False: 27]
  ------------------
 9843|  1.22k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9844|  1.22k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9844:11): [True: 1, False: 1.22k]
  ------------------
 9845|      1|        return false;
 9846|      1|      }
 9847|  1.22k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9847:11): [True: 54, False: 1.16k]
  ------------------
 9848|     54|        return false;
 9849|     54|      }
 9850|  1.16k|      v = (v << 4) | nib;
 9851|  1.16k|      ++p;
 9852|  1.16k|      ++digits;
 9853|  1.16k|    }
 9854|    135|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9854:9): [True: 0, False: 135]
  ------------------
 9855|      0|      return false;
 9856|      0|    }
 9857|    135|    value = v;
 9858|    135|    return true;
 9859|    135|  }
 9860|  2.40k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9860:7): [True: 2.04k, False: 362]
  |  Branch (9860:23): [True: 187, False: 1.85k]
  |  Branch (9860:38): [True: 108, False: 79]
  |  Branch (9860:53): [True: 100, False: 8]
  ------------------
 9861|    100|    ++p;
 9862|    100|    uint64_t v = 0;
 9863|    747|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9863:12): [True: 676, False: 71]
  |  Branch (9863:23): [True: 667, False: 9]
  ------------------
 9864|    667|      const char c = *p;
 9865|    667|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9865:11): [True: 5, False: 662]
  |  Branch (9865:22): [True: 10, False: 652]
  ------------------
 9866|     15|        return false;
 9867|     15|      }
 9868|    652|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9868:11): [True: 5, False: 647]
  ------------------
 9869|      5|        return false;
 9870|      5|      }
 9871|    647|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9872|    647|      ++p;
 9873|    647|    }
 9874|     80|    value = v;
 9875|     80|    return true;
 9876|    100|  }
 9877|  2.30k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9877:7): [True: 260, False: 2.04k]
  |  Branch (9877:19): [True: 1.29k, False: 748]
  ------------------
 9878|  1.55k|    return false;
 9879|  1.55k|  }
 9880|    748|  is_pure_decimal = true;
 9881|    748|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9882|    748|  ++p;
 9883|  1.59k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9883:10): [True: 1.12k, False: 473]
  |  Branch (9883:21): [True: 900, False: 224]
  ------------------
 9884|    900|    const char c = *p;
 9885|    900|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9885:9): [True: 11, False: 889]
  |  Branch (9885:20): [True: 20, False: 869]
  ------------------
 9886|     31|      return false;
 9887|     31|    }
 9888|    869|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9888:9): [True: 18, False: 851]
  ------------------
 9889|     18|      return false;
 9890|     18|    }
 9891|    851|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9892|    851|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9892:9): [True: 2, False: 849]
  ------------------
 9893|      2|      return false;
 9894|      2|    }
 9895|    849|    ++p;
 9896|    849|  }
 9897|    697|  value = v;
 9898|    697|  return true;
 9899|    748|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9903|  7.33k|                           uint16_t& value) noexcept {
 9904|  7.33k|  if (pointer == end) {
  ------------------
  |  Branch (9904:7): [True: 0, False: 7.33k]
  ------------------
 9905|      0|    return 0;
 9906|      0|  }
 9907|  7.33k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9908|  7.33k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9908:7): [True: 7.06k, False: 272]
  ------------------
 9909|  7.06k|    return 0;
 9910|  7.06k|  }
 9911|    272|  uint32_t v = n0;
 9912|    272|  ++pointer;
 9913|    272|  int length = 1;
 9914|    272|  if (pointer != end) {
  ------------------
  |  Branch (9914:7): [True: 255, False: 17]
  ------------------
 9915|    255|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9916|    255|    if (n1 != 0xff) {
  ------------------
  |  Branch (9916:9): [True: 103, False: 152]
  ------------------
 9917|    103|      v = (v << 4) | n1;
 9918|    103|      ++pointer;
 9919|    103|      ++length;
 9920|    103|      if (pointer != end) {
  ------------------
  |  Branch (9920:11): [True: 100, False: 3]
  ------------------
 9921|    100|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9922|    100|        if (n2 != 0xff) {
  ------------------
  |  Branch (9922:13): [True: 64, False: 36]
  ------------------
 9923|     64|          v = (v << 4) | n2;
 9924|     64|          ++pointer;
 9925|     64|          ++length;
 9926|     64|          if (pointer != end) {
  ------------------
  |  Branch (9926:15): [True: 62, False: 2]
  ------------------
 9927|     62|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9928|     62|            if (n3 != 0xff) {
  ------------------
  |  Branch (9928:17): [True: 20, False: 42]
  ------------------
 9929|     20|              v = (v << 4) | n3;
 9930|     20|              ++pointer;
 9931|     20|              ++length;
 9932|     20|            }
 9933|     62|          }
 9934|     64|        }
 9935|    100|      }
 9936|    103|    }
 9937|    255|  }
 9938|    272|  value = static_cast<uint16_t>(v);
 9939|    272|  return length;
 9940|  7.33k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  102|  7.05k|    std::string_view input) noexcept {
  103|  7.05k|  if (input.empty()) return false;
  ------------------
  |  Branch (103:7): [True: 893, False: 6.15k]
  ------------------
  104|  6.15k|  if (input.back() == '.') {
  ------------------
  |  Branch (104:7): [True: 105, False: 6.05k]
  ------------------
  105|    105|    if (input.size() > 254) return false;
  ------------------
  |  Branch (105:9): [True: 0, False: 105]
  ------------------
  106|  6.05k|  } else if (input.size() > 253)
  ------------------
  |  Branch (106:14): [True: 0, False: 6.05k]
  ------------------
  107|      0|    return false;
  108|       |
  109|  6.15k|  size_t start = 0;
  110|  21.2k|  while (start < input.size()) {
  ------------------
  |  Branch (110:10): [True: 16.0k, False: 5.18k]
  ------------------
  111|  16.0k|    auto dot_location = input.find('.', start);
  112|       |    // If not found, it's likely the end of the domain
  113|  16.0k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (113:9): [True: 5.13k, False: 10.9k]
  ------------------
  114|       |
  115|  16.0k|    auto label_size = dot_location - start;
  116|  16.0k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (116:9): [True: 229, False: 15.8k]
  |  Branch (116:28): [True: 750, False: 15.0k]
  ------------------
  117|       |
  118|  15.0k|    start = dot_location + 1;
  119|  15.0k|  }
  120|       |
  121|  5.18k|  return true;
  122|  6.15k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7347|  47.6k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7348|  47.6k|  return is_alnum_plus_table[uint8_t(c)];
 7349|       |  // A table is almost surely much faster than the
 7350|       |  // following under most compilers: return
 7351|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7352|  47.6k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 7024|  8.11k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 7025|  8.11k|  uint64_t broadcast_80 = broadcast(0x80);
 7026|  8.11k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 7027|  8.11k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 7028|  8.11k|  uint64_t non_ascii = 0;
 7029|  8.11k|  size_t i = 0;
 7030|       |
 7031|  23.4k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (7031:10): [True: 15.3k, False: 8.11k]
  ------------------
 7032|  15.3k|    uint64_t word{};
 7033|  15.3k|    memcpy(&word, input + i, sizeof(word));
 7034|  15.3k|    non_ascii |= (word & broadcast_80);
 7035|  15.3k|    word ^=
 7036|  15.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7037|  15.3k|    memcpy(input + i, &word, sizeof(word));
 7038|  15.3k|  }
 7039|  8.11k|  if (i < length) {
  ------------------
  |  Branch (7039:7): [True: 6.24k, False: 1.87k]
  ------------------
 7040|  6.24k|    uint64_t word{};
 7041|  6.24k|    memcpy(&word, input + i, length - i);
 7042|  6.24k|    non_ascii |= (word & broadcast_80);
 7043|  6.24k|    word ^=
 7044|  6.24k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7045|  6.24k|    memcpy(input + i, &word, length - i);
 7046|  6.24k|  }
 7047|  8.11k|  return non_ascii == 0;
 7048|  8.11k|}
_ZN3ada7unicode9broadcastEh:
 7020|  24.3k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 7021|  24.3k|  return 0x101010101010101ull * v;
 7022|  24.3k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12524|    684|    auto apply_query_and_hash = [&]() {
12525|    684|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12525:11): [True: 122, False: 562]
  ------------------
12526|    122|        const size_t q_end =
12527|    122|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12527:13): [True: 18, False: 104]
  ------------------
12528|    122|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12529|    122|                                                q_end - query_start - 1),
12530|    122|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12531|    122|      }
12532|    684|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12532:11): [True: 103, False: 581]
  ------------------
12533|    103|        out.update_unencoded_base_hash(std::string_view(
12534|    103|            input.data() + hash_start + 1, len - hash_start - 1));
12535|    103|      }
12536|    684|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12138|    255|    auto apply_query_and_hash = [&]() {
12139|    255|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12139:11): [True: 73, False: 182]
  ------------------
12140|     73|        const size_t q_end =
12141|     73|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12141:13): [True: 14, False: 59]
  ------------------
12142|     73|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12143|     73|                                                q_end - query_start - 1),
12144|     73|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12145|     73|      }
12146|    255|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12146:11): [True: 55, False: 200]
  ------------------
12147|     55|        out.update_unencoded_base_hash(std::string_view(
12148|     55|            input.data() + hash_start + 1, len - hash_start - 1));
12149|     55|      }
12150|    255|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8782|  11.9k|    std::string_view& input) noexcept {
 8783|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8784|       |  // function). this function should be quite fast.
 8785|  11.9k|  size_t location_of_first = input.find('#');
 8786|  11.9k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8786:7): [True: 11.7k, False: 147]
  ------------------
 8787|  11.7k|    return std::nullopt;
 8788|  11.7k|  }
 8789|    147|  std::string_view hash = input;
 8790|    147|  hash.remove_prefix(location_of_first + 1);
 8791|    147|  input.remove_suffix(input.size() - location_of_first);
 8792|    147|  return hash;
 8793|  11.9k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9740|  1.66k|find_authority_delimiter_special(std::string_view view) noexcept {
 9741|       |  // performance note: we might be able to gain further performance
 9742|       |  // with SIMD intrinsics.
 9743|  7.14k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9743:33): [True: 7.12k, False: 19]
  ------------------
 9744|  7.12k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9744:9): [True: 1.64k, False: 5.47k]
  ------------------
 9745|  1.64k|      return pos - view.begin();
 9746|  1.64k|    }
 9747|  7.12k|  }
 9748|     19|  return size_t(view.size());
 9749|  1.66k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8795|    391|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8796|       |  // Let path be url's path.
 8797|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8798|       |  // Windows drive letter, then return.
 8799|    391|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8799:7): [True: 0, False: 391]
  ------------------
 8800|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8800:7): [True: 0, False: 0]
  |  Branch (8800:54): [True: 0, False: 0]
  ------------------
 8801|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8801:9): [True: 0, False: 0]
  ------------------
 8802|      0|            helpers::substring(path, 1))) {
 8803|      0|      return false;
 8804|      0|    }
 8805|      0|  }
 8806|       |
 8807|       |  // Remove path's last item, if any.
 8808|    391|  size_t last_delimiter = path.rfind('/');
 8809|    391|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8809:7): [True: 188, False: 203]
  ------------------
 8810|    188|    path.erase(last_delimiter);
 8811|    188|    return true;
 8812|    188|  }
 8813|       |
 8814|    203|  return false;
 8815|    391|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9456|  11.9k|    const bool is_special, std::string_view& view) noexcept {
 9457|       |  /**
 9458|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9459|       |   * compute a variable called insideBrackets but this variable is only used
 9460|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9461|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9462|       |   * It is conceptually simpler and arguably more efficient to just return a
 9463|       |   * Boolean indicating whether ':' was found outside brackets.
 9464|       |   */
 9465|  11.9k|  const size_t view_size = view.size();
 9466|  11.9k|  size_t location = 0;
 9467|  11.9k|  bool found_colon = false;
 9468|       |  /**
 9469|       |   * Performance analysis:
 9470|       |   *
 9471|       |   * We are basically seeking the end of the hostname which can be indicated
 9472|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9473|       |   * (where '\\' is only applicable for special URLs). However, these must
 9474|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9475|       |   * '?' does not count.
 9476|       |   *
 9477|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9478|       |   * the set of delimiters, and that we handle it first.
 9479|       |   *
 9480|       |   * So the trick is to have a fast function that locates the next delimiter.
 9481|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9482|       |   * function would be provided by the C++ standard library, but it seems that
 9483|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9484|       |   *
 9485|       |   * We do not break into two loops for speed, but for clarity.
 9486|       |   */
 9487|  11.9k|  if (is_special) {
  ------------------
  |  Branch (9487:7): [True: 11.9k, False: 0]
  ------------------
 9488|       |    // We move to the next delimiter.
 9489|  11.9k|    location = find_next_host_delimiter_special(view, location);
 9490|       |    // Unless we find '[' then we are going only going to have to call
 9491|       |    // find_next_host_delimiter_special once.
 9492|  19.2k|    for (; location < view_size;
  ------------------
  |  Branch (9492:12): [True: 19.2k, False: 88]
  ------------------
 9493|  19.2k|         location = find_next_host_delimiter_special(view, location)) {
 9494|  19.2k|      if (view[location] == '[') {
  ------------------
  |  Branch (9494:11): [True: 7.49k, False: 11.7k]
  ------------------
 9495|  7.49k|        location = view.find(']', location);
 9496|  7.49k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9496:13): [True: 119, False: 7.38k]
  ------------------
 9497|       |          // performance: view.find might get translated to a memchr, which
 9498|       |          // has no notion of std::string_view::npos, so the code does not
 9499|       |          // reflect the assembly.
 9500|    119|          location = view_size;
 9501|    119|          break;
 9502|    119|        }
 9503|  11.7k|      } else {
 9504|  11.7k|        found_colon = view[location] == ':';
 9505|  11.7k|        break;
 9506|  11.7k|      }
 9507|  19.2k|    }
 9508|  11.9k|  } else {
 9509|       |    // We move to the next delimiter.
 9510|      0|    location = find_next_host_delimiter(view, location);
 9511|       |    // Unless we find '[' then we are going only going to have to call
 9512|       |    // find_next_host_delimiter_special once.
 9513|      0|    for (; location < view_size;
  ------------------
  |  Branch (9513:12): [True: 0, False: 0]
  ------------------
 9514|      0|         location = find_next_host_delimiter(view, location)) {
 9515|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (9515:11): [True: 0, False: 0]
  ------------------
 9516|      0|        location = view.find(']', location);
 9517|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9517:13): [True: 0, False: 0]
  ------------------
 9518|       |          // performance: view.find might get translated to a memchr, which
 9519|       |          // has no notion of std::string_view::npos, so the code does not
 9520|       |          // reflect the assembly.
 9521|      0|          location = view_size;
 9522|      0|          break;
 9523|      0|        }
 9524|      0|      } else {
 9525|      0|        found_colon = view[location] == ':';
 9526|      0|        break;
 9527|      0|      }
 9528|      0|    }
 9529|      0|  }
 9530|       |  // performance: remove_suffix may translate into a single instruction.
 9531|  11.9k|  view.remove_suffix(view_size - location);
 9532|  11.9k|  return {location, found_colon};
 9533|  11.9k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9046|  19.2k|    std::string_view view, size_t location) noexcept {
 9047|       |  // first check for short strings in which case we do it naively.
 9048|  19.2k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9048:7): [True: 10.4k, False: 8.79k]
  ------------------
 9049|  41.4k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9049:31): [True: 41.4k, False: 65]
  ------------------
 9050|  41.4k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (9050:11): [True: 530, False: 40.8k]
  |  Branch (9050:29): [True: 9.36k, False: 31.5k]
  |  Branch (9050:47): [True: 5, False: 31.5k]
  ------------------
 9051|  31.5k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (9051:11): [True: 69, False: 31.4k]
  |  Branch (9051:29): [True: 462, False: 30.9k]
  ------------------
 9052|  10.4k|        return i;
 9053|  10.4k|      }
 9054|  41.4k|    }
 9055|     65|    return size_t(view.size());
 9056|  10.4k|  }
 9057|       |  // fast path for long strings (expected to be common)
 9058|  8.79k|  size_t i = location;
 9059|  8.79k|  const __m128i mask1 = _mm_set1_epi8(':');
 9060|  8.79k|  const __m128i mask2 = _mm_set1_epi8('/');
 9061|  8.79k|  const __m128i mask3 = _mm_set1_epi8('\\');
 9062|  8.79k|  const __m128i mask4 = _mm_set1_epi8('?');
 9063|  8.79k|  const __m128i mask5 = _mm_set1_epi8('[');
 9064|       |
 9065|  11.5k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9065:10): [True: 10.4k, False: 1.11k]
  ------------------
 9066|  10.4k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9067|  10.4k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9068|  10.4k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9069|  10.4k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9070|  10.4k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9071|  10.4k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9072|  10.4k|    __m128i m = _mm_or_si128(
 9073|  10.4k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9074|  10.4k|    int mask = _mm_movemask_epi8(m);
 9075|  10.4k|    if (mask != 0) {
  ------------------
  |  Branch (9075:9): [True: 7.67k, False: 2.73k]
  ------------------
 9076|  7.67k|      return i + trailing_zeroes(mask);
 9077|  7.67k|    }
 9078|  10.4k|  }
 9079|  1.11k|  if (i < view.size()) {
  ------------------
  |  Branch (9079:7): [True: 1.11k, False: 4]
  ------------------
 9080|  1.11k|    __m128i word =
 9081|  1.11k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9082|  1.11k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9083|  1.11k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9084|  1.11k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9085|  1.11k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9086|  1.11k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9087|  1.11k|    __m128i m = _mm_or_si128(
 9088|  1.11k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9089|  1.11k|    int mask = _mm_movemask_epi8(m);
 9090|  1.11k|    if (mask != 0) {
  ------------------
  |  Branch (9090:9): [True: 1.09k, False: 19]
  ------------------
 9091|  1.09k|      return view.length() - 16 + trailing_zeroes(mask);
 9092|  1.09k|    }
 9093|  1.11k|  }
 9094|     23|  return size_t(view.length());
 9095|  1.11k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8868|  8.76k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8869|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8870|       |  unsigned long ret;
 8871|       |  // Search the mask data from least significant bit (LSB)
 8872|       |  // to the most significant bit (MSB) for a set bit (1).
 8873|       |  _BitScanForward(&ret, input_num);
 8874|       |  return (int)ret;
 8875|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8876|  8.76k|  return __builtin_ctzl(input_num);
 8877|  8.76k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8878|  8.76k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7276|  56.1k|    const char c) noexcept {
 7277|  56.1k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7278|  56.1k|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12847|  1.18k|  const auto enforce_max_input_length = [&]() {
12848|  1.18k|    if constexpr (store_values) {
12849|  1.18k|      if (url.is_valid) {
  ------------------
  |  Branch (12849:11): [True: 1.18k, False: 0]
  ------------------
12850|  1.18k|        if constexpr (result_type_is_ada_url_aggregator) {
12851|  1.18k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12851:15): [True: 0, False: 1.18k]
  ------------------
12852|      0|            url.is_valid = false;
12853|      0|          }
12854|       |        } else {
12855|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12856|       |            url.is_valid = false;
12857|       |          }
12858|       |        }
12859|  1.18k|      }
12860|  1.18k|    }
12861|  1.18k|  };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
11177|    115|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
11178|    115|  uint32_t digits = 1;
11179|    390|  while (port >= 10) {
  ------------------
  |  Branch (11179:10): [True: 275, False: 115]
  ------------------
11180|    275|    port /= 10;
11181|    275|    ++digits;
11182|    275|  }
11183|    115|  return digits;
11184|    115|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
11187|     99|                                             uint32_t port) {
11188|     99|  buffer += ':';
11189|     99|  char port_buf[5];
11190|     99|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
11191|     99|  (void)ec;
11192|     99|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
11193|     99|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11335|  13.3k|                                        size_t n) noexcept {
11336|  13.3k|  const size_t rem = n - host_start;
11337|  13.3k|  if (rem == 0) {
  ------------------
  |  Branch (11337:7): [True: 0, False: 13.3k]
  ------------------
11338|      0|    return false;
11339|      0|  }
11340|       |#if ADA_NEON
11341|       |  if (rem >= 16) {
11342|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11343|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11344|       |    if (at == 0) {
11345|       |      return false;
11346|       |    }
11347|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11348|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11349|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11350|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11351|       |  }
11352|       |#elif ADA_SSE2
11353|  13.3k|  if (rem >= 16) {
  ------------------
  |  Branch (11353:7): [True: 9.66k, False: 3.63k]
  ------------------
11354|  9.66k|    const __m128i w =
11355|  9.66k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11356|  9.66k|    const uint16_t at = static_cast<uint16_t>(
11357|  9.66k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11358|  9.66k|    if (at == 0) {
  ------------------
  |  Branch (11358:9): [True: 9.54k, False: 124]
  ------------------
11359|  9.54k|      return false;
11360|  9.54k|    }
11361|    124|    const uint16_t delim = static_cast<uint16_t>(
11362|    124|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11363|    124|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11364|    124|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11365|    124|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11365:12): [True: 77, False: 47]
  |  Branch (11365:26): [True: 12, False: 35]
  ------------------
11366|  9.66k|  }
11367|  3.63k|#endif
11368|  3.63k|  const size_t lim = host_start + rem;
11369|  25.3k|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11369:31): [True: 25.3k, False: 0]
  ------------------
11370|  25.3k|    const uint8_t c = p[i];
11371|  25.3k|    if (c == '@') {
  ------------------
  |  Branch (11371:9): [True: 90, False: 25.3k]
  ------------------
11372|     90|      return true;
11373|     90|    }
11374|  25.3k|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11374:9): [True: 3.25k, False: 22.0k]
  |  Branch (11374:21): [True: 173, False: 21.8k]
  |  Branch (11374:33): [True: 120, False: 21.7k]
  ------------------
11375|  3.54k|      return false;
11376|  3.54k|    }
11377|  25.3k|  }
11378|      0|  return false;
11379|  3.63k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11400|  4.65k|                                     bool& has_x) noexcept {
11401|  4.65k|  has_upper = false;
11402|  4.65k|  has_x = false;
11403|  4.65k|  size_t i = start;
11404|  4.65k|#if ADA_PARSER_SSSE3
11405|  4.65k|  if (parser_use_ssse3() && (len - start >= 16)) {
  ------------------
  |  Branch (11405:7): [True: 4.65k, False: 0]
  |  Branch (11405:29): [True: 2.17k, False: 2.48k]
  ------------------
11406|  2.17k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11407|  2.17k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11408|  2.17k|    const __m128i x_splat = _mm_set1_epi8('x');
11409|  2.17k|    auto visit = [&](size_t at) noexcept -> bool {
11410|  2.17k|      const __m128i w =
11411|  2.17k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11412|  2.17k|      const int up = sse2_uppercase(w);
11413|  2.17k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11414|  2.17k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11415|  2.17k|      if (mask == 0) {
11416|  2.17k|        if (up != 0) {
11417|  2.17k|          has_upper = true;
11418|  2.17k|        }
11419|  2.17k|        if (xs != 0) {
11420|  2.17k|          has_x = true;
11421|  2.17k|        }
11422|  2.17k|        return false;
11423|  2.17k|      }
11424|  2.17k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11425|  2.17k|      const int valid = (1 << hit) - 1;
11426|  2.17k|      if ((up & valid) != 0) {
11427|  2.17k|        has_upper = true;
11428|  2.17k|      }
11429|  2.17k|      if ((xs & valid) != 0) {
11430|  2.17k|        has_x = true;
11431|  2.17k|      }
11432|  2.17k|      end = at + static_cast<size_t>(hit);
11433|  2.17k|      return true;
11434|  2.17k|    };
11435|  2.46k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11435:12): [True: 1.33k, False: 1.13k]
  ------------------
11436|  1.33k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11436:11): [True: 925, False: 412]
  |  Branch (11436:23): [True: 115, False: 297]
  ------------------
11437|  1.04k|        return k_host_class[b[end]] == 1;
11438|  1.04k|      }
11439|  1.33k|    }
11440|  1.30k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11440:12): [True: 1.02k, False: 278]
  ------------------
11441|  1.02k|      if (visit(i)) {
  ------------------
  |  Branch (11441:11): [True: 853, False: 175]
  ------------------
11442|    853|        return k_host_class[b[end]] == 1;
11443|    853|      }
11444|  1.02k|    }
11445|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11446|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11447|    278|    if (i > start && i < len) {
  ------------------
  |  Branch (11447:9): [True: 278, False: 0]
  |  Branch (11447:22): [True: 278, False: 0]
  ------------------
11448|    278|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11448:11): [True: 278, False: 0]
  |  Branch (11448:30): [True: 278, False: 0]
  ------------------
11449|    278|        return k_host_class[b[end]] == 1;
11450|    278|      }
11451|      0|      end = len;
11452|      0|      return true;
11453|    278|    }
11454|    278|  }
11455|       |#elif ADA_SSE2
11456|       |  const __m128i x_splat = _mm_set1_epi8('x');
11457|       |  for (; i + 32 <= len; i += 32) {
11458|       |    for (size_t off = 0; off < 32; off += 16) {
11459|       |      const __m128i w =
11460|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11461|       |      const int up = sse2_uppercase(w);
11462|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11463|       |      const int mask = sse2_host_stop(w);
11464|       |      if (mask != 0) {
11465|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11466|       |        const int valid = (1 << hit) - 1;
11467|       |        if ((up & valid) != 0) {
11468|       |          has_upper = true;
11469|       |        }
11470|       |        if ((xs & valid) != 0) {
11471|       |          has_x = true;
11472|       |        }
11473|       |        end = i + off + static_cast<size_t>(hit);
11474|       |        return k_host_class[b[end]] == 1;
11475|       |      }
11476|       |      if (up != 0) {
11477|       |        has_upper = true;
11478|       |      }
11479|       |      if (xs != 0) {
11480|       |        has_x = true;
11481|       |      }
11482|       |    }
11483|       |  }
11484|       |  for (; i + 16 <= len; i += 16) {
11485|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11486|       |    const int up = sse2_uppercase(w);
11487|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11488|       |    const int mask = sse2_host_stop(w);
11489|       |    if (mask != 0) {
11490|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11491|       |      const int valid = (1 << hit) - 1;
11492|       |      if ((up & valid) != 0) {
11493|       |        has_upper = true;
11494|       |      }
11495|       |      if ((xs & valid) != 0) {
11496|       |        has_x = true;
11497|       |      }
11498|       |      end = i + static_cast<size_t>(hit);
11499|       |      return k_host_class[b[end]] == 1;
11500|       |    }
11501|       |    if (up != 0) {
11502|       |      has_upper = true;
11503|       |    }
11504|       |    if (xs != 0) {
11505|       |      has_x = true;
11506|       |    }
11507|       |  }
11508|       |#elif ADA_NEON
11509|       |  if (len - start >= 16) {
11510|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11511|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11512|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11513|       |    auto visit = [&](size_t at) noexcept -> bool {
11514|       |      const uint8x16_t w = vld1q_u8(b + at);
11515|       |      const uint64_t up = neon_uppercase(w);
11516|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11517|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11518|       |      if (bits == 0) {
11519|       |        if (up != 0) {
11520|       |          has_upper = true;
11521|       |        }
11522|       |        if (xs != 0) {
11523|       |          has_x = true;
11524|       |        }
11525|       |        return false;
11526|       |      }
11527|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11528|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11529|       |      if ((up & valid) != 0) {
11530|       |        has_upper = true;
11531|       |      }
11532|       |      if ((xs & valid) != 0) {
11533|       |        has_x = true;
11534|       |      }
11535|       |      end = at + hit;
11536|       |      return true;
11537|       |    };
11538|       |    for (; i + 32 <= len; i += 32) {
11539|       |      if (visit(i) || visit(i + 16)) {
11540|       |        return k_host_class[b[end]] == 1;
11541|       |      }
11542|       |    }
11543|       |    for (; i + 16 <= len; i += 16) {
11544|       |      if (visit(i)) {
11545|       |        return k_host_class[b[end]] == 1;
11546|       |      }
11547|       |    }
11548|       |    if (i > start && i < len) {
11549|       |      if (visit(len - 16) && end >= i) {
11550|       |        return k_host_class[b[end]] == 1;
11551|       |      }
11552|       |      end = len;
11553|       |      return true;
11554|       |    }
11555|       |  }
11556|       |#endif
11557|  5.67k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11557:10): [True: 5.67k, False: 0]
  ------------------
11558|  5.67k|    const uint8_t c = b[i];
11559|  5.67k|    const uint8_t cls = k_host_class[c];
11560|  5.67k|    if (cls == 1) {
  ------------------
  |  Branch (11560:9): [True: 877, False: 4.79k]
  ------------------
11561|    877|      end = i;
11562|    877|      return true;
11563|    877|    }
11564|  4.79k|    if (cls == 2) {
  ------------------
  |  Branch (11564:9): [True: 1.60k, False: 3.18k]
  ------------------
11565|  1.60k|      return false;
11566|  1.60k|    }
11567|  3.18k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11567:9): [True: 1.91k, False: 1.27k]
  |  Branch (11567:21): [True: 442, False: 1.46k]
  ------------------
11568|    442|      has_upper = true;
11569|  2.74k|    } else if (c == 'x') {
  ------------------
  |  Branch (11569:16): [True: 508, False: 2.23k]
  ------------------
11570|    508|      has_x = true;
11571|    508|    }
11572|  3.18k|  }
11573|      0|  end = len;
11574|      0|  return true;
11575|  2.48k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116parser_use_ssse3Ev:
11385|  6.31k|ada_really_inline bool parser_use_ssse3() noexcept {
11386|  6.31k|#ifdef ADA_PARSER_NEED_SSSE3_TARGET
11387|  6.31k|  static const bool supported = __builtin_cpu_supports("ssse3") != 0;
11388|  6.31k|  return supported;
11389|       |#else
11390|       |  return true;
11391|       |#endif
11392|  6.31k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
11216|  6.04k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
11217|  6.04k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
11218|  6.04k|}
serializers.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENKUlmE_clEm:
11409|  3.05k|    auto visit = [&](size_t at) noexcept -> bool {
11410|  3.05k|      const __m128i w =
11411|  3.05k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11412|  3.05k|      const int up = sse2_uppercase(w);
11413|  3.05k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11414|  3.05k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11415|  3.05k|      if (mask == 0) {
  ------------------
  |  Branch (11415:11): [True: 884, False: 2.17k]
  ------------------
11416|    884|        if (up != 0) {
  ------------------
  |  Branch (11416:13): [True: 465, False: 419]
  ------------------
11417|    465|          has_upper = true;
11418|    465|        }
11419|    884|        if (xs != 0) {
  ------------------
  |  Branch (11419:13): [True: 486, False: 398]
  ------------------
11420|    486|          has_x = true;
11421|    486|        }
11422|    884|        return false;
11423|    884|      }
11424|  2.17k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11425|  2.17k|      const int valid = (1 << hit) - 1;
11426|  2.17k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11426:11): [True: 458, False: 1.71k]
  ------------------
11427|    458|        has_upper = true;
11428|    458|      }
11429|  2.17k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11429:11): [True: 512, False: 1.65k]
  ------------------
11430|    512|        has_x = true;
11431|    512|      }
11432|  2.17k|      end = at + static_cast<size_t>(hit);
11433|  2.17k|      return true;
11434|  3.05k|    };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11303|  3.05k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11304|  3.05k|  return _mm_movemask_epi8(_mm_and_si128(
11305|  3.05k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11306|  3.05k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11307|  3.05k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
11223|  4.82k|                                          __m128i hi_tbl) noexcept {
11224|  4.82k|  const __m128i nibble = _mm_set1_epi8(0x0F);
11225|  4.82k|  const __m128i lo = _mm_and_si128(w, nibble);
11226|  4.82k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
11227|  4.82k|  const __m128i hit =
11228|  4.82k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
11229|  4.82k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
11230|  4.82k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
11195|  2.78k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
11196|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
11197|       |  unsigned long ret;
11198|       |  _BitScanForward(&ret, input_num);
11199|       |  return static_cast<int>(ret);
11200|       |#else
11201|  2.78k|  return __builtin_ctz(input_num);
11202|  2.78k|#endif
11203|  2.78k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11635|  1.12k|                                   bool& maybe_dot_segment) noexcept {
11636|  1.12k|  const size_t run_start = i;
11637|  1.12k|#if ADA_PARSER_SSSE3
11638|  1.12k|  if (parser_use_ssse3() && (i + 16 <= len)) {
  ------------------
  |  Branch (11638:7): [True: 1.12k, False: 0]
  |  Branch (11638:29): [True: 655, False: 474]
  ------------------
11639|    655|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11640|    655|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11641|    932|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11641:12): [True: 508, False: 424]
  ------------------
11642|    508|      const __m128i w0 =
11643|    508|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11644|    508|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11645|    508|      if (m0 != 0) {
  ------------------
  |  Branch (11645:11): [True: 152, False: 356]
  ------------------
11646|    152|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11647|    152|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11648|    152|                            maybe_dot_segment);
11649|    152|        i += static_cast<size_t>(hit_bit);
11650|    152|        return;
11651|    152|      }
11652|    356|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11653|    356|      const __m128i w1 =
11654|    356|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11655|    356|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11656|    356|      if (m1 != 0) {
  ------------------
  |  Branch (11656:11): [True: 79, False: 277]
  ------------------
11657|     79|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11658|     79|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11659|     79|                            maybe_dot_segment);
11660|     79|        i += 16 + static_cast<size_t>(hit_bit);
11661|     79|        return;
11662|     79|      }
11663|    277|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11664|    277|    }
11665|    610|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11665:12): [True: 317, False: 293]
  ------------------
11666|    317|      const __m128i w =
11667|    317|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11668|    317|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11669|    317|      if (mask != 0) {
  ------------------
  |  Branch (11669:11): [True: 131, False: 186]
  ------------------
11670|    131|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11671|    131|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11672|    131|                            maybe_dot_segment);
11673|    131|        i += static_cast<size_t>(hit_bit);
11674|    131|        return;
11675|    131|      }
11676|    186|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11677|    186|    }
11678|    293|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11678:9): [True: 293, False: 0]
  |  Branch (11678:26): [True: 207, False: 86]
  ------------------
11679|    207|      const __m128i w =
11680|    207|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11681|    207|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11682|    207|      if (mask != 0) {
  ------------------
  |  Branch (11682:11): [True: 110, False: 97]
  ------------------
11683|    110|        const size_t hit =
11684|    110|            len - 16 +
11685|    110|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11686|    110|        if (hit >= i) {
  ------------------
  |  Branch (11686:13): [True: 110, False: 0]
  ------------------
11687|    454|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11687:30): [True: 344, False: 110]
  ------------------
11688|    344|            if (b[j] == '.') {
  ------------------
  |  Branch (11688:17): [True: 165, False: 179]
  ------------------
11689|    165|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11690|    165|            }
11691|    344|          }
11692|    110|          i = hit;
11693|    110|          return;
11694|    110|        }
11695|    110|      }
11696|    580|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11696:26): [True: 483, False: 97]
  ------------------
11697|    483|        if (b[j] == '.') {
  ------------------
  |  Branch (11697:13): [True: 160, False: 323]
  ------------------
11698|    160|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11699|    160|        }
11700|    483|      }
11701|     97|      i = len;
11702|     97|      return;
11703|    207|    }
11704|    293|  }
11705|       |#elif ADA_SSE2
11706|       |  for (; i + 16 <= len; i += 16) {
11707|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11708|       |    const int mask = sse2_path_stop(w);
11709|       |    if (mask != 0) {
11710|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11711|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11712|       |                          maybe_dot_segment);
11713|       |      i += static_cast<size_t>(hit_bit);
11714|       |      return;
11715|       |    }
11716|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11717|       |  }
11718|       |#elif ADA_NEON
11719|       |  if (i + 16 <= len) {
11720|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11721|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11722|       |    for (; i + 32 <= len; i += 32) {
11723|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11724|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11725|       |      if (bits0 != 0) {
11726|       |        const size_t hit_off =
11727|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11728|       |        const uint64_t valid =
11729|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11730|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11731|       |        i += hit_off;
11732|       |        return;
11733|       |      }
11734|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11735|       |                               maybe_dot_segment);
11736|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11737|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11738|       |      if (bits1 != 0) {
11739|       |        const size_t hit_off =
11740|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11741|       |        const uint64_t valid =
11742|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11743|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11744|       |                                 maybe_dot_segment);
11745|       |        i += 16 + hit_off;
11746|       |        return;
11747|       |      }
11748|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11749|       |                               maybe_dot_segment);
11750|       |    }
11751|       |    for (; i + 16 <= len; i += 16) {
11752|       |      const uint8x16_t w = vld1q_u8(b + i);
11753|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11754|       |      if (bits != 0) {
11755|       |        const size_t hit_off =
11756|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11757|       |        const uint64_t valid =
11758|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11759|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11760|       |        i += hit_off;
11761|       |        return;
11762|       |      }
11763|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11764|       |                               maybe_dot_segment);
11765|       |    }
11766|       |    if (i > run_start && i < len) {
11767|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11768|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11769|       |      if (bits != 0) {
11770|       |        const size_t hit =
11771|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11772|       |        if (hit >= i) {
11773|       |          for (size_t j = i; j < hit; ++j) {
11774|       |            if (b[j] == '.') {
11775|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11776|       |            }
11777|       |          }
11778|       |          i = hit;
11779|       |          return;
11780|       |        }
11781|       |      }
11782|       |      for (size_t j = i; j < len; ++j) {
11783|       |        if (b[j] == '.') {
11784|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11785|       |        }
11786|       |      }
11787|       |      i = len;
11788|       |      return;
11789|       |    }
11790|       |  }
11791|       |#endif
11792|  1.98k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11792:10): [True: 1.74k, False: 249]
  ------------------
11793|  1.74k|    const uint8_t c = b[i];
11794|  1.74k|    const uint8_t cls = k_path[c];
11795|  1.74k|    if (cls != 0) {
  ------------------
  |  Branch (11795:9): [True: 311, False: 1.42k]
  ------------------
11796|    311|      return;
11797|    311|    }
11798|  1.42k|    if (c == '.') {
  ------------------
  |  Branch (11798:9): [True: 500, False: 929]
  ------------------
11799|    500|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11800|    500|    }
11801|  1.42k|  }
11802|    560|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11592|  1.18k|                                           bool& maybe_dot_segment) noexcept {
11593|  1.18k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11593:7): [True: 188, False: 993]
  |  Branch (11593:28): [True: 129, False: 864]
  ------------------
11594|    317|    return;
11595|    317|  }
11596|    864|  const int dots =
11597|    864|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11598|    864|  if (dots == 0) {
  ------------------
  |  Branch (11598:7): [True: 259, False: 605]
  ------------------
11599|    259|    return;
11600|    259|  }
11601|    605|  const int slashes =
11602|    605|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11603|    605|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11603:8): [True: 235, False: 370]
  |  Branch (11603:28): [True: 116, False: 119]
  |  Branch (11603:46): [True: 21, False: 98]
  ------------------
11604|    468|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11604:7): [True: 138, False: 330]
  ------------------
11605|    275|    maybe_dot_segment = true;
11606|    275|  }
11607|    605|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11579|    825|    bool& maybe_dot_segment) noexcept {
11580|    825|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11580:7): [True: 130, False: 695]
  |  Branch (11580:27): [True: 313, False: 382]
  ------------------
11581|    443|    maybe_dot_segment = true;
11582|    443|  }
11583|    825|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11945|    303|                                    size_t len) noexcept {
11946|    303|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11808|    303|  do {                                                                       \
  |  |11809|    303|    const size_t scan_start = i;                                             \
  |  |11810|    303|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11810:9): [True: 303, False: 0]
  |  |  |  Branch (11810:31): [True: 112, False: 191]
  |  |  ------------------
  |  |11811|    112|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11812|    112|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11813|    141|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11813:14): [True: 71, False: 70]
  |  |  ------------------
  |  |11814|     71|        const __m128i w0 =                                                   \
  |  |11815|     71|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11816|     71|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11817|     71|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11817:13): [True: 23, False: 48]
  |  |  ------------------
  |  |11818|     23|          i += static_cast<size_t>(                                          \
  |  |11819|     23|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11820|     23|          return;                                                            \
  |  |11821|     23|        }                                                                    \
  |  |11822|     71|        const __m128i w1 =                                                   \
  |  |11823|     48|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11824|     48|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11825|     48|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11825:13): [True: 19, False: 29]
  |  |  ------------------
  |  |11826|     19|          i += 16 + static_cast<size_t>(                                     \
  |  |11827|     19|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11828|     19|          return;                                                            \
  |  |11829|     19|        }                                                                    \
  |  |11830|     48|      }                                                                      \
  |  |11831|    112|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11831:14): [True: 62, False: 44]
  |  |  ------------------
  |  |11832|     62|        const __m128i w =                                                    \
  |  |11833|     62|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11834|     62|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11835|     62|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11835:13): [True: 26, False: 36]
  |  |  ------------------
  |  |11836|     26|          i += static_cast<size_t>(                                          \
  |  |11837|     26|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11838|     26|          return;                                                            \
  |  |11839|     26|        }                                                                    \
  |  |11840|     62|      }                                                                      \
  |  |11841|     70|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11841:11): [True: 44, False: 0]
  |  |  |  Branch (11841:29): [True: 35, False: 9]
  |  |  ------------------
  |  |11842|     35|        const __m128i w =                                                    \
  |  |11843|     35|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11844|     35|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11845|     35|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11845:13): [True: 15, False: 20]
  |  |  ------------------
  |  |11846|     15|          const size_t hit = len - 16 +                                      \
  |  |11847|     15|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11848|     15|                                 static_cast<uint32_t>(mask)));              \
  |  |11849|     15|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11849:15): [True: 15, False: 0]
  |  |  ------------------
  |  |11850|     15|            i = hit;                                                         \
  |  |11851|     15|            return;                                                          \
  |  |11852|     15|          }                                                                  \
  |  |11853|     15|        }                                                                    \
  |  |11854|     35|        i = len;                                                             \
  |  |11855|     20|        return;                                                              \
  |  |11856|     35|      }                                                                      \
  |  |11857|     44|    }                                                                        \
  |  |11858|    697|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11858:12): [True: 564, False: 133]
  |  |  ------------------
  |  |11859|    564|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11859:11): [True: 67, False: 497]
  |  |  ------------------
  |  |11860|     67|        return;                                                              \
  |  |11861|     67|      }                                                                      \
  |  |11862|    564|    }                                                                        \
  |  |11863|    200|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11863:12): [Folded, False: 133]
  |  |  ------------------
  ------------------
11947|    303|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11950|    223|                                   size_t len) noexcept {
11951|    223|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11808|    223|  do {                                                                       \
  |  |11809|    223|    const size_t scan_start = i;                                             \
  |  |11810|    223|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11810:9): [True: 223, False: 0]
  |  |  |  Branch (11810:31): [True: 84, False: 139]
  |  |  ------------------
  |  |11811|     84|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11812|     84|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11813|    113|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11813:14): [True: 66, False: 47]
  |  |  ------------------
  |  |11814|     66|        const __m128i w0 =                                                   \
  |  |11815|     66|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11816|     66|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11817|     66|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11817:13): [True: 27, False: 39]
  |  |  ------------------
  |  |11818|     27|          i += static_cast<size_t>(                                          \
  |  |11819|     27|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11820|     27|          return;                                                            \
  |  |11821|     27|        }                                                                    \
  |  |11822|     66|        const __m128i w1 =                                                   \
  |  |11823|     39|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11824|     39|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11825|     39|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11825:13): [True: 10, False: 29]
  |  |  ------------------
  |  |11826|     10|          i += 16 + static_cast<size_t>(                                     \
  |  |11827|     10|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11828|     10|          return;                                                            \
  |  |11829|     10|        }                                                                    \
  |  |11830|     39|      }                                                                      \
  |  |11831|     84|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11831:14): [True: 37, False: 35]
  |  |  ------------------
  |  |11832|     37|        const __m128i w =                                                    \
  |  |11833|     37|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11834|     37|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11835|     37|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11835:13): [True: 12, False: 25]
  |  |  ------------------
  |  |11836|     12|          i += static_cast<size_t>(                                          \
  |  |11837|     12|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11838|     12|          return;                                                            \
  |  |11839|     12|        }                                                                    \
  |  |11840|     37|      }                                                                      \
  |  |11841|     47|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11841:11): [True: 35, False: 0]
  |  |  |  Branch (11841:29): [True: 27, False: 8]
  |  |  ------------------
  |  |11842|     27|        const __m128i w =                                                    \
  |  |11843|     27|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11844|     27|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11845|     27|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11845:13): [True: 10, False: 17]
  |  |  ------------------
  |  |11846|     10|          const size_t hit = len - 16 +                                      \
  |  |11847|     10|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11848|     10|                                 static_cast<uint32_t>(mask)));              \
  |  |11849|     10|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11849:15): [True: 10, False: 0]
  |  |  ------------------
  |  |11850|     10|            i = hit;                                                         \
  |  |11851|     10|            return;                                                          \
  |  |11852|     10|          }                                                                  \
  |  |11853|     10|        }                                                                    \
  |  |11854|     27|        i = len;                                                             \
  |  |11855|     17|        return;                                                              \
  |  |11856|     27|      }                                                                      \
  |  |11857|     35|    }                                                                        \
  |  |11858|    555|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11858:12): [True: 436, False: 119]
  |  |  ------------------
  |  |11859|    436|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11859:11): [True: 28, False: 408]
  |  |  ------------------
  |  |11860|     28|        return;                                                              \
  |  |11861|     28|      }                                                                      \
  |  |11862|    436|    }                                                                        \
  |  |11863|    147|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11863:12): [Folded, False: 119]
  |  |  ------------------
  ------------------
11952|    223|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11956|    347|bool path_has_dot_segment(std::string_view path) noexcept {
11957|    347|  if (path.empty()) {
  ------------------
  |  Branch (11957:7): [True: 0, False: 347]
  ------------------
11958|      0|    return false;
11959|      0|  }
11960|       |  // "." / ".." at the start, with or without a leading '/'.
11961|    347|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11961:20): [True: 347, False: 0]
  ------------------
11962|    347|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11962:7): [True: 347, False: 0]
  |  Branch (11962:26): [True: 149, False: 198]
  ------------------
11963|    149|    const size_t after = i + 1;
11964|    149|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11964:9): [True: 3, False: 146]
  |  Branch (11964:33): [True: 42, False: 104]
  ------------------
11965|    104|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11965:10): [True: 104, False: 0]
  |  Branch (11965:33): [True: 35, False: 69]
  ------------------
11966|     60|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11966:11): [True: 1, False: 34]
  |  Branch (11966:39): [True: 14, False: 20]
  ------------------
11967|     60|      return true;
11968|     60|    }
11969|    149|  }
11970|    287|  static constexpr std::string_view slash_dot{"/.", 2};
11971|    287|  size_t p = i;
11972|    518|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11972:10): [True: 355, False: 163]
  ------------------
11973|    355|    const size_t after = p + 2;
11974|    355|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11974:9): [True: 4, False: 351]
  |  Branch (11974:33): [True: 45, False: 306]
  ------------------
11975|    306|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11975:10): [True: 306, False: 0]
  |  Branch (11975:33): [True: 142, False: 164]
  ------------------
11976|    142|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11976:11): [True: 16, False: 126]
  |  Branch (11976:39): [True: 59, False: 67]
  ------------------
11977|    124|      return true;
11978|    124|    }
11979|    231|    p = after;
11980|    231|  }
11981|    163|  return false;
11982|    287|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13942|  11.9k|    ada::url_components& components, uint32_t new_difference) {
13943|  11.9k|  components.username_end += new_difference;
13944|  11.9k|  components.host_start += new_difference;
13945|  11.9k|  components.host_end += new_difference;
13946|  11.9k|  components.pathname_start += new_difference;
13947|  11.9k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13947:7): [True: 0, False: 11.9k]
  ------------------
13948|      0|    components.search_start += new_difference;
13949|      0|  }
13950|  11.9k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13950:7): [True: 0, False: 11.9k]
  ------------------
13951|      0|    components.hash_start += new_difference;
13952|      0|  }
13953|  11.9k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14312|    939|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14313|    939|  ada_log("url_aggregator::parse_path ", input);
14314|    939|  ADA_ASSERT_TRUE(validate());
14315|    939|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14316|    939|  std::string tmp_buffer;
14317|    939|  std::string_view internal_input;
14318|    939|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14318:7): [True: 0, False: 939]
  ------------------
14319|      0|    tmp_buffer = input;
14320|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14321|       |    // just directly build the string from user_input.
14322|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14323|      0|    internal_input = tmp_buffer;
14324|    939|  } else {
14325|    939|    internal_input = input;
14326|    939|  }
14327|       |
14328|       |  // If url is special, then:
14329|    939|  if (is_special()) {
  ------------------
  |  Branch (14329:7): [True: 939, False: 0]
  ------------------
14330|    939|    if (internal_input.empty()) {
  ------------------
  |  Branch (14330:9): [True: 149, False: 790]
  ------------------
14331|    149|      update_base_pathname("/");
14332|    790|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14332:16): [True: 790, False: 0]
  |  Branch (14332:46): [True: 0, False: 0]
  ------------------
14333|    790|      consume_prepared_path(internal_input.substr(1));
14334|    790|    } else {
14335|      0|      consume_prepared_path(internal_input);
14336|      0|    }
14337|    939|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14337:14): [True: 0, False: 0]
  ------------------
14338|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14338:9): [True: 0, False: 0]
  ------------------
14339|      0|      consume_prepared_path(internal_input.substr(1));
14340|      0|    } else {
14341|      0|      consume_prepared_path(internal_input);
14342|      0|    }
14343|      0|  } else {
14344|       |    // Non-special URLs with an empty host can have their paths erased
14345|       |    // Path-only URLs cannot have their paths erased
14346|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14346:9): [True: 0, False: 0]
  |  Branch (14346:57): [True: 0, False: 0]
  ------------------
14347|      0|      update_base_pathname("/");
14348|      0|    }
14349|      0|  }
14350|    939|  ADA_ASSERT_TRUE(validate());
14351|    939|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14445|  11.9k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14446|  11.9k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14447|  11.9k|          " bytes]");
14448|  11.9k|  ADA_ASSERT_TRUE(validate());
14449|  11.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14450|  11.9k|  if (input.empty()) {
  ------------------
  |  Branch (14450:7): [True: 2, False: 11.8k]
  ------------------
14451|      2|    return is_valid = false;
14452|      2|  }  // technically unnecessary.
14453|       |  // If input starts with U+005B ([), then:
14454|  11.8k|  if (input[0] == '[') {
  ------------------
  |  Branch (14454:7): [True: 7.23k, False: 4.66k]
  ------------------
14455|       |    // If input does not end with U+005D (]), validation error, return failure.
14456|  7.23k|    if (input.back() != ']') {
  ------------------
  |  Branch (14456:9): [True: 47, False: 7.19k]
  ------------------
14457|     47|      return is_valid = false;
14458|     47|    }
14459|  7.19k|    ada_log("parse_host ipv6");
14460|       |
14461|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14462|       |    // trailing U+005D (]) removed.
14463|  7.19k|    input.remove_prefix(1);
14464|  7.19k|    input.remove_suffix(1);
14465|  7.19k|    return parse_ipv6(input);
14466|  7.23k|  }
14467|       |
14468|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14469|       |  // input.
14470|  4.66k|  if (!is_special()) {
  ------------------
  |  Branch (14470:7): [True: 0, False: 4.66k]
  ------------------
14471|      0|    return parse_opaque_host(input);
14472|      0|  }
14473|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14474|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14475|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14476|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14477|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14478|       |
14479|       |  // Often, the input does not contain any forbidden code points, and no upper
14480|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14481|       |  // optimize for such a common case.
14482|       |
14483|       |  // Fast path: try to parse as pure decimal IPv4 first.
14484|  4.66k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14485|  4.66k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14485:7): [True: 316, False: 4.34k]
  ------------------
14486|    316|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14486:9): [True: 316, False: 0]
  |  Branch (14486:27): [True: 2, False: 314]
  ------------------
14487|      2|      update_base_hostname(input.substr(0, input.size() - 1));
14488|    314|    } else {
14489|    314|      update_base_hostname(input);
14490|    314|    }
14491|    316|    host_type = IPV4;
14492|    316|    is_valid = true;
14493|    316|    ada_log("parse_host fast path decimal ipv4");
14494|    316|    ADA_ASSERT_TRUE(validate());
14495|    316|    return true;
14496|    316|  }
14497|  4.34k|  uint8_t is_forbidden_or_upper =
14498|  4.34k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14499|  4.34k|                                                             input.size());
14500|  4.34k|  static constexpr std::string_view xn_dash{"xn-", 3};
14501|  4.34k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14501:7): [True: 1.52k, False: 2.82k]
  ------------------
14502|  1.52k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14502:9): [True: 347, False: 1.17k]
  ------------------
14503|    347|      std::string lowered(input);
14504|    347|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14505|    347|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14505:11): [True: 272, False: 75]
  ------------------
14506|    324|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14506:11): [True: 52, False: 23]
  ------------------
14507|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14508|       |        // This also avoids a double buffer rewrite for hex/octal IPv4.
14509|    324|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14509:13): [True: 170, False: 154]
  ------------------
14510|    170|          ada_log("parse_host fast path ipv4");
14511|    170|          return parse_ipv4(lowered, false);
14512|    170|        }
14513|    154|        update_base_hostname(lowered);
14514|    154|        ada_log("parse_host fast path ", get_hostname());
14515|    154|        is_valid = true;
14516|    154|        return true;
14517|    324|      }
14518|  1.17k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14518:16): [True: 1.08k, False: 93]
  ------------------
14519|  1.14k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14519:16): [True: 61, False: 32]
  ------------------
14520|       |      // Check IPv4 before mutating so failures leave the buffer untouched.
14521|  1.14k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14521:11): [True: 923, False: 220]
  ------------------
14522|    923|        ada_log("parse_host fast path ipv4");
14523|    923|        return parse_ipv4(input, false);
14524|    923|      }
14525|    220|      update_base_hostname(input);
14526|    220|      ada_log("parse_host fast path ", get_hostname());
14527|    220|      is_valid = true;
14528|    220|      return true;
14529|  1.14k|    }
14530|  2.82k|  } else if (const size_t first_percent = input.find('%');
14531|  2.82k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14531:14): [True: 305, False: 2.51k]
  ------------------
14532|    305|    std::string decoded = unicode::percent_decode(input, first_percent);
14533|    305|    const uint8_t decoded_flags =
14534|    305|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14535|    305|                                                               decoded.size());
14536|    305|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14536:9): [True: 193, False: 112]
  ------------------
14537|    193|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14537:11): [True: 73, False: 120]
  ------------------
14538|     73|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14539|     73|      }
14540|    193|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14540:11): [True: 163, False: 30]
  ------------------
14541|    181|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14541:11): [True: 18, False: 12]
  ------------------
14542|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14543|    181|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14543:13): [True: 92, False: 89]
  ------------------
14544|     92|          return parse_ipv4(decoded, false);
14545|     92|        }
14546|     89|        update_base_hostname(decoded);
14547|     89|        is_valid = true;
14548|     89|        return true;
14549|    181|      }
14550|    193|    }
14551|    305|  }
14552|       |  // We have encountered at least one forbidden code point or the input contains
14553|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14554|       |  // conversion.
14555|       |
14556|  2.69k|  ada_log("parse_host calling to_ascii");
14557|  2.69k|  std::optional<std::string> host = std::string(get_hostname());
14558|  2.69k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14559|  2.69k|  if (!is_valid) {
  ------------------
  |  Branch (14559:7): [True: 1.28k, False: 1.41k]
  ------------------
14560|  1.28k|    ada_log("parse_host to_ascii returns false");
14561|  1.28k|    return is_valid = false;
14562|  1.28k|  }
14563|  1.41k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14564|  1.41k|          " bytes]");
14565|       |
14566|  1.41k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14566:7): [True: 0, False: 1.41k]
  ------------------
14567|  1.41k|                          ada::unicode::is_forbidden_domain_code_point)) {
14568|      0|    return is_valid = false;
14569|      0|  }
14570|       |
14571|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14572|       |  // asciiDomain.
14573|  1.41k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14573:7): [True: 1.19k, False: 219]
  ------------------
14574|  1.19k|    ada_log("parse_host got ipv4 ", *host);
14575|  1.19k|    return parse_ipv4(host.value(), false);
14576|  1.19k|  }
14577|       |
14578|    219|  update_base_hostname(host.value());
14579|    219|  ADA_ASSERT_TRUE(validate());
14580|    219|  return true;
14581|  1.41k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15427|  1.88k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15428|  1.88k|  ada_log("url_aggregator::consume_prepared_path ", input);
15429|       |  /***
15430|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15431|       |   * unfortunate. This particular function is nearly identical, except that it
15432|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15433|       |   * very common) merely appends to the buffer. This is the same trivial path as
15434|       |   * with helpers::parse_prepared_path, except that we have the additional check
15435|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15436|       |   * modify it, and then insert it back into the buffer.
15437|       |   */
15438|  1.88k|  uint8_t accumulator = checkers::path_signature(input);
15439|       |  // Let us first detect a trivial case.
15440|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15441|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15442|       |  // no dot, and no character needing percent encoding.
15443|  1.88k|  constexpr uint8_t need_encoding = 1;
15444|  1.88k|  constexpr uint8_t backslash_char = 2;
15445|  1.88k|  constexpr uint8_t dot_char = 4;
15446|  1.88k|  constexpr uint8_t percent_char = 8;
15447|  1.88k|  bool special = type != ada::scheme::NOT_SPECIAL;
15448|  1.88k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15448:39): [True: 0, False: 1.88k]
  ------------------
15449|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15449:39): [True: 0, False: 0]
  ------------------
15450|  1.88k|  bool trivial_path =
15451|  1.88k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15451:7): [True: 722, False: 1.16k]
  |  Branch (15451:8): [True: 1.88k, False: 0]
  ------------------
15452|  1.88k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15453|      0|                  0)) &&
15454|    722|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15454:7): [True: 722, False: 0]
  ------------------
15455|  1.88k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15455:7): [True: 512, False: 1.37k]
  |  Branch (15455:34): [True: 512, False: 0]
  ------------------
15456|       |    // '4' means that we have at least one dot, but nothing that requires
15457|       |    // percent encoding or decoding. The only part that is not trivial is
15458|       |    // that we may have single dots and double dots path segments.
15459|       |    // If we have such segments, then we either have a path that begins
15460|       |    // with '.' (easy to check), or we have the sequence './'.
15461|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15462|       |    // Note: we know that '\' is not present.
15463|    512|    if (input[0] != '.') {
  ------------------
  |  Branch (15463:9): [True: 211, False: 301]
  ------------------
15464|    211|      size_t slashdot = 0;
15465|    211|      bool dot_is_file = true;
15466|    834|      for (;;) {
15467|    834|        slashdot = input.find("/.", slashdot);
15468|    834|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15468:13): [True: 211, False: 623]
  ------------------
15469|    211|          break;
15470|    623|        } else {  // uncommon
15471|       |          // only three cases matter: /./, /.. or a final /
15472|    623|          slashdot += 2;
15473|    623|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15473:28): [True: 8, False: 615]
  |  Branch (15473:56): [True: 341, False: 274]
  ------------------
15474|    274|                           input[slashdot] == '/');
  ------------------
  |  Branch (15474:28): [True: 156, False: 118]
  ------------------
15475|    623|        }
15476|    834|      }
15477|    211|      trivial_path = dot_is_file;
15478|    211|    }
15479|    512|  }
15480|  1.88k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15480:7): [True: 759, False: 1.13k]
  |  Branch (15480:23): [True: 759, False: 0]
  ------------------
15481|    759|    ada_log("parse_path trivial");
15482|    759|    buffer += '/';
15483|    759|    buffer += input;
15484|    759|    return;
15485|    759|  }
15486|  1.13k|  std::string path = std::string(get_pathname());
15487|       |  // We are going to need to look a bit at the path, but let us see if we can
15488|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15489|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15490|       |  // there.
15491|  1.13k|  bool fast_path =
15492|  1.13k|      (special &&
  ------------------
  |  Branch (15492:8): [True: 1.13k, False: 0]
  ------------------
15493|  1.13k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15493:8): [True: 475, False: 655]
  ------------------
15494|    475|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15494:7): [True: 475, False: 0]
  ------------------
15495|  1.13k|  if (fast_path) {
  ------------------
  |  Branch (15495:7): [True: 475, False: 655]
  ------------------
15496|    475|    ada_log("parse_prepared_path fast");
15497|       |    // Here we don't need to worry about \ or percent encoding.
15498|       |    // We also do not have a file protocol. We might have dots, however,
15499|       |    // but dots must as appear as '.', and they cannot be encoded because
15500|       |    // the symbol '%' is not present.
15501|    475|    size_t previous_location = 0;  // We start at 0.
15502|  2.77k|    do {
15503|  2.77k|      size_t new_location = input.find('/', previous_location);
15504|       |      // std::string_view path_view = input;
15505|       |      //  We process the last segment separately:
15506|  2.77k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15506:11): [True: 475, False: 2.30k]
  ------------------
15507|    475|        std::string_view path_view = input.substr(previous_location);
15508|    475|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15508:13): [True: 21, False: 454]
  ------------------
15509|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15510|     21|          if (path.empty()) {
  ------------------
  |  Branch (15510:15): [True: 3, False: 18]
  ------------------
15511|      3|            path = '/';
15512|      3|            update_base_pathname(path);
15513|      3|            return;
15514|      3|          }
15515|       |          // Fast case where we have nothing to do:
15516|     18|          if (path.back() == '/') {
  ------------------
  |  Branch (15516:15): [True: 4, False: 14]
  ------------------
15517|      4|            update_base_pathname(path);
15518|      4|            return;
15519|      4|          }
15520|       |          // If you have the path "/joe/myfriend",
15521|       |          // then you delete 'myfriend'.
15522|     14|          path.resize(path.rfind('/') + 1);
15523|     14|          update_base_pathname(path);
15524|     14|          return;
15525|     18|        }
15526|    454|        path += '/';
15527|    454|        if (path_view != ".") {
  ------------------
  |  Branch (15527:13): [True: 442, False: 12]
  ------------------
15528|    442|          path.append(path_view);
15529|    442|        }
15530|    454|        update_base_pathname(path);
15531|    454|        return;
15532|  2.30k|      } else {
15533|       |        // This is a non-final segment.
15534|  2.30k|        std::string_view path_view =
15535|  2.30k|            input.substr(previous_location, new_location - previous_location);
15536|  2.30k|        previous_location = new_location + 1;
15537|  2.30k|        if (path_view == "..") {
  ------------------
  |  Branch (15537:13): [True: 390, False: 1.91k]
  ------------------
15538|    390|          size_t last_delimiter = path.rfind('/');
15539|    390|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15539:15): [True: 203, False: 187]
  ------------------
15540|    203|            path.erase(last_delimiter);
15541|    203|          }
15542|  1.91k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15542:20): [True: 1.63k, False: 279]
  ------------------
15543|  1.63k|          path += '/';
15544|  1.63k|          path.append(path_view);
15545|  1.63k|        }
15546|  2.30k|      }
15547|  2.77k|    } while (true);
  ------------------
  |  Branch (15547:14): [True: 2.30k, Folded]
  ------------------
15548|    655|  } else {
15549|    655|    ada_log("parse_path slow");
15550|       |    // we have reached the general case
15551|    655|    bool needs_percent_encoding = (accumulator & 1);
15552|  4.10k|    do {
15553|  4.10k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15553:26): [True: 4.10k, False: 0]
  |  Branch (15553:37): [True: 121, False: 3.98k]
  ------------------
15554|  4.10k|                            ? input.find_first_of("/\\")
15555|  4.10k|                            : input.find('/');
15556|  4.10k|      std::string_view path_view = input;
15557|  4.10k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15557:11): [True: 3.44k, False: 655]
  ------------------
15558|  3.44k|        path_view.remove_suffix(path_view.size() - location);
15559|  3.44k|        input.remove_prefix(location + 1);
15560|  3.44k|      }
15561|       |      // Path encoding preserves dots and percent signs, so normalize first.
15562|  4.10k|      if (unicode::is_double_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15562:11): [True: 391, False: 3.71k]
  ------------------
15563|    391|        helpers::shorten_path(path, type);
15564|    391|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15564:13): [True: 14, False: 377]
  ------------------
15565|     14|          path += '/';
15566|     14|        }
15567|  3.71k|      } else if (unicode::is_single_dot_path_segment(path_view) &&
  ------------------
  |  Branch (15567:18): [True: 255, False: 3.45k]
  ------------------
15568|    255|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15568:18): [True: 8, False: 247]
  ------------------
15569|      8|        path += '/';
15570|      8|      }
15571|       |      // Otherwise, if path_view is not a single-dot path segment, then:
15572|  3.70k|      else if (!unicode::is_single_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15572:16): [True: 3.45k, False: 247]
  ------------------
15573|       |        // If url's scheme is "file", url's path is empty, and path_view is a
15574|       |        // Windows drive letter, then replace the second code point in
15575|       |        // path_view with U+003A (:).
15576|  3.45k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15576:13): [True: 0, False: 3.45k]
  |  Branch (15576:48): [True: 0, False: 0]
  ------------------
15577|      0|            path_view.size() == 2 &&
  ------------------
  |  Branch (15577:13): [True: 0, False: 0]
  ------------------
15578|      0|            checkers::is_windows_drive_letter(path_view)) {
  ------------------
  |  Branch (15578:13): [True: 0, False: 0]
  ------------------
15579|      0|          path += '/';
15580|      0|          path += path_view[0];
15581|      0|          path += ':';
15582|      0|          path_view.remove_prefix(2);
15583|      0|          path.append(path_view);
15584|  3.45k|        } else {
15585|       |          // Append encoded bytes directly to the pathname.
15586|  3.45k|          path += '/';
15587|  3.45k|          if (!needs_percent_encoding ||
  ------------------
  |  Branch (15587:15): [True: 479, False: 2.97k]
  ------------------
15588|  2.97k|              !ada::unicode::percent_encode<true>(
  ------------------
  |  Branch (15588:15): [True: 2.05k, False: 919]
  ------------------
15589|  2.97k|                  path_view, character_sets::PATH_PERCENT_ENCODE, path)) {
15590|  2.53k|            path.append(path_view);
15591|  2.53k|          }
15592|  3.45k|        }
15593|  3.45k|      }
15594|  4.10k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15594:11): [True: 655, False: 3.44k]
  ------------------
15595|    655|        update_base_pathname(path);
15596|    655|        return;
15597|    655|      }
15598|  4.10k|    } while (true);
  ------------------
  |  Branch (15598:14): [True: 3.44k, Folded]
  ------------------
15599|    655|  }
15600|  1.13k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   14|  9.22k|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|  9.22k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (16:7): [True: 800, False: 8.42k]
  ------------------
   17|    800|    return false;
   18|    800|  }
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|  8.42k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 123, False: 8.29k]
  ------------------
   21|    123|    view.remove_suffix(1);
   22|    123|  }
   23|       |  // From the last character, find the last dot.
   24|  8.42k|  size_t last_dot = view.rfind('.');
   25|  8.42k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (25:7): [True: 7.49k, False: 927]
  ------------------
   26|       |    // We have at least one dot.
   27|  7.49k|    view.remove_prefix(last_dot + 1);
   28|  7.49k|  }
   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.42k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (32:7): [True: 7.84k, False: 573]
  ------------------
   33|  7.84k|    return true;
   34|  7.84k|  }
   35|       |  // It could be hex (0x), but not if there is a single character.
   36|    573|  if (view.size() == 1) {
  ------------------
  |  Branch (36:7): [True: 0, False: 573]
  ------------------
   37|      0|    return false;
   38|      0|  }
   39|       |  // It must start with 0x.
   40|    573|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (40:7): [True: 76, False: 497]
  ------------------
   41|     76|    return false;
   42|     76|  }
   43|       |  // We must allow "0x".
   44|    497|  if (view.size() == 2) {
  ------------------
  |  Branch (44:7): [True: 35, False: 462]
  ------------------
   45|     35|    return true;
   46|     35|  }
   47|       |  // We have 0x followed by some characters, we need to check that they are
   48|       |  // hexadecimals.
   49|    462|  view.remove_prefix(2);
   50|    462|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   51|    497|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7436|  5.40k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7437|  5.40k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7437:11): [True: 5.40k, False: 0]
  |  Branch (7437:23): [True: 2.50k, False: 2.89k]
  |  Branch (7437:37): [True: 2.89k, False: 4]
  |  Branch (7437:49): [True: 2.87k, False: 20]
  ------------------
 7438|  5.40k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   77|  8.94k|    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.94k|  size_t i = 0;
   84|  8.94k|  uint8_t accumulator{};
   85|  25.8k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (85:10): [True: 16.8k, False: 8.94k]
  ------------------
   86|  16.8k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   87|  16.8k|                           path_signature_table[uint8_t(input[i + 1])] |
   88|  16.8k|                           path_signature_table[uint8_t(input[i + 2])] |
   89|  16.8k|                           path_signature_table[uint8_t(input[i + 3])] |
   90|  16.8k|                           path_signature_table[uint8_t(input[i + 4])] |
   91|  16.8k|                           path_signature_table[uint8_t(input[i + 5])] |
   92|  16.8k|                           path_signature_table[uint8_t(input[i + 6])] |
   93|  16.8k|                           path_signature_table[uint8_t(input[i + 7])]);
   94|  16.8k|  }
   95|  35.9k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (95:10): [True: 26.9k, False: 8.94k]
  ------------------
   96|  26.9k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   97|  26.9k|  }
   98|  8.94k|  return accumulator;
   99|  8.94k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7317|  11.7k|                                              size_t length) noexcept {
 7318|  11.7k|  size_t i = 0;
 7319|  11.7k|  uint8_t accumulator{};
 7320|  60.1k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7320:10): [True: 48.4k, False: 11.7k]
  ------------------
 7321|  48.4k|    accumulator |=
 7322|  48.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7323|  48.4k|    accumulator |=
 7324|  48.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7325|  48.4k|    accumulator |=
 7326|  48.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7327|  48.4k|    accumulator |=
 7328|  48.4k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7329|  48.4k|  }
 7330|  27.5k|  for (; i < length; i++) {
  ------------------
  |  Branch (7330:10): [True: 15.8k, False: 11.7k]
  ------------------
 7331|  15.8k|    accumulator |=
 7332|  15.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7333|  15.8k|  }
 7334|  11.7k|  return accumulator;
 7335|  11.7k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13960|  11.9k|    const std::string_view input_with_colon) {
13961|  11.9k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13962|  11.9k|  ADA_ASSERT_TRUE(validate());
13963|  11.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13964|  11.9k|  std::string_view input{input_with_colon};
13965|  11.9k|  input.remove_suffix(1);
13966|  11.9k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13967|  11.9k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13968|       |  /**
13969|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13970|       |   *http, https), in which case, we can go really fast.
13971|       |   **/
13972|  11.9k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13972:7): [True: 11.9k, False: 0]
  ------------------
13973|       |    if constexpr (has_state_override) {
13974|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13975|       |      // then return.
13976|       |      if (is_special() != is_input_special) {
13977|       |        return false;
13978|       |      }
13979|       |
13980|       |      // If url includes credentials or has a non-null port, and buffer is
13981|       |      // "file", then return.
13982|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13983|       |          parsed_type == ada::scheme::type::FILE) {
13984|       |        return false;
13985|       |      }
13986|       |
13987|       |      // If url's scheme is "file" and its host is an empty host, then return.
13988|       |      // An empty host is the empty string.
13989|       |      if (type == ada::scheme::type::FILE &&
13990|       |          components.host_start == components.host_end) {
13991|       |        return false;
13992|       |      }
13993|       |    }
13994|       |
13995|  11.9k|    type = parsed_type;
13996|  11.9k|    set_scheme_from_view_with_colon(input_with_colon);
13997|       |
13998|       |    if constexpr (has_state_override) {
13999|       |      // This is uncommon.
14000|       |      uint16_t urls_scheme_port = get_special_port();
14001|       |
14002|       |      if (urls_scheme_port) {
14003|       |        // If url's port is url's scheme's default port, then set url's port to
14004|       |        // null.
14005|       |        if (components.port == urls_scheme_port) {
14006|       |          clear_port();
14007|       |        }
14008|       |      }
14009|       |    }
14010|  11.9k|  } else {  // slow path
14011|      0|    std::string _buffer(input);
14012|       |    // Next function is only valid if the input is ASCII and returns false
14013|       |    // otherwise, but it seems that we always have ascii content so we do not
14014|       |    // need to check the return value.
14015|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
14016|       |
14017|       |    if constexpr (has_state_override) {
14018|       |      // The state-override validation errors below ("return" in the WHATWG URL
14019|       |      // parser) leave the URL unchanged. The setter contract is
14020|       |      // "true on success, false if the scheme is invalid" -- the fast path
14021|       |      // above already returns false here, so the slow path must agree.
14022|       |
14023|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
14024|       |      // then return. If url's scheme is not a special scheme and buffer is a
14025|       |      // special scheme, then return.
14026|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
14027|       |        return false;
14028|       |      }
14029|       |
14030|       |      // If url includes credentials or has a non-null port, and buffer is
14031|       |      // "file", then return.
14032|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14033|       |          _buffer == "file") {
14034|       |        return false;
14035|       |      }
14036|       |
14037|       |      // If url's scheme is "file" and its host is an empty host, then return.
14038|       |      // An empty host is the empty string.
14039|       |      if (type == ada::scheme::type::FILE &&
14040|       |          components.host_start == components.host_end) {
14041|       |        return false;
14042|       |      }
14043|       |    }
14044|       |
14045|      0|    set_scheme(_buffer);
14046|       |
14047|       |    if constexpr (has_state_override) {
14048|       |      // This is uncommon.
14049|       |      uint16_t urls_scheme_port = get_special_port();
14050|       |
14051|       |      if (urls_scheme_port) {
14052|       |        // If url's port is url's scheme's default port, then set url's port to
14053|       |        // null.
14054|       |        if (components.port == urls_scheme_port) {
14055|       |          clear_port();
14056|       |        }
14057|       |      }
14058|       |    }
14059|      0|  }
14060|  11.9k|  ADA_ASSERT_TRUE(validate());
14061|  11.9k|  return true;
14062|  11.9k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14086|  11.9k|    std::string_view new_scheme_with_colon) {
14087|  11.9k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
14088|  11.9k|          new_scheme_with_colon);
14089|  11.9k|  ADA_ASSERT_TRUE(validate());
14090|  11.9k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
14091|  11.9k|                  new_scheme_with_colon.back() == ':');
14092|       |  // next line could overflow but unsigned arithmetic has well-defined
14093|       |  // overflows.
14094|  11.9k|  uint32_t new_difference =
14095|  11.9k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
14096|       |
14097|  11.9k|  if (buffer.empty()) {
  ------------------
  |  Branch (14097:7): [True: 11.9k, False: 0]
  ------------------
14098|  11.9k|    buffer.append(new_scheme_with_colon);
14099|  11.9k|  } else {
14100|      0|    buffer.erase(0, components.protocol_end);
14101|      0|    buffer.insert(0, new_scheme_with_colon);
14102|      0|  }
14103|  11.9k|  components.protocol_end += new_difference;
14104|       |
14105|  11.9k|  apply_shifted_non_scheme_offsets(components, new_difference);
14106|  11.9k|  ADA_ASSERT_TRUE(validate());
14107|  11.9k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5869|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1086|   256k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1087|   256k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1088|   256k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2216|  21.4k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2230|  10.7k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 1712|  15.8k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3702|  10.7k|      : impl_base(unexpect, std::move(e.value())),
 3703|  10.7k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2688|  10.7k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3306|  13.3k|  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_:
 3788|  2.57k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3661|  2.57k|      : impl_base(in_place, std::forward<Args>(args)...),
 3662|  2.57k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2676|  2.57k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7922|  2.57k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7925|  15.8k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6923|  11.9k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6924|  11.9k|  if (scheme.empty()) {
  ------------------
  |  Branch (6924:7): [True: 0, False: 11.9k]
  ------------------
 6925|      0|    return ada::scheme::NOT_SPECIAL;
 6926|      0|  }
 6927|  11.9k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6928|  11.9k|  const std::string_view target = details::is_special_list[hash_value];
 6929|  11.9k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6929:7): [True: 11.9k, False: 0]
  ------------------
 6930|  11.9k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6930:7): [True: 11.9k, False: 0]
  ------------------
 6931|  11.9k|          details::scheme_keys[hash_value]) {
 6932|  11.9k|    return ada::scheme::type(hash_value);
 6933|  11.9k|  } else {
 6934|      0|    return ada::scheme::NOT_SPECIAL;
 6935|      0|  }
 6936|  11.9k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6864|  11.9k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6865|  11.9k|  uint64_t input = (uint8_t)p[0];
 6866|  11.9k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6867|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6868|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6869|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6870|  11.9k|  return input;
 6871|  11.9k|}
_ZN3ada14url_aggregatorC2Ev:
 7920|  13.3k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 5017|  13.3k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1460|  14.1k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1461|  14.1k|  const size_t len = input.size();
 1462|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1463|  14.1k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1463:7): [True: 9.53k, False: 4.63k]
  |  Branch (1463:18): [True: 1.86k, False: 2.77k]
  ------------------
 1464|  11.3k|    return ipv4_fast_fail;
 1465|  11.3k|  }
 1466|  2.77k|  const char* data = input.data();
 1467|       |
 1468|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1469|       |  return detail::try_parse_ipv4_avx512(data, len);
 1470|       |#else
 1471|  2.77k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1472|  14.1k|#endif
 1473|  14.1k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1301|  2.77k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1302|  2.77k|  uint32_t ipv4 = 0;
 1303|  5.08k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1303:19): [True: 4.55k, False: 533]
  ------------------
 1304|  4.55k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1304:9): [True: 4, False: 4.55k]
  ------------------
 1305|      4|      return ipv4_fast_fail;
 1306|      4|    }
 1307|  4.55k|    uint32_t val;
 1308|  4.55k|    char c = *p;
 1309|  4.55k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1309:9): [True: 3.91k, False: 641]
  |  Branch (1309:21): [True: 2.81k, False: 1.10k]
  ------------------
 1310|  2.81k|      val = static_cast<uint32_t>(c - '0');
 1311|  2.81k|      ++p;
 1312|  2.81k|    } else {
 1313|  1.74k|      return ipv4_fast_fail;
 1314|  1.74k|    }
 1315|  2.81k|    if (p < pend) {
  ------------------
  |  Branch (1315:9): [True: 2.57k, False: 235]
  ------------------
 1316|  2.57k|      c = *p;
 1317|  2.57k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1317:11): [True: 1.51k, False: 1.05k]
  |  Branch (1317:23): [True: 1.34k, False: 172]
  ------------------
 1318|  1.34k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1318:13): [True: 98, False: 1.24k]
  ------------------
 1319|     98|          return ipv4_fast_fail;
 1320|     98|        }
 1321|  1.24k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1322|  1.24k|        ++p;
 1323|  1.24k|        if (p < pend) {
  ------------------
  |  Branch (1323:13): [True: 1.10k, False: 147]
  ------------------
 1324|  1.10k|          c = *p;
 1325|  1.10k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1325:15): [True: 747, False: 354]
  |  Branch (1325:27): [True: 735, False: 12]
  ------------------
 1326|    735|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1327|    735|            ++p;
 1328|    735|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1328:17): [True: 133, False: 602]
  ------------------
 1329|    133|              return ipv4_fast_fail;
 1330|    133|            }
 1331|    735|          }
 1332|  1.10k|        }
 1333|  1.24k|      }
 1334|  2.57k|    }
 1335|  2.57k|    ipv4 = (ipv4 << 8) | val;
 1336|  2.57k|    if (i < 3) {
  ------------------
  |  Branch (1336:9): [True: 2.04k, False: 533]
  ------------------
 1337|  2.04k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1337:11): [True: 41, False: 2.00k]
  |  Branch (1337:24): [True: 222, False: 1.78k]
  ------------------
 1338|    263|        return ipv4_fast_fail;
 1339|    263|      }
 1340|  1.78k|      ++p;
 1341|  1.78k|    }
 1342|  2.57k|  }
 1343|    533|  if (p != pend) {
  ------------------
  |  Branch (1343:7): [True: 54, False: 479]
  ------------------
 1344|     54|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1344:9): [True: 22, False: 32]
  |  Branch (1344:26): [True: 4, False: 18]
  ------------------
 1345|      4|      return ipv4;
 1346|      4|    }
 1347|     50|    return ipv4_fast_fail;
 1348|     54|  }
 1349|    479|  return ipv4;
 1350|    533|}
_ZNK3ada8url_base10is_specialEv:
 7411|  45.1k|    const noexcept {
 7412|  45.1k|  return type != ada::scheme::NOT_SPECIAL;
 7413|  45.1k|}
_ZN3ada8checkers8is_alphaEc:
 1281|  18.0k|constexpr bool is_alpha(char x) noexcept {
 1282|  18.0k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1282:10): [True: 14.6k, False: 3.47k]
  |  Branch (1282:34): [True: 14.3k, False: 237]
  ------------------
 1283|  18.0k|}
_ZN3ada8checkers8to_lowerEc:
 1279|  32.7k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1254|  11.1k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1255|  11.1k|  if (view.empty()) {
  ------------------
  |  Branch (1255:7): [True: 0, False: 11.1k]
  ------------------
 1256|      0|    return false;
 1257|      0|  }
 1258|  11.1k|  const char* start = view.data();
 1259|  11.1k|  const char* end = start + view.size();
 1260|  11.1k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1260:7): [True: 415, False: 10.7k]
  ------------------
 1261|    415|    --end;
 1262|    415|    if (end == start) {
  ------------------
  |  Branch (1262:9): [True: 247, False: 168]
  ------------------
 1263|    247|      return false;
 1264|    247|    }
 1265|    415|  }
 1266|  10.8k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1266:7): [True: 1.41k, False: 9.47k]
  ------------------
 1267|  1.41k|    return false;
 1268|  1.41k|  }
 1269|  9.47k|  const char* label = end;
 1270|  34.1k|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1270:10): [True: 32.6k, False: 1.44k]
  |  Branch (1270:28): [True: 24.6k, False: 8.03k]
  ------------------
 1271|  24.6k|    --label;
 1272|  24.6k|  }
 1273|  9.47k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1273:7): [True: 8.03k, False: 1.44k]
  |  Branch (1273:25): [True: 287, False: 7.74k]
  ------------------
 1274|    287|    return false;
 1275|    287|  }
 1276|  9.18k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1276:10): [True: 9.18k, False: 0]
  |  Branch (1276:26): [True: 8.66k, False: 526]
  ------------------
 1277|  9.47k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1248|  43.5k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1249|  43.5k|  const unsigned char c = static_cast<unsigned char>(x);
 1250|  43.5k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1250:11): [True: 35.4k, False: 8.14k]
  |  Branch (1250:23): [True: 25.3k, False: 10.0k]
  |  Branch (1250:37): [True: 9.43k, False: 8.77k]
  |  Branch (1250:49): [True: 5.86k, False: 3.57k]
  ------------------
 1251|  12.3k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1251:11): [True: 4.10k, False: 8.24k]
  |  Branch (1251:23): [True: 264, False: 3.83k]
  |  Branch (1251:36): [True: 2.42k, False: 9.65k]
  |  Branch (1251:48): [True: 209, False: 9.44k]
  ------------------
 1252|  43.5k|}
_ZN3ada8checkers8is_digitEc:
 1246|  23.1k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6920|    586|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6921|    586|  return details::special_ports[int(type)];
 6922|    586|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8653|  1.36k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8654|  1.36k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8655|  1.36k|          " bytes] \n", to_diagram());
 8656|  1.36k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8657|  1.36k|  ADA_ASSERT_TRUE(validate());
 8658|       |
 8659|  1.36k|  const bool begins_with_dashdash = input.starts_with("//");
 8660|  1.36k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8660:7): [True: 1.15k, False: 211]
  |  Branch (8660:32): [True: 0, False: 1.15k]
  ------------------
 8661|       |    // We must delete the ./
 8662|      0|    delete_dash_dot();
 8663|      0|  }
 8664|       |
 8665|  1.36k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8665:7): [True: 211, False: 1.15k]
  |  Branch (8665:31): [True: 211, False: 0]
  |  Branch (8665:51): [True: 0, False: 211]
  ------------------
 8666|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (8666:7): [True: 0, False: 0]
  ------------------
 8667|       |    // If url's host is null, url does not have an opaque path, url's path's
 8668|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8669|       |    // output.
 8670|      0|    buffer.insert(components.pathname_start, "/.");
 8671|      0|    components.pathname_start += 2;
 8672|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8672:9): [True: 0, False: 0]
  ------------------
 8673|      0|      components.search_start += 2;
 8674|      0|    }
 8675|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8675:9): [True: 0, False: 0]
  ------------------
 8676|      0|      components.hash_start += 2;
 8677|      0|    }
 8678|      0|  }
 8679|       |
 8680|  1.36k|  uint32_t difference = replace_and_resize(
 8681|  1.36k|      components.pathname_start,
 8682|  1.36k|      components.pathname_start + get_pathname_length(), input);
 8683|  1.36k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8683:7): [True: 0, False: 1.36k]
  ------------------
 8684|      0|    components.search_start += difference;
 8685|      0|  }
 8686|  1.36k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8686:7): [True: 0, False: 1.36k]
  ------------------
 8687|      0|    components.hash_start += difference;
 8688|      0|  }
 8689|  1.36k|  ADA_ASSERT_TRUE(validate());
 8690|  1.36k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8495|  3.03k|    uint32_t start, uint32_t end, std::string_view input) {
 8496|  3.03k|  uint32_t current_length = end - start;
 8497|  3.03k|  uint32_t input_size = uint32_t(input.size());
 8498|  3.03k|  uint32_t new_difference = input_size - current_length;
 8499|       |
 8500|  3.03k|  if (current_length == 0) {
  ------------------
  |  Branch (8500:7): [True: 2.94k, False: 92]
  ------------------
 8501|  2.94k|    buffer.insert(start, input);
 8502|  2.94k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8502:14): [True: 7, False: 85]
  ------------------
 8503|      7|    if (input_size != 0) {
  ------------------
  |  Branch (8503:9): [True: 7, False: 0]
  ------------------
 8504|      7|      std::memmove(buffer.data() + start, input.data(), input_size);
 8505|      7|    }
 8506|     85|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8506:14): [True: 0, False: 85]
  ------------------
 8507|      0|    buffer.erase(start, current_length - input_size);
 8508|      0|    buffer.replace(start, input_size, input);
 8509|     85|  } else {
 8510|     85|    buffer.replace(start, current_length, input.substr(0, current_length));
 8511|     85|    buffer.insert(start + current_length, input.substr(current_length));
 8512|     85|  }
 8513|       |
 8514|  3.03k|  return new_difference;
 8515|  3.03k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8546|  1.36k|url_aggregator::get_pathname_length() const noexcept {
 8547|  1.36k|  ada_log("url_aggregator::get_pathname_length");
 8548|  1.36k|  uint32_t ending_index = uint32_t(buffer.size());
 8549|  1.36k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8549:7): [True: 0, False: 1.36k]
  ------------------
 8550|      0|    ending_index = components.search_start;
 8551|  1.36k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8551:14): [True: 0, False: 1.36k]
  ------------------
 8552|      0|    ending_index = components.hash_start;
 8553|      0|  }
 8554|  1.36k|  return ending_index - components.pathname_start;
 8555|  1.36k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9488|  1.13k|    ada_lifetime_bound {
 9489|  1.13k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9490|  1.13k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9491|  1.13k|          " components.search_start = ", components.search_start,
 9492|  1.13k|          " components.hash_start = ", components.hash_start);
 9493|  1.13k|  auto ending_index = uint32_t(buffer.size());
 9494|  1.13k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9494:7): [True: 0, False: 1.13k]
  ------------------
 9495|      0|    ending_index = components.search_start;
 9496|  1.13k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9496:14): [True: 0, False: 1.13k]
  ------------------
 9497|      0|    ending_index = components.hash_start;
 9498|      0|  }
 9499|  1.13k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9500|  1.13k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8471|    274|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8472|    274|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8473|    274|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8474|    274|          " bytes] components.hash_start = ", components.hash_start);
 8475|    274|  ADA_ASSERT_TRUE(validate());
 8476|    274|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8477|    274|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8477:7): [True: 0, False: 274]
  ------------------
 8478|      0|    buffer.resize(components.hash_start);
 8479|      0|  }
 8480|    274|  components.hash_start = uint32_t(buffer.size());
 8481|    274|  buffer += "#";
 8482|    274|  bool encoding_required = unicode::percent_encode<true>(
 8483|    274|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8484|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8485|       |  // encoding was not deemed required.
 8486|    274|  if (!encoding_required) {
  ------------------
  |  Branch (8486:7): [True: 177, False: 97]
  ------------------
 8487|    177|    buffer.append(input);
 8488|    177|  }
 8489|    274|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8490|    274|          buffer, "' [", buffer.size(), " bytes]");
 8491|    274|  ADA_ASSERT_TRUE(validate());
 8492|    274|}
_ZNK3ada8url_base19scheme_default_portEv:
 7420|     76|url_base::scheme_default_port() const noexcept {
 7421|     76|  return scheme::get_special_port(type);
 7422|     76|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1285|  7.05k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1286|  7.05k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1286:10): [True: 6.08k, False: 965]
  ------------------
 1287|  6.08k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1287:11): [True: 2.44k, False: 3.64k]
  |  Branch (1287:34): [True: 444, False: 1.99k]
  |  Branch (1287:55): [True: 2, False: 1.99k]
  ------------------
 1288|    446|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1288:11): [True: 3, False: 443]
  |  Branch (1288:35): [True: 212, False: 231]
  |  Branch (1288:54): [True: 1, False: 230]
  ------------------
 1289|    230|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1289:35): [True: 45, False: 185]
  |  Branch (1289:54): [True: 28, False: 157]
  ------------------
 1290|  7.05k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1293|  7.05k|    std::string_view input) noexcept {
 1294|  7.05k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1294:10): [True: 97, False: 6.95k]
  |  Branch (1294:32): [True: 25, False: 72]
  |  Branch (1294:54): [True: 2, False: 23]
  ------------------
 1295|  7.05k|}
_ZN3ada7helpers14leading_zeroesEj:
 2001|  12.0k|inline int leading_zeroes(uint32_t input_num) noexcept {
 2002|       |#if ADA_REGULAR_VISUAL_STUDIO
 2003|       |  unsigned long leading_zero(0);
 2004|       |  unsigned long in(input_num);
 2005|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 2006|       |#else
 2007|  12.0k|  return __builtin_clz(input_num);
 2008|  12.0k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 2009|  12.0k|}
_ZN3ada14url_aggregator7reserveEj:
 9161|  11.9k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9162|  11.9k|  buffer.reserve(capacity);
 9163|  11.9k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8879|  1.07k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8880|  1.07k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8881|  1.07k|          "\n", to_diagram());
 8882|  1.07k|  ADA_ASSERT_TRUE(validate());
 8883|  1.07k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8884|       |#if ADA_DEVELOPMENT_CHECKS
 8885|       |  // computing the expected password.
 8886|       |  std::string password_expected = std::string(get_password());
 8887|       |  password_expected.append(input);
 8888|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8889|  1.07k|  add_authority_slashes_if_needed();
 8890|       |
 8891|       |  // If input is empty, do nothing.
 8892|  1.07k|  if (input.empty()) {
  ------------------
  |  Branch (8892:7): [True: 495, False: 576]
  ------------------
 8893|    495|    return;
 8894|    495|  }
 8895|       |
 8896|    576|  uint32_t difference = uint32_t(input.size());
 8897|    576|  if (has_password()) {
  ------------------
  |  Branch (8897:7): [True: 512, False: 64]
  ------------------
 8898|    512|    buffer.insert(components.host_start, input);
 8899|    512|  } else {
 8900|     64|    difference++;  // Increment for ":"
 8901|     64|    buffer.insert(components.username_end, ":");
 8902|     64|    buffer.insert(components.username_end + 1, input);
 8903|     64|  }
 8904|    576|  components.host_start += difference;
 8905|       |
 8906|       |  // The following line is required to add "@" to hostname. When updating
 8907|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8908|       |  // responsibility to set it.
 8909|    576|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8909:7): [True: 38, False: 538]
  ------------------
 8910|     38|    buffer.insert(components.host_start, "@");
 8911|     38|    difference++;
 8912|     38|  }
 8913|       |
 8914|    576|  components.host_end += difference;
 8915|    576|  components.pathname_start += difference;
 8916|    576|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8916:7): [True: 0, False: 576]
  ------------------
 8917|      0|    components.search_start += difference;
 8918|      0|  }
 8919|    576|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8919:7): [True: 0, False: 576]
  ------------------
 8920|      0|    components.hash_start += difference;
 8921|      0|  }
 8922|       |#if ADA_DEVELOPMENT_CHECKS
 8923|       |  std::string password_after(get_password());
 8924|       |  ADA_ASSERT_EQUAL(
 8925|       |      password_expected, password_after,
 8926|       |      "append_base_password problem after inserting " + std::string(input));
 8927|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8928|    576|  ADA_ASSERT_TRUE(validate());
 8929|    576|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9135|  4.36k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9136|  4.36k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9137|  4.36k|  ADA_ASSERT_TRUE(validate());
 9138|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9139|       |  // to insert
 9140|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9141|  4.36k|  if (has_authority()) {
  ------------------
  |  Branch (9141:7): [True: 2.57k, False: 1.79k]
  ------------------
 9142|  2.57k|    return;
 9143|  2.57k|  }
 9144|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9145|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9146|       |  // the insert could be fused with another insert.
 9147|  1.79k|  buffer.insert(components.protocol_end, "//");
 9148|  1.79k|  components.username_end += 2;
 9149|  1.79k|  components.host_start += 2;
 9150|  1.79k|  components.host_end += 2;
 9151|  1.79k|  components.pathname_start += 2;
 9152|  1.79k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9152:7): [True: 0, False: 1.79k]
  ------------------
 9153|      0|    components.search_start += 2;
 9154|      0|  }
 9155|  1.79k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9155:7): [True: 0, False: 1.79k]
  ------------------
 9156|      0|    components.hash_start += 2;
 9157|      0|  }
 9158|  1.79k|  ADA_ASSERT_TRUE(validate());
 9159|  1.79k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8763|  1.62k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8764|  1.62k|  ada_log("url_aggregator::append_base_username ", input);
 8765|  1.62k|  ADA_ASSERT_TRUE(validate());
 8766|  1.62k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8767|       |#if ADA_DEVELOPMENT_CHECKS
 8768|       |  // computing the expected password.
 8769|       |  std::string username_expected(get_username());
 8770|       |  username_expected.append(input);
 8771|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8772|  1.62k|  add_authority_slashes_if_needed();
 8773|       |
 8774|       |  // If input is empty, do nothing.
 8775|  1.62k|  if (input.empty()) {
  ------------------
  |  Branch (8775:7): [True: 627, False: 1.00k]
  ------------------
 8776|    627|    return;
 8777|    627|  }
 8778|       |
 8779|  1.00k|  uint32_t difference = uint32_t(input.size());
 8780|  1.00k|  buffer.insert(components.username_end, input);
 8781|  1.00k|  components.username_end += difference;
 8782|  1.00k|  components.host_start += difference;
 8783|       |
 8784|  1.00k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8784:7): [True: 168, False: 832]
  ------------------
 8785|    168|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8785:7): [True: 168, False: 0]
  ------------------
 8786|    168|    buffer.insert(components.host_start, "@");
 8787|    168|    difference++;
 8788|    168|  }
 8789|       |
 8790|  1.00k|  components.host_end += difference;
 8791|  1.00k|  components.pathname_start += difference;
 8792|  1.00k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8792:7): [True: 0, False: 1.00k]
  ------------------
 8793|      0|    components.search_start += difference;
 8794|      0|  }
 8795|  1.00k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8795:7): [True: 0, False: 1.00k]
  ------------------
 8796|      0|    components.hash_start += difference;
 8797|      0|  }
 8798|       |#if ADA_DEVELOPMENT_CHECKS
 8799|       |  std::string username_after(get_username());
 8800|       |  ADA_ASSERT_EQUAL(
 8801|       |      username_expected, username_after,
 8802|       |      "append_base_username problem after inserting " + std::string(input));
 8803|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8804|  1.00k|  ADA_ASSERT_TRUE(validate());
 8805|  1.00k|}
_ZN3ada14url_aggregator16update_base_portEj:
 8931|     44|inline void url_aggregator::update_base_port(uint32_t input) {
 8932|     44|  ada_log("url_aggregator::update_base_port");
 8933|     44|  ADA_ASSERT_TRUE(validate());
 8934|     44|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8934:7): [True: 0, False: 44]
  ------------------
 8935|      0|    clear_port();
 8936|      0|    return;
 8937|      0|  }
 8938|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8939|       |  // value is probably already available as a string.
 8940|     44|  std::string value = helpers::concat(":", std::to_string(input));
 8941|     44|  uint32_t difference = uint32_t(value.size());
 8942|       |
 8943|     44|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8943:7): [True: 0, False: 44]
  ------------------
 8944|      0|    difference -= components.pathname_start - components.host_end;
 8945|      0|    buffer.erase(components.host_end,
 8946|      0|                 components.pathname_start - components.host_end);
 8947|      0|  }
 8948|       |
 8949|     44|  buffer.insert(components.host_end, value);
 8950|     44|  components.pathname_start += difference;
 8951|     44|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8951:7): [True: 0, False: 44]
  ------------------
 8952|      0|    components.search_start += difference;
 8953|      0|  }
 8954|     44|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8954:7): [True: 0, False: 44]
  ------------------
 8955|      0|    components.hash_start += difference;
 8956|      0|  }
 8957|     44|  components.port = input;
 8958|     44|  ADA_ASSERT_TRUE(validate());
 8959|     44|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1991|     44|std::string concat(Args... args) {
 1992|     44|  std::string answer;
 1993|     44|  inner_concat(answer, args...);
 1994|     44|  return answer;
 1995|     44|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1980|     44|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1981|     44|  buffer.append(t);
 1982|     44|  return inner_concat(buffer, args...);
 1983|     44|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1972|     44|inline void inner_concat(std::string& buffer, T t) {
 1973|     44|  buffer.append(t);
 1974|     44|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8602|    644|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8603|    644|  ada_log("url_aggregator::update_base_search ", input,
 8604|    644|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8605|    644|  ADA_ASSERT_TRUE(validate());
 8606|    644|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8607|       |
 8608|    644|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8608:7): [True: 644, False: 0]
  ------------------
 8609|    644|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8609:9): [True: 644, False: 0]
  ------------------
 8610|    644|      components.search_start = uint32_t(buffer.size());
 8611|    644|      buffer += "?";
 8612|    644|    } else {
 8613|      0|      buffer.resize(components.search_start + 1);
 8614|      0|    }
 8615|       |
 8616|    644|    bool encoding_required =
 8617|    644|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8618|       |    // When encoding_required is false, then buffer is left unchanged, and
 8619|       |    // percent encoding was not deemed required.
 8620|    644|    if (!encoding_required) {
  ------------------
  |  Branch (8620:9): [True: 499, False: 145]
  ------------------
 8621|    499|      buffer.append(input);
 8622|    499|    }
 8623|    644|  } else {
 8624|      0|    const size_t idx =
 8625|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8626|      0|    std::string encoded;
 8627|      0|    std::string_view replacement = input;
 8628|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8628:9): [True: 0, False: 0]
  ------------------
 8629|      0|      encoded =
 8630|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8631|      0|      replacement = encoded;
 8632|      0|    }
 8633|       |
 8634|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8634:9): [True: 0, False: 0]
  ------------------
 8635|      0|      const uint32_t difference = replace_and_resize(
 8636|      0|          components.search_start + 1, components.hash_start, replacement);
 8637|      0|      components.hash_start += difference;
 8638|      0|    } else {
 8639|      0|      components.search_start = components.hash_start;
 8640|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8641|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8641:11): [True: 0, False: 0]
  ------------------
 8642|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8643|      0|                     replacement.data(), replacement.size());
 8644|      0|      }
 8645|      0|      components.hash_start +=
 8646|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8647|      0|    }
 8648|      0|  }
 8649|       |
 8650|    644|  ADA_ASSERT_TRUE(validate());
 8651|    644|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8517|  1.66k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8518|  1.66k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8519|  1.66k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8520|  1.66k|  ADA_ASSERT_TRUE(validate());
 8521|  1.66k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8522|       |
 8523|       |  // This next line is required for when parsing a URL like `foo://`
 8524|  1.66k|  add_authority_slashes_if_needed();
 8525|       |
 8526|  1.66k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8527|  1.66k|  uint32_t new_difference =
 8528|  1.66k|      replace_and_resize(components.host_start, components.host_end, input);
 8529|       |
 8530|  1.66k|  if (has_credentials) {
  ------------------
  |  Branch (8530:7): [True: 92, False: 1.57k]
  ------------------
 8531|     92|    buffer.insert(components.host_start, "@");
 8532|     92|    new_difference++;
 8533|     92|  }
 8534|  1.66k|  components.host_end += new_difference;
 8535|  1.66k|  components.pathname_start += new_difference;
 8536|  1.66k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8536:7): [True: 0, False: 1.66k]
  ------------------
 8537|      0|    components.search_start += new_difference;
 8538|      0|  }
 8539|  1.66k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8539:7): [True: 0, False: 1.66k]
  ------------------
 8540|      0|    components.hash_start += new_difference;
 8541|      0|  }
 8542|  1.66k|  ADA_ASSERT_TRUE(validate());
 8543|  1.66k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9249|    556|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9250|    556|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9251|    556|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9251:7): [True: 553, False: 3]
  |  Branch (9251:24): [True: 1, False: 552]
  ------------------
 9252|      1|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9253|      1|    is_valid = false;
 9254|      1|    return 0;
 9255|      1|  }
 9256|    555|  uint16_t parsed_port{};
 9257|    555|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9258|    555|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9258:7): [True: 12, False: 543]
  ------------------
 9259|     12|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9260|     12|    is_valid = false;
 9261|     12|    return 0;
 9262|     12|  }
 9263|    543|  ada_log("parse_port: ", parsed_port);
 9264|    543|  const size_t consumed = size_t(r.ptr - view.data());
 9265|    543|  ada_log("parse_port: consumed ", consumed);
 9266|    543|  if (check_trailing_content) {
  ------------------
  |  Branch (9266:7): [True: 543, False: 0]
  ------------------
 9267|    543|    is_valid &=
 9268|    543|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9268:10): [True: 22, False: 521]
  |  Branch (9268:37): [True: 32, False: 489]
  ------------------
 9269|    489|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9269:10): [True: 22, False: 467]
  |  Branch (9269:36): [True: 467, False: 0]
  |  Branch (9269:52): [True: 0, False: 467]
  ------------------
 9270|    543|  }
 9271|    543|  ada_log("parse_port: is_valid = ", is_valid);
 9272|    543|  if (is_valid) {
  ------------------
  |  Branch (9272:7): [True: 76, False: 467]
  ------------------
 9273|     76|    ada_log("parse_port", r.ec == std::errc());
 9274|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9275|     76|    auto default_port = scheme_default_port();
 9276|     76|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9276:27): [True: 0, False: 76]
  |  Branch (9276:48): [True: 0, False: 0]
  ------------------
 9277|     76|                         (default_port != parsed_port);
  ------------------
  |  Branch (9277:26): [True: 75, False: 1]
  ------------------
 9278|     76|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9278:9): [True: 45, False: 31]
  |  Branch (9278:32): [True: 44, False: 1]
  ------------------
 9279|     44|      update_base_port(parsed_port);
 9280|     44|    } else {
 9281|     32|      clear_port();
 9282|     32|    }
 9283|     76|  }
 9284|    543|  return consumed;
 9285|    555|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8369|  7.05k|                                              const uint8_t character_set[]) {
 8370|  7.05k|  const char* data = input.data();
 8371|  7.05k|  const size_t size = input.size();
 8372|       |
 8373|       |  // Process 8 bytes at a time using unrolled loop
 8374|  7.05k|  size_t i = 0;
 8375|  7.46k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8375:10): [True: 626, False: 6.84k]
  ------------------
 8376|    626|    unsigned char chunk[8];
 8377|    626|    std::memcpy(&chunk, data + i,
 8378|    626|                8);  // entices compiler to unconditionally process 8 characters
 8379|       |
 8380|       |    // Check 8 characters at once
 8381|  4.30k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8381:24): [True: 3.89k, False: 416]
  ------------------
 8382|  3.89k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8382:11): [True: 210, False: 3.68k]
  ------------------
 8383|    210|        return i + j;
 8384|    210|      }
 8385|  3.89k|    }
 8386|    626|  }
 8387|       |
 8388|       |  // Handle remaining bytes
 8389|  7.21k|  for (; i < size; i++) {
  ------------------
  |  Branch (8389:10): [True: 520, False: 6.69k]
  ------------------
 8390|    520|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8390:9): [True: 145, False: 375]
  ------------------
 8391|    145|      return i;
 8392|    145|    }
 8393|    520|  }
 8394|       |
 8395|  6.69k|  return size;
 8396|  6.84k|}
_ZN3ada14url_aggregator10clear_portEv:
 8961|     32|inline void url_aggregator::clear_port() {
 8962|     32|  ada_log("url_aggregator::clear_port");
 8963|     32|  ADA_ASSERT_TRUE(validate());
 8964|     32|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8964:7): [True: 32, False: 0]
  ------------------
 8965|     32|    return;
 8966|     32|  }
 8967|      0|  uint32_t length = components.pathname_start - components.host_end;
 8968|      0|  buffer.erase(components.host_end, length);
 8969|      0|  components.pathname_start -= length;
 8970|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8970:7): [True: 0, False: 0]
  ------------------
 8971|      0|    components.search_start -= length;
 8972|      0|  }
 8973|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8973:7): [True: 0, False: 0]
  ------------------
 8974|      0|    components.hash_start -= length;
 8975|      0|  }
 8976|      0|  components.port = url_components::omitted;
 8977|      0|  ADA_ASSERT_TRUE(validate());
 8978|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9126|  4.57k|    const noexcept {
 9127|  4.57k|  ada_log("url_aggregator::has_authority");
 9128|       |  // Performance: instead of doing this potentially expensive check, we could
 9129|       |  // have a boolean in the struct.
 9130|  4.57k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9130:10): [True: 2.78k, False: 1.79k]
  ------------------
 9131|  2.78k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9131:10): [True: 2.78k, False: 0]
  ------------------
 9132|  2.78k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9132:10): [True: 2.78k, False: 0]
  ------------------
 9133|  4.57k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9206|  1.15k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9207|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9208|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9209|       |  // U+002F (/) followed by U+002E (.) to output.
 9210|  1.15k|  ada_log("url_aggregator::has_dash_dot");
 9211|       |#if ADA_DEVELOPMENT_CHECKS
 9212|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9213|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9214|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9215|       |  if (components.pathname_start == components.host_end + 2) {
 9216|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9217|       |                     buffer[components.host_end + 1] == '.') ||
 9218|       |                    (buffer[components.host_end] == ':' &&
 9219|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9220|       |  }
 9221|       |  if (components.pathname_start == components.host_end + 2 &&
 9222|       |      buffer[components.host_end] == '/' &&
 9223|       |      buffer[components.host_end + 1] == '.') {
 9224|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9225|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9226|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9227|       |  }
 9228|       |#endif
 9229|       |  // Performance: it should be uncommon for components.pathname_start ==
 9230|       |  // components.host_end + 2 to be true. So we put this check first in the
 9231|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9232|       |  // more expensive, but should be uncommon.
 9233|  1.15k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9233:10): [True: 12, False: 1.14k]
  ------------------
 9234|     12|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9234:10): [True: 12, False: 0]
  |  Branch (9234:30): [True: 0, False: 12]
  ------------------
 9235|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9235:10): [True: 0, False: 0]
  ------------------
 9236|  1.15k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4101|  13.3k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4070|  2.88k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4071|  2.88k|    TL_ASSERT(has_value());
  ------------------
  |  | 2123|  2.88k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4071:5): [True: 2.88k, False: 0]
  ------------------
 4072|  2.88k|    return valptr();
 4073|  2.88k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3366|  2.88k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4100|  2.88k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2698|  13.3k|  ~expected_storage_base() {
 2699|  13.3k|    if (m_has_val) {
  ------------------
  |  Branch (2699:9): [True: 2.57k, False: 10.7k]
  ------------------
 2700|  2.57k|      m_val.~T();
 2701|  2.57k|    }
 2702|  13.3k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1913|  4.16k|                                                       size_t pos2) {
 1914|       |#if ADA_DEVELOPMENT_CHECKS
 1915|       |  if (pos2 < pos1) {
 1916|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1917|       |              << std::endl;
 1918|       |    abort();
 1919|       |  }
 1920|       |#endif
 1921|  4.16k|  return input.substr(pos1, pos2 - pos1);
 1922|  4.16k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8558|    759|    const noexcept {
 8559|    759|  return buffer.size() == components.pathname_start;
 8560|    759|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9175|    576|constexpr bool url_aggregator::has_password() const noexcept {
 9176|    576|  ada_log("url_aggregator::has_password");
 9177|       |  // This function does not care about the length of the password
 9178|    576|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9178:10): [True: 512, False: 64]
  ------------------
 9179|    512|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9179:10): [True: 512, False: 0]
  ------------------
 9180|    576|}
_ZNK3ada14url_aggregator8validateEv:
 9317|  2.57k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9318|  2.57k|  if (!is_valid) {
  ------------------
  |  Branch (9318:7): [True: 0, False: 2.57k]
  ------------------
 9319|      0|    return true;
 9320|      0|  }
 9321|  2.57k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9321:7): [True: 0, False: 2.57k]
  ------------------
 9322|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9323|      0|            to_diagram());
 9324|      0|    return false;
 9325|      0|  }
 9326|       |  // We have a credible components struct, but let us investivate more
 9327|       |  // carefully:
 9328|       |  /**
 9329|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9330|       |   *       |     |    |          | ^^^^|       |   |
 9331|       |   *       |     |    |          | |   |       |   `----- hash_start
 9332|       |   *       |     |    |          | |   |       `--------- search_start
 9333|       |   *       |     |    |          | |   `----------------- pathname_start
 9334|       |   *       |     |    |          | `--------------------- port
 9335|       |   *       |     |    |          `----------------------- host_end
 9336|       |   *       |     |    `---------------------------------- host_start
 9337|       |   *       |     `--------------------------------------- username_end
 9338|       |   *       `--------------------------------------------- protocol_end
 9339|       |   */
 9340|  2.57k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9340:7): [True: 0, False: 2.57k]
  ------------------
 9341|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9342|      0|    return false;
 9343|      0|  }
 9344|  2.57k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9344:7): [True: 0, False: 2.57k]
  ------------------
 9345|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9346|      0|    return false;
 9347|      0|  }
 9348|  2.57k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9348:7): [True: 0, False: 2.57k]
  ------------------
 9349|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9350|      0|    return false;
 9351|      0|  }
 9352|  2.57k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9352:7): [True: 0, False: 2.57k]
  ------------------
 9353|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9354|      0|    return false;
 9355|      0|  }
 9356|  2.57k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9356:7): [True: 0, False: 2.57k]
  ------------------
 9357|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9358|      0|    return false;
 9359|      0|  }
 9360|       |
 9361|  2.57k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9361:7): [True: 0, False: 2.57k]
  ------------------
 9362|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9363|      0|    return false;
 9364|      0|  }
 9365|  2.57k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9365:7): [True: 0, False: 2.57k]
  ------------------
 9366|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9367|      0|    return false;
 9368|      0|  }
 9369|  2.57k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9369:7): [True: 0, False: 2.57k]
  ------------------
 9370|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9371|      0|    return false;
 9372|      0|  }
 9373|  2.57k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9373:7): [True: 0, False: 2.57k]
  ------------------
 9374|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9375|      0|    return false;
 9376|      0|  }
 9377|  2.57k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9377:7): [True: 0, False: 2.57k]
  ------------------
 9378|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9379|      0|            to_diagram());
 9380|      0|    return false;
 9381|      0|  }
 9382|       |
 9383|  2.57k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9383:7): [True: 2.57k, False: 0]
  ------------------
 9384|  2.57k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9384:9): [True: 0, False: 2.57k]
  ------------------
 9385|      0|      ada_log(
 9386|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9387|      0|          to_diagram());
 9388|      0|      return false;
 9389|      0|    }
 9390|  2.57k|  }
 9391|       |
 9392|  2.57k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9392:7): [True: 2.57k, False: 0]
  ------------------
 9393|  2.57k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9393:7): [True: 80, False: 2.49k]
  ------------------
 9394|     80|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9394:9): [True: 67, False: 13]
  ------------------
 9395|     67|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9395:9): [True: 0, False: 67]
  ------------------
 9396|      0|      ada_log(
 9397|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9398|      0|          "\n",
 9399|      0|          to_diagram());
 9400|      0|      return false;
 9401|      0|    }
 9402|     80|  }
 9403|       |
 9404|  2.57k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9404:7): [True: 2.57k, False: 0]
  ------------------
 9405|  2.57k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9405:9): [True: 22, False: 2.55k]
  ------------------
 9406|     22|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9406:11): [True: 0, False: 22]
  ------------------
 9407|      0|        ada_log(
 9408|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9409|      0|            to_diagram());
 9410|      0|        return false;
 9411|      0|      }
 9412|  2.55k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9412:16): [True: 2.55k, False: 0]
  ------------------
 9413|  2.55k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9413:16): [True: 2.55k, False: 0]
  ------------------
 9414|  2.55k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9414:11): [True: 2.48k, False: 67]
  ------------------
 9415|  2.48k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9415:13): [True: 0, False: 2.48k]
  ------------------
 9416|  2.48k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9416:13): [True: 0, False: 2.48k]
  ------------------
 9417|      0|          ada_log(
 9418|      0|              "url_aggregator::validate missing // between protocol and host "
 9419|      0|              "\n",
 9420|      0|              to_diagram());
 9421|      0|          return false;
 9422|      0|        }
 9423|  2.48k|      } else {
 9424|     67|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9424:13): [True: 67, False: 0]
  ------------------
 9425|     67|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9425:13): [True: 0, False: 67]
  ------------------
 9426|      0|          ada_log(
 9427|      0|              "url_aggregator::validate missing @ at the end of the username "
 9428|      0|              "\n",
 9429|      0|              to_diagram());
 9430|      0|          return false;
 9431|      0|        }
 9432|     67|      }
 9433|  2.55k|    } else {
 9434|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9434:11): [True: 0, False: 0]
  ------------------
 9435|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9436|      0|                to_diagram());
 9437|      0|        return false;
 9438|      0|      }
 9439|      0|    }
 9440|  2.57k|  }
 9441|  2.57k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9441:7): [True: 2.57k, False: 0]
  ------------------
 9442|  2.57k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9442:7): [True: 159, False: 2.41k]
  ------------------
 9443|    159|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9443:9): [True: 26, False: 133]
  ------------------
 9444|     26|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9444:9): [True: 0, False: 26]
  ------------------
 9445|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9445:9): [True: 0, False: 0]
  ------------------
 9446|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9446:11): [True: 0, False: 0]
  ------------------
 9447|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9447:11): [True: 0, False: 0]
  ------------------
 9448|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9448:11): [True: 0, False: 0]
  ------------------
 9449|      0|        ada_log(
 9450|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9451|      0|            to_diagram());
 9452|      0|        return false;
 9453|      0|      }
 9454|    159|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9454:16): [True: 0, False: 159]
  ------------------
 9455|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9456|      0|              to_diagram());
 9457|      0|      return false;
 9458|      0|    }
 9459|    159|  }
 9460|  2.57k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9460:7): [True: 2.57k, False: 0]
  ------------------
 9461|  2.57k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9461:7): [True: 2.57k, False: 0]
  ------------------
 9462|  2.57k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9462:7): [True: 2.57k, False: 0]
  |  Branch (9462:60): [True: 2.57k, False: 0]
  ------------------
 9463|  2.57k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9463:9): [True: 0, False: 2.57k]
  ------------------
 9464|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9465|      0|              to_diagram());
 9466|      0|      return false;
 9467|      0|    }
 9468|  2.57k|  }
 9469|  2.57k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9469:7): [True: 765, False: 1.81k]
  ------------------
 9470|    765|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9470:9): [True: 0, False: 765]
  ------------------
 9471|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9472|      0|              to_diagram());
 9473|      0|      return false;
 9474|      0|    }
 9475|    765|  }
 9476|  2.57k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9476:7): [True: 381, False: 2.19k]
  ------------------
 9477|    381|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9477:9): [True: 0, False: 381]
  ------------------
 9478|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9479|      0|              to_diagram());
 9480|      0|      return false;
 9481|      0|    }
 9482|    381|  }
 9483|       |
 9484|  2.57k|  return true;
 9485|  2.57k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7801|  2.57k|    const noexcept {
 7802|       |  /**
 7803|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7804|       |   *       |     |    |          | ^^^^|       |   |
 7805|       |   *       |     |    |          | |   |       |   `----- hash_start
 7806|       |   *       |     |    |          | |   |       `--------- search_start
 7807|       |   *       |     |    |          | |   `----------------- pathname_start
 7808|       |   *       |     |    |          | `--------------------- port
 7809|       |   *       |     |    |          `----------------------- host_end
 7810|       |   *       |     |    `---------------------------------- host_start
 7811|       |   *       |     `--------------------------------------- username_end
 7812|       |   *       `--------------------------------------------- protocol_end
 7813|       |   */
 7814|       |  // These conditions can be made more strict.
 7815|  2.57k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7815:7): [True: 0, False: 2.57k]
  ------------------
 7816|      0|    return false;
 7817|      0|  }
 7818|  2.57k|  uint32_t index = protocol_end;
 7819|       |
 7820|  2.57k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7820:7): [True: 0, False: 2.57k]
  ------------------
 7821|      0|    return false;
 7822|      0|  }
 7823|  2.57k|  if (username_end < index) {
  ------------------
  |  Branch (7823:7): [True: 0, False: 2.57k]
  ------------------
 7824|      0|    return false;
 7825|      0|  }
 7826|  2.57k|  index = username_end;
 7827|       |
 7828|  2.57k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7828:7): [True: 0, False: 2.57k]
  ------------------
 7829|      0|    return false;
 7830|      0|  }
 7831|  2.57k|  if (host_start < index) {
  ------------------
  |  Branch (7831:7): [True: 0, False: 2.57k]
  ------------------
 7832|      0|    return false;
 7833|      0|  }
 7834|  2.57k|  index = host_start;
 7835|       |
 7836|  2.57k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7836:7): [True: 159, False: 2.41k]
  ------------------
 7837|    159|    if (port > 0xffff) {
  ------------------
  |  Branch (7837:9): [True: 0, False: 159]
  ------------------
 7838|      0|      return false;
 7839|      0|    }
 7840|    159|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7841|    159|    if (index + port_length < index) {
  ------------------
  |  Branch (7841:9): [True: 0, False: 159]
  ------------------
 7842|      0|      return false;
 7843|      0|    }
 7844|    159|    index += port_length;
 7845|    159|  }
 7846|       |
 7847|  2.57k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7847:7): [True: 0, False: 2.57k]
  ------------------
 7848|      0|    return false;
 7849|      0|  }
 7850|  2.57k|  if (pathname_start < index) {
  ------------------
  |  Branch (7850:7): [True: 0, False: 2.57k]
  ------------------
 7851|      0|    return false;
 7852|      0|  }
 7853|  2.57k|  index = pathname_start;
 7854|       |
 7855|  2.57k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7855:7): [True: 765, False: 1.81k]
  ------------------
 7856|    765|    if (search_start < index) {
  ------------------
  |  Branch (7856:9): [True: 0, False: 765]
  ------------------
 7857|      0|      return false;
 7858|      0|    }
 7859|    765|    index = search_start;
 7860|    765|  }
 7861|       |
 7862|  2.57k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7862:7): [True: 381, False: 2.19k]
  ------------------
 7863|    381|    if (hash_start < index) {
  ------------------
  |  Branch (7863:9): [True: 0, False: 381]
  ------------------
 7864|      0|      return false;
 7865|      0|    }
 7866|    381|  }
 7867|       |
 7868|  2.57k|  return true;
 7869|  2.57k|}
_ZN3ada7helpers16fast_digit_countEj:
 2017|    159|inline int fast_digit_count(uint32_t x) noexcept {
 2018|    159|  auto int_log2 = [](uint32_t z) -> int {
 2019|    159|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2020|    159|  };
 2021|       |  // Compiles to very few instructions. Note that the
 2022|       |  // table is static and thus effectively a constant.
 2023|       |  // We leave it inside the function because it is meaningless
 2024|       |  // outside of it (this comes at no performance cost).
 2025|    159|  const static uint64_t table[] = {
 2026|    159|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2027|    159|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2028|    159|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2029|    159|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2030|    159|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2031|    159|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2032|    159|      42949672960, 42949672960};
 2033|    159|  return int((x + table[int_log2(x)]) >> 32);
 2034|    159|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2018|    159|  auto int_log2 = [](uint32_t z) -> int {
 2019|    159|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2020|    159|  };

LLVMFuzzerTestOneInput:
   21|  7.05k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   22|  7.05k|  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|  7.05k|  uint64_t ipv4_addr = fdp.ConsumeIntegral<uint64_t>();
   28|  7.05k|  std::string ipv4_str = ada::serializers::ipv4(ipv4_addr);
   29|  7.05k|  volatile size_t ipv4_len = ipv4_str.size();
   30|  7.05k|  (void)ipv4_len;
   31|       |
   32|       |  // ===== IPv6 Serialization =====
   33|  7.05k|  std::array<uint16_t, 8> ipv6_addr{};
   34|  56.4k|  for (auto& piece : ipv6_addr) {
  ------------------
  |  Branch (34:20): [True: 56.4k, False: 7.05k]
  ------------------
   35|  56.4k|    piece = fdp.ConsumeIntegral<uint16_t>();
   36|  56.4k|  }
   37|       |
   38|       |  // find_longest_sequence_of_ipv6_pieces: basic invariants must hold.
   39|  7.05k|  size_t compress = 0, compress_length = 0;
   40|  7.05k|  ada::serializers::find_longest_sequence_of_ipv6_pieces(ipv6_addr, compress,
   41|  7.05k|                                                         compress_length);
   42|       |  // The longest run cannot exceed 8 pieces.
   43|  7.05k|  assert(compress_length <= 8);
  ------------------
  |  Branch (43:3): [True: 7.05k, False: 0]
  ------------------
   44|       |  // If a run was found (length > 0) its start index must be in-bounds.
   45|  7.05k|  if (compress_length > 0) {
  ------------------
  |  Branch (45:7): [True: 2.02k, False: 5.03k]
  ------------------
   46|  2.02k|    assert(compress < 8);
  ------------------
  |  Branch (46:5): [True: 2.02k, False: 0]
  ------------------
   47|  2.02k|    assert(compress + compress_length <= 8);
  ------------------
  |  Branch (47:5): [True: 2.02k, False: 0]
  ------------------
   48|  2.02k|  }
   49|       |
   50|  7.05k|  std::string ipv6_str = ada::serializers::ipv6(ipv6_addr);
   51|  7.05k|  volatile size_t ipv6_len = ipv6_str.size();
   52|  7.05k|  (void)ipv6_len;
   53|       |
   54|       |  // Serialized IPv6 must always be a non-empty string.
   55|  7.05k|  assert(!ipv6_str.empty());
  ------------------
  |  Branch (55:3): [True: 7.05k, 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|  7.05k|  {
   62|  7.05k|    std::string ip_candidate = fdp.ConsumeRandomLengthString(32);
   63|  7.05k|    uint64_t fast_result = ada::checkers::try_parse_ipv4_fast(ip_candidate);
   64|  7.05k|    if (fast_result <= 0xFFFFFFFF) {
  ------------------
  |  Branch (64:9): [True: 80, False: 6.97k]
  ------------------
   65|       |      // Serialize the parsed address and re-parse.
   66|     80|      std::string canonical = ada::serializers::ipv4(fast_result);
   67|     80|      uint64_t recheck = ada::checkers::try_parse_ipv4_fast(canonical);
   68|     80|      if (recheck != fast_result) {
  ------------------
  |  Branch (68:11): [True: 0, False: 80]
  ------------------
   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|     80|    }
   77|  7.05k|  }
   78|       |
   79|       |  // ===== Percent Encode / Decode =====
   80|  7.05k|  {
   81|  7.05k|    std::string source = fdp.ConsumeRandomLengthString(128);
   82|       |
   83|       |    // Exercise all six standard character sets used by the URL parser.
   84|  7.05k|    const uint8_t* sets[] = {
   85|  7.05k|        ada::character_sets::C0_CONTROL_PERCENT_ENCODE,
   86|  7.05k|        ada::character_sets::PATH_PERCENT_ENCODE,
   87|  7.05k|        ada::character_sets::QUERY_PERCENT_ENCODE,
   88|  7.05k|        ada::character_sets::FRAGMENT_PERCENT_ENCODE,
   89|  7.05k|        ada::character_sets::USERINFO_PERCENT_ENCODE,
   90|  7.05k|        ada::character_sets::SPECIAL_QUERY_PERCENT_ENCODE,
   91|  7.05k|    };
   92|       |
   93|  42.3k|    for (const uint8_t* charset : sets) {
  ------------------
  |  Branch (93:33): [True: 42.3k, False: 7.05k]
  ------------------
   94|       |      // Two-argument percent_encode: returns the encoded string.
   95|  42.3k|      std::string encoded = ada::unicode::percent_encode(source, charset);
   96|  42.3k|      volatile size_t enc_len = encoded.size();
   97|  42.3k|      (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|  42.3k|      assert(encoded.size() >= source.size());
  ------------------
  |  Branch (101:7): [True: 42.3k, False: 0]
  ------------------
  102|       |
  103|       |      // Three-argument percent_encode: starts encoding from a given index.
  104|  42.3k|      size_t start_idx = fdp.ConsumeIntegralInRange<size_t>(0, source.size());
  105|  42.3k|      std::string encoded_from =
  106|  42.3k|          ada::unicode::percent_encode(source, charset, start_idx);
  107|  42.3k|      volatile size_t enf_len = encoded_from.size();
  108|  42.3k|      (void)enf_len;
  109|       |
  110|       |      // Template form: percent_encode<false> (replace).
  111|  42.3k|      {
  112|  42.3k|        std::string out;
  113|  42.3k|        bool changed =
  114|  42.3k|            ada::unicode::percent_encode<false>(source, charset, out);
  115|  42.3k|        volatile bool c = changed;
  116|  42.3k|        (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|  42.3k|        if (changed) {
  ------------------
  |  Branch (119:13): [True: 2.02k, False: 40.2k]
  ------------------
  120|  2.02k|          assert(out.size() >= source.size());
  ------------------
  |  Branch (120:11): [True: 2.02k, False: 0]
  ------------------
  121|  2.02k|        }
  122|  42.3k|      }
  123|       |
  124|       |      // Template form: percent_encode<true> (append).
  125|  42.3k|      {
  126|  42.3k|        std::string out = "prefix_";
  127|  42.3k|        size_t prefix_len = out.size();
  128|  42.3k|        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|  42.3k|        assert(out.size() >= prefix_len);
  ------------------
  |  Branch (131:9): [True: 42.3k, False: 0]
  ------------------
  132|  42.3k|      }
  133|  42.3k|    }
  134|       |
  135|       |    // Percent decode: feed raw fuzz input (may contain invalid sequences).
  136|  7.05k|    {
  137|  7.05k|      size_t pct_pos = source.find('%');
  138|  7.05k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (138:11): [True: 183, False: 6.86k]
  ------------------
  139|    183|        std::string decoded = ada::unicode::percent_decode(source, pct_pos);
  140|       |        // Decoded output can't be longer than the input.
  141|    183|        assert(decoded.size() <= source.size());
  ------------------
  |  Branch (141:9): [True: 183, False: 0]
  ------------------
  142|    183|        volatile size_t dec_len = decoded.size();
  143|    183|        (void)dec_len;
  144|    183|      }
  145|  7.05k|    }
  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|  7.05k|    {
  150|  7.05k|      std::string encoded = ada::unicode::percent_encode(
  151|  7.05k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  152|  7.05k|      size_t pct_pos = encoded.find('%');
  153|  7.05k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (153:11): [True: 420, False: 6.63k]
  ------------------
  154|    420|        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|    420|        if (source.find('%') == std::string::npos && decoded != source) {
  ------------------
  |  Branch (157:13): [True: 237, False: 183]
  |  Branch (157:54): [True: 0, False: 237]
  ------------------
  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.63k|      } else {
  165|       |        // No encoding was needed; the output should equal the input.
  166|  6.63k|        assert(encoded == source);
  ------------------
  |  Branch (166:9): [True: 6.63k, False: 0]
  ------------------
  167|  6.63k|      }
  168|  7.05k|    }
  169|       |
  170|       |    // percent_encode_index: the returned index must be within [0, size].
  171|  7.05k|    {
  172|  7.05k|      size_t idx = ada::unicode::percent_encode_index(
  173|  7.05k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  174|  7.05k|      assert(idx <= source.size());
  ------------------
  |  Branch (174:7): [True: 7.05k, False: 0]
  ------------------
  175|  7.05k|    }
  176|  7.05k|  }
  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|  7.05k|  {
  183|  7.05k|    std::string util_input = fdp.ConsumeRandomLengthString(128);
  184|       |
  185|       |    // has_tabs_or_newline: any string is valid input.
  186|  7.05k|    volatile bool has_tn = ada::unicode::has_tabs_or_newline(util_input);
  187|  7.05k|    (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|  7.05k|    if (!util_input.empty()) {
  ------------------
  |  Branch (193:9): [True: 6.15k, False: 893]
  ------------------
  194|  6.15k|      volatile bool is_v4 = ada::checkers::is_ipv4(util_input);
  195|  6.15k|      (void)is_v4;
  196|  6.15k|      if (is_v4) {
  ------------------
  |  Branch (196:11): [True: 5.94k, False: 218]
  ------------------
  197|  5.94k|        std::string ipv4_url = "http://" + util_input + "/";
  198|  5.94k|        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.94k|        if (parsed) {
  ------------------
  |  Branch (202:13): [True: 2.26k, False: 3.67k]
  ------------------
  203|  2.26k|          volatile bool v = parsed->validate();
  204|  2.26k|          (void)v;
  205|  2.26k|        }
  206|  5.94k|      }
  207|  6.15k|    }
  208|       |
  209|       |    // path_signature: returns a bitmask; must not crash.
  210|  7.05k|    volatile uint8_t sig = ada::checkers::path_signature(util_input);
  211|  7.05k|    (void)sig;
  212|       |
  213|       |    // is_windows_drive_letter: must not crash on short or long inputs.
  214|  7.05k|    volatile bool is_wdl = ada::checkers::is_windows_drive_letter(util_input);
  215|  7.05k|    (void)is_wdl;
  216|       |
  217|       |    // is_normalized_windows_drive_letter
  218|  7.05k|    volatile bool is_nwdl =
  219|  7.05k|        ada::checkers::is_normalized_windows_drive_letter(util_input);
  220|  7.05k|    (void)is_nwdl;
  221|       |
  222|       |    // Consistency: a normalised Windows drive letter is a subset of
  223|       |    // Windows drive letters.
  224|  7.05k|    if (is_nwdl && !is_wdl) {
  ------------------
  |  Branch (224:9): [True: 2, False: 7.05k]
  |  Branch (224:20): [True: 0, False: 2]
  ------------------
  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|  7.05k|    {
  234|  7.05k|      std::string lower_copy = util_input;
  235|  7.05k|      volatile bool all_ascii =
  236|  7.05k|          ada::unicode::to_lower_ascii(lower_copy.data(), lower_copy.size());
  237|  7.05k|      (void)all_ascii;
  238|       |      // The result should be at most as long as the input.
  239|  7.05k|      assert(lower_copy.size() == util_input.size());
  ------------------
  |  Branch (239:7): [True: 7.05k, False: 0]
  ------------------
  240|  7.05k|    }
  241|       |
  242|       |    // contains_forbidden_domain_code_point: must not crash.
  243|  7.05k|    volatile bool has_forbidden =
  244|  7.05k|        ada::unicode::contains_forbidden_domain_code_point(util_input.data(),
  245|  7.05k|                                                           util_input.size());
  246|  7.05k|    (void)has_forbidden;
  247|       |
  248|       |    // contains_forbidden_domain_code_point_or_upper: must not crash.
  249|  7.05k|    volatile uint8_t forbidden_or_upper =
  250|  7.05k|        ada::unicode::contains_forbidden_domain_code_point_or_upper(
  251|  7.05k|            util_input.data(), util_input.size());
  252|  7.05k|    (void)forbidden_or_upper;
  253|       |
  254|       |    // verify_dns_length: must not crash; also check consistency with
  255|       |    // to_ascii output.
  256|  7.05k|    volatile bool dns_ok = ada::checkers::verify_dns_length(util_input);
  257|  7.05k|    (void)dns_ok;
  258|  7.05k|  }
  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|  7.05k|    if (ipv4_addr <= 0xFFFFFFFF) {
  ------------------
  |  Branch (265:9): [True: 310, False: 6.74k]
  ------------------
  266|    310|      std::string url_str = "http://" + ipv4_str + "/path?q=1";
  267|    310|      auto parsed = ada::parse<ada::url_aggregator>(url_str);
  268|    310|      if (parsed) {
  ------------------
  |  Branch (268:11): [True: 310, False: 0]
  ------------------
  269|    310|        volatile bool v = parsed->validate();
  270|    310|        (void)v;
  271|       |        // The URL's hostname must be the canonical dotted-decimal address.
  272|    310|        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|    310|        (void)host;
  277|    310|      }
  278|    310|    }
  279|       |
  280|       |    // IPv6: wrap in brackets.
  281|  7.05k|    std::string ipv6_url_str = "http://[" + ipv6_str + "]/path";
  282|  7.05k|    auto parsed_ipv6 = ada::parse<ada::url_aggregator>(ipv6_url_str);
  283|  7.05k|    if (parsed_ipv6) {
  ------------------
  |  Branch (283:9): [True: 0, False: 7.05k]
  ------------------
  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|  7.05k|  }
  300|       |
  301|  7.05k|  return 0;
  302|  7.05k|}

