_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7617|  3.08k|                    std::string& out) {
 7618|  3.08k|  ada_log("percent_encode ", input, " to output string while ",
 7619|  3.08k|          append ? "appending" : "overwriting");
 7620|  3.08k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|  3.08k|    return character_sets::bit_at(character_set, c);
 7622|  3.08k|  });
 7623|  3.08k|  ada_log("percent_encode done checking, moved to ",
 7624|  3.08k|          std::distance(input.begin(), pointer));
 7625|       |
 7626|       |  // Optimization: Don't iterate if percent encode is not required
 7627|  3.08k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7627:7): [True: 1.76k, False: 1.32k]
  ------------------
 7628|  1.76k|    ada_log("percent_encode encoding not needed.");
 7629|  1.76k|    return false;
 7630|  1.76k|  }
 7631|       |  if constexpr (!append) {
 7632|       |    out.clear();
 7633|       |  }
 7634|  1.32k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7635|  1.32k|          " bytes");
 7636|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7637|  1.32k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7638|  1.32k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7639|  1.32k|          " bytes");
 7640|  55.3k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7640:10): [True: 54.0k, False: 1.32k]
  ------------------
 7641|  54.0k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7641:9): [True: 38.3k, False: 15.6k]
  ------------------
 7642|  38.3k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7643|  38.3k|    } else {
 7644|  15.6k|      out += *pointer;
 7645|  15.6k|    }
 7646|  54.0k|  }
 7647|  1.32k|  return true;
 7648|  3.08k|}
_ZN3ada7unicode22form_urlencoded_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7517|  53.0k|std::string form_urlencoded_decode(const std::string_view input) {
 7518|  53.0k|  const size_t len = input.size();
 7519|  53.0k|  if (len == 0) [[unlikely]] {
  ------------------
  |  Branch (7519:7): [True: 26.5k, False: 26.5k]
  ------------------
 7520|  26.5k|    return {};
 7521|  26.5k|  }
 7522|       |
 7523|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7524|  26.5k|  const char* const src = input.data();
 7525|  26.5k|  const char* const end = src + len;
 7526|  26.5k|  const char* p = src;
 7527|       |
 7528|       |  // Advance over the untransformed prefix.
 7529|   114k|  while (p < end && *p != '+' && *p != '%') {
  ------------------
  |  Branch (7529:10): [True: 104k, False: 10.4k]
  |  Branch (7529:21): [True: 102k, False: 1.69k]
  |  Branch (7529:34): [True: 88.1k, False: 14.3k]
  ------------------
 7530|  88.1k|    ++p;
 7531|  88.1k|  }
 7532|  26.5k|  if (p == end) {
  ------------------
  |  Branch (7532:7): [True: 10.4k, False: 16.0k]
  ------------------
 7533|  10.4k|    return std::string(input);
 7534|  10.4k|  }
 7535|       |
 7536|       |  // Output is always at most as long as the input: write into a single
 7537|       |  // pre-sized buffer, then shrink to the final length.
 7538|  16.0k|  std::string out(len, '\0');
 7539|  16.0k|  char* d = out.data();
 7540|  16.0k|  char* const d0 = d;
 7541|       |
 7542|  16.0k|  const size_t prefix = static_cast<size_t>(p - src);
 7543|  16.0k|  std::memcpy(d, src, prefix);
 7544|  16.0k|  d += prefix;
 7545|       |
 7546|  57.8k|  while (p < end) {
  ------------------
  |  Branch (7546:10): [True: 41.7k, False: 16.0k]
  ------------------
 7547|  41.7k|    const char c = *p;
 7548|  41.7k|    if (c == '+') {
  ------------------
  |  Branch (7548:9): [True: 8.85k, False: 32.9k]
  ------------------
 7549|  8.85k|      *d++ = ' ';
 7550|  8.85k|      ++p;
 7551|  32.9k|    } else if (c == '%') {
  ------------------
  |  Branch (7551:16): [True: 22.0k, False: 10.8k]
  ------------------
 7552|       |      // Decode runs of valid %XX tightly (common for nested URL query values).
 7553|   137k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7553:14): [True: 123k, False: 13.9k]
  |  Branch (7553:29): [True: 117k, False: 6.30k]
  ------------------
 7554|   117k|        const uint8_t hi = unhex_table[static_cast<uint8_t>(p[1])];
 7555|   117k|        const uint8_t lo = unhex_table[static_cast<uint8_t>(p[2])];
 7556|   117k|        if ((hi | lo) >= 16) {
  ------------------
  |  Branch (7556:13): [True: 1.78k, False: 115k]
  ------------------
 7557|  1.78k|          break;
 7558|  1.78k|        }
 7559|   115k|        *d++ = static_cast<char>((hi << 4) | lo);
 7560|   115k|        p += 3;
 7561|   115k|      }
 7562|  22.0k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7562:11): [True: 11.1k, False: 10.8k]
  |  Branch (7562:22): [True: 3.75k, False: 7.40k]
  ------------------
 7563|       |        // Invalid escape: copy '%' literally and continue.
 7564|  3.75k|        *d++ = *p++;
 7565|  3.75k|      }
 7566|  22.0k|    } else {
 7567|       |      // Copy a plain run until the next '+' or '%'.
 7568|  10.8k|      const char* start = p;
 7569|  10.8k|      ++p;
 7570|  36.6k|      while (p < end && *p != '+' && *p != '%') {
  ------------------
  |  Branch (7570:14): [True: 34.9k, False: 1.77k]
  |  Branch (7570:25): [True: 31.6k, False: 3.25k]
  |  Branch (7570:38): [True: 25.8k, False: 5.84k]
  ------------------
 7571|  25.8k|        ++p;
 7572|  25.8k|      }
 7573|  10.8k|      const size_t n = static_cast<size_t>(p - start);
 7574|  10.8k|      std::memcpy(d, start, n);
 7575|  10.8k|      d += n;
 7576|  10.8k|    }
 7577|  41.7k|  }
 7578|       |
 7579|  16.0k|  out.resize(static_cast<size_t>(d - d0));
 7580|  16.0k|  return out;
 7581|  26.5k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7587|   113k|                           const uint8_t character_set[]) {
 7588|   113k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7589|   113k|    return character_sets::bit_at(character_set, c);
 7590|   113k|  });
 7591|       |  // Optimization: Don't iterate if percent encode is not required
 7592|   113k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7592:7): [True: 78.6k, False: 34.7k]
  ------------------
 7593|  78.6k|    return std::string(input);
 7594|  78.6k|  }
 7595|       |
 7596|  34.7k|  std::string result;
 7597|  34.7k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7598|       |                                   // produce 3 characters.
 7599|  34.7k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7600|  34.7k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7600:7): [True: 3.29k, False: 31.4k]
  ------------------
 7601|  3.29k|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7602|  3.29k|                          result);
 7603|  31.4k|  } else {
 7604|   186k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7604:12): [True: 155k, False: 31.4k]
  ------------------
 7605|   155k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7605:11): [True: 134k, False: 20.4k]
  ------------------
 7606|   134k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7607|   134k|      } else {
 7608|  20.4k|        result += *pointer;
 7609|  20.4k|      }
 7610|   155k|    }
 7611|  31.4k|  }
 7612|  34.7k|  return result;
 7613|   113k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7992|  3.29k|                           const uint8_t character_set[], std::string& out) {
 7993|  3.29k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7994|  3.29k|#ifdef ADA_UNICODE_NEED_SSSE3_TARGET
 7995|  3.29k|  static const bool ssse3_supported = __builtin_cpu_supports("ssse3") != 0;
 7996|  3.29k|  const bool use_wide = ssse3_supported;
 7997|       |#else
 7998|       |  const bool use_wide = true;
 7999|       |#endif
 8000|  3.29k|  if (use_wide && static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (8000:7): [True: 3.29k, False: 0]
  |  Branch (8000:19): [True: 3.29k, False: 0]
  ------------------
 8001|  3.29k|    percent_encode_to_wide(p, end, character_set, out);
 8002|  3.29k|    return;
 8003|  3.29k|  }
 8004|      0|#endif
 8005|      0|  percent_encode_to_scalar(p, end, character_set, out);
 8006|      0|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8547|  2.91k|    std::string_view input, const result_type* base_url) {
 8548|  2.91k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8549|  2.91k|  if (!u.is_valid) {
  ------------------
  |  Branch (8549:7): [True: 0, False: 2.91k]
  ------------------
 8550|      0|    return tl::unexpected(errors::type_error);
 8551|      0|  }
 8552|  2.91k|  return u;
 8553|  2.91k|}
_ZN3ada20get_max_input_lengthEv:
 8168|  10.6k|uint32_t get_max_input_length() {
 8169|  10.6k|  return max_input_length_.load(std::memory_order_relaxed);
 8170|  10.6k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9535|    514|void trim_c0_whitespace(std::string_view& input) noexcept {
 9536|    514|  while (!input.empty() &&
  ------------------
  |  Branch (9536:10): [True: 514, False: 0]
  ------------------
 9537|    514|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9537:10): [True: 0, False: 514]
  ------------------
 9538|      0|    input.remove_prefix(1);
 9539|      0|  }
 9540|  2.78k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9540:10): [True: 2.78k, False: 0]
  |  Branch (9540:28): [True: 2.26k, False: 514]
  ------------------
 9541|  2.26k|    input.remove_suffix(1);
 9542|  2.26k|  }
 9543|    514|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12262|  2.91k|                                                result_type& out) {
12263|  2.91k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12264|  2.91k|  constexpr bool is_aggregator =
12265|  2.91k|      std::is_same_v<result_type, ada::url_aggregator>;
12266|  2.91k|  static_assert(is_ada_url || is_aggregator);
12267|       |
12268|  2.91k|  const size_t len = input.size();
12269|       |  // Shortest accepted form is "ws://x" (6).
12270|  2.91k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12270:7): [True: 0, False: 2.91k]
  ------------------
12271|      0|    return false;
12272|      0|  }
12273|  2.91k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12274|       |
12275|  2.91k|  size_t pos = 0;
12276|  2.91k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12277|  2.91k|  uint32_t protocol_end = 0;
12278|  2.91k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12279|  2.91k|    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|  2.91k|  if (len >= 8) {
  ------------------
  |  Branch (12282:7): [True: 2.91k, False: 0]
  ------------------
12283|  2.91k|    uint64_t first8 = 0;
12284|  2.91k|    std::memcpy(&first8, b, 8);
12285|  2.91k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12285:9): [True: 2.91k, False: 0]
  ------------------
12286|  2.91k|      pos = 8;
12287|  2.91k|      scheme_type = ada::scheme::type::HTTPS;
12288|  2.91k|      protocol_end = 6;
12289|  2.91k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12289:16): [True: 0, False: 0]
  ------------------
12290|      0|               0x002f2f3a70747468ull) {  // "http://"
12291|      0|      pos = 7;
12292|      0|      scheme_type = ada::scheme::type::HTTP;
12293|      0|      protocol_end = 5;
12294|      0|    } 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|  2.91k|  } 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|  2.91k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12371:7): [True: 2.91k, False: 0]
  |  Branch (12371:21): [True: 0, False: 2.91k]
  |  Branch (12371:38): [True: 0, False: 2.91k]
  ------------------
12372|      0|    return false;
12373|      0|  }
12374|       |
12375|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12376|  2.91k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12376:7): [True: 2.91k, False: 0]
  |  Branch (12376:22): [True: 2.91k, False: 0]
  |  Branch (12376:39): [True: 0, False: 2.91k]
  |  Branch (12376:57): [True: 0, False: 2.91k]
  ------------------
12377|      0|    return false;
12378|      0|  }
12379|       |
12380|  2.91k|  const size_t host_start = pos;
12381|  2.91k|  bool has_upper = false;
12382|  2.91k|  bool has_x = false;
12383|  2.91k|  size_t host_end = pos;
12384|  2.91k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12384:7): [True: 0, False: 2.91k]
  ------------------
12385|      0|    return false;
12386|      0|  }
12387|  2.91k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12387:7): [True: 0, False: 2.91k]
  ------------------
12388|      0|    return false;
12389|      0|  }
12390|  2.91k|  const size_t host_len = host_end - host_start;
12391|  2.91k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12391:7): [True: 0, False: 2.91k]
  ------------------
12392|      0|    return false;
12393|      0|  }
12394|  2.91k|  {
12395|  2.91k|    std::string_view hv(input.data() + host_start, host_len);
12396|  2.91k|    char host_buf[256];
12397|  2.91k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12397:9): [True: 0, False: 2.91k]
  ------------------
12398|      0|      std::memcpy(host_buf, input.data() + host_start, host_len);
12399|      0|      unicode::to_lower_ascii(host_buf, host_len);
12400|      0|      hv = std::string_view(host_buf, host_len);
12401|      0|    }
12402|  2.91k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12402:9): [True: 0, False: 2.91k]
  ------------------
12403|      0|      return false;
12404|      0|    }
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|  2.91k|    static constexpr std::string_view xn{"xn-", 3};
12408|  2.91k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12408:10): [True: 2.91k, False: 0]
  |  Branch (12408:19): [True: 0, False: 0]
  |  Branch (12408:33): [True: 0, False: 2.91k]
  ------------------
12409|      0|        [[unlikely]] {
12410|      0|      return false;
12411|      0|    }
12412|  2.91k|  }
12413|       |
12414|  2.91k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12414:7): [True: 2.91k, False: 0]
  |  Branch (12414:25): [True: 0, False: 2.91k]
  ------------------
12415|      0|    return finish_simple_absolute_with_port(input, out, scheme_type,
12416|      0|                                            protocol_end, host_start, host_end,
12417|      0|                                            host_len, has_upper);
12418|      0|  }
12419|       |
12420|  2.91k|  size_t i = host_end;
12421|  2.91k|  size_t path_start = host_end;
12422|  2.91k|  size_t path_end = host_end;
12423|  2.91k|  size_t query_start = std::string_view::npos;
12424|  2.91k|  size_t hash_start = std::string_view::npos;
12425|  2.91k|  bool has_path = false;
12426|  2.91k|  bool maybe_dot_segment = false;
12427|  2.91k|  bool rest_simple = true;
12428|       |
12429|  2.91k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12429:7): [True: 2.91k, False: 0]
  |  Branch (12429:18): [True: 2.91k, False: 0]
  ------------------
12430|  2.91k|    has_path = true;
12431|  2.91k|    path_start = i;
12432|  2.91k|    ++i;
12433|  2.91k|    scan_path_run(b, i, len, maybe_dot_segment);
12434|  2.91k|    if (i < len) {
  ------------------
  |  Branch (12434:9): [True: 2.91k, False: 0]
  ------------------
12435|  2.91k|      const uint8_t cls = k_path[b[i]];
12436|  2.91k|      if (cls == 1) {
  ------------------
  |  Branch (12436:11): [True: 2.91k, False: 0]
  ------------------
12437|  2.91k|        path_end = i;
12438|  2.91k|        if (b[i] == '?') {
  ------------------
  |  Branch (12438:13): [True: 2.91k, False: 0]
  ------------------
12439|  2.91k|          query_start = i;
12440|  2.91k|          ++i;
12441|  2.91k|          goto scan_query;
12442|  2.91k|        }
12443|      0|        hash_start = i;
12444|      0|        ++i;
12445|      0|        goto scan_hash;
12446|  2.91k|      }
12447|      0|      rest_simple = false;
12448|      0|      hash_start = input.find('#', i);
12449|      0|      query_start = input.substr(0, hash_start).find('?', i);
12450|      0|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12450:11): [True: 0, False: 0]
  ------------------
12451|      0|        path_end = query_start;
12452|      0|      } else {
12453|      0|        path_end = hash_start != std::string_view::npos ? hash_start : len;
  ------------------
  |  Branch (12453:20): [True: 0, False: 0]
  ------------------
12454|      0|      }
12455|      0|      goto after_rest;
12456|  2.91k|    }
12457|      0|    path_end = i;
12458|      0|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12458:14): [True: 0, False: 0]
  |  Branch (12458:25): [True: 0, False: 0]
  ------------------
12459|      0|    query_start = i;
12460|      0|    ++i;
12461|      0|    goto scan_query;
12462|      0|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12462:14): [True: 0, False: 0]
  |  Branch (12462:25): [True: 0, False: 0]
  ------------------
12463|      0|    hash_start = i;
12464|      0|    ++i;
12465|      0|    goto scan_hash;
12466|      0|  }
12467|      0|  goto after_rest;
12468|       |
12469|  2.91k|scan_query:
12470|  2.91k|  scan_query_run(b, i, len);
12471|  2.91k|  if (i < len) {
  ------------------
  |  Branch (12471:7): [True: 1.53k, False: 1.37k]
  ------------------
12472|  1.53k|    if (b[i] == '#') {
  ------------------
  |  Branch (12472:9): [True: 219, False: 1.31k]
  ------------------
12473|    219|      hash_start = i;
12474|    219|      ++i;
12475|    219|      goto scan_hash;
12476|    219|    }
12477|  1.31k|    rest_simple = false;
12478|  1.31k|    goto scan_query_boundary;
12479|  1.53k|  }
12480|  1.37k|  goto after_rest;
12481|       |
12482|  1.37k|scan_query_boundary:
12483|  1.31k|  hash_start = input.find('#', i);
12484|  1.31k|  goto after_rest;
12485|       |
12486|    219|scan_hash:
12487|    219|  scan_hash_run(b, i, len);
12488|    219|  if (i < len) {
  ------------------
  |  Branch (12488:7): [True: 146, False: 73]
  ------------------
12489|    146|    rest_simple = false;
12490|    146|  }
12491|       |
12492|  2.91k|after_rest:
12493|  2.91k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12493:7): [True: 1.44k, False: 1.46k]
  |  Branch (12493:22): [True: 0, False: 1.44k]
  ------------------
12494|      0|    const std::string_view path_body(input.data() + path_start,
12495|      0|                                     path_end - path_start);
12496|      0|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12496:9): [True: 0, False: 0]
  ------------------
12497|      0|      rest_simple = false;
12498|      0|    }
12499|      0|  }
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|  2.91k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12506:7): [True: 1.46k, False: 1.44k]
  |  Branch (12506:24): [True: 350, False: 1.11k]
  ------------------
12507|  1.11k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12507:24): [True: 164, False: 951]
  ------------------
12508|    514|    return false;
12509|    514|  }
12510|       |
12511|  2.39k|  out.type = scheme_type;
12512|  2.39k|  out.is_valid = true;
12513|  2.39k|  out.has_opaque_path = false;
12514|  2.39k|  out.host_type = DEFAULT;
12515|       |
12516|  2.39k|  if (!rest_simple) {
  ------------------
  |  Branch (12516:7): [True: 951, False: 1.44k]
  ------------------
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|    951|    const std::string_view path_view =
12521|    951|        has_path
  ------------------
  |  Branch (12521:9): [True: 951, False: 0]
  ------------------
12522|    951|            ? std::string_view(input.data() + path_start, path_end - path_start)
12523|    951|            : std::string_view{};
12524|    951|    auto apply_query_and_hash = [&]() {
12525|    951|      if (query_start != std::string_view::npos) {
12526|    951|        const size_t q_end =
12527|    951|            (hash_start != std::string_view::npos) ? hash_start : len;
12528|    951|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12529|    951|                                                q_end - query_start - 1),
12530|    951|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12531|    951|      }
12532|    951|      if (hash_start != std::string_view::npos) {
12533|    951|        out.update_unencoded_base_hash(std::string_view(
12534|    951|            input.data() + hash_start + 1, len - hash_start - 1));
12535|    951|      }
12536|    951|    };
12537|    951|    if constexpr (is_aggregator) {
12538|    951|      out.buffer.assign(input.substr(0, host_end));
12539|    951|      if (has_upper) {
  ------------------
  |  Branch (12539:11): [True: 0, False: 951]
  ------------------
12540|      0|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12541|      0|      }
12542|    951|      out.components.protocol_end = protocol_end;
12543|    951|      out.components.username_end = protocol_end + 2;
12544|    951|      out.components.host_start = protocol_end + 2;
12545|    951|      out.components.host_end = static_cast<uint32_t>(host_end);
12546|    951|      out.components.port = url_components::omitted;
12547|    951|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12548|    951|      out.components.search_start = url_components::omitted;
12549|    951|      out.components.hash_start = url_components::omitted;
12550|    951|      out.parse_path(path_view);
12551|    951|      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|    951|    return true;
12562|    951|  }
12563|       |
12564|  1.44k|  const bool need_slash = !has_path;
12565|  1.44k|  if constexpr (is_aggregator) {
12566|  1.44k|    if (!need_slash) {
  ------------------
  |  Branch (12566:9): [True: 1.44k, False: 0]
  ------------------
12567|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12568|  1.44k|      out.buffer.assign(input);
12569|  1.44k|      if (has_upper) {
  ------------------
  |  Branch (12569:11): [True: 0, False: 1.44k]
  ------------------
12570|      0|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12571|      0|      }
12572|  1.44k|      out.components.protocol_end = protocol_end;
12573|  1.44k|      out.components.username_end = protocol_end + 2;
12574|  1.44k|      out.components.host_start = protocol_end + 2;
12575|  1.44k|      out.components.host_end = static_cast<uint32_t>(host_end);
12576|  1.44k|      out.components.port = url_components::omitted;
12577|  1.44k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12578|  1.44k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12578:37): [True: 1.44k, False: 0]
  ------------------
12579|  1.44k|                                        ? static_cast<uint32_t>(query_start)
12580|  1.44k|                                        : url_components::omitted;
12581|  1.44k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12581:35): [True: 73, False: 1.37k]
  ------------------
12582|  1.44k|                                      ? static_cast<uint32_t>(hash_start)
12583|  1.44k|                                      : url_components::omitted;
12584|  1.44k|    } else {
12585|      0|      out.buffer.clear();
12586|      0|      out.buffer.reserve(len + 1);
12587|      0|      out.buffer.append(input.substr(0, host_end));
12588|      0|      out.buffer.push_back('/');
12589|      0|      if (host_end < len) {
  ------------------
  |  Branch (12589:11): [True: 0, False: 0]
  ------------------
12590|      0|        out.buffer.append(input.substr(host_end));
12591|      0|      }
12592|      0|      if (has_upper) {
  ------------------
  |  Branch (12592:11): [True: 0, False: 0]
  ------------------
12593|      0|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12594|      0|      }
12595|      0|      out.components.protocol_end = protocol_end;
12596|      0|      out.components.username_end = protocol_end + 2;
12597|      0|      out.components.host_start = protocol_end + 2;
12598|      0|      out.components.host_end = static_cast<uint32_t>(host_end);
12599|      0|      out.components.port = url_components::omitted;
12600|      0|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12601|      0|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12601:37): [True: 0, False: 0]
  ------------------
12602|      0|                                        ? static_cast<uint32_t>(query_start + 1)
12603|      0|                                        : url_components::omitted;
12604|      0|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12604:35): [True: 0, False: 0]
  ------------------
12605|      0|                                      ? static_cast<uint32_t>(hash_start + 1)
12606|      0|                                      : url_components::omitted;
12607|      0|    }
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|  1.44k|  return true;
12630|  2.39k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12819|  2.91k|                           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|  2.91k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12826|  2.91k|  constexpr bool result_type_is_ada_url_aggregator =
12827|  2.91k|      std::is_same_v<url_aggregator, result_type>;
12828|  2.91k|  static_assert(result_type_is_ada_url ||
12829|  2.91k|                result_type_is_ada_url_aggregator);  // We don't support
12830|       |                                                     // anything else for now.
12831|       |
12832|  2.91k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12833|  2.91k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12834|  2.91k|          ")");
12835|       |
12836|  2.91k|  result_type url{};
12837|       |
12838|  2.91k|  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|  2.91k|  const auto enforce_max_input_length = [&]() {
12848|  2.91k|    if constexpr (store_values) {
12849|  2.91k|      if (url.is_valid) {
12850|  2.91k|        if constexpr (result_type_is_ada_url_aggregator) {
12851|  2.91k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12852|  2.91k|            url.is_valid = false;
12853|  2.91k|          }
12854|  2.91k|        } else {
12855|  2.91k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12856|  2.91k|            url.is_valid = false;
12857|  2.91k|          }
12858|  2.91k|        }
12859|  2.91k|      }
12860|  2.91k|    }
12861|  2.91k|  };
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|  2.91k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12866:7): [True: 0, False: 2.91k]
  ------------------
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|  2.91k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12872:7): [True: 0, False: 2.91k]
  ------------------
12873|      0|    url.is_valid &= base_url->is_valid;
12874|      0|  }
12875|  2.91k|  if (!url.is_valid) {
  ------------------
  |  Branch (12875:7): [True: 0, False: 2.91k]
  ------------------
12876|      0|    return url;
12877|      0|  }
12878|       |
12879|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12880|  2.91k|  if constexpr (store_values) {
12881|  2.91k|    bool hit_fast_path = false;
12882|  2.91k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12882:9): [True: 2.91k, 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|  2.91k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12886|  2.91k|      const size_t n = user_input.size();
12887|  2.91k|      size_t host_start = 0;
12888|  2.91k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12888:11): [True: 2.91k, False: 0]
  |  Branch (12888:21): [True: 0, False: 2.91k]
  |  Branch (12888:36): [True: 0, False: 0]
  |  Branch (12888:51): [True: 0, False: 0]
  ------------------
12889|      0|        host_start = 7;
12890|  2.91k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12890:18): [True: 2.91k, False: 0]
  |  Branch (12890:28): [True: 2.91k, False: 0]
  |  Branch (12890:43): [True: 2.91k, False: 0]
  |  Branch (12890:58): [True: 2.91k, False: 0]
  ------------------
12891|  2.91k|        host_start = 8;
12892|  2.91k|      }
12893|  2.91k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12893:34): [True: 2.91k, False: 0]
  ------------------
12894|  2.91k|      const bool skip_ip =
12895|  2.91k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12895:11): [True: 0, False: 2.91k]
  |  Branch (12895:33): [True: 2.91k, False: 0]
  |  Branch (12895:54): [True: 0, False: 2.91k]
  ------------------
12896|  2.91k|      const bool skip_userinfo =
12897|  2.91k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12897:11): [True: 2.91k, False: 0]
  |  Branch (12897:30): [True: 0, False: 2.91k]
  ------------------
12898|  2.91k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12898:23): [True: 2.91k, False: 0]
  |  Branch (12898:35): [True: 2.91k, False: 0]
  ------------------
12899|  2.91k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12899:23): [True: 2.39k, False: 514]
  ------------------
12900|  2.91k|    } else {
12901|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12902|      0|    }
12903|  2.91k|    if (hit_fast_path) {
  ------------------
  |  Branch (12903:9): [True: 2.39k, False: 514]
  ------------------
12904|  2.39k|      if constexpr (result_type_is_ada_url_aggregator) {
12905|  2.39k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12905:13): [True: 0, False: 2.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|  2.39k|      return url;
12920|  2.39k|    }
12921|  2.91k|  }
12922|       |
12923|    514|  state state = state::SCHEME_START;
12924|       |
12925|  2.91k|  std::string tmp_buffer;
12926|  2.91k|  std::string_view url_data;
12927|  2.91k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12927:7): [True: 266, False: 2.64k]
  ------------------
12928|    266|    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|    266|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12932|    266|    url_data = tmp_buffer;
12933|  2.64k|  } else [[likely]] {
12934|  2.64k|    url_data = user_input;
12935|  2.64k|  }
12936|       |
12937|       |  // Leading and trailing control characters are uncommon and easy to deal with
12938|       |  // (no performance concern).
12939|  2.91k|  helpers::trim_c0_whitespace(url_data);
12940|       |
12941|  2.91k|  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|  2.91k|    uint32_t reserve_capacity =
12954|  2.91k|        (0xFFFFFFFF >>
12955|  2.91k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12956|  2.91k|        1;
12957|  2.91k|    url.reserve(reserve_capacity);
12958|  2.91k|  }
12959|       |
12960|       |  // Optimization opportunity. Most websites do not have fragment.
12961|  2.91k|  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|  2.91k|  size_t input_position = 0;
12971|  2.91k|  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|  6.51k|  while (input_position <= input_size) {
  ------------------
  |  Branch (12976:10): [True: 4.11k, False: 2.39k]
  ------------------
12977|  4.11k|    ada_log("In parsing at ", input_position, " out of ", input_size,
12978|  4.11k|            " in state ", ada::to_string(state));
12979|  4.11k|    switch (state) {
12980|    514|      case state::SCHEME_START: {
  ------------------
  |  Branch (12980:7): [True: 514, False: 3.59k]
  ------------------
12981|    514|        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|    514|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12984:13): [True: 514, False: 0]
  ------------------
12985|    514|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12985:13): [True: 514, False: 0]
  ------------------
12986|    514|          state = state::SCHEME;
12987|    514|          input_position++;
12988|    514|        } 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|    514|        break;
12994|      0|      }
12995|    514|      case state::SCHEME: {
  ------------------
  |  Branch (12995:7): [True: 514, False: 3.59k]
  ------------------
12996|    514|        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|  2.57k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12999:16): [True: 2.57k, False: 0]
  ------------------
13000|  2.57k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13000:16): [True: 2.05k, False: 514]
  ------------------
13001|  2.05k|          input_position++;
13002|  2.05k|        }
13003|       |        // Otherwise, if c is U+003A (:), then:
13004|    514|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13004:13): [True: 514, False: 0]
  ------------------
13005|    514|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13005:13): [True: 514, False: 0]
  ------------------
13006|    514|          ada_log("SCHEME the scheme should be ",
13007|    514|                  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|    514|          } else {
13013|       |            // we pass the colon along instead of painfully adding it back.
13014|    514|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (13014:17): [True: 0, False: 514]
  ------------------
13015|    514|                    url_data.substr(0, input_position + 1))) {
13016|      0|              return url;
13017|      0|            }
13018|    514|          }
13019|    514|          ada_log("SCHEME the scheme is ", url.get_protocol());
13020|       |
13021|       |          // If url's scheme is "file", then:
13022|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13023|    514|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13023:15): [True: 0, False: 514]
  ------------------
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|    514|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13030:20): [True: 514, False: 0]
  |  Branch (13030:40): [True: 0, False: 514]
  ------------------
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|    514|          else if (url.is_special()) {
  ------------------
  |  Branch (13037:20): [True: 514, False: 0]
  ------------------
13038|    514|            state = state::SPECIAL_AUTHORITY_SLASHES;
13039|    514|          }
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|    514|        }
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|    514|        input_position++;
13062|    514|        break;
13063|    514|      }
13064|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13064:7): [True: 0, False: 4.11k]
  ------------------
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|    514|      case state::AUTHORITY: {
  ------------------
  |  Branch (13117:7): [True: 514, False: 3.59k]
  ------------------
13118|    514|        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|    514|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13129:13): [True: 453, False: 61]
  ------------------
13130|    453|          state = state::HOST;
13131|    453|          break;
13132|    453|        }
13133|     61|        bool at_sign_seen{false};
13134|     61|        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|     61|        do {
13141|     61|          std::string_view view = url_data.substr(input_position);
13142|       |          // The delimiters are @, /, ? \\.
13143|     61|          size_t location =
13144|     61|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13144:15): [True: 61, False: 0]
  ------------------
13145|     61|                               : helpers::find_authority_delimiter(view);
13146|     61|          std::string_view authority_view = view.substr(0, location);
13147|     61|          size_t end_of_authority = input_position + authority_view.size();
13148|       |          // If c is U+0040 (@), then:
13149|     61|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13149:15): [True: 61, False: 0]
  ------------------
13150|     61|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13150:15): [True: 0, False: 61]
  ------------------
13151|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13152|      0|            if (at_sign_seen) {
  ------------------
  |  Branch (13152:17): [True: 0, False: 0]
  ------------------
13153|      0|              if (password_token_seen) {
  ------------------
  |  Branch (13153:19): [True: 0, False: 0]
  ------------------
13154|       |                if constexpr (result_type_is_ada_url) {
13155|       |                  url.password += "%40";
13156|      0|                } else {
13157|      0|                  url.append_base_password("%40");
13158|      0|                }
13159|      0|              } else {
13160|       |                if constexpr (result_type_is_ada_url) {
13161|       |                  url.username += "%40";
13162|      0|                } else {
13163|      0|                  url.append_base_username("%40");
13164|      0|                }
13165|      0|              }
13166|      0|            }
13167|       |
13168|      0|            at_sign_seen = true;
13169|       |
13170|      0|            if (!password_token_seen) {
  ------------------
  |  Branch (13170:17): [True: 0, False: 0]
  ------------------
13171|      0|              size_t password_token_location = authority_view.find(':');
13172|      0|              password_token_seen =
13173|      0|                  password_token_location != std::string_view::npos;
13174|       |
13175|      0|              if constexpr (store_values) {
13176|      0|                if (!password_token_seen) {
  ------------------
  |  Branch (13176:21): [True: 0, False: 0]
  ------------------
13177|       |                  if constexpr (result_type_is_ada_url) {
13178|       |                    url.username += unicode::percent_encode(
13179|       |                        authority_view,
13180|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13181|      0|                  } else {
13182|      0|                    url.append_base_username(unicode::percent_encode(
13183|      0|                        authority_view,
13184|      0|                        character_sets::USERINFO_PERCENT_ENCODE));
13185|      0|                  }
13186|      0|                } 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|      0|                  } else {
13195|      0|                    url.append_base_username(unicode::percent_encode(
13196|      0|                        authority_view.substr(0, password_token_location),
13197|      0|                        character_sets::USERINFO_PERCENT_ENCODE));
13198|      0|                    url.append_base_password(unicode::percent_encode(
13199|      0|                        authority_view.substr(password_token_location + 1),
13200|      0|                        character_sets::USERINFO_PERCENT_ENCODE));
13201|      0|                  }
13202|      0|                }
13203|      0|              }
13204|      0|            } 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|      0|              } else {
13209|      0|                url.append_base_password(unicode::percent_encode(
13210|      0|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13211|      0|              }
13212|      0|            }
13213|      0|          }
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|     61|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13217:20): [True: 0, False: 61]
  ------------------
13218|     61|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13218:20): [True: 61, False: 0]
  ------------------
13219|      0|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13219:20): [True: 0, False: 0]
  ------------------
13220|     61|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13220:21): [True: 0, False: 0]
  |  Branch (13220:41): [True: 0, False: 0]
  ------------------
13221|       |            // If atSignSeen is true and authority_view is the empty string,
13222|       |            // validation error, return failure.
13223|     61|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13223:17): [True: 0, False: 61]
  |  Branch (13223:33): [True: 0, False: 0]
  ------------------
13224|      0|              url.is_valid = false;
13225|      0|              return url;
13226|      0|            }
13227|     61|            state = state::HOST;
13228|     61|            break;
13229|     61|          }
13230|      0|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13230:15): [True: 0, False: 0]
  ------------------
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|      0|          input_position = end_of_authority + 1;
13240|      0|        } while (true);
  ------------------
  |  Branch (13240:18): [True: 0, Folded]
  ------------------
13241|       |
13242|     61|        break;
13243|     61|      }
13244|     61|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13244:7): [True: 0, False: 4.11k]
  ------------------
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|     61|      }
13262|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13262:7): [True: 0, False: 4.11k]
  ------------------
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|     61|      }
13278|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13278:7): [True: 0, False: 4.11k]
  ------------------
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: 4.11k]
  ------------------
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|    514|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13404:7): [True: 514, False: 3.59k]
  ------------------
13405|    514|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13406|    514|                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|    514|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13411:13): [True: 514, False: 0]
  ------------------
13412|    514|          input_position += 2;
13413|    514|        }
13414|       |
13415|    514|        [[fallthrough]];
13416|    514|      }
13417|    514|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13417:7): [True: 0, False: 4.11k]
  ------------------
13418|    514|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13419|    514|                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|    514|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13423:16): [True: 514, False: 0]
  ------------------
13424|    514|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13424:17): [True: 0, False: 514]
  ------------------
13425|    514|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13425:17): [True: 0, False: 514]
  ------------------
13426|      0|          input_position++;
13427|      0|        }
13428|    514|        state = state::AUTHORITY;
13429|       |
13430|    514|        break;
13431|    514|      }
13432|    514|      case state::QUERY: {
  ------------------
  |  Branch (13432:7): [True: 514, False: 3.59k]
  ------------------
13433|    514|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13434|    514|        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|    514|          const uint8_t* query_percent_encode_set =
13438|    514|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13438:15): [True: 514, False: 0]
  ------------------
13439|    514|                               : 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|    514|          url.update_base_search(url_data.substr(input_position),
13444|    514|                                 query_percent_encode_set);
13445|    514|          ada_log("QUERY update_base_search completed ");
13446|    514|          if (fragment.has_value()) {
  ------------------
  |  Branch (13446:15): [True: 115, False: 399]
  ------------------
13447|    115|            url.update_unencoded_base_hash(*fragment);
13448|    115|          }
13449|    514|        }
13450|    514|        enforce_max_input_length();
13451|    514|        return url;
13452|    514|      }
13453|    514|      case state::HOST: {
  ------------------
  |  Branch (13453:7): [True: 514, False: 3.59k]
  ------------------
13454|    514|        ada_log("HOST ", helpers::substring(url_data, input_position));
13455|       |
13456|    514|        std::string_view host_view = url_data.substr(input_position);
13457|    514|        auto [location, found_colon] =
13458|    514|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13459|    514|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13459:26): [True: 514, False: 0]
  ------------------
13460|    514|                             ? input_position + location
13461|    514|                             : 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|    514|        if (found_colon) {
  ------------------
  |  Branch (13465:13): [True: 0, False: 514]
  ------------------
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|      0|          ada_log("HOST parsing ", host_view);
13470|      0|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13470:15): [True: 0, False: 0]
  ------------------
13471|      0|            return url;
13472|      0|          }
13473|      0|          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|      0|          state = state::PORT;
13477|      0|          input_position++;
13478|      0|        }
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|    514|        else {
13485|       |          // If url is special and host_view is the empty string, validation
13486|       |          // error, return failure.
13487|    514|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13487:15): [True: 0, False: 514]
  |  Branch (13487:36): [True: 0, False: 0]
  ------------------
13488|      0|            url.is_valid = false;
13489|      0|            return url;
13490|      0|          }
13491|    514|          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|    514|          if (host_view.empty()) {
  ------------------
  |  Branch (13494:15): [True: 0, False: 514]
  ------------------
13495|      0|            url.update_base_hostname("");
13496|    514|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13496:22): [True: 0, False: 514]
  ------------------
13497|      0|            return url;
13498|      0|          }
13499|    514|          ada_log("HOST parsing results in ", url.get_hostname(),
13500|    514|                  " href=", url.get_href());
13501|       |
13502|       |          // Set url's host to host, and state to path start state.
13503|    514|          state = state::PATH_START;
13504|    514|        }
13505|       |
13506|    514|        break;
13507|    514|      }
13508|    514|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13508:7): [True: 0, False: 4.11k]
  ------------------
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|    514|      }
13547|      0|      case state::PORT: {
  ------------------
  |  Branch (13547:7): [True: 0, False: 4.11k]
  ------------------
13548|      0|        ada_log("PORT ", helpers::substring(url_data, input_position));
13549|      0|        std::string_view port_view = url_data.substr(input_position);
13550|      0|        input_position += url.parse_port(port_view, true);
13551|      0|        if (!url.is_valid) {
  ------------------
  |  Branch (13551:13): [True: 0, False: 0]
  ------------------
13552|      0|          return url;
13553|      0|        }
13554|      0|        state = state::PATH_START;
13555|      0|        [[fallthrough]];
13556|      0|      }
13557|    514|      case state::PATH_START: {
  ------------------
  |  Branch (13557:7): [True: 514, False: 3.59k]
  ------------------
13558|    514|        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|    514|        if (url.is_special()) {
  ------------------
  |  Branch (13568:13): [True: 514, False: 0]
  ------------------
13569|       |          // Set state to path state.
13570|    514|          state = state::PATH;
13571|       |
13572|       |          // Optimization: Avoiding going into PATH state improves the
13573|       |          // performance of urls ending with /.
13574|    514|          if (input_position == input_size) {
  ------------------
  |  Branch (13574:15): [True: 0, False: 514]
  ------------------
13575|      0|            if constexpr (store_values) {
13576|      0|              url.update_base_pathname("/");
13577|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13577:19): [True: 0, False: 0]
  ------------------
13578|      0|                url.update_unencoded_base_hash(*fragment);
13579|      0|              }
13580|      0|            }
13581|      0|            enforce_max_input_length();
13582|      0|            return url;
13583|      0|          }
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|    514|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13587:15): [True: 0, False: 514]
  ------------------
13588|      0|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13588:15): [True: 0, False: 0]
  ------------------
13589|      0|            break;
13590|      0|          }
13591|    514|        }
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|    514|        input_position++;
13610|    514|        break;
13611|    514|      }
13612|    514|      case state::PATH: {
  ------------------
  |  Branch (13612:7): [True: 514, False: 3.59k]
  ------------------
13613|    514|        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|    514|        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|    514|        size_t locofquestionmark = view.find('?');
13626|    514|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13626:13): [True: 514, False: 0]
  ------------------
13627|    514|          state = state::QUERY;
13628|    514|          view.remove_suffix(view.size() - locofquestionmark);
13629|    514|          input_position += locofquestionmark + 1;
13630|    514|        } else {
13631|      0|          input_position = input_size + 1;
13632|      0|        }
13633|    514|        if constexpr (store_values) {
13634|       |          if constexpr (result_type_is_ada_url) {
13635|       |            helpers::parse_prepared_path(view, url.type, url.path);
13636|    514|          } else {
13637|    514|            url.consume_prepared_path(view);
13638|    514|            ADA_ASSERT_TRUE(url.validate());
13639|    514|          }
13640|    514|        }
13641|    514|        break;
13642|    514|      }
13643|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13643:7): [True: 0, False: 4.11k]
  ------------------
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|    514|      }
13699|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13699:7): [True: 0, False: 4.11k]
  ------------------
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: 4.11k]
  ------------------
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: 4.11k]
  ------------------
13829|      0|        unreachable();
13830|  4.11k|    }
13831|  4.11k|  }
13832|  2.39k|  if constexpr (store_values) {
13833|  2.39k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13833:9): [True: 0, False: 2.39k]
  ------------------
13834|      0|      url.update_unencoded_base_hash(*fragment);
13835|      0|    }
13836|  2.39k|  }
13837|  2.39k|  enforce_max_input_length();
13838|  2.39k|  return url;
13839|  2.91k|}
_ZNK3ada14url_aggregator23needs_rollback_snapshotEm:
14131|  1.53k|bool url_aggregator::needs_rollback_snapshot(size_t input_len) const noexcept {
14132|       |  // 3x should cover worst-case percent-encoding of every input byte; the
14133|       |  // constant covers the handful of delimiter bytes a setter may add ("/.", "?",
14134|       |  // "#" and so on)
14135|  1.53k|  return buffer.size() + input_len * 3 + 16 > ada::get_max_input_length();
14136|  1.53k|}
_ZN3ada14url_aggregator10set_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14353|  2.91k|void url_aggregator::set_search(const std::string_view input) {
14354|  2.91k|  ada_log("url_aggregator::set_search ", input);
14355|  2.91k|  ADA_ASSERT_TRUE(validate());
14356|  2.91k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14357|  2.91k|  if (input.empty()) {
  ------------------
  |  Branch (14357:7): [True: 1.37k, False: 1.53k]
  ------------------
14358|  1.37k|    clear_search();
14359|  1.37k|    helpers::strip_trailing_spaces_from_opaque_path(*this);
14360|  1.37k|    return;
14361|  1.37k|  }
14362|       |
14363|  1.53k|  std::string_view stripped = input[0] == '?' ? input.substr(1) : input;
  ------------------
  |  Branch (14363:31): [True: 0, False: 1.53k]
  ------------------
14364|       |  // Fast path: no tabs/newlines (the common case) avoids the std::string
14365|       |  // allocation entirely by passing the view straight to update_base_search.
14366|  1.53k|  std::string cleaned;
14367|  1.53k|  std::string_view effective = stripped;
14368|  1.53k|  if (unicode::has_tabs_or_newline(stripped)) {
  ------------------
  |  Branch (14368:7): [True: 0, False: 1.53k]
  ------------------
14369|      0|    cleaned = stripped;
14370|      0|    helpers::remove_ascii_tab_or_newline(cleaned);
14371|      0|    effective = cleaned;
14372|      0|  }
14373|       |
14374|  1.53k|  auto query_percent_encode_set =
14375|  1.53k|      is_special() ? ada::character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (14375:7): [True: 1.53k, False: 0]
  ------------------
14376|  1.53k|                   : ada::character_sets::QUERY_PERCENT_ENCODE;
14377|       |
14378|  1.53k|  std::optional<url_aggregator> saved_url;
14379|  1.53k|  if (needs_rollback_snapshot(effective.size())) {
  ------------------
  |  Branch (14379:7): [True: 0, False: 1.53k]
  ------------------
14380|      0|    saved_url = *this;
14381|      0|  }
14382|  1.53k|  update_base_search(effective, query_percent_encode_set);
14383|  1.53k|  if (saved_url && buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (14383:7): [True: 0, False: 1.53k]
  |  Branch (14383:20): [True: 0, False: 0]
  ------------------
14384|      0|    *this = std::move(*saved_url);
14385|      0|    return;
14386|      0|  }
14387|  1.53k|  ADA_ASSERT_TRUE(validate());
14388|  1.53k|}
_ZNK3ada14url_aggregator10get_searchEv:
14870|  2.91k|    ada_lifetime_bound {
14871|  2.91k|  ada_log("url_aggregator::get_search");
14872|       |  // If this's URL's query is either null or the empty string, then return the
14873|       |  // empty string. Return U+003F (?), followed by this's URL's query.
14874|  2.91k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (14874:7): [True: 0, False: 2.91k]
  ------------------
14875|      0|    return "";
14876|      0|  }
14877|  2.91k|  auto ending_index = uint32_t(buffer.size());
14878|  2.91k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (14878:7): [True: 383, False: 2.52k]
  ------------------
14879|    383|    ending_index = components.hash_start;
14880|    383|  }
14881|  2.91k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (14881:7): [True: 1.31k, False: 1.59k]
  ------------------
14882|  1.31k|    return "";
14883|  1.31k|  }
14884|  1.59k|  return helpers::substring(buffer, components.search_start, ending_index);
14885|  2.91k|}
_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|      4|  bool build(const uint8_t* lens, int n) {
  430|      4|    std::memset(counts, 0, sizeof(counts));
  431|      4|    std::memset(first_code, 0, sizeof(first_code));
  432|      4|    std::memset(base_idx, 0, sizeof(base_idx));
  433|      4|    nsymbols = n;
  434|      4|    max_bits = 0;
  435|    644|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (435:21): [True: 640, False: 4]
  ------------------
  436|    640|      lengths[i] = lens[i];
  437|    640|      if (lens[i]) {
  ------------------
  |  Branch (437:11): [True: 640, False: 0]
  ------------------
  438|    640|        counts[lens[i]]++;
  439|    640|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (439:13): [True: 6, False: 634]
  ------------------
  440|    640|      }
  441|    640|    }
  442|       |    // Canonical first code for each bit length (RFC 1951).
  443|      4|    int code = 0;
  444|     64|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (444:24): [True: 60, False: 4]
  ------------------
  445|     60|      code = (code + counts[bits - 1]) << 1;
  446|     60|      first_code[bits] = code;
  447|     60|    }
  448|      4|    int idx = 0;
  449|     32|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (449:24): [True: 28, False: 4]
  ------------------
  450|     28|      base_idx[bits] = idx;
  451|       |      // assign symbols in symbol order for codes of this length
  452|  5.53k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (452:25): [True: 5.50k, False: 28]
  ------------------
  453|  5.50k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (453:13): [True: 640, False: 4.86k]
  ------------------
  454|    640|          symbols[idx++] = static_cast<int16_t>(sym);
  455|    640|        }
  456|  5.50k|      }
  457|     28|    }
  458|      4|    return true;
  459|      4|  }
_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|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7620|   122k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7621|   122k|    return character_sets::bit_at(character_set, c);
 7622|   122k|  });
url_search_params.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7588|  94.1k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7589|  94.1k|    return character_sets::bit_at(character_set, c);
 7590|  94.1k|  });
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7974|  3.29k|                            const uint8_t character_set[], std::string& out) {
 7975|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7976|  3.29k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7977|  3.29k|#if ADA_UNICODE_SSSE3
 7978|  3.29k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7979|  3.29k|  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|  3.29k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7801|  3.29k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7802|  3.29k|  ssse3_percent_tables t{};
 7803|  3.29k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7804|  3.29k|  t.cs_hi =
 7805|  3.29k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7806|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7807|  3.29k|  t.pow2 =
 7808|  3.29k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7809|  3.29k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7810|  3.29k|  t.mask_07 = _mm_set1_epi8(0x07);
 7811|  3.29k|  t.zero = _mm_setzero_si128();
 7812|  3.29k|  return t;
 7813|  3.29k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7832|  3.29k|    const ssse3_percent_tables& tables, std::string& out) {
 7833|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7834|  13.5k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7834:10): [True: 10.2k, False: 3.29k]
  ------------------
 7835|  10.2k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7836|  10.2k|    const __m128i word1 =
 7837|  10.2k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7838|  10.2k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7839|  10.2k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7840|  10.2k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7840:9): [True: 596, False: 9.66k]
  ------------------
 7841|    596|      out.append(p, 32);
 7842|  9.66k|    } else {
 7843|  9.66k|      if (mask0 == 0) {
  ------------------
  |  Branch (7843:11): [True: 288, False: 9.37k]
  ------------------
 7844|    288|        out.append(p, 16);
 7845|  9.37k|      } else {
 7846|  9.37k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7847|  9.37k|      }
 7848|  9.66k|      if (mask1 == 0) {
  ------------------
  |  Branch (7848:11): [True: 539, False: 9.12k]
  ------------------
 7849|    539|        out.append(p + 16, 16);
 7850|  9.12k|      } else {
 7851|  9.12k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7852|  9.12k|      }
 7853|  9.66k|    }
 7854|  10.2k|    p += 32;
 7855|  10.2k|  }
 7856|  3.29k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7856:7): [True: 1.81k, False: 1.48k]
  ------------------
 7857|  1.81k|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7858|  1.81k|    const int mask = ssse3_percent_mask(word, tables);
 7859|  1.81k|    if (mask == 0) {
  ------------------
  |  Branch (7859:9): [True: 281, False: 1.53k]
  ------------------
 7860|    281|      out.append(p, 16);
 7861|  1.53k|    } else {
 7862|  1.53k|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7863|  1.53k|    }
 7864|  1.81k|    p += 16;
 7865|  1.81k|  }
 7866|  3.29k|  percent_encode_to_scalar(p, end, character_set, out);
 7867|  3.29k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7816|  22.3k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7817|  22.3k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7818|  22.3k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7819|  22.3k|  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|  22.3k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7822|  22.3k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7823|  22.3k|                                       _mm_andnot_si128(high_byte, lo));
 7824|  22.3k|  const __m128i bits =
 7825|  22.3k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7826|  22.3k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7827|  22.3k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7828|  22.3k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7756|  20.0k|                                          size_t width, std::string& out) {
 7757|  20.0k|  uint64_t bits = mask;
 7758|  20.0k|  size_t off = 0;
 7759|   286k|  while (bits != 0) {
  ------------------
  |  Branch (7759:10): [True: 266k, False: 20.0k]
  ------------------
 7760|   266k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7761|   266k|    if (zero_run != 0) {
  ------------------
  |  Branch (7761:9): [True: 16.1k, False: 250k]
  ------------------
 7762|  16.1k|      out.append(p + off, static_cast<size_t>(zero_run));
 7763|  16.1k|    }
 7764|   266k|    off += static_cast<size_t>(zero_run);
 7765|   266k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7766|   266k|    ++off;
 7767|   266k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7768|   266k|  }
 7769|  20.0k|  if (off < width) {
  ------------------
  |  Branch (7769:7): [True: 3.53k, False: 16.4k]
  ------------------
 7770|  3.53k|    out.append(p + off, width - off);
 7771|  3.53k|  }
 7772|  20.0k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7744|   266k|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|   266k|  return __builtin_ctz(input_num);
 7751|   266k|#endif
 7752|   266k|}
url_search_params.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7777|  3.29k|                                                std::string& out) {
 7778|  19.7k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7778:10): [True: 16.4k, False: 3.29k]
  ------------------
 7779|  16.4k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7779:9): [True: 11.8k, False: 4.64k]
  ------------------
 7780|  11.8k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7781|  11.8k|    } else {
 7782|  4.64k|      out += *p;
 7783|  4.64k|    }
 7784|  16.4k|  }
 7785|  3.29k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7130|  4.38k|    std::string_view user_input) noexcept {
 7131|       |  // first check for short strings in which case we do it naively.
 7132|  4.38k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (7132:7): [True: 1.63k, False: 2.75k]
  ------------------
 7133|  1.63k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 7134|  1.63k|  }
 7135|       |  // fast path for long strings (expected to be common)
 7136|  2.75k|  size_t i = 0;
 7137|  2.75k|  const __m128i mask1 = _mm_set1_epi8('\r');
 7138|  2.75k|  const __m128i mask2 = _mm_set1_epi8('\n');
 7139|  2.75k|  const __m128i mask3 = _mm_set1_epi8('\t');
 7140|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 7141|  2.75k|  __m128i running{0};
 7142|  18.7k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (7142:10): [True: 15.9k, False: 2.75k]
  ------------------
 7143|  15.9k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 7144|  15.9k|    running = _mm_or_si128(
 7145|  15.9k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7146|  15.9k|                                           _mm_cmpeq_epi8(word, mask2))),
 7147|  15.9k|        _mm_cmpeq_epi8(word, mask3));
 7148|  15.9k|  }
 7149|  2.75k|  if (i < user_input.size()) {
  ------------------
  |  Branch (7149:7): [True: 2.57k, False: 177]
  ------------------
 7150|  2.57k|    __m128i word = _mm_loadu_si128(
 7151|  2.57k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 7152|  2.57k|    running = _mm_or_si128(
 7153|  2.57k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7154|  2.57k|                                           _mm_cmpeq_epi8(word, mask2))),
 7155|  2.57k|        _mm_cmpeq_epi8(word, mask3));
 7156|  2.57k|  }
 7157|  2.75k|  return _mm_movemask_epi8(running) != 0;
 7158|  4.38k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 7016|  4.85k|constexpr bool is_tabs_or_newline(char c) noexcept {
 7017|  4.85k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (7017:10): [True: 0, False: 4.85k]
  |  Branch (7017:23): [True: 0, False: 4.85k]
  |  Branch (7017:36): [True: 0, False: 4.85k]
  ------------------
 7018|  4.85k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8842|    266|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|    266|  if (!ada::unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (8847:7): [True: 0, False: 266]
  ------------------
 8848|      0|    return;
 8849|      0|  }
 8850|    266|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8851|    266|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7375|  24.7k|    const char c) noexcept {
 7376|  24.7k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7376:10): [True: 667, False: 24.0k]
  |  Branch (7376:23): [True: 1.16k, False: 22.8k]
  |  Branch (7376:36): [True: 612, False: 22.2k]
  ------------------
 7377|  24.7k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7370|  4.76k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7371|  4.76k|  return (unsigned char)c <= ' ';
 7372|  4.76k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   77|  1.46k|    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|  1.46k|  size_t i = 0;
   84|  1.46k|  uint8_t accumulator{};
   85|  1.46k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (85:10): [True: 0, False: 1.46k]
  ------------------
   86|      0|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   87|      0|                           path_signature_table[uint8_t(input[i + 1])] |
   88|      0|                           path_signature_table[uint8_t(input[i + 2])] |
   89|      0|                           path_signature_table[uint8_t(input[i + 3])] |
   90|      0|                           path_signature_table[uint8_t(input[i + 4])] |
   91|      0|                           path_signature_table[uint8_t(input[i + 5])] |
   92|      0|                           path_signature_table[uint8_t(input[i + 6])] |
   93|      0|                           path_signature_table[uint8_t(input[i + 7])]);
   94|      0|  }
   95|  1.46k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (95:10): [True: 0, False: 1.46k]
  ------------------
   96|      0|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   97|      0|  }
   98|  1.46k|  return accumulator;
   99|  1.46k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7347|  2.57k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7348|  2.57k|  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|  2.57k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12524|    951|    auto apply_query_and_hash = [&]() {
12525|    951|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12525:11): [True: 951, False: 0]
  ------------------
12526|    951|        const size_t q_end =
12527|    951|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12527:13): [True: 195, False: 756]
  ------------------
12528|    951|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12529|    951|                                                q_end - query_start - 1),
12530|    951|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12531|    951|      }
12532|    951|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12532:11): [True: 195, False: 756]
  ------------------
12533|    195|        out.update_unencoded_base_hash(std::string_view(
12534|    195|            input.data() + hash_start + 1, len - hash_start - 1));
12535|    195|      }
12536|    951|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8782|    514|    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|    514|  size_t location_of_first = input.find('#');
 8786|    514|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8786:7): [True: 399, False: 115]
  ------------------
 8787|    399|    return std::nullopt;
 8788|    399|  }
 8789|    115|  std::string_view hash = input;
 8790|    115|  hash.remove_prefix(location_of_first + 1);
 8791|    115|  input.remove_suffix(input.size() - location_of_first);
 8792|    115|  return hash;
 8793|    514|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9740|     61|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|    732|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9743:33): [True: 732, False: 0]
  ------------------
 9744|    732|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9744:9): [True: 61, False: 671]
  ------------------
 9745|     61|      return pos - view.begin();
 9746|     61|    }
 9747|    732|  }
 9748|      0|  return size_t(view.size());
 9749|     61|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9456|    514|    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|    514|  const size_t view_size = view.size();
 9466|    514|  size_t location = 0;
 9467|    514|  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|    514|  if (is_special) {
  ------------------
  |  Branch (9487:7): [True: 514, False: 0]
  ------------------
 9488|       |    // We move to the next delimiter.
 9489|    514|    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|    514|    for (; location < view_size;
  ------------------
  |  Branch (9492:12): [True: 514, False: 0]
  ------------------
 9493|    514|         location = find_next_host_delimiter_special(view, location)) {
 9494|    514|      if (view[location] == '[') {
  ------------------
  |  Branch (9494:11): [True: 0, False: 514]
  ------------------
 9495|      0|        location = view.find(']', location);
 9496|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9496:13): [True: 0, False: 0]
  ------------------
 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|      0|          location = view_size;
 9501|      0|          break;
 9502|      0|        }
 9503|    514|      } else {
 9504|    514|        found_colon = view[location] == ':';
 9505|    514|        break;
 9506|    514|      }
 9507|    514|    }
 9508|    514|  } 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|    514|  view.remove_suffix(view_size - location);
 9532|    514|  return {location, found_colon};
 9533|    514|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9046|    514|    std::string_view view, size_t location) noexcept {
 9047|       |  // first check for short strings in which case we do it naively.
 9048|    514|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9048:7): [True: 247, False: 267]
  ------------------
 9049|  2.96k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9049:31): [True: 2.96k, False: 0]
  ------------------
 9050|  2.96k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (9050:11): [True: 0, False: 2.96k]
  |  Branch (9050:29): [True: 247, False: 2.71k]
  |  Branch (9050:47): [True: 0, False: 2.71k]
  ------------------
 9051|  2.71k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (9051:11): [True: 0, False: 2.71k]
  |  Branch (9051:29): [True: 0, False: 2.71k]
  ------------------
 9052|    247|        return i;
 9053|    247|      }
 9054|  2.96k|    }
 9055|      0|    return size_t(view.size());
 9056|    247|  }
 9057|       |  // fast path for long strings (expected to be common)
 9058|    267|  size_t i = location;
 9059|    267|  const __m128i mask1 = _mm_set1_epi8(':');
 9060|    267|  const __m128i mask2 = _mm_set1_epi8('/');
 9061|    267|  const __m128i mask3 = _mm_set1_epi8('\\');
 9062|    267|  const __m128i mask4 = _mm_set1_epi8('?');
 9063|    267|  const __m128i mask5 = _mm_set1_epi8('[');
 9064|       |
 9065|    267|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9065:10): [True: 267, False: 0]
  ------------------
 9066|    267|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9067|    267|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9068|    267|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9069|    267|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9070|    267|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9071|    267|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9072|    267|    __m128i m = _mm_or_si128(
 9073|    267|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9074|    267|    int mask = _mm_movemask_epi8(m);
 9075|    267|    if (mask != 0) {
  ------------------
  |  Branch (9075:9): [True: 267, False: 0]
  ------------------
 9076|    267|      return i + trailing_zeroes(mask);
 9077|    267|    }
 9078|    267|  }
 9079|      0|  if (i < view.size()) {
  ------------------
  |  Branch (9079:7): [True: 0, False: 0]
  ------------------
 9080|      0|    __m128i word =
 9081|      0|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9082|      0|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9083|      0|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9084|      0|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9085|      0|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9086|      0|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9087|      0|    __m128i m = _mm_or_si128(
 9088|      0|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9089|      0|    int mask = _mm_movemask_epi8(m);
 9090|      0|    if (mask != 0) {
  ------------------
  |  Branch (9090:9): [True: 0, False: 0]
  ------------------
 9091|      0|      return view.length() - 16 + trailing_zeroes(mask);
 9092|      0|    }
 9093|      0|  }
 9094|      0|  return size_t(view.length());
 9095|      0|}
_ZN3ada7helpers15trailing_zeroesEj:
 8868|    267|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|    267|  return __builtin_ctzl(input_num);
 8877|    267|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8878|    267|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7317|    514|                                              size_t length) noexcept {
 7318|    514|  size_t i = 0;
 7319|    514|  uint8_t accumulator{};
 7320|  1.54k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7320:10): [True: 1.02k, False: 514]
  ------------------
 7321|  1.02k|    accumulator |=
 7322|  1.02k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7323|  1.02k|    accumulator |=
 7324|  1.02k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7325|  1.02k|    accumulator |=
 7326|  1.02k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7327|  1.02k|    accumulator |=
 7328|  1.02k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7329|  1.02k|  }
 7330|  2.05k|  for (; i < length; i++) {
  ------------------
  |  Branch (7330:10): [True: 1.54k, False: 514]
  ------------------
 7331|  1.54k|    accumulator |=
 7332|  1.54k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7333|  1.54k|  }
 7334|    514|  return accumulator;
 7335|    514|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12847|    514|  const auto enforce_max_input_length = [&]() {
12848|    514|    if constexpr (store_values) {
12849|    514|      if (url.is_valid) {
  ------------------
  |  Branch (12849:11): [True: 514, False: 0]
  ------------------
12850|    514|        if constexpr (result_type_is_ada_url_aggregator) {
12851|    514|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12851:15): [True: 0, False: 514]
  ------------------
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|    514|      }
12860|    514|    }
12861|    514|  };
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11335|  2.91k|                                        size_t n) noexcept {
11336|  2.91k|  const size_t rem = n - host_start;
11337|  2.91k|  if (rem == 0) {
  ------------------
  |  Branch (11337:7): [True: 0, False: 2.91k]
  ------------------
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|  2.91k|  if (rem >= 16) {
  ------------------
  |  Branch (11353:7): [True: 1.34k, False: 1.56k]
  ------------------
11354|  1.34k|    const __m128i w =
11355|  1.34k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11356|  1.34k|    const uint16_t at = static_cast<uint16_t>(
11357|  1.34k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11358|  1.34k|    if (at == 0) {
  ------------------
  |  Branch (11358:9): [True: 1.30k, False: 45]
  ------------------
11359|  1.30k|      return false;
11360|  1.30k|    }
11361|     45|    const uint16_t delim = static_cast<uint16_t>(
11362|     45|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11363|     45|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11364|     45|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11365|     45|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11365:12): [True: 0, False: 45]
  |  Branch (11365:26): [True: 0, False: 45]
  ------------------
11366|  1.34k|  }
11367|  1.56k|#endif
11368|  1.56k|  const size_t lim = host_start + rem;
11369|  18.7k|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11369:31): [True: 18.7k, False: 0]
  ------------------
11370|  18.7k|    const uint8_t c = p[i];
11371|  18.7k|    if (c == '@') {
  ------------------
  |  Branch (11371:9): [True: 0, False: 18.7k]
  ------------------
11372|      0|      return true;
11373|      0|    }
11374|  18.7k|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11374:9): [True: 1.56k, False: 17.2k]
  |  Branch (11374:21): [True: 0, False: 17.2k]
  |  Branch (11374:33): [True: 0, False: 17.2k]
  ------------------
11375|  1.56k|      return false;
11376|  1.56k|    }
11377|  18.7k|  }
11378|      0|  return false;
11379|  1.56k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11400|  2.91k|                                     bool& has_x) noexcept {
11401|  2.91k|  has_upper = false;
11402|  2.91k|  has_x = false;
11403|  2.91k|  size_t i = start;
11404|  2.91k|#if ADA_PARSER_SSSE3
11405|  2.91k|  if (parser_use_ssse3() && (len - start >= 16)) {
  ------------------
  |  Branch (11405:7): [True: 2.91k, False: 0]
  |  Branch (11405:29): [True: 1.34k, False: 1.56k]
  ------------------
11406|  1.34k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11407|  1.34k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11408|  1.34k|    const __m128i x_splat = _mm_set1_epi8('x');
11409|  1.34k|    auto visit = [&](size_t at) noexcept -> bool {
11410|  1.34k|      const __m128i w =
11411|  1.34k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11412|  1.34k|      const int up = sse2_uppercase(w);
11413|  1.34k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11414|  1.34k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11415|  1.34k|      if (mask == 0) {
11416|  1.34k|        if (up != 0) {
11417|  1.34k|          has_upper = true;
11418|  1.34k|        }
11419|  1.34k|        if (xs != 0) {
11420|  1.34k|          has_x = true;
11421|  1.34k|        }
11422|  1.34k|        return false;
11423|  1.34k|      }
11424|  1.34k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11425|  1.34k|      const int valid = (1 << hit) - 1;
11426|  1.34k|      if ((up & valid) != 0) {
11427|  1.34k|        has_upper = true;
11428|  1.34k|      }
11429|  1.34k|      if ((xs & valid) != 0) {
11430|  1.34k|        has_x = true;
11431|  1.34k|      }
11432|  1.34k|      end = at + static_cast<size_t>(hit);
11433|  1.34k|      return true;
11434|  1.34k|    };
11435|  1.34k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11435:12): [True: 793, False: 555]
  ------------------
11436|    793|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11436:11): [True: 793, False: 0]
  |  Branch (11436:23): [True: 0, False: 0]
  ------------------
11437|    793|        return k_host_class[b[end]] == 1;
11438|    793|      }
11439|    793|    }
11440|    555|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11440:12): [True: 555, False: 0]
  ------------------
11441|    555|      if (visit(i)) {
  ------------------
  |  Branch (11441:11): [True: 555, False: 0]
  ------------------
11442|    555|        return k_host_class[b[end]] == 1;
11443|    555|      }
11444|    555|    }
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|      0|    if (i > start && i < len) {
  ------------------
  |  Branch (11447:9): [True: 0, False: 0]
  |  Branch (11447:22): [True: 0, False: 0]
  ------------------
11448|      0|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11448:11): [True: 0, False: 0]
  |  Branch (11448:30): [True: 0, False: 0]
  ------------------
11449|      0|        return k_host_class[b[end]] == 1;
11450|      0|      }
11451|      0|      end = len;
11452|      0|      return true;
11453|      0|    }
11454|      0|  }
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|  18.7k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11557:10): [True: 18.7k, False: 0]
  ------------------
11558|  18.7k|    const uint8_t c = b[i];
11559|  18.7k|    const uint8_t cls = k_host_class[c];
11560|  18.7k|    if (cls == 1) {
  ------------------
  |  Branch (11560:9): [True: 1.56k, False: 17.2k]
  ------------------
11561|  1.56k|      end = i;
11562|  1.56k|      return true;
11563|  1.56k|    }
11564|  17.2k|    if (cls == 2) {
  ------------------
  |  Branch (11564:9): [True: 0, False: 17.2k]
  ------------------
11565|      0|      return false;
11566|      0|    }
11567|  17.2k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11567:9): [True: 15.6k, False: 1.56k]
  |  Branch (11567:21): [True: 0, False: 15.6k]
  ------------------
11568|      0|      has_upper = true;
11569|  17.2k|    } else if (c == 'x') {
  ------------------
  |  Branch (11569:16): [True: 1.56k, False: 15.6k]
  ------------------
11570|  1.56k|      has_x = true;
11571|  1.56k|    }
11572|  17.2k|  }
11573|      0|  end = len;
11574|      0|  return true;
11575|  1.56k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_116parser_use_ssse3Ev:
11385|  8.95k|ada_really_inline bool parser_use_ssse3() noexcept {
11386|  8.95k|#ifdef ADA_PARSER_NEED_SSSE3_TARGET
11387|  8.95k|  static const bool supported = __builtin_cpu_supports("ssse3") != 0;
11388|  8.95k|  return supported;
11389|       |#else
11390|       |  return true;
11391|       |#endif
11392|  8.95k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
11216|  6.51k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
11217|  6.51k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
11218|  6.51k|}
url_search_params.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENKUlmE_clEm:
11409|  1.34k|    auto visit = [&](size_t at) noexcept -> bool {
11410|  1.34k|      const __m128i w =
11411|  1.34k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11412|  1.34k|      const int up = sse2_uppercase(w);
11413|  1.34k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11414|  1.34k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11415|  1.34k|      if (mask == 0) {
  ------------------
  |  Branch (11415:11): [True: 0, False: 1.34k]
  ------------------
11416|      0|        if (up != 0) {
  ------------------
  |  Branch (11416:13): [True: 0, False: 0]
  ------------------
11417|      0|          has_upper = true;
11418|      0|        }
11419|      0|        if (xs != 0) {
  ------------------
  |  Branch (11419:13): [True: 0, False: 0]
  ------------------
11420|      0|          has_x = true;
11421|      0|        }
11422|      0|        return false;
11423|      0|      }
11424|  1.34k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11425|  1.34k|      const int valid = (1 << hit) - 1;
11426|  1.34k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11426:11): [True: 0, False: 1.34k]
  ------------------
11427|      0|        has_upper = true;
11428|      0|      }
11429|  1.34k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11429:11): [True: 1.34k, False: 0]
  ------------------
11430|  1.34k|        has_x = true;
11431|  1.34k|      }
11432|  1.34k|      end = at + static_cast<size_t>(hit);
11433|  1.34k|      return true;
11434|  1.34k|    };
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11303|  1.34k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11304|  1.34k|  return _mm_movemask_epi8(_mm_and_si128(
11305|  1.34k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11306|  1.34k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11307|  1.34k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
11223|  4.27k|                                          __m128i hi_tbl) noexcept {
11224|  4.27k|  const __m128i nibble = _mm_set1_epi8(0x0F);
11225|  4.27k|  const __m128i lo = _mm_and_si128(w, nibble);
11226|  4.27k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
11227|  4.27k|  const __m128i hit =
11228|  4.27k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
11229|  4.27k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
11230|  4.27k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
11195|  3.15k|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|  3.15k|  return __builtin_ctz(input_num);
11202|  3.15k|#endif
11203|  3.15k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11635|  2.91k|                                   bool& maybe_dot_segment) noexcept {
11636|  2.91k|  const size_t run_start = i;
11637|  2.91k|#if ADA_PARSER_SSSE3
11638|  2.91k|  if (parser_use_ssse3() && (i + 16 <= len)) {
  ------------------
  |  Branch (11638:7): [True: 2.91k, False: 0]
  |  Branch (11638:29): [True: 902, False: 2.01k]
  ------------------
11639|    902|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11640|    902|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11641|    902|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11641:12): [True: 650, False: 252]
  ------------------
11642|    650|      const __m128i w0 =
11643|    650|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11644|    650|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11645|    650|      if (m0 != 0) {
  ------------------
  |  Branch (11645:11): [True: 650, False: 0]
  ------------------
11646|    650|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11647|    650|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11648|    650|                            maybe_dot_segment);
11649|    650|        i += static_cast<size_t>(hit_bit);
11650|    650|        return;
11651|    650|      }
11652|      0|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11653|      0|      const __m128i w1 =
11654|      0|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11655|      0|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11656|      0|      if (m1 != 0) {
  ------------------
  |  Branch (11656:11): [True: 0, False: 0]
  ------------------
11657|      0|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11658|      0|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11659|      0|                            maybe_dot_segment);
11660|      0|        i += 16 + static_cast<size_t>(hit_bit);
11661|      0|        return;
11662|      0|      }
11663|      0|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11664|      0|    }
11665|    252|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11665:12): [True: 252, False: 0]
  ------------------
11666|    252|      const __m128i w =
11667|    252|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11668|    252|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11669|    252|      if (mask != 0) {
  ------------------
  |  Branch (11669:11): [True: 252, False: 0]
  ------------------
11670|    252|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11671|    252|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11672|    252|                            maybe_dot_segment);
11673|    252|        i += static_cast<size_t>(hit_bit);
11674|    252|        return;
11675|    252|      }
11676|      0|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11677|      0|    }
11678|      0|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11678:9): [True: 0, False: 0]
  |  Branch (11678:26): [True: 0, False: 0]
  ------------------
11679|      0|      const __m128i w =
11680|      0|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11681|      0|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11682|      0|      if (mask != 0) {
  ------------------
  |  Branch (11682:11): [True: 0, False: 0]
  ------------------
11683|      0|        const size_t hit =
11684|      0|            len - 16 +
11685|      0|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11686|      0|        if (hit >= i) {
  ------------------
  |  Branch (11686:13): [True: 0, False: 0]
  ------------------
11687|      0|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11687:30): [True: 0, False: 0]
  ------------------
11688|      0|            if (b[j] == '.') {
  ------------------
  |  Branch (11688:17): [True: 0, False: 0]
  ------------------
11689|      0|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11690|      0|            }
11691|      0|          }
11692|      0|          i = hit;
11693|      0|          return;
11694|      0|        }
11695|      0|      }
11696|      0|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11696:26): [True: 0, False: 0]
  ------------------
11697|      0|        if (b[j] == '.') {
  ------------------
  |  Branch (11697:13): [True: 0, False: 0]
  ------------------
11698|      0|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11699|      0|        }
11700|      0|      }
11701|      0|      i = len;
11702|      0|      return;
11703|      0|    }
11704|      0|  }
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|  2.01k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11792:10): [True: 2.01k, False: 0]
  ------------------
11793|  2.01k|    const uint8_t c = b[i];
11794|  2.01k|    const uint8_t cls = k_path[c];
11795|  2.01k|    if (cls != 0) {
  ------------------
  |  Branch (11795:9): [True: 2.01k, False: 0]
  ------------------
11796|  2.01k|      return;
11797|  2.01k|    }
11798|      0|    if (c == '.') {
  ------------------
  |  Branch (11798:9): [True: 0, False: 0]
  ------------------
11799|      0|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11800|      0|    }
11801|      0|  }
11802|  2.01k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11592|    902|                                           bool& maybe_dot_segment) noexcept {
11593|    902|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11593:7): [True: 0, False: 902]
  |  Branch (11593:28): [True: 902, False: 0]
  ------------------
11594|    902|    return;
11595|    902|  }
11596|      0|  const int dots =
11597|      0|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11598|      0|  if (dots == 0) {
  ------------------
  |  Branch (11598:7): [True: 0, False: 0]
  ------------------
11599|      0|    return;
11600|      0|  }
11601|      0|  const int slashes =
11602|      0|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11603|      0|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11603:8): [True: 0, False: 0]
  |  Branch (11603:28): [True: 0, False: 0]
  |  Branch (11603:46): [True: 0, False: 0]
  ------------------
11604|      0|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11604:7): [True: 0, False: 0]
  ------------------
11605|      0|    maybe_dot_segment = true;
11606|      0|  }
11607|      0|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11945|  2.91k|                                    size_t len) noexcept {
11946|  2.91k|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11808|  2.91k|  do {                                                                       \
  |  |11809|  2.91k|    const size_t scan_start = i;                                             \
  |  |11810|  2.91k|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11810:9): [True: 2.91k, False: 0]
  |  |  |  Branch (11810:31): [True: 867, False: 2.04k]
  |  |  ------------------
  |  |11811|    867|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11812|    867|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11813|  1.24k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11813:14): [True: 911, False: 332]
  |  |  ------------------
  |  |11814|    911|        const __m128i w0 =                                                   \
  |  |11815|    911|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11816|    911|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11817|    911|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11817:13): [True: 490, False: 421]
  |  |  ------------------
  |  |11818|    490|          i += static_cast<size_t>(                                          \
  |  |11819|    490|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11820|    490|          return;                                                            \
  |  |11821|    490|        }                                                                    \
  |  |11822|    911|        const __m128i w1 =                                                   \
  |  |11823|    421|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11824|    421|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11825|    421|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11825:13): [True: 45, False: 376]
  |  |  ------------------
  |  |11826|     45|          i += 16 + static_cast<size_t>(                                     \
  |  |11827|     45|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11828|     45|          return;                                                            \
  |  |11829|     45|        }                                                                    \
  |  |11830|    421|      }                                                                      \
  |  |11831|    867|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11831:14): [True: 268, False: 139]
  |  |  ------------------
  |  |11832|    268|        const __m128i w =                                                    \
  |  |11833|    268|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11834|    268|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11835|    268|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11835:13): [True: 193, False: 75]
  |  |  ------------------
  |  |11836|    193|          i += static_cast<size_t>(                                          \
  |  |11837|    193|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11838|    193|          return;                                                            \
  |  |11839|    193|        }                                                                    \
  |  |11840|    268|      }                                                                      \
  |  |11841|    332|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11841:11): [True: 139, False: 0]
  |  |  |  Branch (11841:29): [True: 111, False: 28]
  |  |  ------------------
  |  |11842|    111|        const __m128i w =                                                    \
  |  |11843|    111|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11844|    111|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11845|    111|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11845:13): [True: 55, False: 56]
  |  |  ------------------
  |  |11846|     55|          const size_t hit = len - 16 +                                      \
  |  |11847|     55|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11848|     55|                                 static_cast<uint32_t>(mask)));              \
  |  |11849|     55|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11849:15): [True: 55, False: 0]
  |  |  ------------------
  |  |11850|     55|            i = hit;                                                         \
  |  |11851|     55|            return;                                                          \
  |  |11852|     55|          }                                                                  \
  |  |11853|     55|        }                                                                    \
  |  |11854|    111|        i = len;                                                             \
  |  |11855|     56|        return;                                                              \
  |  |11856|    111|      }                                                                      \
  |  |11857|    139|    }                                                                        \
  |  |11858|  3.06k|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11858:12): [True: 1.75k, False: 1.31k]
  |  |  ------------------
  |  |11859|  1.75k|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11859:11): [True: 755, False: 996]
  |  |  ------------------
  |  |11860|    755|        return;                                                              \
  |  |11861|    755|      }                                                                      \
  |  |11862|  1.75k|    }                                                                        \
  |  |11863|  2.07k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11863:12): [Folded, False: 1.31k]
  |  |  ------------------
  ------------------
11947|  2.91k|}
url_search_params.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11950|    219|                                   size_t len) noexcept {
11951|    219|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11808|    219|  do {                                                                       \
  |  |11809|    219|    const size_t scan_start = i;                                             \
  |  |11810|    219|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11810:9): [True: 219, False: 0]
  |  |  |  Branch (11810:31): [True: 141, False: 78]
  |  |  ------------------
  |  |11811|    141|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11812|    141|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11813|    200|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11813:14): [True: 124, False: 76]
  |  |  ------------------
  |  |11814|    124|        const __m128i w0 =                                                   \
  |  |11815|    124|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11816|    124|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11817|    124|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11817:13): [True: 42, False: 82]
  |  |  ------------------
  |  |11818|     42|          i += static_cast<size_t>(                                          \
  |  |11819|     42|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11820|     42|          return;                                                            \
  |  |11821|     42|        }                                                                    \
  |  |11822|    124|        const __m128i w1 =                                                   \
  |  |11823|     82|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11824|     82|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11825|     82|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11825:13): [True: 23, False: 59]
  |  |  ------------------
  |  |11826|     23|          i += 16 + static_cast<size_t>(                                     \
  |  |11827|     23|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11828|     23|          return;                                                            \
  |  |11829|     23|        }                                                                    \
  |  |11830|     82|      }                                                                      \
  |  |11831|    141|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11831:14): [True: 56, False: 53]
  |  |  ------------------
  |  |11832|     56|        const __m128i w =                                                    \
  |  |11833|     56|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11834|     56|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11835|     56|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11835:13): [True: 23, False: 33]
  |  |  ------------------
  |  |11836|     23|          i += static_cast<size_t>(                                          \
  |  |11837|     23|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11838|     23|          return;                                                            \
  |  |11839|     23|        }                                                                    \
  |  |11840|     56|      }                                                                      \
  |  |11841|     76|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11841:11): [True: 53, False: 0]
  |  |  |  Branch (11841:29): [True: 47, False: 6]
  |  |  ------------------
  |  |11842|     47|        const __m128i w =                                                    \
  |  |11843|     47|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11844|     47|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11845|     47|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11845:13): [True: 38, False: 9]
  |  |  ------------------
  |  |11846|     38|          const size_t hit = len - 16 +                                      \
  |  |11847|     38|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11848|     38|                                 static_cast<uint32_t>(mask)));              \
  |  |11849|     38|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11849:15): [True: 38, False: 0]
  |  |  ------------------
  |  |11850|     38|            i = hit;                                                         \
  |  |11851|     38|            return;                                                          \
  |  |11852|     38|          }                                                                  \
  |  |11853|     38|        }                                                                    \
  |  |11854|     47|        i = len;                                                             \
  |  |11855|      9|        return;                                                              \
  |  |11856|     47|      }                                                                      \
  |  |11857|     53|    }                                                                        \
  |  |11858|    219|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11858:12): [True: 79, False: 64]
  |  |  ------------------
  |  |11859|     79|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11859:11): [True: 20, False: 59]
  |  |  ------------------
  |  |11860|     20|        return;                                                              \
  |  |11861|     20|      }                                                                      \
  |  |11862|     79|    }                                                                        \
  |  |11863|     84|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11863:12): [Folded, False: 64]
  |  |  ------------------
  ------------------
11952|    219|}
url_search_params.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13942|    514|    ada::url_components& components, uint32_t new_difference) {
13943|    514|  components.username_end += new_difference;
13944|    514|  components.host_start += new_difference;
13945|    514|  components.host_end += new_difference;
13946|    514|  components.pathname_start += new_difference;
13947|    514|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13947:7): [True: 0, False: 514]
  ------------------
13948|      0|    components.search_start += new_difference;
13949|      0|  }
13950|    514|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13950:7): [True: 0, False: 514]
  ------------------
13951|      0|    components.hash_start += new_difference;
13952|      0|  }
13953|    514|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14312|    951|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14313|    951|  ada_log("url_aggregator::parse_path ", input);
14314|    951|  ADA_ASSERT_TRUE(validate());
14315|    951|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14316|    951|  std::string tmp_buffer;
14317|    951|  std::string_view internal_input;
14318|    951|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14318:7): [True: 0, False: 951]
  ------------------
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|    951|  } else {
14325|    951|    internal_input = input;
14326|    951|  }
14327|       |
14328|       |  // If url is special, then:
14329|    951|  if (is_special()) {
  ------------------
  |  Branch (14329:7): [True: 951, False: 0]
  ------------------
14330|    951|    if (internal_input.empty()) {
  ------------------
  |  Branch (14330:9): [True: 0, False: 951]
  ------------------
14331|      0|      update_base_pathname("/");
14332|    951|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14332:16): [True: 951, False: 0]
  |  Branch (14332:46): [True: 0, False: 0]
  ------------------
14333|    951|      consume_prepared_path(internal_input.substr(1));
14334|    951|    } else {
14335|      0|      consume_prepared_path(internal_input);
14336|      0|    }
14337|    951|  } 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|    951|  ADA_ASSERT_TRUE(validate());
14351|    951|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14445|    514|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14446|    514|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14447|    514|          " bytes]");
14448|    514|  ADA_ASSERT_TRUE(validate());
14449|    514|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14450|    514|  if (input.empty()) {
  ------------------
  |  Branch (14450:7): [True: 0, False: 514]
  ------------------
14451|      0|    return is_valid = false;
14452|      0|  }  // technically unnecessary.
14453|       |  // If input starts with U+005B ([), then:
14454|    514|  if (input[0] == '[') {
  ------------------
  |  Branch (14454:7): [True: 0, False: 514]
  ------------------
14455|       |    // If input does not end with U+005D (]), validation error, return failure.
14456|      0|    if (input.back() != ']') {
  ------------------
  |  Branch (14456:9): [True: 0, False: 0]
  ------------------
14457|      0|      return is_valid = false;
14458|      0|    }
14459|      0|    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|      0|    input.remove_prefix(1);
14464|      0|    input.remove_suffix(1);
14465|      0|    return parse_ipv6(input);
14466|      0|  }
14467|       |
14468|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14469|       |  // input.
14470|    514|  if (!is_special()) {
  ------------------
  |  Branch (14470:7): [True: 0, False: 514]
  ------------------
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|    514|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14485|    514|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14485:7): [True: 0, False: 514]
  ------------------
14486|      0|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14486:9): [True: 0, False: 0]
  |  Branch (14486:27): [True: 0, False: 0]
  ------------------
14487|      0|      update_base_hostname(input.substr(0, input.size() - 1));
14488|      0|    } else {
14489|      0|      update_base_hostname(input);
14490|      0|    }
14491|      0|    host_type = IPV4;
14492|      0|    is_valid = true;
14493|      0|    ada_log("parse_host fast path decimal ipv4");
14494|      0|    ADA_ASSERT_TRUE(validate());
14495|      0|    return true;
14496|      0|  }
14497|    514|  uint8_t is_forbidden_or_upper =
14498|    514|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14499|    514|                                                             input.size());
14500|    514|  static constexpr std::string_view xn_dash{"xn-", 3};
14501|    514|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14501:7): [True: 514, False: 0]
  ------------------
14502|    514|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14502:9): [True: 0, False: 514]
  ------------------
14503|      0|      std::string lowered(input);
14504|      0|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14505|      0|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14505:11): [True: 0, False: 0]
  ------------------
14506|      0|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14506:11): [True: 0, False: 0]
  ------------------
14507|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14508|       |        // This also avoids a double buffer rewrite for hex/octal IPv4.
14509|      0|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14509:13): [True: 0, False: 0]
  ------------------
14510|      0|          ada_log("parse_host fast path ipv4");
14511|      0|          return parse_ipv4(lowered, false);
14512|      0|        }
14513|      0|        update_base_hostname(lowered);
14514|      0|        ada_log("parse_host fast path ", get_hostname());
14515|      0|        is_valid = true;
14516|      0|        return true;
14517|      0|      }
14518|    514|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14518:16): [True: 514, False: 0]
  ------------------
14519|    514|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14519:16): [True: 0, False: 0]
  ------------------
14520|       |      // Check IPv4 before mutating so failures leave the buffer untouched.
14521|    514|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14521:11): [True: 0, False: 514]
  ------------------
14522|      0|        ada_log("parse_host fast path ipv4");
14523|      0|        return parse_ipv4(input, false);
14524|      0|      }
14525|    514|      update_base_hostname(input);
14526|    514|      ada_log("parse_host fast path ", get_hostname());
14527|    514|      is_valid = true;
14528|    514|      return true;
14529|    514|    }
14530|    514|  } else if (const size_t first_percent = input.find('%');
14531|      0|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14531:14): [True: 0, False: 0]
  ------------------
14532|      0|    std::string decoded = unicode::percent_decode(input, first_percent);
14533|      0|    const uint8_t decoded_flags =
14534|      0|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14535|      0|                                                               decoded.size());
14536|      0|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14536:9): [True: 0, False: 0]
  ------------------
14537|      0|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14537:11): [True: 0, False: 0]
  ------------------
14538|      0|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14539|      0|      }
14540|      0|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14540:11): [True: 0, False: 0]
  ------------------
14541|      0|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14541:11): [True: 0, False: 0]
  ------------------
14542|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14543|      0|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14543:13): [True: 0, False: 0]
  ------------------
14544|      0|          return parse_ipv4(decoded, false);
14545|      0|        }
14546|      0|        update_base_hostname(decoded);
14547|      0|        is_valid = true;
14548|      0|        return true;
14549|      0|      }
14550|      0|    }
14551|      0|  }
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|      0|  ada_log("parse_host calling to_ascii");
14557|      0|  std::optional<std::string> host = std::string(get_hostname());
14558|      0|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14559|      0|  if (!is_valid) {
  ------------------
  |  Branch (14559:7): [True: 0, False: 0]
  ------------------
14560|      0|    ada_log("parse_host to_ascii returns false");
14561|      0|    return is_valid = false;
14562|      0|  }
14563|      0|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14564|      0|          " bytes]");
14565|       |
14566|      0|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14566:7): [True: 0, False: 0]
  ------------------
14567|      0|                          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|      0|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14573:7): [True: 0, False: 0]
  ------------------
14574|      0|    ada_log("parse_host got ipv4 ", *host);
14575|      0|    return parse_ipv4(host.value(), false);
14576|      0|  }
14577|       |
14578|      0|  update_base_hostname(host.value());
14579|      0|  ADA_ASSERT_TRUE(validate());
14580|      0|  return true;
14581|      0|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15427|  1.46k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15428|  1.46k|  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.46k|  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.46k|  constexpr uint8_t need_encoding = 1;
15444|  1.46k|  constexpr uint8_t backslash_char = 2;
15445|  1.46k|  constexpr uint8_t dot_char = 4;
15446|  1.46k|  constexpr uint8_t percent_char = 8;
15447|  1.46k|  bool special = type != ada::scheme::NOT_SPECIAL;
15448|  1.46k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15448:39): [True: 0, False: 1.46k]
  ------------------
15449|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15449:39): [True: 0, False: 0]
  ------------------
15450|  1.46k|  bool trivial_path =
15451|  1.46k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15451:7): [True: 1.46k, False: 0]
  |  Branch (15451:8): [True: 1.46k, False: 0]
  ------------------
15452|  1.46k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15453|      0|                  0)) &&
15454|  1.46k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15454:7): [True: 1.46k, False: 0]
  ------------------
15455|  1.46k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15455:7): [True: 0, False: 1.46k]
  |  Branch (15455:34): [True: 0, 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|      0|    if (input[0] != '.') {
  ------------------
  |  Branch (15463:9): [True: 0, False: 0]
  ------------------
15464|      0|      size_t slashdot = 0;
15465|      0|      bool dot_is_file = true;
15466|      0|      for (;;) {
15467|      0|        slashdot = input.find("/.", slashdot);
15468|      0|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15468:13): [True: 0, False: 0]
  ------------------
15469|      0|          break;
15470|      0|        } else {  // uncommon
15471|       |          // only three cases matter: /./, /.. or a final /
15472|      0|          slashdot += 2;
15473|      0|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15473:28): [True: 0, False: 0]
  |  Branch (15473:56): [True: 0, False: 0]
  ------------------
15474|      0|                           input[slashdot] == '/');
  ------------------
  |  Branch (15474:28): [True: 0, False: 0]
  ------------------
15475|      0|        }
15476|      0|      }
15477|      0|      trivial_path = dot_is_file;
15478|      0|    }
15479|      0|  }
15480|  1.46k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15480:7): [True: 1.46k, False: 0]
  |  Branch (15480:23): [True: 1.46k, False: 0]
  ------------------
15481|  1.46k|    ada_log("parse_path trivial");
15482|  1.46k|    buffer += '/';
15483|  1.46k|    buffer += input;
15484|  1.46k|    return;
15485|  1.46k|  }
15486|      0|  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|      0|  bool fast_path =
15492|      0|      (special &&
  ------------------
  |  Branch (15492:8): [True: 0, False: 0]
  ------------------
15493|      0|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15493:8): [True: 0, False: 0]
  ------------------
15494|      0|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15494:7): [True: 0, False: 0]
  ------------------
15495|      0|  if (fast_path) {
  ------------------
  |  Branch (15495:7): [True: 0, False: 0]
  ------------------
15496|      0|    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|      0|    size_t previous_location = 0;  // We start at 0.
15502|      0|    do {
15503|      0|      size_t new_location = input.find('/', previous_location);
15504|       |      // std::string_view path_view = input;
15505|       |      //  We process the last segment separately:
15506|      0|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15506:11): [True: 0, False: 0]
  ------------------
15507|      0|        std::string_view path_view = input.substr(previous_location);
15508|      0|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15508:13): [True: 0, False: 0]
  ------------------
15509|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15510|      0|          if (path.empty()) {
  ------------------
  |  Branch (15510:15): [True: 0, False: 0]
  ------------------
15511|      0|            path = '/';
15512|      0|            update_base_pathname(path);
15513|      0|            return;
15514|      0|          }
15515|       |          // Fast case where we have nothing to do:
15516|      0|          if (path.back() == '/') {
  ------------------
  |  Branch (15516:15): [True: 0, False: 0]
  ------------------
15517|      0|            update_base_pathname(path);
15518|      0|            return;
15519|      0|          }
15520|       |          // If you have the path "/joe/myfriend",
15521|       |          // then you delete 'myfriend'.
15522|      0|          path.resize(path.rfind('/') + 1);
15523|      0|          update_base_pathname(path);
15524|      0|          return;
15525|      0|        }
15526|      0|        path += '/';
15527|      0|        if (path_view != ".") {
  ------------------
  |  Branch (15527:13): [True: 0, False: 0]
  ------------------
15528|      0|          path.append(path_view);
15529|      0|        }
15530|      0|        update_base_pathname(path);
15531|      0|        return;
15532|      0|      } else {
15533|       |        // This is a non-final segment.
15534|      0|        std::string_view path_view =
15535|      0|            input.substr(previous_location, new_location - previous_location);
15536|      0|        previous_location = new_location + 1;
15537|      0|        if (path_view == "..") {
  ------------------
  |  Branch (15537:13): [True: 0, False: 0]
  ------------------
15538|      0|          size_t last_delimiter = path.rfind('/');
15539|      0|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15539:15): [True: 0, False: 0]
  ------------------
15540|      0|            path.erase(last_delimiter);
15541|      0|          }
15542|      0|        } else if (path_view != ".") {
  ------------------
  |  Branch (15542:20): [True: 0, False: 0]
  ------------------
15543|      0|          path += '/';
15544|      0|          path.append(path_view);
15545|      0|        }
15546|      0|      }
15547|      0|    } while (true);
  ------------------
  |  Branch (15547:14): [True: 0, Folded]
  ------------------
15548|      0|  } else {
15549|      0|    ada_log("parse_path slow");
15550|       |    // we have reached the general case
15551|      0|    bool needs_percent_encoding = (accumulator & 1);
15552|      0|    do {
15553|      0|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15553:26): [True: 0, False: 0]
  |  Branch (15553:37): [True: 0, False: 0]
  ------------------
15554|      0|                            ? input.find_first_of("/\\")
15555|      0|                            : input.find('/');
15556|      0|      std::string_view path_view = input;
15557|      0|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15557:11): [True: 0, False: 0]
  ------------------
15558|      0|        path_view.remove_suffix(path_view.size() - location);
15559|      0|        input.remove_prefix(location + 1);
15560|      0|      }
15561|       |      // Path encoding preserves dots and percent signs, so normalize first.
15562|      0|      if (unicode::is_double_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15562:11): [True: 0, False: 0]
  ------------------
15563|      0|        helpers::shorten_path(path, type);
15564|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15564:13): [True: 0, False: 0]
  ------------------
15565|      0|          path += '/';
15566|      0|        }
15567|      0|      } else if (unicode::is_single_dot_path_segment(path_view) &&
  ------------------
  |  Branch (15567:18): [True: 0, False: 0]
  ------------------
15568|      0|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15568:18): [True: 0, False: 0]
  ------------------
15569|      0|        path += '/';
15570|      0|      }
15571|       |      // Otherwise, if path_view is not a single-dot path segment, then:
15572|      0|      else if (!unicode::is_single_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15572:16): [True: 0, False: 0]
  ------------------
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|      0|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15576:13): [True: 0, False: 0]
  |  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|      0|        } else {
15585|       |          // Append encoded bytes directly to the pathname.
15586|      0|          path += '/';
15587|      0|          if (!needs_percent_encoding ||
  ------------------
  |  Branch (15587:15): [True: 0, False: 0]
  ------------------
15588|      0|              !ada::unicode::percent_encode<true>(
  ------------------
  |  Branch (15588:15): [True: 0, False: 0]
  ------------------
15589|      0|                  path_view, character_sets::PATH_PERCENT_ENCODE, path)) {
15590|      0|            path.append(path_view);
15591|      0|          }
15592|      0|        }
15593|      0|      }
15594|      0|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15594:11): [True: 0, False: 0]
  ------------------
15595|      0|        update_base_pathname(path);
15596|      0|        return;
15597|      0|      }
15598|      0|    } while (true);
  ------------------
  |  Branch (15598:14): [True: 0, Folded]
  ------------------
15599|      0|  }
15600|      0|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   14|    514|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|    514|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (16:7): [True: 514, False: 0]
  ------------------
   17|    514|    return false;
   18|    514|  }
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|      0|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 0, False: 0]
  ------------------
   21|      0|    view.remove_suffix(1);
   22|      0|  }
   23|       |  // From the last character, find the last dot.
   24|      0|  size_t last_dot = view.rfind('.');
   25|      0|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (25:7): [True: 0, False: 0]
  ------------------
   26|       |    // We have at least one dot.
   27|      0|    view.remove_prefix(last_dot + 1);
   28|      0|  }
   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|      0|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (32:7): [True: 0, False: 0]
  ------------------
   33|      0|    return true;
   34|      0|  }
   35|       |  // It could be hex (0x), but not if there is a single character.
   36|      0|  if (view.size() == 1) {
  ------------------
  |  Branch (36:7): [True: 0, False: 0]
  ------------------
   37|      0|    return false;
   38|      0|  }
   39|       |  // It must start with 0x.
   40|      0|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (40:7): [True: 0, False: 0]
  ------------------
   41|      0|    return false;
   42|      0|  }
   43|       |  // We must allow "0x".
   44|      0|  if (view.size() == 2) {
  ------------------
  |  Branch (44:7): [True: 0, False: 0]
  ------------------
   45|      0|    return true;
   46|      0|  }
   47|       |  // We have 0x followed by some characters, we need to check that they are
   48|       |  // hexadecimals.
   49|      0|  view.remove_prefix(2);
   50|      0|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   51|      0|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13960|    514|    const std::string_view input_with_colon) {
13961|    514|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13962|    514|  ADA_ASSERT_TRUE(validate());
13963|    514|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13964|    514|  std::string_view input{input_with_colon};
13965|    514|  input.remove_suffix(1);
13966|    514|  auto parsed_type = ada::scheme::get_scheme_type(input);
13967|    514|  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|    514|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13972:7): [True: 514, 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|    514|    type = parsed_type;
13996|    514|    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|    514|  } 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|    514|  ADA_ASSERT_TRUE(validate());
14061|    514|  return true;
14062|    514|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14086|    514|    std::string_view new_scheme_with_colon) {
14087|    514|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
14088|    514|          new_scheme_with_colon);
14089|    514|  ADA_ASSERT_TRUE(validate());
14090|    514|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
14091|    514|                  new_scheme_with_colon.back() == ':');
14092|       |  // next line could overflow but unsigned arithmetic has well-defined
14093|       |  // overflows.
14094|    514|  uint32_t new_difference =
14095|    514|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
14096|       |
14097|    514|  if (buffer.empty()) {
  ------------------
  |  Branch (14097:7): [True: 514, False: 0]
  ------------------
14098|    514|    buffer.append(new_scheme_with_colon);
14099|    514|  } else {
14100|      0|    buffer.erase(0, components.protocol_end);
14101|      0|    buffer.insert(0, new_scheme_with_colon);
14102|      0|  }
14103|    514|  components.protocol_end += new_difference;
14104|       |
14105|    514|  apply_shifted_non_scheme_offsets(components, new_difference);
14106|    514|  ADA_ASSERT_TRUE(validate());
14107|    514|}
_ZN3ada7helpers38strip_trailing_spaces_from_opaque_pathINS_14url_aggregatorEEEvRT_:
 9716|  1.37k|ada_really_inline void strip_trailing_spaces_from_opaque_path(url_type& url) {
 9717|  1.37k|  ada_log("helpers::strip_trailing_spaces_from_opaque_path");
 9718|  1.37k|  if (!url.has_opaque_path) return;
  ------------------
  |  Branch (9718:7): [True: 1.37k, False: 0]
  ------------------
 9719|      0|  if (url.has_hash()) return;
  ------------------
  |  Branch (9719:7): [True: 0, False: 0]
  ------------------
 9720|      0|  if (url.has_search()) return;
  ------------------
  |  Branch (9720:7): [True: 0, False: 0]
  ------------------
 9721|       |
 9722|      0|  auto path = std::string(url.get_pathname());
 9723|      0|  while (!path.empty() && path.back() == ' ') {
  ------------------
  |  Branch (9723:10): [True: 0, False: 0]
  |  Branch (9723:27): [True: 0, False: 0]
  ------------------
 9724|      0|    path.resize(path.size() - 1);
 9725|      0|  }
 9726|      0|  url.update_base_pathname(path);
 9727|      0|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5869|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1086|   469k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1087|   469k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1088|   469k|}
_ZN3ada8url_baseD2Ev:
 1712|  5.82k|  virtual ~url_base() = default;
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3306|  2.91k|  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.91k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3661|  2.91k|      : impl_base(in_place, std::forward<Args>(args)...),
 3662|  2.91k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2676|  2.91k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7922|  2.91k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7925|  5.82k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6923|    514|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6924|    514|  if (scheme.empty()) {
  ------------------
  |  Branch (6924:7): [True: 0, False: 514]
  ------------------
 6925|      0|    return ada::scheme::NOT_SPECIAL;
 6926|      0|  }
 6927|    514|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6928|    514|  const std::string_view target = details::is_special_list[hash_value];
 6929|    514|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6929:7): [True: 514, False: 0]
  ------------------
 6930|    514|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6930:7): [True: 514, False: 0]
  ------------------
 6931|    514|          details::scheme_keys[hash_value]) {
 6932|    514|    return ada::scheme::type(hash_value);
 6933|    514|  } else {
 6934|      0|    return ada::scheme::NOT_SPECIAL;
 6935|      0|  }
 6936|    514|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6864|    514|inline uint64_t branchless_load5(const char* p, size_t n) {
 6865|    514|  uint64_t input = (uint8_t)p[0];
 6866|    514|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6867|    514|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6868|    514|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6869|    514|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6870|    514|  return input;
 6871|    514|}
_ZN3ada14url_aggregatorC2Ev:
 7920|  2.91k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 5017|  2.91k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1460|    514|try_parse_ipv4_fast(std::string_view input) noexcept {
 1461|    514|  const size_t len = input.size();
 1462|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1463|    514|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1463:7): [True: 0, False: 514]
  |  Branch (1463:18): [True: 0, False: 514]
  ------------------
 1464|      0|    return ipv4_fast_fail;
 1465|      0|  }
 1466|    514|  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|    514|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1472|    514|#endif
 1473|    514|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1301|    514|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1302|    514|  uint32_t ipv4 = 0;
 1303|    514|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1303:19): [True: 514, False: 0]
  ------------------
 1304|    514|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1304:9): [True: 0, False: 514]
  ------------------
 1305|      0|      return ipv4_fast_fail;
 1306|      0|    }
 1307|    514|    uint32_t val;
 1308|    514|    char c = *p;
 1309|    514|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1309:9): [True: 514, False: 0]
  |  Branch (1309:21): [True: 0, False: 514]
  ------------------
 1310|      0|      val = static_cast<uint32_t>(c - '0');
 1311|      0|      ++p;
 1312|    514|    } else {
 1313|    514|      return ipv4_fast_fail;
 1314|    514|    }
 1315|      0|    if (p < pend) {
  ------------------
  |  Branch (1315:9): [True: 0, False: 0]
  ------------------
 1316|      0|      c = *p;
 1317|      0|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1317:11): [True: 0, False: 0]
  |  Branch (1317:23): [True: 0, False: 0]
  ------------------
 1318|      0|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1318:13): [True: 0, False: 0]
  ------------------
 1319|      0|          return ipv4_fast_fail;
 1320|      0|        }
 1321|      0|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1322|      0|        ++p;
 1323|      0|        if (p < pend) {
  ------------------
  |  Branch (1323:13): [True: 0, False: 0]
  ------------------
 1324|      0|          c = *p;
 1325|      0|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1325:15): [True: 0, False: 0]
  |  Branch (1325:27): [True: 0, False: 0]
  ------------------
 1326|      0|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1327|      0|            ++p;
 1328|      0|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1328:17): [True: 0, False: 0]
  ------------------
 1329|      0|              return ipv4_fast_fail;
 1330|      0|            }
 1331|      0|          }
 1332|      0|        }
 1333|      0|      }
 1334|      0|    }
 1335|      0|    ipv4 = (ipv4 << 8) | val;
 1336|      0|    if (i < 3) {
  ------------------
  |  Branch (1336:9): [True: 0, False: 0]
  ------------------
 1337|      0|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1337:11): [True: 0, False: 0]
  |  Branch (1337:24): [True: 0, False: 0]
  ------------------
 1338|      0|        return ipv4_fast_fail;
 1339|      0|      }
 1340|      0|      ++p;
 1341|      0|    }
 1342|      0|  }
 1343|      0|  if (p != pend) {
  ------------------
  |  Branch (1343:7): [True: 0, False: 0]
  ------------------
 1344|      0|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1344:9): [True: 0, False: 0]
  |  Branch (1344:26): [True: 0, False: 0]
  ------------------
 1345|      0|      return ipv4;
 1346|      0|    }
 1347|      0|    return ipv4_fast_fail;
 1348|      0|  }
 1349|      0|  return ipv4;
 1350|      0|}
_ZNK3ada8url_base10is_specialEv:
 7411|  5.63k|    const noexcept {
 7412|  5.63k|  return type != ada::scheme::NOT_SPECIAL;
 7413|  5.63k|}
_ZN3ada8checkers8is_alphaEc:
 1281|    514|constexpr bool is_alpha(char x) noexcept {
 1282|    514|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1282:10): [True: 514, False: 0]
  |  Branch (1282:34): [True: 514, False: 0]
  ------------------
 1283|    514|}
_ZN3ada8checkers8to_lowerEc:
 1279|  1.02k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1254|  3.42k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1255|  3.42k|  if (view.empty()) {
  ------------------
  |  Branch (1255:7): [True: 0, False: 3.42k]
  ------------------
 1256|      0|    return false;
 1257|      0|  }
 1258|  3.42k|  const char* start = view.data();
 1259|  3.42k|  const char* end = start + view.size();
 1260|  3.42k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1260:7): [True: 0, False: 3.42k]
  ------------------
 1261|      0|    --end;
 1262|      0|    if (end == start) {
  ------------------
  |  Branch (1262:9): [True: 0, False: 0]
  ------------------
 1263|      0|      return false;
 1264|      0|    }
 1265|      0|  }
 1266|  3.42k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1266:7): [True: 3.42k, False: 0]
  ------------------
 1267|  3.42k|    return false;
 1268|  3.42k|  }
 1269|      0|  const char* label = end;
 1270|      0|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1270:10): [True: 0, False: 0]
  |  Branch (1270:28): [True: 0, False: 0]
  ------------------
 1271|      0|    --label;
 1272|      0|  }
 1273|      0|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1273:7): [True: 0, False: 0]
  |  Branch (1273:25): [True: 0, False: 0]
  ------------------
 1274|      0|    return false;
 1275|      0|  }
 1276|      0|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1276:10): [True: 0, False: 0]
  |  Branch (1276:26): [True: 0, False: 0]
  ------------------
 1277|      0|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1248|  3.42k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1249|  3.42k|  const unsigned char c = static_cast<unsigned char>(x);
 1250|  3.42k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1250:11): [True: 3.42k, False: 0]
  |  Branch (1250:23): [True: 0, False: 3.42k]
  |  Branch (1250:37): [True: 3.42k, False: 0]
  |  Branch (1250:49): [True: 0, False: 3.42k]
  ------------------
 1251|  3.42k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1251:11): [True: 3.42k, False: 0]
  |  Branch (1251:23): [True: 0, False: 3.42k]
  |  Branch (1251:36): [True: 0, False: 3.42k]
  |  Branch (1251:48): [True: 0, False: 3.42k]
  ------------------
 1252|  3.42k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8495|    743|    uint32_t start, uint32_t end, std::string_view input) {
 8496|    743|  uint32_t current_length = end - start;
 8497|    743|  uint32_t input_size = uint32_t(input.size());
 8498|    743|  uint32_t new_difference = input_size - current_length;
 8499|       |
 8500|    743|  if (current_length == 0) {
  ------------------
  |  Branch (8500:7): [True: 514, False: 229]
  ------------------
 8501|    514|    buffer.insert(start, input);
 8502|    514|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8502:14): [True: 5, False: 224]
  ------------------
 8503|      5|    if (input_size != 0) {
  ------------------
  |  Branch (8503:9): [True: 5, False: 0]
  ------------------
 8504|      5|      std::memmove(buffer.data() + start, input.data(), input_size);
 8505|      5|    }
 8506|    224|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8506:14): [True: 57, False: 167]
  ------------------
 8507|     57|    buffer.erase(start, current_length - input_size);
 8508|     57|    buffer.replace(start, input_size, input);
 8509|    167|  } else {
 8510|    167|    buffer.replace(start, current_length, input.substr(0, current_length));
 8511|    167|    buffer.insert(start + current_length, input.substr(current_length));
 8512|    167|  }
 8513|       |
 8514|    743|  return new_difference;
 8515|    743|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8471|    310|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8472|    310|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8473|    310|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8474|    310|          " bytes] components.hash_start = ", components.hash_start);
 8475|    310|  ADA_ASSERT_TRUE(validate());
 8476|    310|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8477|    310|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8477:7): [True: 0, False: 310]
  ------------------
 8478|      0|    buffer.resize(components.hash_start);
 8479|      0|  }
 8480|    310|  components.hash_start = uint32_t(buffer.size());
 8481|    310|  buffer += "#";
 8482|    310|  bool encoding_required = unicode::percent_encode<true>(
 8483|    310|      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|    310|  if (!encoding_required) {
  ------------------
  |  Branch (8486:7): [True: 137, False: 173]
  ------------------
 8487|    137|    buffer.append(input);
 8488|    137|  }
 8489|    310|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8490|    310|          buffer, "' [", buffer.size(), " bytes]");
 8491|    310|  ADA_ASSERT_TRUE(validate());
 8492|    310|}
_ZN3ada7helpers14leading_zeroesEj:
 2001|    514|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|    514|  return __builtin_clz(input_num);
 2008|    514|#endif  // ADA_REGULAR_VISUAL_STUDIO
 2009|    514|}
_ZN3ada14url_aggregator7reserveEj:
 9161|    514|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9162|    514|  buffer.reserve(capacity);
 9163|    514|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9135|    514|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9136|    514|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9137|    514|  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|    514|  if (has_authority()) {
  ------------------
  |  Branch (9141:7): [True: 0, False: 514]
  ------------------
 9142|      0|    return;
 9143|      0|  }
 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|    514|  buffer.insert(components.protocol_end, "//");
 9148|    514|  components.username_end += 2;
 9149|    514|  components.host_start += 2;
 9150|    514|  components.host_end += 2;
 9151|    514|  components.pathname_start += 2;
 9152|    514|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9152:7): [True: 0, False: 514]
  ------------------
 9153|      0|    components.search_start += 2;
 9154|      0|  }
 9155|    514|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9155:7): [True: 0, False: 514]
  ------------------
 9156|      0|    components.hash_start += 2;
 9157|      0|  }
 9158|    514|  ADA_ASSERT_TRUE(validate());
 9159|    514|}
_ZN3ada14url_aggregator12clear_searchEv:
 8985|  1.37k|inline void url_aggregator::clear_search() {
 8986|  1.37k|  ada_log("url_aggregator::clear_search");
 8987|  1.37k|  ADA_ASSERT_TRUE(validate());
 8988|  1.37k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8988:7): [True: 0, False: 1.37k]
  ------------------
 8989|      0|    return;
 8990|      0|  }
 8991|       |
 8992|  1.37k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8992:7): [True: 1.22k, False: 154]
  ------------------
 8993|  1.22k|    buffer.resize(components.search_start);
 8994|  1.22k|  } else {
 8995|    154|    buffer.erase(components.search_start,
 8996|    154|                 components.hash_start - components.search_start);
 8997|    154|    components.hash_start = components.search_start;
 8998|    154|  }
 8999|       |
 9000|  1.37k|  components.search_start = url_components::omitted;
 9001|       |
 9002|       |#if ADA_DEVELOPMENT_CHECKS
 9003|       |  ADA_ASSERT_EQUAL(get_search(), "",
 9004|       |                   "search should have been cleared on buffer=" + buffer +
 9005|       |                       " with " + components.to_string() + "\n" + to_diagram());
 9006|       |#endif
 9007|  1.37k|  ADA_ASSERT_TRUE(validate());
 9008|  1.37k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8602|  3.00k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8603|  3.00k|  ada_log("url_aggregator::update_base_search ", input,
 8604|  3.00k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8605|  3.00k|  ADA_ASSERT_TRUE(validate());
 8606|  3.00k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8607|       |
 8608|  3.00k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8608:7): [True: 2.77k, False: 229]
  ------------------
 8609|  2.77k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8609:9): [True: 1.46k, False: 1.30k]
  ------------------
 8610|  1.46k|      components.search_start = uint32_t(buffer.size());
 8611|  1.46k|      buffer += "?";
 8612|  1.46k|    } else {
 8613|  1.30k|      buffer.resize(components.search_start + 1);
 8614|  1.30k|    }
 8615|       |
 8616|  2.77k|    bool encoding_required =
 8617|  2.77k|        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|  2.77k|    if (!encoding_required) {
  ------------------
  |  Branch (8620:9): [True: 1.62k, False: 1.14k]
  ------------------
 8621|  1.62k|      buffer.append(input);
 8622|  1.62k|    }
 8623|  2.77k|  } else {
 8624|    229|    const size_t idx =
 8625|    229|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8626|    229|    std::string encoded;
 8627|    229|    std::string_view replacement = input;
 8628|    229|    if (idx != input.size()) {
  ------------------
  |  Branch (8628:9): [True: 0, False: 229]
  ------------------
 8629|      0|      encoded =
 8630|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8631|      0|      replacement = encoded;
 8632|      0|    }
 8633|       |
 8634|    229|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8634:9): [True: 229, False: 0]
  ------------------
 8635|    229|      const uint32_t difference = replace_and_resize(
 8636|    229|          components.search_start + 1, components.hash_start, replacement);
 8637|    229|      components.hash_start += difference;
 8638|    229|    } 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|    229|  }
 8649|       |
 8650|  3.00k|  ADA_ASSERT_TRUE(validate());
 8651|  3.00k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8517|    514|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8518|    514|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8519|    514|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8520|    514|  ADA_ASSERT_TRUE(validate());
 8521|    514|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8522|       |
 8523|       |  // This next line is required for when parsing a URL like `foo://`
 8524|    514|  add_authority_slashes_if_needed();
 8525|       |
 8526|    514|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8527|    514|  uint32_t new_difference =
 8528|    514|      replace_and_resize(components.host_start, components.host_end, input);
 8529|       |
 8530|    514|  if (has_credentials) {
  ------------------
  |  Branch (8530:7): [True: 0, False: 514]
  ------------------
 8531|      0|    buffer.insert(components.host_start, "@");
 8532|      0|    new_difference++;
 8533|      0|  }
 8534|    514|  components.host_end += new_difference;
 8535|    514|  components.pathname_start += new_difference;
 8536|    514|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8536:7): [True: 0, False: 514]
  ------------------
 8537|      0|    components.search_start += new_difference;
 8538|      0|  }
 8539|    514|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8539:7): [True: 0, False: 514]
  ------------------
 8540|      0|    components.hash_start += new_difference;
 8541|      0|  }
 8542|    514|  ADA_ASSERT_TRUE(validate());
 8543|    514|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8369|    229|                                              const uint8_t character_set[]) {
 8370|    229|  const char* data = input.data();
 8371|    229|  const size_t size = input.size();
 8372|       |
 8373|       |  // Process 8 bytes at a time using unrolled loop
 8374|    229|  size_t i = 0;
 8375|  3.52k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8375:10): [True: 3.29k, False: 229]
  ------------------
 8376|  3.29k|    unsigned char chunk[8];
 8377|  3.29k|    std::memcpy(&chunk, data + i,
 8378|  3.29k|                8);  // entices compiler to unconditionally process 8 characters
 8379|       |
 8380|       |    // Check 8 characters at once
 8381|  29.6k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8381:24): [True: 26.3k, False: 3.29k]
  ------------------
 8382|  26.3k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8382:11): [True: 0, False: 26.3k]
  ------------------
 8383|      0|        return i + j;
 8384|      0|      }
 8385|  26.3k|    }
 8386|  3.29k|  }
 8387|       |
 8388|       |  // Handle remaining bytes
 8389|  1.01k|  for (; i < size; i++) {
  ------------------
  |  Branch (8389:10): [True: 783, False: 229]
  ------------------
 8390|    783|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8390:9): [True: 0, False: 783]
  ------------------
 8391|      0|      return i;
 8392|      0|    }
 8393|    783|  }
 8394|       |
 8395|    229|  return size;
 8396|    229|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9126|    514|    const noexcept {
 9127|    514|  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|    514|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9130:10): [True: 0, False: 514]
  ------------------
 9131|      0|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9131:10): [True: 0, False: 0]
  ------------------
 9132|      0|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9132:10): [True: 0, False: 0]
  ------------------
 9133|    514|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4101|  2.91k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4070|  8.73k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4071|  8.73k|    TL_ASSERT(has_value());
  ------------------
  |  | 2123|  8.73k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4071:5): [True: 8.73k, False: 0]
  ------------------
 4072|  8.73k|    return valptr();
 4073|  8.73k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3366|  8.73k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4100|  8.73k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2698|  2.91k|  ~expected_storage_base() {
 2699|  2.91k|    if (m_has_val) {
  ------------------
  |  Branch (2699:9): [True: 2.91k, False: 0]
  ------------------
 2700|  2.91k|      m_val.~T();
 2701|  2.91k|    }
 2702|  2.91k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1913|  1.59k|                                                       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|  1.59k|  return input.substr(pos1, pos2 - pos1);
 1922|  1.59k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8558|  1.46k|    const noexcept {
 8559|  1.46k|  return buffer.size() == components.pathname_start;
 8560|  1.46k|}
_ZN3ada17url_search_paramsC2ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9605|  14.5k|  explicit url_search_params(const std::string_view input) {
 9606|  14.5k|    initialize(input);
 9607|  14.5k|  }
_ZN3ada17url_search_params10initializeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9830|  17.4k|inline void url_search_params::initialize(std::string_view input) {
 9831|  17.4k|  if (!input.empty() && input.front() == '?') {
  ------------------
  |  Branch (9831:7): [True: 6.18k, False: 11.2k]
  |  Branch (9831:25): [True: 26, False: 6.15k]
  ------------------
 9832|     26|    input.remove_prefix(1);
 9833|     26|  }
 9834|  17.4k|  if (input.empty()) {
  ------------------
  |  Branch (9834:7): [True: 11.2k, False: 6.17k]
  ------------------
 9835|  11.2k|    return;
 9836|  11.2k|  }
 9837|       |  // Refuse overlong query strings (same process-wide cap as URL parsing).
 9838|  6.17k|  if (input.size() > get_max_input_length()) {
  ------------------
  |  Branch (9838:7): [True: 0, False: 6.17k]
  ------------------
 9839|      0|    return;
 9840|      0|  }
 9841|       |
 9842|  6.17k|  params.reserve(size_t(std::count(input.begin(), input.end(), '&')) + 1);
 9843|       |
 9844|  6.17k|  auto process_key_value = [&](const std::string_view current) {
 9845|  6.17k|    const auto equal = current.find('=');
 9846|  6.17k|    if (equal == std::string_view::npos) {
 9847|  6.17k|      params.emplace_back(unicode::form_urlencoded_decode(current), "");
 9848|  6.17k|    } else {
 9849|  6.17k|      params.emplace_back(
 9850|  6.17k|          unicode::form_urlencoded_decode(current.substr(0, equal)),
 9851|  6.17k|          unicode::form_urlencoded_decode(current.substr(equal + 1)));
 9852|  6.17k|    }
 9853|  6.17k|  };
 9854|       |
 9855|  41.4k|  while (!input.empty()) {
  ------------------
  |  Branch (9855:10): [True: 41.2k, False: 217]
  ------------------
 9856|  41.2k|    const auto ampersand_index = input.find('&');
 9857|       |
 9858|  41.2k|    if (ampersand_index == std::string_view::npos) {
  ------------------
  |  Branch (9858:9): [True: 5.95k, False: 35.2k]
  ------------------
 9859|  5.95k|      if (!input.empty()) {
  ------------------
  |  Branch (9859:11): [True: 5.95k, False: 0]
  ------------------
 9860|  5.95k|        process_key_value(input);
 9861|  5.95k|      }
 9862|  5.95k|      break;
 9863|  35.2k|    } else if (ampersand_index != 0) {
  ------------------
  |  Branch (9863:16): [True: 26.5k, False: 8.74k]
  ------------------
 9864|  26.5k|      process_key_value(input.substr(0, ampersand_index));
 9865|  26.5k|    }
 9866|       |
 9867|  35.2k|    input.remove_prefix(ampersand_index + 1);
 9868|  35.2k|  }
 9869|  6.17k|}
_ZZN3ada17url_search_params10initializeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_E_clES5_:
 9844|  32.4k|  auto process_key_value = [&](const std::string_view current) {
 9845|  32.4k|    const auto equal = current.find('=');
 9846|  32.4k|    if (equal == std::string_view::npos) {
  ------------------
  |  Branch (9846:9): [True: 11.8k, False: 20.5k]
  ------------------
 9847|  11.8k|      params.emplace_back(unicode::form_urlencoded_decode(current), "");
 9848|  20.5k|    } else {
 9849|  20.5k|      params.emplace_back(
 9850|  20.5k|          unicode::form_urlencoded_decode(current.substr(0, equal)),
 9851|  20.5k|          unicode::form_urlencoded_decode(current.substr(equal + 1)));
 9852|  20.5k|    }
 9853|  32.4k|  };
_ZN3ada17url_search_paramsD2Ev:
 9613|  29.1k|  ~url_search_params() = default;
_ZNK3ada17url_search_params9to_stringEv:
 9917|  26.2k|inline std::string url_search_params::to_string() const {
 9918|  26.2k|  auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE;
 9919|  26.2k|  std::string out{};
 9920|  82.9k|  for (size_t i = 0; i < params.size(); i++) {
  ------------------
  |  Branch (9920:22): [True: 56.7k, False: 26.2k]
  ------------------
 9921|  56.7k|    auto key = ada::unicode::percent_encode(params[i].first, character_set);
 9922|  56.7k|    auto value = ada::unicode::percent_encode(params[i].second, character_set);
 9923|       |
 9924|       |    // Performance optimization: Move this inside percent_encode.
 9925|  56.7k|    std::ranges::replace(key, ' ', '+');
 9926|  56.7k|    std::ranges::replace(value, ' ', '+');
 9927|       |
 9928|  56.7k|    if (i != 0) {
  ------------------
  |  Branch (9928:9): [True: 43.6k, False: 13.0k]
  ------------------
 9929|  43.6k|      out += "&";
 9930|  43.6k|    }
 9931|  56.7k|    out.append(key);
 9932|  56.7k|    out += "=";
 9933|  56.7k|    out.append(value);
 9934|  56.7k|  }
 9935|  26.2k|  return out;
 9936|  26.2k|}
_ZNK3ada17url_search_params4sizeEv:
 9876|  26.2k|inline size_t url_search_params::size() const noexcept { return params.size(); }
_ZN3ada17url_search_params4sortEv:
 9965|  5.82k|inline void url_search_params::sort() {
 9966|       |  // Keys are expected to be valid UTF-8, but percent_decode can produce
 9967|       |  // arbitrary byte sequences. Handle truncated/invalid sequences gracefully.
 9968|  5.82k|  std::ranges::stable_sort(params, [](const key_value_pair& lhs,
 9969|  5.82k|                                      const key_value_pair& rhs) {
 9970|  5.82k|    size_t i = 0, j = 0;
 9971|  5.82k|    uint32_t low_surrogate1 = 0, low_surrogate2 = 0;
 9972|  5.82k|    while ((i < lhs.first.size() || low_surrogate1 != 0) &&
 9973|  5.82k|           (j < rhs.first.size() || low_surrogate2 != 0)) {
 9974|  5.82k|      uint32_t codePoint1 = 0, codePoint2 = 0;
 9975|       |
 9976|  5.82k|      if (low_surrogate1 != 0) {
 9977|  5.82k|        codePoint1 = low_surrogate1;
 9978|  5.82k|        low_surrogate1 = 0;
 9979|  5.82k|      } else {
 9980|  5.82k|        uint8_t c1 = uint8_t(lhs.first[i]);
 9981|  5.82k|        if (c1 > 0x7F && c1 <= 0xDF && i + 1 < lhs.first.size()) {
 9982|  5.82k|          codePoint1 = ((c1 & 0x1F) << 6) | (uint8_t(lhs.first[i + 1]) & 0x3F);
 9983|  5.82k|          i += 2;
 9984|  5.82k|        } else if (c1 > 0xDF && c1 <= 0xEF && i + 2 < lhs.first.size()) {
 9985|  5.82k|          codePoint1 = ((c1 & 0x0F) << 12) |
 9986|  5.82k|                       ((uint8_t(lhs.first[i + 1]) & 0x3F) << 6) |
 9987|  5.82k|                       (uint8_t(lhs.first[i + 2]) & 0x3F);
 9988|  5.82k|          i += 3;
 9989|  5.82k|        } else if (c1 > 0xEF && c1 <= 0xF7 && i + 3 < lhs.first.size()) {
 9990|  5.82k|          codePoint1 = ((c1 & 0x07) << 18) |
 9991|  5.82k|                       ((uint8_t(lhs.first[i + 1]) & 0x3F) << 12) |
 9992|  5.82k|                       ((uint8_t(lhs.first[i + 2]) & 0x3F) << 6) |
 9993|  5.82k|                       (uint8_t(lhs.first[i + 3]) & 0x3F);
 9994|  5.82k|          i += 4;
 9995|       |
 9996|  5.82k|          codePoint1 -= 0x10000;
 9997|  5.82k|          uint16_t high_surrogate = uint16_t(0xD800 + (codePoint1 >> 10));
 9998|  5.82k|          low_surrogate1 = uint16_t(0xDC00 + (codePoint1 & 0x3FF));
 9999|  5.82k|          codePoint1 = high_surrogate;
10000|  5.82k|        } else {
10001|       |          // ASCII (c1 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
10002|  5.82k|          codePoint1 = c1;
10003|  5.82k|          i++;
10004|  5.82k|        }
10005|  5.82k|      }
10006|       |
10007|  5.82k|      if (low_surrogate2 != 0) {
10008|  5.82k|        codePoint2 = low_surrogate2;
10009|  5.82k|        low_surrogate2 = 0;
10010|  5.82k|      } else {
10011|  5.82k|        uint8_t c2 = uint8_t(rhs.first[j]);
10012|  5.82k|        if (c2 > 0x7F && c2 <= 0xDF && j + 1 < rhs.first.size()) {
10013|  5.82k|          codePoint2 = ((c2 & 0x1F) << 6) | (uint8_t(rhs.first[j + 1]) & 0x3F);
10014|  5.82k|          j += 2;
10015|  5.82k|        } else if (c2 > 0xDF && c2 <= 0xEF && j + 2 < rhs.first.size()) {
10016|  5.82k|          codePoint2 = ((c2 & 0x0F) << 12) |
10017|  5.82k|                       ((uint8_t(rhs.first[j + 1]) & 0x3F) << 6) |
10018|  5.82k|                       (uint8_t(rhs.first[j + 2]) & 0x3F);
10019|  5.82k|          j += 3;
10020|  5.82k|        } else if (c2 > 0xEF && c2 <= 0xF7 && j + 3 < rhs.first.size()) {
10021|  5.82k|          codePoint2 = ((c2 & 0x07) << 18) |
10022|  5.82k|                       ((uint8_t(rhs.first[j + 1]) & 0x3F) << 12) |
10023|  5.82k|                       ((uint8_t(rhs.first[j + 2]) & 0x3F) << 6) |
10024|  5.82k|                       (uint8_t(rhs.first[j + 3]) & 0x3F);
10025|  5.82k|          j += 4;
10026|  5.82k|          codePoint2 -= 0x10000;
10027|  5.82k|          uint16_t high_surrogate = uint16_t(0xD800 + (codePoint2 >> 10));
10028|  5.82k|          low_surrogate2 = uint16_t(0xDC00 + (codePoint2 & 0x3FF));
10029|  5.82k|          codePoint2 = high_surrogate;
10030|  5.82k|        } else {
10031|       |          // ASCII (c2 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
10032|  5.82k|          codePoint2 = c2;
10033|  5.82k|          j++;
10034|  5.82k|        }
10035|  5.82k|      }
10036|       |
10037|  5.82k|      if (codePoint1 != codePoint2) {
10038|  5.82k|        return (codePoint1 < codePoint2);
10039|  5.82k|      }
10040|  5.82k|    }
10041|  5.82k|    return (j < rhs.first.size() || low_surrogate2 != 0);
10042|  5.82k|  });
10043|  5.82k|}
_ZZN3ada17url_search_params4sortEvENKUlRKNSt3__14pairINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES8_EESB_E_clESB_SB_:
 9969|  39.1k|                                      const key_value_pair& rhs) {
 9970|  39.1k|    size_t i = 0, j = 0;
 9971|  39.1k|    uint32_t low_surrogate1 = 0, low_surrogate2 = 0;
 9972|  63.0k|    while ((i < lhs.first.size() || low_surrogate1 != 0) &&
  ------------------
  |  Branch (9972:13): [True: 40.7k, False: 22.3k]
  |  Branch (9972:37): [True: 397, False: 21.9k]
  ------------------
 9973|  41.1k|           (j < rhs.first.size() || low_surrogate2 != 0)) {
  ------------------
  |  Branch (9973:13): [True: 39.0k, False: 2.16k]
  |  Branch (9973:37): [True: 389, False: 1.78k]
  ------------------
 9974|  39.3k|      uint32_t codePoint1 = 0, codePoint2 = 0;
 9975|       |
 9976|  39.3k|      if (low_surrogate1 != 0) {
  ------------------
  |  Branch (9976:11): [True: 1.13k, False: 38.2k]
  ------------------
 9977|  1.13k|        codePoint1 = low_surrogate1;
 9978|  1.13k|        low_surrogate1 = 0;
 9979|  38.2k|      } else {
 9980|  38.2k|        uint8_t c1 = uint8_t(lhs.first[i]);
 9981|  38.2k|        if (c1 > 0x7F && c1 <= 0xDF && i + 1 < lhs.first.size()) {
  ------------------
  |  Branch (9981:13): [True: 13.2k, False: 24.9k]
  |  Branch (9981:26): [True: 4.51k, False: 8.78k]
  |  Branch (9981:40): [True: 1.35k, False: 3.15k]
  ------------------
 9982|  1.35k|          codePoint1 = ((c1 & 0x1F) << 6) | (uint8_t(lhs.first[i + 1]) & 0x3F);
 9983|  1.35k|          i += 2;
 9984|  36.9k|        } else if (c1 > 0xDF && c1 <= 0xEF && i + 2 < lhs.first.size()) {
  ------------------
  |  Branch (9984:20): [True: 8.78k, False: 28.1k]
  |  Branch (9984:33): [True: 2.27k, False: 6.50k]
  |  Branch (9984:47): [True: 1.29k, False: 979]
  ------------------
 9985|  1.29k|          codePoint1 = ((c1 & 0x0F) << 12) |
 9986|  1.29k|                       ((uint8_t(lhs.first[i + 1]) & 0x3F) << 6) |
 9987|  1.29k|                       (uint8_t(lhs.first[i + 2]) & 0x3F);
 9988|  1.29k|          i += 3;
 9989|  35.6k|        } else if (c1 > 0xEF && c1 <= 0xF7 && i + 3 < lhs.first.size()) {
  ------------------
  |  Branch (9989:20): [True: 6.50k, False: 29.1k]
  |  Branch (9989:33): [True: 4.33k, False: 2.17k]
  |  Branch (9989:47): [True: 1.45k, False: 2.87k]
  ------------------
 9990|  1.45k|          codePoint1 = ((c1 & 0x07) << 18) |
 9991|  1.45k|                       ((uint8_t(lhs.first[i + 1]) & 0x3F) << 12) |
 9992|  1.45k|                       ((uint8_t(lhs.first[i + 2]) & 0x3F) << 6) |
 9993|  1.45k|                       (uint8_t(lhs.first[i + 3]) & 0x3F);
 9994|  1.45k|          i += 4;
 9995|       |
 9996|  1.45k|          codePoint1 -= 0x10000;
 9997|  1.45k|          uint16_t high_surrogate = uint16_t(0xD800 + (codePoint1 >> 10));
 9998|  1.45k|          low_surrogate1 = uint16_t(0xDC00 + (codePoint1 & 0x3FF));
 9999|  1.45k|          codePoint1 = high_surrogate;
10000|  34.1k|        } else {
10001|       |          // ASCII (c1 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
10002|  34.1k|          codePoint1 = c1;
10003|  34.1k|          i++;
10004|  34.1k|        }
10005|  38.2k|      }
10006|       |
10007|  39.3k|      if (low_surrogate2 != 0) {
  ------------------
  |  Branch (10007:11): [True: 1.13k, False: 38.2k]
  ------------------
10008|  1.13k|        codePoint2 = low_surrogate2;
10009|  1.13k|        low_surrogate2 = 0;
10010|  38.2k|      } else {
10011|  38.2k|        uint8_t c2 = uint8_t(rhs.first[j]);
10012|  38.2k|        if (c2 > 0x7F && c2 <= 0xDF && j + 1 < rhs.first.size()) {
  ------------------
  |  Branch (10012:13): [True: 15.3k, False: 22.8k]
  |  Branch (10012:26): [True: 6.06k, False: 9.30k]
  |  Branch (10012:40): [True: 2.01k, False: 4.05k]
  ------------------
10013|  2.01k|          codePoint2 = ((c2 & 0x1F) << 6) | (uint8_t(rhs.first[j + 1]) & 0x3F);
10014|  2.01k|          j += 2;
10015|  36.2k|        } else if (c2 > 0xDF && c2 <= 0xEF && j + 2 < rhs.first.size()) {
  ------------------
  |  Branch (10015:20): [True: 9.30k, False: 26.9k]
  |  Branch (10015:33): [True: 2.40k, False: 6.89k]
  |  Branch (10015:47): [True: 1.37k, False: 1.03k]
  ------------------
10016|  1.37k|          codePoint2 = ((c2 & 0x0F) << 12) |
10017|  1.37k|                       ((uint8_t(rhs.first[j + 1]) & 0x3F) << 6) |
10018|  1.37k|                       (uint8_t(rhs.first[j + 2]) & 0x3F);
10019|  1.37k|          j += 3;
10020|  34.8k|        } else if (c2 > 0xEF && c2 <= 0xF7 && j + 3 < rhs.first.size()) {
  ------------------
  |  Branch (10020:20): [True: 6.89k, False: 27.9k]
  |  Branch (10020:33): [True: 4.27k, False: 2.62k]
  |  Branch (10020:47): [True: 1.61k, False: 2.65k]
  ------------------
10021|  1.61k|          codePoint2 = ((c2 & 0x07) << 18) |
10022|  1.61k|                       ((uint8_t(rhs.first[j + 1]) & 0x3F) << 12) |
10023|  1.61k|                       ((uint8_t(rhs.first[j + 2]) & 0x3F) << 6) |
10024|  1.61k|                       (uint8_t(rhs.first[j + 3]) & 0x3F);
10025|  1.61k|          j += 4;
10026|  1.61k|          codePoint2 -= 0x10000;
10027|  1.61k|          uint16_t high_surrogate = uint16_t(0xD800 + (codePoint2 >> 10));
10028|  1.61k|          low_surrogate2 = uint16_t(0xDC00 + (codePoint2 & 0x3FF));
10029|  1.61k|          codePoint2 = high_surrogate;
10030|  33.2k|        } else {
10031|       |          // ASCII (c2 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
10032|  33.2k|          codePoint2 = c2;
10033|  33.2k|          j++;
10034|  33.2k|        }
10035|  38.2k|      }
10036|       |
10037|  39.3k|      if (codePoint1 != codePoint2) {
  ------------------
  |  Branch (10037:11): [True: 15.4k, False: 23.9k]
  ------------------
10038|  15.4k|        return (codePoint1 < codePoint2);
10039|  15.4k|      }
10040|  39.3k|    }
10041|  23.6k|    return (j < rhs.first.size() || low_surrogate2 != 0);
  ------------------
  |  Branch (10041:13): [True: 4.55k, False: 19.1k]
  |  Branch (10041:37): [True: 20, False: 19.1k]
  ------------------
10042|  39.1k|  });
_ZN3ada17url_search_params5resetENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9825|  2.91k|inline void url_search_params::reset(std::string_view input) {
 9826|  2.91k|  params.clear();
 9827|  2.91k|  initialize(input);
 9828|  2.91k|}
_ZN3ada17url_search_params6appendENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
 9872|  16.2k|                                      const std::string_view value) {
 9873|  16.2k|  params.emplace_back(key, value);
 9874|  16.2k|}
_ZN3ada17url_search_params3setENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
 9939|  2.91k|                                   const std::string_view value) {
 9940|  2.91k|  const auto find = [&key](const auto& param) { return param.first == key; };
 9941|       |
 9942|  2.91k|  auto it = std::ranges::find_if(params, find);
 9943|       |
 9944|  2.91k|  if (it == params.end()) {
  ------------------
  |  Branch (9944:7): [True: 0, False: 2.91k]
  ------------------
 9945|      0|    params.emplace_back(key, value);
 9946|  2.91k|  } else {
 9947|  2.91k|    it->second = value;
 9948|  2.91k|    params.erase(std::remove_if(std::next(it), params.end(), find),
 9949|  2.91k|                 params.end());
 9950|  2.91k|  }
 9951|  2.91k|}
_ZZN3ada17url_search_params3setENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_ENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9940|  5.82k|  const auto find = [&key](const auto& param) { return param.first == key; };
_ZN3ada17url_search_params6removeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9953|  4.16k|inline void url_search_params::remove(const std::string_view key) {
 9954|  4.16k|  std::erase_if(params,
 9955|  4.16k|                [&key](const auto& param) { return param.first == key; });
 9956|  4.16k|}
_ZZN3ada17url_search_params6removeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9955|  9.23k|                [&key](const auto& param) { return param.first == key; });
_ZN3ada17url_search_params6removeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
 9959|  4.16k|                                      const std::string_view value) {
 9960|  4.16k|  std::erase_if(params, [&key, &value](const auto& param) {
 9961|  4.16k|    return param.first == key && param.second == value;
 9962|  4.16k|  });
 9963|  4.16k|}
_ZZN3ada17url_search_params6removeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_ENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9960|  3.34k|  std::erase_if(params, [&key, &value](const auto& param) {
 9961|  3.34k|    return param.first == key && param.second == value;
  ------------------
  |  Branch (9961:12): [True: 0, False: 3.34k]
  |  Branch (9961:34): [True: 0, False: 0]
  ------------------
 9962|  3.34k|  });
_ZN3ada17url_search_params3hasENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9903|  22.2k|inline bool url_search_params::has(const std::string_view key) noexcept {
 9904|  22.2k|  auto entry = std::ranges::find_if(
 9905|  22.2k|      params, [&key](const auto& param) { return param.first == key; });
 9906|  22.2k|  return entry != params.end();
 9907|  22.2k|}
_ZZN3ada17url_search_params3hasENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9905|   268k|      params, [&key](const auto& param) { return param.first == key; });
_ZN3ada17url_search_params3hasENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
 9910|  12.5k|                                   std::string_view value) noexcept {
 9911|  12.5k|  auto entry = std::ranges::find_if(params, [&key, &value](const auto& param) {
 9912|  12.5k|    return param.first == key && param.second == value;
 9913|  12.5k|  });
 9914|  12.5k|  return entry != params.end();
 9915|  12.5k|}
_ZZN3ada17url_search_params3hasENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_ENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9911|   137k|  auto entry = std::ranges::find_if(params, [&key, &value](const auto& param) {
 9912|   137k|    return param.first == key && param.second == value;
  ------------------
  |  Branch (9912:12): [True: 14.7k, False: 123k]
  |  Branch (9912:34): [True: 10.9k, False: 3.80k]
  ------------------
 9913|   137k|  });
_ZN3ada17url_search_params3getENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9879|  18.3k|    const std::string_view key) {
 9880|  18.3k|  auto entry = std::ranges::find_if(
 9881|  18.3k|      params, [&key](const auto& param) { return param.first == key; });
 9882|       |
 9883|  18.3k|  if (entry == params.end()) {
  ------------------
  |  Branch (9883:7): [True: 5.51k, False: 12.8k]
  ------------------
 9884|  5.51k|    return std::nullopt;
 9885|  5.51k|  }
 9886|       |
 9887|  12.8k|  return entry->second;
 9888|  18.3k|}
_ZZN3ada17url_search_params3getENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlRKT_E_clINS1_4pairINS1_12basic_stringIcS4_NS1_9allocatorIcEEEESF_EEEEDaS8_:
 9881|   143k|      params, [&key](const auto& param) { return param.first == key; });
_ZN3ada17url_search_params7get_allENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9891|  5.82k|    const std::string_view key) {
 9892|  5.82k|  std::vector<std::string> out{};
 9893|       |
 9894|  16.3k|  for (auto& param : params) {
  ------------------
  |  Branch (9894:20): [True: 16.3k, False: 5.82k]
  ------------------
 9895|  16.3k|    if (param.first == key) {
  ------------------
  |  Branch (9895:9): [True: 5.75k, False: 10.6k]
  ------------------
 9896|  5.75k|      out.emplace_back(param.second);
 9897|  5.75k|    }
 9898|  16.3k|  }
 9899|       |
 9900|  5.82k|  return out;
 9901|  5.82k|}
_ZN3ada17url_search_params8get_keysEv:
10045|  2.91k|inline url_search_params_keys_iter url_search_params::get_keys() {
10046|  2.91k|  return url_search_params_keys_iter(*this);
10047|  2.91k|}
_ZN3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE0EEC2ERNS_17url_search_paramsE:
 9785|  2.91k|  inline url_search_params_iter(url_search_params& params_) : params(params_) {}
_ZN3ada17url_search_params10get_valuesEv:
10052|  2.91k|inline url_search_params_values_iter url_search_params::get_values() {
10053|  2.91k|  return url_search_params_values_iter(*this);
10054|  2.91k|}
_ZN3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE1EEC2ERNS_17url_search_paramsE:
 9785|  2.91k|  inline url_search_params_iter(url_search_params& params_) : params(params_) {}
_ZN3ada17url_search_params11get_entriesEv:
10059|  2.91k|inline url_search_params_entries_iter url_search_params::get_entries() {
10060|  2.91k|  return url_search_params_entries_iter(*this);
10061|  2.91k|}
_ZN3ada22url_search_params_iterINSt3__14pairINS1_17basic_string_viewIcNS1_11char_traitsIcEEEES6_EELNS_27url_search_params_iter_typeE2EEC2ERNS_17url_search_paramsE:
 9785|  2.91k|  inline url_search_params_iter(url_search_params& params_) : params(params_) {}
_ZN3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE0EE4nextEv:
10069|  9.57k|inline std::optional<std::string_view> url_search_params_keys_iter::next() {
10070|  9.57k|  if (!has_next()) {
  ------------------
  |  Branch (10070:7): [True: 0, False: 9.57k]
  ------------------
10071|      0|    return std::nullopt;
10072|      0|  }
10073|  9.57k|  return params.params[pos++].first;
10074|  9.57k|}
_ZN3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE1EE4nextEv:
10077|  9.57k|inline std::optional<std::string_view> url_search_params_values_iter::next() {
10078|  9.57k|  if (!has_next()) {
  ------------------
  |  Branch (10078:7): [True: 0, False: 9.57k]
  ------------------
10079|      0|    return std::nullopt;
10080|      0|  }
10081|  9.57k|  return params.params[pos++].second;
10082|  9.57k|}
_ZN3ada22url_search_params_iterINSt3__14pairINS1_17basic_string_viewIcNS1_11char_traitsIcEEEES6_EELNS_27url_search_params_iter_typeE2EE4nextEv:
10086|  9.57k|url_search_params_entries_iter::next() {
10087|  9.57k|  if (!has_next()) {
  ------------------
  |  Branch (10087:7): [True: 0, False: 9.57k]
  ------------------
10088|      0|    return std::nullopt;
10089|      0|  }
10090|  9.57k|  return params.params[pos++];
10091|  9.57k|}
_ZNK3ada17url_search_params5beginEv:
 9722|  11.6k|  inline auto begin() const { return params.begin(); }
_ZNK3ada17url_search_params3endEv:
 9723|  11.6k|  inline auto end() const { return params.end(); }
_ZNK3ada17url_search_params5frontEv:
 9724|  1.13k|  inline auto front() const { return params.front(); }
_ZNK3ada17url_search_params4backEv:
 9725|  1.13k|  inline auto back() const { return params.back(); }
_ZNK3ada17url_search_paramsixEm:
 9726|  1.13k|  inline auto operator[](size_t index) const { return params[index]; }
_ZN3ada17url_search_paramsC2Ev:
 9598|  8.73k|  url_search_params() = default;
_ZN3ada17url_search_paramsC2ERKS0_:
 9609|  2.91k|  url_search_params(const url_search_params& u) = default;
_ZN3ada17url_search_paramsaSERKS0_:
 9612|  2.91k|  url_search_params& operator=(const url_search_params& u) = default;
_ZN3ada17url_search_paramsC2EOS0_:
 9610|  2.91k|  url_search_params(url_search_params&& u) noexcept = default;
_ZN3ada17url_search_paramsaSEOS0_:
 9611|  2.91k|  url_search_params& operator=(url_search_params&& u) noexcept = default;
_ZNK3ada14url_aggregator8validateEv:
 9317|  2.91k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9318|  2.91k|  if (!is_valid) {
  ------------------
  |  Branch (9318:7): [True: 0, False: 2.91k]
  ------------------
 9319|      0|    return true;
 9320|      0|  }
 9321|  2.91k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9321:7): [True: 0, False: 2.91k]
  ------------------
 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.91k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9340:7): [True: 0, False: 2.91k]
  ------------------
 9341|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9342|      0|    return false;
 9343|      0|  }
 9344|  2.91k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9344:7): [True: 0, False: 2.91k]
  ------------------
 9345|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9346|      0|    return false;
 9347|      0|  }
 9348|  2.91k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9348:7): [True: 0, False: 2.91k]
  ------------------
 9349|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9350|      0|    return false;
 9351|      0|  }
 9352|  2.91k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9352:7): [True: 0, False: 2.91k]
  ------------------
 9353|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9354|      0|    return false;
 9355|      0|  }
 9356|  2.91k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9356:7): [True: 0, False: 2.91k]
  ------------------
 9357|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9358|      0|    return false;
 9359|      0|  }
 9360|       |
 9361|  2.91k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9361:7): [True: 0, False: 2.91k]
  ------------------
 9362|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9363|      0|    return false;
 9364|      0|  }
 9365|  2.91k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9365:7): [True: 0, False: 2.91k]
  ------------------
 9366|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9367|      0|    return false;
 9368|      0|  }
 9369|  2.91k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9369:7): [True: 0, False: 2.91k]
  ------------------
 9370|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9371|      0|    return false;
 9372|      0|  }
 9373|  2.91k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9373:7): [True: 0, False: 2.91k]
  ------------------
 9374|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9375|      0|    return false;
 9376|      0|  }
 9377|  2.91k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9377:7): [True: 0, False: 2.91k]
  ------------------
 9378|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9379|      0|            to_diagram());
 9380|      0|    return false;
 9381|      0|  }
 9382|       |
 9383|  2.91k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9383:7): [True: 2.91k, False: 0]
  ------------------
 9384|  2.91k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9384:9): [True: 0, False: 2.91k]
  ------------------
 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.91k|  }
 9391|       |
 9392|  2.91k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9392:7): [True: 2.91k, False: 0]
  ------------------
 9393|  2.91k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9393:7): [True: 0, False: 2.91k]
  ------------------
 9394|      0|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9394:9): [True: 0, False: 0]
  ------------------
 9395|      0|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9395:9): [True: 0, False: 0]
  ------------------
 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|      0|  }
 9403|       |
 9404|  2.91k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9404:7): [True: 2.91k, False: 0]
  ------------------
 9405|  2.91k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9405:9): [True: 0, False: 2.91k]
  ------------------
 9406|      0|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9406:11): [True: 0, False: 0]
  ------------------
 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.91k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9412:16): [True: 2.91k, False: 0]
  ------------------
 9413|  2.91k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9413:16): [True: 2.91k, False: 0]
  ------------------
 9414|  2.91k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9414:11): [True: 2.91k, False: 0]
  ------------------
 9415|  2.91k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9415:13): [True: 0, False: 2.91k]
  ------------------
 9416|  2.91k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9416:13): [True: 0, False: 2.91k]
  ------------------
 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.91k|      } else {
 9424|      0|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9424:13): [True: 0, False: 0]
  ------------------
 9425|      0|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9425:13): [True: 0, False: 0]
  ------------------
 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|      0|      }
 9433|  2.91k|    } 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.91k|  }
 9441|  2.91k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9441:7): [True: 2.91k, False: 0]
  ------------------
 9442|  2.91k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9442:7): [True: 0, False: 2.91k]
  ------------------
 9443|      0|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9443:9): [True: 0, False: 0]
  ------------------
 9444|      0|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9444:9): [True: 0, False: 0]
  ------------------
 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|      0|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9454:16): [True: 0, False: 0]
  ------------------
 9455|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9456|      0|              to_diagram());
 9457|      0|      return false;
 9458|      0|    }
 9459|      0|  }
 9460|  2.91k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9460:7): [True: 2.91k, False: 0]
  ------------------
 9461|  2.91k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9461:7): [True: 2.91k, False: 0]
  ------------------
 9462|  2.91k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9462:7): [True: 2.91k, False: 0]
  |  Branch (9462:60): [True: 2.91k, False: 0]
  ------------------
 9463|  2.91k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9463:9): [True: 0, False: 2.91k]
  ------------------
 9464|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9465|      0|              to_diagram());
 9466|      0|      return false;
 9467|      0|    }
 9468|  2.91k|  }
 9469|  2.91k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9469:7): [True: 1.53k, False: 1.37k]
  ------------------
 9470|  1.53k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9470:9): [True: 0, False: 1.53k]
  ------------------
 9471|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9472|      0|              to_diagram());
 9473|      0|      return false;
 9474|      0|    }
 9475|  1.53k|  }
 9476|  2.91k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9476:7): [True: 383, False: 2.52k]
  ------------------
 9477|    383|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9477:9): [True: 0, False: 383]
  ------------------
 9478|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9479|      0|              to_diagram());
 9480|      0|      return false;
 9481|      0|    }
 9482|    383|  }
 9483|       |
 9484|  2.91k|  return true;
 9485|  2.91k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7801|  2.91k|    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.91k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7815:7): [True: 0, False: 2.91k]
  ------------------
 7816|      0|    return false;
 7817|      0|  }
 7818|  2.91k|  uint32_t index = protocol_end;
 7819|       |
 7820|  2.91k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7820:7): [True: 0, False: 2.91k]
  ------------------
 7821|      0|    return false;
 7822|      0|  }
 7823|  2.91k|  if (username_end < index) {
  ------------------
  |  Branch (7823:7): [True: 0, False: 2.91k]
  ------------------
 7824|      0|    return false;
 7825|      0|  }
 7826|  2.91k|  index = username_end;
 7827|       |
 7828|  2.91k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7828:7): [True: 0, False: 2.91k]
  ------------------
 7829|      0|    return false;
 7830|      0|  }
 7831|  2.91k|  if (host_start < index) {
  ------------------
  |  Branch (7831:7): [True: 0, False: 2.91k]
  ------------------
 7832|      0|    return false;
 7833|      0|  }
 7834|  2.91k|  index = host_start;
 7835|       |
 7836|  2.91k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7836:7): [True: 0, False: 2.91k]
  ------------------
 7837|      0|    if (port > 0xffff) {
  ------------------
  |  Branch (7837:9): [True: 0, False: 0]
  ------------------
 7838|      0|      return false;
 7839|      0|    }
 7840|      0|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7841|      0|    if (index + port_length < index) {
  ------------------
  |  Branch (7841:9): [True: 0, False: 0]
  ------------------
 7842|      0|      return false;
 7843|      0|    }
 7844|      0|    index += port_length;
 7845|      0|  }
 7846|       |
 7847|  2.91k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7847:7): [True: 0, False: 2.91k]
  ------------------
 7848|      0|    return false;
 7849|      0|  }
 7850|  2.91k|  if (pathname_start < index) {
  ------------------
  |  Branch (7850:7): [True: 0, False: 2.91k]
  ------------------
 7851|      0|    return false;
 7852|      0|  }
 7853|  2.91k|  index = pathname_start;
 7854|       |
 7855|  2.91k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7855:7): [True: 1.53k, False: 1.37k]
  ------------------
 7856|  1.53k|    if (search_start < index) {
  ------------------
  |  Branch (7856:9): [True: 0, False: 1.53k]
  ------------------
 7857|      0|      return false;
 7858|      0|    }
 7859|  1.53k|    index = search_start;
 7860|  1.53k|  }
 7861|       |
 7862|  2.91k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7862:7): [True: 383, False: 2.52k]
  ------------------
 7863|    383|    if (hash_start < index) {
  ------------------
  |  Branch (7863:9): [True: 0, False: 383]
  ------------------
 7864|      0|      return false;
 7865|      0|    }
 7866|    383|  }
 7867|       |
 7868|  2.91k|  return true;
 7869|  2.91k|}
_ZNK3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE0EE8has_nextEv:
10064|  22.0k|inline bool url_search_params_iter<T, Type>::has_next() const {
10065|  22.0k|  return pos < params.params.size();
10066|  22.0k|}
_ZNK3ada22url_search_params_iterINSt3__117basic_string_viewIcNS1_11char_traitsIcEEEELNS_27url_search_params_iter_typeE1EE8has_nextEv:
10064|  22.0k|inline bool url_search_params_iter<T, Type>::has_next() const {
10065|  22.0k|  return pos < params.params.size();
10066|  22.0k|}
_ZNK3ada22url_search_params_iterINSt3__14pairINS1_17basic_string_viewIcNS1_11char_traitsIcEEEES6_EELNS_27url_search_params_iter_typeE2EE8has_nextEv:
10064|  22.0k|inline bool url_search_params_iter<T, Type>::has_next() const {
10065|  22.0k|  return pos < params.params.size();
10066|  22.0k|}

LLVMFuzzerTestOneInput:
    9|  2.91k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   10|  2.91k|  FuzzedDataProvider fdp(data, size);
   11|  2.91k|  std::string source = fdp.ConsumeRandomLengthString(256);
   12|  2.91k|  std::string base_source = fdp.ConsumeRandomLengthString(256);
   13|  2.91k|  std::string key3 = fdp.ConsumeRandomLengthString(64);
   14|  2.91k|  std::string value3 = fdp.ConsumeRandomLengthString(64);
   15|       |
   16|       |  /**
   17|       |   * ada::url_search_params
   18|       |   */
   19|  2.91k|  volatile size_t length = 0;
   20|       |
   21|  2.91k|  auto base_source_view =
   22|  2.91k|      std::string_view(base_source.data(), base_source.length());
   23|       |
   24|       |  // Test constructor with initial value
   25|  2.91k|  auto initialized = ada::url_search_params(base_source_view);
   26|  2.91k|  length += initialized.size();
   27|  2.91k|  initialized.to_string();
   28|       |
   29|       |  // Test get() and get_all() on initialized params
   30|  2.91k|  {
   31|  2.91k|    auto val = initialized.get(source);
   32|  2.91k|    if (val.has_value()) {
  ------------------
  |  Branch (32:9): [True: 266, False: 2.64k]
  ------------------
   33|    266|      length += val->size();
   34|    266|    }
   35|  2.91k|    auto all_vals = initialized.get_all(source);
   36|  2.91k|    for (const auto& v : all_vals) {
  ------------------
  |  Branch (36:24): [True: 2.38k, False: 2.91k]
  ------------------
   37|  2.38k|      length += v.size();
   38|  2.38k|    }
   39|  2.91k|  }
   40|       |
   41|       |  // Test sort() on initialized params
   42|  2.91k|  initialized.sort();
   43|       |
   44|       |  // Test C++ range-for iteration; also verify has(k) and has(k,v) consistency.
   45|  9.64k|  for (const auto& pair : initialized) {
  ------------------
  |  Branch (45:25): [True: 9.64k, False: 2.91k]
  ------------------
   46|  9.64k|    length += pair.first.size();
   47|  9.64k|    length += pair.second.size();
   48|       |
   49|       |    // Every key seen in iteration must be reported by has(key).
   50|  9.64k|    if (!initialized.has(pair.first)) {
  ------------------
  |  Branch (50:9): [True: 0, False: 9.64k]
  ------------------
   51|      0|      printf(
   52|      0|          "url_search_params: iteration yielded key '%s' but has(key) is "
   53|      0|          "false\n",
   54|      0|          std::string(pair.first).c_str());
   55|      0|      abort();
   56|      0|    }
   57|       |
   58|       |    // has(key, value) → has(key)
   59|  9.64k|    if (initialized.has(pair.first, pair.second) &&
  ------------------
  |  Branch (59:9): [True: 9.64k, False: 0]
  ------------------
   60|  9.64k|        !initialized.has(pair.first)) {
  ------------------
  |  Branch (60:9): [True: 0, False: 9.64k]
  ------------------
   61|      0|      printf(
   62|      0|          "url_search_params: has(key,value) is true but has(key) is false "
   63|      0|          "for key '%s'\n",
   64|      0|          std::string(pair.first).c_str());
   65|      0|      abort();
   66|      0|    }
   67|       |
   68|       |    // get(key) must return a value when the key exists.
   69|  9.64k|    auto got = initialized.get(pair.first);
   70|  9.64k|    if (!got.has_value()) {
  ------------------
  |  Branch (70:9): [True: 0, False: 9.64k]
  ------------------
   71|      0|      printf(
   72|      0|          "url_search_params: has(key) is true but get(key) returned nullopt "
   73|      0|          "for key '%s'\n",
   74|      0|          std::string(pair.first).c_str());
   75|      0|      abort();
   76|      0|    }
   77|  9.64k|  }
   78|       |
   79|       |  // Test index-based access
   80|  2.91k|  if (initialized.size() > 0) {
  ------------------
  |  Branch (80:7): [True: 1.13k, False: 1.77k]
  ------------------
   81|  1.13k|    auto front = initialized.front();
   82|  1.13k|    length += front.first.size();
   83|  1.13k|    auto back = initialized.back();
   84|  1.13k|    length += back.first.size();
   85|  1.13k|    auto first = initialized[0];
   86|  1.13k|    length += first.first.size();
   87|  1.13k|  }
   88|       |
   89|       |  // Test default-constructed params with various mutations
   90|  2.91k|  auto search_params = ada::url_search_params();
   91|  2.91k|  search_params.append(source, base_source);
   92|  2.91k|  search_params.append(key3, value3);
   93|  2.91k|  search_params.set(source, base_source);
   94|  2.91k|  search_params.to_string();
   95|       |
   96|       |  // Test size()
   97|  2.91k|  length += search_params.size();
   98|       |
   99|       |  // Test has() and has(key, value) overloads
  100|  2.91k|  volatile bool has_key = search_params.has(base_source);
  101|  2.91k|  if (has_key) {
  ------------------
  |  Branch (101:7): [True: 1.71k, False: 1.19k]
  ------------------
  102|  1.71k|    search_params.append(base_source, source);
  103|  1.71k|  }
  104|       |
  105|       |  // Test get() - returns first matching value
  106|  2.91k|  {
  107|  2.91k|    auto val = search_params.get(source);
  108|  2.91k|    if (val.has_value()) {
  ------------------
  |  Branch (108:9): [True: 2.91k, False: 0]
  ------------------
  109|  2.91k|      length += val->size();
  110|  2.91k|    }
  111|  2.91k|  }
  112|       |
  113|       |  // Test get_all() - returns all matching values
  114|  2.91k|  {
  115|  2.91k|    auto all_vals = search_params.get_all(source);
  116|  2.91k|    length += all_vals.size();
  117|  3.37k|    for (const auto& v : all_vals) {
  ------------------
  |  Branch (117:24): [True: 3.37k, False: 2.91k]
  ------------------
  118|  3.37k|      length += v.size();
  119|  3.37k|    }
  120|  2.91k|  }
  121|       |
  122|       |  // Test remove(key) and remove(key, value) overloads
  123|  2.91k|  search_params.remove(source);
  124|  2.91k|  search_params.remove(source, base_source);
  125|       |
  126|       |  // Test has(key, value) after remove
  127|  2.91k|  if (search_params.has(base_source, source)) {
  ------------------
  |  Branch (127:7): [True: 1.25k, False: 1.65k]
  ------------------
  128|  1.25k|    search_params.remove(base_source);
  129|  1.25k|    search_params.remove(base_source, source);
  130|  1.25k|  }
  131|       |
  132|       |  // Append more pairs for iteration testing
  133|  2.91k|  search_params.append(key3, value3);
  134|  2.91k|  search_params.append(source, key3);
  135|  2.91k|  search_params.append(base_source, value3);
  136|       |
  137|       |  // Test sort()
  138|  2.91k|  search_params.sort();
  139|       |
  140|       |  // Test serialization after sort
  141|  2.91k|  std::string serialized = search_params.to_string();
  142|  2.91k|  length += serialized.size();
  143|       |
  144|       |  // Test JavaScript-style iterator: keys
  145|  2.91k|  auto keys = search_params.get_keys();
  146|  12.4k|  while (keys.has_next()) {
  ------------------
  |  Branch (146:10): [True: 9.57k, False: 2.91k]
  ------------------
  147|  9.57k|    auto k = keys.next();
  148|  9.57k|    if (k.has_value()) {
  ------------------
  |  Branch (148:9): [True: 9.57k, False: 0]
  ------------------
  149|  9.57k|      length += k->size();
  150|  9.57k|    }
  151|  9.57k|  }
  152|       |
  153|       |  // Test JavaScript-style iterator: values
  154|  2.91k|  auto values = search_params.get_values();
  155|  12.4k|  while (values.has_next()) {
  ------------------
  |  Branch (155:10): [True: 9.57k, False: 2.91k]
  ------------------
  156|  9.57k|    auto v = values.next();
  157|  9.57k|    if (v.has_value()) {
  ------------------
  |  Branch (157:9): [True: 9.57k, False: 0]
  ------------------
  158|  9.57k|      length += v->size();
  159|  9.57k|    }
  160|  9.57k|  }
  161|       |
  162|       |  // Test JavaScript-style iterator: entries
  163|  2.91k|  auto entries = search_params.get_entries();
  164|  12.4k|  while (entries.has_next()) {
  ------------------
  |  Branch (164:10): [True: 9.57k, False: 2.91k]
  ------------------
  165|  9.57k|    auto e = entries.next();
  166|  9.57k|    if (e.has_value()) {
  ------------------
  |  Branch (166:9): [True: 9.57k, False: 0]
  ------------------
  167|  9.57k|      length += e->first.size();
  168|  9.57k|      length += e->second.size();
  169|  9.57k|    }
  170|  9.57k|  }
  171|       |
  172|       |  // Test C++ range-for on the mutated params
  173|  9.57k|  for (const auto& pair : search_params) {
  ------------------
  |  Branch (173:25): [True: 9.57k, False: 2.91k]
  ------------------
  174|  9.57k|    length += pair.first.size();
  175|  9.57k|    length += pair.second.size();
  176|  9.57k|  }
  177|       |
  178|       |  // Test reset() - private method used by C API
  179|  2.91k|  std::string resetted_value = fdp.ConsumeRandomLengthString(256);
  180|  2.91k|  search_params.reset(resetted_value);
  181|  2.91k|  length += search_params.size();
  182|       |
  183|       |  // Test that reset() followed by iteration doesn't crash
  184|  2.91k|  for (const auto& pair : search_params) {
  ------------------
  |  Branch (184:25): [True: 2.78k, False: 2.91k]
  ------------------
  185|  2.78k|    length += pair.first.size();
  186|  2.78k|    length += pair.second.size();
  187|  2.78k|  }
  188|       |
  189|       |  // Test get() after reset
  190|  2.91k|  {
  191|  2.91k|    auto val = search_params.get(source);
  192|  2.91k|    if (val.has_value()) {
  ------------------
  |  Branch (192:9): [True: 40, False: 2.87k]
  ------------------
  193|     40|      length += val->size();
  194|     40|    }
  195|  2.91k|  }
  196|       |
  197|       |  // Test copy constructor and copy assignment
  198|  2.91k|  ada::url_search_params copied = search_params;
  199|  2.91k|  length += copied.size();
  200|  2.91k|  ada::url_search_params assigned;
  201|  2.91k|  assigned = search_params;
  202|  2.91k|  length += assigned.size();
  203|       |
  204|       |  // Test move constructor and move assignment
  205|  2.91k|  ada::url_search_params move_constructed = std::move(copied);
  206|  2.91k|  length += move_constructed.size();
  207|  2.91k|  ada::url_search_params move_assigned;
  208|  2.91k|  move_assigned = std::move(assigned);
  209|  2.91k|  length += move_assigned.size();
  210|       |
  211|       |  /**
  212|       |   * Serialisation idempotency.
  213|       |   *
  214|       |   * The application/x-www-form-urlencoded serialiser must be a fixed point:
  215|       |   * parsing the serialised form of any url_search_params and serialising
  216|       |   * again must produce the same string. This invariant is mandated by the
  217|       |   * WHATWG spec and must hold for all inputs.
  218|       |   *
  219|       |   * We test this on both the initialised params (constructed from fuzz input)
  220|       |   * and the mutated params (after append / set / remove / sort).
  221|       |   */
  222|       |
  223|       |  // Initialised params idempotency.
  224|  2.91k|  {
  225|  2.91k|    std::string s1 = initialized.to_string();
  226|  2.91k|    ada::url_search_params reparsed(s1);
  227|  2.91k|    std::string s2 = reparsed.to_string();
  228|  2.91k|    if (s1 != s2) {
  ------------------
  |  Branch (228:9): [True: 0, False: 2.91k]
  ------------------
  229|      0|      printf(
  230|      0|          "url_search_params serialisation not idempotent (initialized)!\n"
  231|      0|          "  first:  %s\n  second: %s\n",
  232|      0|          s1.c_str(), s2.c_str());
  233|      0|      abort();
  234|      0|    }
  235|  2.91k|  }
  236|       |
  237|       |  // Mutated params idempotency.
  238|  2.91k|  {
  239|  2.91k|    std::string s1 = move_assigned.to_string();
  240|  2.91k|    ada::url_search_params reparsed(s1);
  241|  2.91k|    std::string s2 = reparsed.to_string();
  242|  2.91k|    if (s1 != s2) {
  ------------------
  |  Branch (242:9): [True: 0, False: 2.91k]
  ------------------
  243|      0|      printf(
  244|      0|          "url_search_params serialisation not idempotent (mutated)!\n"
  245|      0|          "  first:  %s\n  second: %s\n",
  246|      0|          s1.c_str(), s2.c_str());
  247|      0|      abort();
  248|      0|    }
  249|  2.91k|  }
  250|       |
  251|       |  /**
  252|       |   * Round-trip via URL.
  253|       |   *
  254|       |   * Embed the fuzz input as the query component of a real URL, extract the
  255|       |   * search params from the parsed URL's search string, and verify that the
  256|       |   * resulting params serialise idempotently. This exercises the interface
  257|       |   * between URL parsing and search-params parsing.
  258|       |   */
  259|  2.91k|  {
  260|  2.91k|    std::string url_str = "https://example.com/?" + source;
  261|  2.91k|    auto parsed_url = ada::parse<ada::url_aggregator>(url_str);
  262|  2.91k|    if (parsed_url) {
  ------------------
  |  Branch (262:9): [True: 2.91k, False: 0]
  ------------------
  263|  2.91k|      std::string search_raw = std::string(parsed_url->get_search());
  264|  2.91k|      std::string_view search_view = search_raw;
  265|  2.91k|      if (!search_view.empty() && search_view[0] == '?') {
  ------------------
  |  Branch (265:11): [True: 1.59k, False: 1.31k]
  |  Branch (265:35): [True: 1.59k, False: 0]
  ------------------
  266|  1.59k|        search_view = search_view.substr(1);
  267|  1.59k|      }
  268|       |
  269|  2.91k|      ada::url_search_params sp_from_url(search_view);
  270|       |
  271|       |      // Size and iteration must not crash.
  272|  2.91k|      length += sp_from_url.size();
  273|  3.81k|      for (const auto& pair : sp_from_url) {
  ------------------
  |  Branch (273:29): [True: 3.81k, False: 2.91k]
  ------------------
  274|  3.81k|        length += pair.first.size();
  275|  3.81k|        length += pair.second.size();
  276|  3.81k|      }
  277|       |
  278|       |      // Idempotency check.
  279|  2.91k|      std::string t1 = sp_from_url.to_string();
  280|  2.91k|      ada::url_search_params sp2(t1);
  281|  2.91k|      std::string t2 = sp2.to_string();
  282|  2.91k|      if (t1 != t2) {
  ------------------
  |  Branch (282:11): [True: 0, False: 2.91k]
  ------------------
  283|      0|        printf(
  284|      0|            "url_search_params via URL round-trip not idempotent!\n"
  285|      0|            "  first:  %s\n  second: %s\n",
  286|      0|            t1.c_str(), t2.c_str());
  287|      0|        abort();
  288|      0|      }
  289|       |
  290|       |      // Set the serialised params back on the URL – must not crash.
  291|  2.91k|      parsed_url->set_search(t1);
  292|  2.91k|      volatile bool v = parsed_url->validate();
  293|  2.91k|      (void)v;
  294|  2.91k|    }
  295|  2.91k|  }
  296|       |
  297|  2.91k|  return 0;
  298|  2.91k|}

