_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  162|  4.76k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  163|  4.76k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  164|  4.76k|  size_t pos = 0;
  165|  4.76k|  const char32_t* start{utf32_output};
  166|  90.5k|  while (pos < len) {
  ------------------
  |  Branch (166:10): [True: 86.2k, False: 4.28k]
  ------------------
  167|       |    // try to convert the next block of 16 ASCII bytes
  168|  86.2k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (168:9): [True: 59.8k, False: 26.4k]
  ------------------
  169|       |                            // bytes, check that they are ascii
  170|  59.8k|      uint64_t v1;
  171|  59.8k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  172|  59.8k|      uint64_t v2;
  173|  59.8k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  174|  59.8k|      uint64_t v{v1 | v2};
  175|  59.8k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (175:11): [True: 3.50k, False: 56.3k]
  ------------------
  176|  3.50k|        size_t final_pos = pos + 16;
  177|  59.6k|        while (pos < final_pos) {
  ------------------
  |  Branch (177:16): [True: 56.0k, False: 3.50k]
  ------------------
  178|  56.0k|          *utf32_output++ = char32_t(buf[pos]);
  179|  56.0k|          pos++;
  180|  56.0k|        }
  181|  3.50k|        continue;
  182|  3.50k|      }
  183|  59.8k|    }
  184|  82.7k|    uint8_t leading_byte = data[pos];  // leading byte
  185|  82.7k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (185:9): [True: 45.3k, False: 37.4k]
  ------------------
  186|       |      // converting one ASCII byte !!!
  187|  45.3k|      *utf32_output++ = char32_t(leading_byte);
  188|  45.3k|      pos++;
  189|  45.3k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (189:16): [True: 6.94k, False: 30.4k]
  ------------------
  190|       |      // We have a two-byte UTF-8
  191|  6.94k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (191:11): [True: 54, False: 6.89k]
  ------------------
  192|     54|        return 0;
  193|     54|      }  // minimal bound checking
  194|  6.89k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (194:11): [True: 102, False: 6.79k]
  ------------------
  195|    102|        return 0;
  196|    102|      }
  197|       |      // range check
  198|  6.79k|      uint32_t code_point =
  199|  6.79k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  200|  6.79k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (200:11): [True: 8, False: 6.78k]
  |  Branch (200:32): [True: 0, False: 6.78k]
  ------------------
  201|      8|        return 0;
  202|      8|      }
  203|  6.78k|      *utf32_output++ = char32_t(code_point);
  204|  6.78k|      pos += 2;
  205|  30.4k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (205:16): [True: 29.5k, False: 976]
  ------------------
  206|       |      // We have a three-byte UTF-8
  207|  29.5k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (207:11): [True: 14, False: 29.4k]
  ------------------
  208|     14|        return 0;
  209|     14|      }  // minimal bound checking
  210|       |
  211|  29.4k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (211:11): [True: 34, False: 29.4k]
  ------------------
  212|     34|        return 0;
  213|     34|      }
  214|  29.4k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (214:11): [True: 8, False: 29.4k]
  ------------------
  215|      8|        return 0;
  216|      8|      }
  217|       |      // range check
  218|  29.4k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  219|  29.4k|                            (data[pos + 1] & 0b00111111) << 6 |
  220|  29.4k|                            (data[pos + 2] & 0b00111111);
  221|  29.4k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (221:11): [True: 14, False: 29.4k]
  |  Branch (221:33): [True: 0, False: 29.4k]
  ------------------
  222|  29.4k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (222:12): [True: 3.95k, False: 25.4k]
  |  Branch (222:35): [True: 8, False: 3.94k]
  ------------------
  223|     22|        return 0;
  224|     22|      }
  225|  29.4k|      *utf32_output++ = char32_t(code_point);
  226|  29.4k|      pos += 3;
  227|  29.4k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (227:16): [True: 816, False: 160]
  ------------------
  228|       |      // we have a 4-byte UTF-8 word.
  229|    816|      if (pos + 3 >= len) {
  ------------------
  |  Branch (229:11): [True: 10, False: 806]
  ------------------
  230|     10|        return 0;
  231|     10|      }  // minimal bound checking
  232|    806|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (232:11): [True: 22, False: 784]
  ------------------
  233|     22|        return 0;
  234|     22|      }
  235|    784|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (235:11): [True: 12, False: 772]
  ------------------
  236|     12|        return 0;
  237|     12|      }
  238|    772|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (238:11): [True: 10, False: 762]
  ------------------
  239|     10|        return 0;
  240|     10|      }
  241|       |
  242|       |      // range check
  243|    762|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  244|    762|                            (data[pos + 1] & 0b00111111) << 12 |
  245|    762|                            (data[pos + 2] & 0b00111111) << 6 |
  246|    762|                            (data[pos + 3] & 0b00111111);
  247|    762|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (247:11): [True: 14, False: 748]
  |  Branch (247:35): [True: 8, False: 740]
  ------------------
  248|     22|        return 0;
  249|     22|      }
  250|    740|      *utf32_output++ = char32_t(code_point);
  251|    740|      pos += 4;
  252|    740|    } else {
  253|    160|      return 0;
  254|    160|    }
  255|  82.7k|  }
  256|  4.28k|  return utf32_output - start;
  257|  4.76k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  272|  4.80k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  273|  4.80k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  274|  4.80k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|  4.80k|    return c > -65;
  278|  4.80k|  });
  279|  4.80k|}
_ZN3ada4idna9ascii_mapEPcm:
 5259|   123k|void ascii_map(char* input, size_t length) {
 5260|   123k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|   123k|    return 0x101010101010101ull * v;
 5262|   123k|  };
 5263|   123k|  uint64_t broadcast_80 = broadcast(0x80);
 5264|   123k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5265|   123k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5266|   123k|  size_t i = 0;
 5267|       |
 5268|   325k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5268:10): [True: 201k, False: 123k]
  ------------------
 5269|   201k|    uint64_t word{};
 5270|   201k|    std::memcpy(&word, input + i, sizeof(word));
 5271|   201k|    word ^=
 5272|   201k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5273|   201k|    std::memcpy(input + i, &word, sizeof(word));
 5274|   201k|  }
 5275|   123k|  if (i < length) {
  ------------------
  |  Branch (5275:7): [True: 63.9k, False: 59.5k]
  ------------------
 5276|  63.9k|    uint64_t word{};
 5277|  63.9k|    std::memcpy(&word, input + i, length - i);
 5278|  63.9k|    word ^=
 5279|  63.9k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5280|  63.9k|    std::memcpy(input + i, &word, length - i);
 5281|  63.9k|  }
 5282|   123k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5286|  6.27k|bool map(std::u32string_view input, std::u32string& out) {
 5287|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5288|  6.27k|  out.clear();
 5289|  6.27k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5289:7): [True: 0, False: 6.27k]
  ------------------
 5290|      0|    return false;
 5291|      0|  }
 5292|       |
 5293|       |  // Pass 1: validate and compute exact output length.
 5294|  6.27k|  size_t out_size = 0;
 5295|   154k|  for (char32_t x : input) {
  ------------------
  |  Branch (5295:19): [True: 154k, False: 5.89k]
  ------------------
 5296|   154k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5297|   154k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5297:9): [True: 376, False: 153k]
  ------------------
 5298|    376|      return false;
 5299|    376|    }
 5300|   153k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5300:9): [True: 98.2k, False: 55.5k]
  ------------------
 5301|  98.2k|      ++out_size;
 5302|  98.2k|      continue;
 5303|  98.2k|    }
 5304|  55.5k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5304:9): [True: 0, False: 55.5k]
  ------------------
 5305|      0|      return false;
 5306|      0|    }
 5307|  55.5k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5308|  55.5k|  }
 5309|       |
 5310|       |  // Pass 2: write into a single allocation.
 5311|  5.89k|  out.resize(out_size);
 5312|  5.89k|  size_t w = 0;
 5313|   153k|  for (char32_t x : input) {
  ------------------
  |  Branch (5313:19): [True: 153k, False: 5.89k]
  ------------------
 5314|   153k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5315|   153k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5315:9): [True: 97.9k, False: 55.4k]
  ------------------
 5316|  97.9k|      out[w++] = x;
 5317|  97.9k|      continue;
 5318|  97.9k|    }
 5319|       |    // IGNORED or mapped (status already validated in pass 1).
 5320|  55.4k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5321|   269k|    while (*ptr != 0) {
  ------------------
  |  Branch (5321:12): [True: 214k, False: 55.4k]
  ------------------
 5322|   214k|      out[w++] = utf8_next(ptr);
 5323|   214k|    }
 5324|  55.4k|  }
 5325|  5.89k|  return true;
 5326|  6.27k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5420|    932|    const std::u32string_view input) noexcept {
 5421|    932|  bool decomposition_needed{false};
 5422|    932|  size_t additional_elements{0};
 5423|  57.0k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5423:35): [True: 57.0k, False: 932]
  ------------------
 5424|  57.0k|    size_t decomposition_length{0};
 5425|       |
 5426|  57.0k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5426:9): [True: 3.13k, False: 53.8k]
  ------------------
 5427|  3.13k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5427:9): [True: 1.15k, False: 1.97k]
  ------------------
 5428|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5429|  1.15k|      decomposition_length = 2;
 5430|  1.15k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5430:11): [True: 308, False: 850]
  ------------------
 5431|    308|        decomposition_length = 3;
 5432|    308|      }
 5433|  55.8k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5433:16): [True: 55.8k, False: 0]
  ------------------
 5434|  55.8k|      const uint8_t di = decomposition_index[current_character >> 8];
 5435|  55.8k|      const uint16_t* const decomposition =
 5436|  55.8k|          decomposition_block_row(di) + (current_character % 256);
 5437|  55.8k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5438|  55.8k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5438:11): [True: 2.25k, False: 53.5k]
  |  Branch (5438:41): [True: 0, False: 2.25k]
  ------------------
 5439|      0|        decomposition_length = 0;
 5440|      0|      }
 5441|  55.8k|    }
 5442|  57.0k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5442:9): [True: 3.41k, False: 53.5k]
  ------------------
 5443|  3.41k|      decomposition_needed = true;
 5444|  3.41k|      additional_elements += decomposition_length - 1;
 5445|  3.41k|    }
 5446|  57.0k|  }
 5447|    932|  return {decomposition_needed, additional_elements};
 5448|    932|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5450|    410|void decompose(std::u32string& input, size_t additional_elements) {
 5451|    410|  input.resize(input.size() + additional_elements);
 5452|    410|  for (size_t descending_idx = input.size(),
 5453|    410|              input_count = descending_idx - additional_elements;
 5454|  47.2k|       input_count--;) {
  ------------------
  |  Branch (5454:8): [True: 46.8k, False: 410]
  ------------------
 5455|  46.8k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5455:9): [True: 2.61k, False: 44.2k]
  ------------------
 5456|  2.61k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5456:9): [True: 1.15k, False: 1.46k]
  ------------------
 5457|       |      // Hangul decomposition.
 5458|  1.15k|      char32_t s_index = input[input_count] - hangul_sbase;
 5459|  1.15k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5459:11): [True: 308, False: 850]
  ------------------
 5460|    308|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5461|    308|      }
 5462|  1.15k|      input[--descending_idx] =
 5463|  1.15k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5464|  1.15k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5465|  45.6k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5465:16): [True: 45.6k, False: 0]
  ------------------
 5466|  45.6k|      const uint16_t* decomposition =
 5467|  45.6k|          decomposition_block_row(
 5468|  45.6k|              decomposition_index[input[input_count] >> 8]) +
 5469|  45.6k|          (input[input_count] % 256);
 5470|  45.6k|      uint16_t decomposition_length =
 5471|  45.6k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5472|  45.6k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5472:11): [True: 2.25k, False: 43.4k]
  |  Branch (5472:39): [True: 0, False: 2.25k]
  ------------------
 5473|      0|        decomposition_length = 0;
 5474|      0|      }
 5475|  45.6k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5475:11): [True: 2.25k, False: 43.4k]
  ------------------
 5476|  2.25k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5477|  2.25k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5477:13): [True: 0, False: 2.25k]
  ------------------
 5478|      0|          input[--descending_idx] = input[input_count];
 5479|  2.25k|        } else {
 5480|  7.26k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5480:18): [True: 5.01k, False: 2.25k]
  ------------------
 5481|  5.01k|            input[--descending_idx] =
 5482|  5.01k|                decomposition_data[base + decomposition_length];
 5483|  5.01k|          }
 5484|  2.25k|        }
 5485|  43.4k|      } else {
 5486|  43.4k|        input[--descending_idx] = input[input_count];
 5487|  43.4k|      }
 5488|  45.6k|    } else {
 5489|      0|      input[--descending_idx] = input[input_count];
 5490|      0|    }
 5491|  46.8k|  }
 5492|    410|}
_ZN3ada4idna7get_cccEDi:
 5494|   599k|uint8_t get_ccc(char32_t c) noexcept {
 5495|   599k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5495:7): [True: 0, False: 599k]
  ------------------
 5496|      0|    return 0;
 5497|      0|  }
 5498|   599k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5499|   599k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5501|    932|void sort_marks(std::u32string& input) {
 5502|  61.2k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5502:24): [True: 60.2k, False: 932]
  ------------------
 5503|  60.2k|    uint8_t ccc = get_ccc(input[idx]);
 5504|  60.2k|    if (ccc == 0) {
  ------------------
  |  Branch (5504:9): [True: 54.9k, False: 5.37k]
  ------------------
 5505|  54.9k|      continue;
 5506|  54.9k|    }
 5507|  5.37k|    auto current_character = input[idx];
 5508|  5.37k|    size_t back_idx = idx;
 5509|  7.95k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5509:12): [True: 7.81k, False: 138]
  |  Branch (5509:29): [True: 2.57k, False: 5.23k]
  ------------------
 5510|  2.57k|      input[back_idx] = input[back_idx - 1];
 5511|  2.57k|      back_idx--;
 5512|  2.57k|    }
 5513|  5.37k|    input[back_idx] = current_character;
 5514|  5.37k|  }
 5515|    932|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5517|    932|void decompose_nfc(std::u32string& input) {
 5518|       |  /**
 5519|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5520|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5521|       |   */
 5522|    932|  auto [decomposition_needed, additional_elements] =
 5523|    932|      compute_decomposition_length(input);
 5524|    932|  if (decomposition_needed) {
  ------------------
  |  Branch (5524:7): [True: 410, False: 522]
  ------------------
 5525|    410|    decompose(input, additional_elements);
 5526|    410|  }
 5527|    932|  sort_marks(input);
 5528|    932|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5688|  5.86k|bool is_already_nfc(std::u32string_view input) noexcept {
 5689|  5.86k|  if (input.empty()) {
  ------------------
  |  Branch (5689:7): [True: 0, False: 5.86k]
  ------------------
 5690|      0|    return true;
 5691|      0|  }
 5692|  5.86k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5692:7): [True: 0, False: 5.86k]
  |  Branch (5692:30): [True: 0, False: 0]
  ------------------
 5693|      0|    return false;
 5694|      0|  }
 5695|  5.86k|  uint8_t last_ccc = 0;
 5696|  5.86k|  bool maybe = false;
 5697|   299k|  for (char32_t c : input) {
  ------------------
  |  Branch (5697:19): [True: 299k, False: 5.55k]
  ------------------
 5698|   299k|    if (c < nfc_qc_first_non_starter) {
  ------------------
  |  Branch (5698:9): [True: 143k, False: 155k]
  ------------------
 5699|   143k|      last_ccc = 0;
 5700|   143k|      continue;
 5701|   143k|    }
 5702|   155k|    const uint8_t ccc = get_ccc(c);
 5703|   155k|    if (ccc != 0 && last_ccc > ccc) {
  ------------------
  |  Branch (5703:9): [True: 6.96k, False: 148k]
  |  Branch (5703:21): [True: 308, False: 6.65k]
  ------------------
 5704|    308|      return false;
 5705|    308|    }
 5706|   155k|    const nfc_quick_check check = get_nfc_quick_check(c);
 5707|   155k|    if (check == nfc_quick_check::no) {
  ------------------
  |  Branch (5707:9): [True: 0, False: 155k]
  ------------------
 5708|      0|      return false;
 5709|      0|    }
 5710|   155k|    maybe = maybe || check == nfc_quick_check::maybe;
  ------------------
  |  Branch (5710:13): [True: 10.3k, False: 145k]
  |  Branch (5710:22): [True: 1.95k, False: 143k]
  ------------------
 5711|   155k|    last_ccc = ccc;
 5712|   155k|  }
 5713|  5.55k|  return !maybe || maybe_is_nfc(input);
  ------------------
  |  Branch (5713:10): [True: 3.65k, False: 1.90k]
  |  Branch (5713:20): [True: 344, False: 1.55k]
  ------------------
 5714|  5.86k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5716|    932|void compose(std::u32string& input) {
 5717|       |  /**
 5718|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5719|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5720|       |   */
 5721|    932|  size_t input_count{0};
 5722|    932|  size_t composition_count{0};
 5723|  54.1k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5723:10): [True: 53.1k, False: 932]
  ------------------
 5724|  53.1k|    input[composition_count] = input[input_count];
 5725|  53.1k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5725:9): [True: 6.31k, False: 46.8k]
  ------------------
 5726|  6.31k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5726:9): [True: 1.99k, False: 4.31k]
  ------------------
 5727|  1.99k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5727:11): [True: 1.98k, False: 16]
  ------------------
 5728|  1.98k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5728:11): [True: 1.53k, False: 444]
  ------------------
 5729|  1.53k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5729:11): [True: 1.24k, False: 298]
  ------------------
 5730|  1.24k|        input[composition_count] =
 5731|  1.24k|            hangul_sbase +
 5732|  1.24k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5733|  1.24k|             input[input_count + 1] - hangul_vbase) *
 5734|  1.24k|                hangul_tcount;
 5735|  1.24k|        input_count++;
 5736|  1.24k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5736:13): [True: 1.21k, False: 30]
  ------------------
 5737|  1.21k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5737:13): [True: 536, False: 674]
  ------------------
 5738|    536|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5738:13): [True: 328, False: 208]
  ------------------
 5739|    328|          input[composition_count] += input[++input_count] - hangul_tbase;
 5740|    328|        }
 5741|  1.24k|      }
 5742|  51.1k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5742:16): [True: 1.62k, False: 49.5k]
  ------------------
 5743|  1.62k|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5743:16): [True: 0, False: 1.62k]
  ------------------
 5744|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5744:11): [True: 0, False: 0]
  ------------------
 5745|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5745:11): [True: 0, False: 0]
  ------------------
 5746|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5746:11): [True: 0, False: 0]
  ------------------
 5747|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5747:11): [True: 0, False: 0]
  ------------------
 5748|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5749|      0|      }
 5750|  51.1k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5750:16): [True: 51.1k, False: 0]
  ------------------
 5751|  51.1k|      const uint16_t* composition =
 5752|  51.1k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5753|  51.1k|          (input[input_count] % 256);
 5754|  51.1k|      size_t initial_composition_count = composition_count;
 5755|  57.6k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5755:39): [True: 56.8k, False: 864]
  ------------------
 5756|  56.8k|           input_count++) {
 5757|  56.8k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5758|       |
 5759|  56.8k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5759:13): [True: 16.1k, False: 40.6k]
  |  Branch (5759:49): [True: 15.5k, False: 650]
  ------------------
 5760|  15.5k|          int left = composition[0];
 5761|  15.5k|          int right = composition[1];
 5762|  15.5k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5762:15): [True: 0, False: 15.5k]
  |  Branch (5762:27): [True: 0, False: 15.5k]
  ------------------
 5763|  15.5k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5763:15): [True: 0, False: 15.5k]
  ------------------
 5764|      0|            break;
 5765|      0|          }
 5766|  32.8k|          while (left + 2 < right) {
  ------------------
  |  Branch (5766:18): [True: 17.3k, False: 15.5k]
  ------------------
 5767|  17.3k|            int middle = left + (((right - left) >> 1) & ~1);
 5768|  17.3k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5768:17): [True: 4.74k, False: 12.5k]
  ------------------
 5769|  17.3k|                input[input_count + 1]) {
 5770|  4.74k|              left = middle;
 5771|  4.74k|            }
 5772|  17.3k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5772:17): [True: 14.6k, False: 2.68k]
  ------------------
 5773|  17.3k|                input[input_count + 1]) {
 5774|  14.6k|              right = middle;
 5775|  14.6k|            }
 5776|  17.3k|          }
 5777|  15.5k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5777:15): [True: 15.5k, False: 0]
  ------------------
 5778|  15.5k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5778:15): [True: 3.44k, False: 12.0k]
  ------------------
 5779|  15.5k|                  input[input_count + 1]) {
 5780|  3.44k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5781|  3.44k|            input[initial_composition_count] = composed;
 5782|  3.44k|            composition =
 5783|  3.44k|                composition_block_row(composition_index[composed >> 8]) +
 5784|  3.44k|                (composed % 256);
 5785|  3.44k|            continue;
 5786|  3.44k|          }
 5787|  15.5k|        }
 5788|       |
 5789|  53.3k|        if (ccc == 0) {
  ------------------
  |  Branch (5789:13): [True: 50.3k, False: 3.02k]
  ------------------
 5790|  50.3k|          break;
 5791|  50.3k|        }
 5792|  3.02k|        previous_ccc = ccc;
 5793|  3.02k|        input[++composition_count] = input[input_count + 1];
 5794|  3.02k|      }
 5795|  51.1k|    }
 5796|  53.1k|  }
 5797|       |
 5798|    932|  if (composition_count < input_count) {
  ------------------
  |  Branch (5798:7): [True: 824, False: 108]
  ------------------
 5799|    824|    input.resize(composition_count);
 5800|    824|  }
 5801|    932|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5803|    932|bool normalize(std::u32string& input) {
 5804|       |  /**
 5805|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5806|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5807|       |   */
 5808|    932|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5808:7): [True: 0, False: 932]
  |  Branch (5808:27): [True: 0, False: 932]
  ------------------
 5809|    932|      composition_index == nullptr) {
  ------------------
  |  Branch (5809:7): [True: 0, False: 932]
  ------------------
 5810|      0|    return false;
 5811|      0|  }
 5812|    932|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5812:7): [True: 0, False: 932]
  ------------------
 5813|      0|    return true;
 5814|      0|  }
 5815|    932|  decompose_nfc(input);
 5816|    932|  compose(input);
 5817|    932|  return true;
 5818|    932|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5878|  2.16k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5879|  2.16k|  int32_t written_out{0};
 5880|  2.16k|  out.reserve(out.size() + input.size());
 5881|  2.16k|  uint32_t n = initial_n;
 5882|  2.16k|  int32_t i = 0;
 5883|  2.16k|  int32_t bias = initial_bias;
 5884|       |  // grab ascii content
 5885|       |  // RFC 3492 section 6.2: copy the code points before the last delimiter,
 5886|       |  // then consume the delimiter only "if more than zero code points were
 5887|       |  // consumed". With a leading delimiter, b == 0, decoding starts at the
 5888|       |  // delimiter itself, which is not a digit, and fails. This matches the
 5889|       |  // reference implementation in appendix C (`in = b > 0 ? b + 1 : 0`).
 5890|  2.16k|  size_t end_of_ascii = input.find_last_of('-');
 5891|  2.16k|  if (end_of_ascii != std::string_view::npos && end_of_ascii > 0) {
  ------------------
  |  Branch (5891:7): [True: 574, False: 1.59k]
  |  Branch (5891:49): [True: 568, False: 6]
  ------------------
 5892|  6.82k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5892:20): [True: 6.82k, False: 568]
  ------------------
 5893|  6.82k|      if (c >= 0x80) {
  ------------------
  |  Branch (5893:11): [True: 0, False: 6.82k]
  ------------------
 5894|      0|        return false;
 5895|      0|      }
 5896|  6.82k|      out.push_back(c);
 5897|  6.82k|      written_out++;
 5898|  6.82k|    }
 5899|    568|    input.remove_prefix(end_of_ascii + 1);
 5900|    568|  }
 5901|  29.0k|  while (!input.empty()) {
  ------------------
  |  Branch (5901:10): [True: 27.0k, False: 2.06k]
  ------------------
 5902|  27.0k|    int32_t oldi = i;
 5903|  27.0k|    int32_t w = 1;
 5904|  36.0k|    for (int32_t k = base;; k += base) {
 5905|  36.0k|      if (input.empty()) {
  ------------------
  |  Branch (5905:11): [True: 26, False: 35.9k]
  ------------------
 5906|     26|        return false;
 5907|     26|      }
 5908|  35.9k|      uint8_t code_point = input.front();
 5909|  35.9k|      input.remove_prefix(1);
 5910|  35.9k|      int32_t digit = char_to_digit_value(code_point);
 5911|  35.9k|      if (digit < 0) {
  ------------------
  |  Branch (5911:11): [True: 36, False: 35.9k]
  ------------------
 5912|     36|        return false;
 5913|     36|      }
 5914|  35.9k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5914:11): [True: 14, False: 35.9k]
  ------------------
 5915|     14|        return false;
 5916|     14|      }
 5917|  35.9k|      i = i + digit * w;
 5918|  35.9k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5918:19): [True: 5.74k, False: 30.1k]
  |  Branch (5918:38): [True: 28.9k, False: 1.28k]
  ------------------
 5919|  35.9k|      if (digit < t) {
  ------------------
  |  Branch (5919:11): [True: 26.9k, False: 9.00k]
  ------------------
 5920|  26.9k|        break;
 5921|  26.9k|      }
 5922|  9.00k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5922:11): [True: 0, False: 9.00k]
  ------------------
 5923|      0|        return false;
 5924|      0|      }
 5925|  9.00k|      w = w * (base - t);
 5926|  9.00k|    }
 5927|  26.9k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5928|  26.9k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5928:9): [True: 26, False: 26.9k]
  ------------------
 5929|     26|      return false;
 5930|     26|    }
 5931|  26.9k|    n = n + i / (written_out + 1);
 5932|  26.9k|    i = i % (written_out + 1);
 5933|  26.9k|    if (n < 0x80) {
  ------------------
  |  Branch (5933:9): [True: 0, False: 26.9k]
  ------------------
 5934|      0|      return false;
 5935|      0|    }
 5936|  26.9k|    out.insert(out.begin() + i, n);
 5937|  26.9k|    written_out++;
 5938|  26.9k|    ++i;
 5939|  26.9k|  }
 5940|       |  // See https://github.com/whatwg/url/issues/803
 5941|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5942|  2.06k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5942:7): [True: 1.05k, False: 1.01k]
  |  Branch (5942:26): [True: 316, False: 736]
  |  Branch (5942:44): [True: 214, False: 102]
  |  Branch (5942:62): [True: 120, False: 94]
  ------------------
 5943|    120|      out[3] == U'-') {
  ------------------
  |  Branch (5943:7): [True: 8, False: 112]
  ------------------
 5944|      8|    return false;
 5945|      8|  }
 5946|  2.05k|  return true;
 5947|  2.06k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 6027|  21.4k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 6028|  21.4k|  out.reserve(input.size() + out.size());
 6029|  21.4k|  uint32_t n = initial_n;
 6030|  21.4k|  int32_t d = 0;
 6031|  21.4k|  int32_t bias = initial_bias;
 6032|  21.4k|  size_t h = 0;
 6033|       |  // first push the ascii content
 6034|  95.4k|  for (uint32_t c : input) {
  ------------------
  |  Branch (6034:19): [True: 95.4k, False: 21.4k]
  ------------------
 6035|  95.4k|    if (c < 0x80) {
  ------------------
  |  Branch (6035:9): [True: 45.2k, False: 50.2k]
  ------------------
 6036|  45.2k|      ++h;
 6037|  45.2k|      out.push_back(char(c));
 6038|  45.2k|    }
 6039|  95.4k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (6039:9): [True: 0, False: 95.4k]
  |  Branch (6039:26): [True: 1.11k, False: 94.3k]
  |  Branch (6039:41): [True: 0, False: 1.11k]
  ------------------
 6040|      0|      return false;
 6041|      0|    }
 6042|  95.4k|  }
 6043|  21.4k|  size_t b = h;
 6044|  21.4k|  if (b > 0) {
  ------------------
  |  Branch (6044:7): [True: 18.5k, False: 2.91k]
  ------------------
 6045|  18.5k|    out.push_back('-');
 6046|  18.5k|  }
 6047|  63.7k|  while (h < input.size()) {
  ------------------
  |  Branch (6047:10): [True: 42.2k, False: 21.4k]
  ------------------
 6048|  42.2k|    uint32_t m = 0x10FFFF;
 6049|   266k|    for (auto code_point : input) {
  ------------------
  |  Branch (6049:26): [True: 266k, False: 42.2k]
  ------------------
 6050|   266k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (6050:11): [True: 108k, False: 157k]
  |  Branch (6050:30): [True: 45.7k, False: 63.1k]
  ------------------
 6051|   266k|    }
 6052|       |
 6053|  42.2k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (6053:9): [True: 0, False: 42.2k]
  ------------------
 6054|      0|      return false;
 6055|      0|    }
 6056|  42.2k|    d = d + int32_t((m - n) * (h + 1));
 6057|  42.2k|    n = m;
 6058|   266k|    for (auto c : input) {
  ------------------
  |  Branch (6058:17): [True: 266k, False: 42.2k]
  ------------------
 6059|   266k|      if (c < n) {
  ------------------
  |  Branch (6059:11): [True: 157k, False: 108k]
  ------------------
 6060|   157k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (6060:13): [True: 0, False: 157k]
  ------------------
 6061|      0|          return false;
 6062|      0|        }
 6063|   157k|        ++d;
 6064|   157k|      }
 6065|   266k|      if (c == n) {
  ------------------
  |  Branch (6065:11): [True: 50.2k, False: 216k]
  ------------------
 6066|  50.2k|        int32_t q = d;
 6067|   170k|        for (int32_t k = base;; k += base) {
 6068|   170k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (6068:23): [True: 44.6k, False: 125k]
  |  Branch (6068:42): [True: 106k, False: 19.5k]
  ------------------
 6069|       |
 6070|   170k|          if (q < t) {
  ------------------
  |  Branch (6070:15): [True: 50.2k, False: 120k]
  ------------------
 6071|  50.2k|            break;
 6072|  50.2k|          }
 6073|   120k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 6074|   120k|          q = (q - t) / (base - t);
 6075|   120k|        }
 6076|  50.2k|        out.push_back(digit_to_char(q));
 6077|  50.2k|        bias = adapt(d, int32_t(h + 1), h == b);
 6078|  50.2k|        d = 0;
 6079|  50.2k|        ++h;
 6080|  50.2k|      }
 6081|   266k|    }
 6082|  42.2k|    ++d;
 6083|  42.2k|    ++n;
 6084|  42.2k|  }
 6085|  21.4k|  return true;
 6086|  21.4k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6548|   128k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6549|   128k|  out.clear();
 6550|       |  // The ASCII path is a single same-size copy, so it needs no length bound.
 6551|       |  // Checking first would reject the (longer) ASCII output of a non-ASCII input
 6552|       |  // that was accepted, breaking to_ascii(to_ascii(x)) == to_ascii(x).
 6553|   128k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6553:7): [True: 123k, False: 4.80k]
  ------------------
 6554|   123k|    from_ascii_to_ascii(ut8_string, out);
 6555|   123k|    return true;
 6556|   123k|  }
 6557|  4.80k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6557:7): [True: 0, False: 4.80k]
  ------------------
 6558|      0|    return false;
 6559|      0|  }
 6560|       |
 6561|       |#ifdef ADA_USE_SIMDUTF
 6562|       |  size_t utf32_length =
 6563|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6564|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6565|       |    return false;
 6566|       |  }
 6567|       |  std::u32string working(utf32_length, U'\0');
 6568|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6569|       |      ut8_string.data(), ut8_string.size(), working.data());
 6570|       |#else
 6571|  4.80k|  size_t utf32_length =
 6572|  4.80k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6573|  4.80k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6573:7): [True: 42, False: 4.76k]
  |  Branch (6573:28): [True: 42, False: 0]
  ------------------
 6574|     42|    return false;
 6575|     42|  }
 6576|  4.76k|  std::u32string working(utf32_length, U'\0');
 6577|  4.76k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6578|  4.76k|      ut8_string.data(), ut8_string.size(), working.data());
 6579|  4.76k|#endif
 6580|  4.76k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6580:7): [True: 478, False: 4.28k]
  |  Branch (6580:35): [True: 0, False: 4.28k]
  ------------------
 6581|    478|    return false;
 6582|    478|  }
 6583|  4.28k|  working.resize(actual_utf32_length);
 6584|       |
 6585|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6586|  4.28k|  std::u32string mapped;
 6587|  4.28k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6587:7): [True: 90, False: 4.19k]
  ------------------
 6588|     90|    return false;
 6589|     90|  }
 6590|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6591|  4.19k|  working.clear();
 6592|       |
 6593|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6594|  4.19k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6594:7): [True: 3.34k, False: 850]
  |  Branch (6594:28): [True: 726, False: 2.61k]
  ------------------
 6595|    726|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6595:9): [True: 0, False: 726]
  ------------------
 6596|      0|      return false;
 6597|      0|    }
 6598|    726|  }
 6599|       |
 6600|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6601|  4.19k|  out.reserve(mapped.size() + 8);
 6602|       |
 6603|       |  // CheckBidi applies to every label once any label is RTL (RFC 5893), which a
 6604|       |  // later label can decide. Any failure rejects the whole domain, so it is
 6605|       |  // enough to know at the end whether some label is RTL and whether every
 6606|       |  // label satisfies the Bidi rule.
 6607|  4.19k|  bool bidi_domain = false;
 6608|  4.19k|  bool bidi_rule_holds = true;
 6609|  4.19k|  auto accept = [&](const label_check& check) {
 6610|  4.19k|    bidi_domain = bidi_domain || check.rtl;
 6611|  4.19k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
 6612|  4.19k|    return check.valid && (bidi_rule_holds || !bidi_domain);
 6613|  4.19k|  };
 6614|       |
 6615|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6616|  4.19k|  const char32_t* p = mapped.data();
 6617|  4.19k|  const char32_t* const end = p + mapped.size();
 6618|  4.19k|  std::u32string post_map;
 6619|       |
 6620|  30.5k|  while (p < end) {
  ------------------
  |  Branch (6620:10): [True: 27.7k, False: 2.86k]
  ------------------
 6621|  27.7k|    const char32_t* label_begin = p;
 6622|   266k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6622:12): [True: 262k, False: 3.58k]
  |  Branch (6622:23): [True: 238k, False: 24.1k]
  ------------------
 6623|   238k|      ++p;
 6624|   238k|    }
 6625|  27.7k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6626|  27.7k|    std::u32string_view label_view(label_begin, label_size);
 6627|  27.7k|    const bool is_last_label = (p == end);
 6628|  27.7k|    if (p < end) {
  ------------------
  |  Branch (6628:9): [True: 24.1k, False: 3.58k]
  ------------------
 6629|  24.1k|      ++p;  // skip dot
 6630|  24.1k|    }
 6631|       |
 6632|  27.7k|    if (label_size == 0) {
  ------------------
  |  Branch (6632:9): [True: 618, False: 27.0k]
  ------------------
 6633|       |      // empty label
 6634|  27.0k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6634:16): [True: 2.19k, False: 24.8k]
  ------------------
 6635|  54.7k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6635:23): [True: 54.7k, False: 2.16k]
  ------------------
 6636|  54.7k|        if (c >= 0x80) {
  ------------------
  |  Branch (6636:13): [True: 32, False: 54.7k]
  ------------------
 6637|     32|          out.clear();
 6638|     32|          return false;
 6639|     32|        }
 6640|  54.7k|      }
 6641|  2.16k|      append_ascii_label(out, label_view);
 6642|  2.16k|      std::string_view puny_segment_ascii(
 6643|  2.16k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6644|  2.16k|      working.clear();
 6645|  2.16k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6645:11): [True: 110, False: 2.05k]
  ------------------
 6646|    110|        out.clear();
 6647|    110|        return false;
 6648|    110|      }
 6649|  2.05k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6649:11): [True: 68, False: 1.98k]
  ------------------
 6650|     68|        out.clear();
 6651|     68|        return false;
 6652|     68|      }
 6653|  1.98k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6653:11): [True: 286, False: 1.70k]
  |  Branch (6653:49): [True: 116, False: 1.58k]
  ------------------
 6654|    402|        out.clear();
 6655|    402|        return false;
 6656|    402|      }
 6657|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6658|  1.58k|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6658:11): [True: 1.58k, False: 0]
  |  Branch (6658:34): [True: 206, False: 1.38k]
  ------------------
 6659|    206|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6659:13): [True: 0, False: 206]
  |  Branch (6659:37): [True: 200, False: 6]
  ------------------
 6660|    200|          out.clear();
 6661|    200|          return false;
 6662|    200|        }
 6663|    206|      }
 6664|  1.38k|      if (post_map.empty() || !accept(check_label(post_map))) {
  ------------------
  |  Branch (6664:11): [True: 0, False: 1.38k]
  |  Branch (6664:11): [True: 38, False: 1.34k]
  |  Branch (6664:31): [True: 38, False: 1.34k]
  ------------------
 6665|     38|        out.clear();
 6666|     38|        return false;
 6667|     38|      }
 6668|  24.8k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6668:16): [True: 2.93k, False: 21.9k]
  ------------------
 6669|       |      // All-ASCII domains never reach here (they return above). An ASCII label
 6670|       |      // in a Bidi domain must still satisfy RFC 5893 rules 1, 5, and 6.
 6671|  2.93k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6671:11): [True: 12, False: 2.92k]
  ------------------
 6672|     12|        out.clear();
 6673|     12|        return false;
 6674|     12|      }
 6675|  2.92k|      append_ascii_label(out, label_view);
 6676|  21.9k|    } else {
 6677|  21.9k|      if (!accept(check_label(label_view))) {
  ------------------
  |  Branch (6677:11): [True: 464, False: 21.4k]
  ------------------
 6678|    464|        out.clear();
 6679|    464|        return false;
 6680|    464|      }
 6681|  21.4k|      out.append("xn--");
 6682|  21.4k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6682:11): [True: 0, False: 21.4k]
  ------------------
 6683|      0|        out.clear();
 6684|      0|        return false;
 6685|      0|      }
 6686|  21.4k|    }
 6687|  26.3k|    if (!is_last_label) {
  ------------------
  |  Branch (6687:9): [True: 23.7k, False: 2.66k]
  ------------------
 6688|  23.7k|      out.push_back('.');
 6689|  23.7k|    }
 6690|  26.3k|  }
 6691|  2.86k|  return true;
 6692|  4.19k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6694|   128k|std::string to_ascii(std::string_view ut8_string) {
 6695|   128k|  std::string out;
 6696|   128k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6696:7): [True: 1.93k, False: 126k]
  ------------------
 6697|  1.93k|    return {};
 6698|  1.93k|  }
 6699|   126k|  return out;
 6700|   128k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7679|  46.5k|                    std::string& out) {
 7680|  46.5k|  ada_log("percent_encode ", input, " to output string while ",
 7681|  46.5k|          append ? "appending" : "overwriting");
 7682|  46.5k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|  46.5k|    return character_sets::bit_at(character_set, c);
 7684|  46.5k|  });
 7685|  46.5k|  ada_log("percent_encode done checking, moved to ",
 7686|  46.5k|          std::distance(input.begin(), pointer));
 7687|       |
 7688|       |  // Optimization: Don't iterate if percent encode is not required
 7689|  46.5k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7689:7): [True: 38.5k, False: 7.96k]
  ------------------
 7690|  38.5k|    ada_log("percent_encode encoding not needed.");
 7691|  38.5k|    return false;
 7692|  38.5k|  }
 7693|       |  if constexpr (!append) {
 7694|       |    out.clear();
 7695|       |  }
 7696|  7.96k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7697|  7.96k|          " bytes");
 7698|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7699|  7.96k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7700|  7.96k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7701|  7.96k|          " bytes");
 7702|   133k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7702:10): [True: 125k, False: 7.96k]
  ------------------
 7703|   125k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7703:9): [True: 97.7k, False: 27.9k]
  ------------------
 7704|  97.7k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7705|  97.7k|    } else {
 7706|  27.9k|      out += *pointer;
 7707|  27.9k|    }
 7708|   125k|  }
 7709|  7.96k|  return true;
 7710|  46.5k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7510|  40.1k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7511|       |  // next line is for safety only, we expect users to avoid calling
 7512|       |  // percent_decode when first_percent is outside the range.
 7513|  40.1k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7513:7): [True: 0, False: 40.1k]
  ------------------
 7514|      0|    return std::string(input);
 7515|      0|  }
 7516|       |
 7517|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7518|  40.1k|  const char* const src = input.data();
 7519|  40.1k|  const char* const end = src + input.size();
 7520|       |
 7521|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7522|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7523|       |  // byte-at-a-time appends of the naive version.
 7524|  40.1k|  std::string out(input.size(), '\0');
 7525|  40.1k|  char* d = out.data();
 7526|  40.1k|  char* const d0 = d;
 7527|       |
 7528|  40.1k|  std::memcpy(d, src, first_percent);
 7529|  40.1k|  d += first_percent;
 7530|       |
 7531|  40.1k|  const char* p = src + first_percent;
 7532|   124k|  while (p < end) {
  ------------------
  |  Branch (7532:10): [True: 84.5k, False: 40.1k]
  ------------------
 7533|  84.5k|    if (*p == '%') {
  ------------------
  |  Branch (7533:9): [True: 43.2k, False: 41.2k]
  ------------------
 7534|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7535|  86.5k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7535:14): [True: 85.2k, False: 1.28k]
  |  Branch (7535:29): [True: 45.2k, False: 39.9k]
  ------------------
 7536|  45.2k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7536:13): [True: 1.29k, False: 43.9k]
  |  Branch (7536:42): [True: 712, False: 43.2k]
  ------------------
 7537|  2.00k|          break;
 7538|  2.00k|        }
 7539|  43.2k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7540|  43.2k|                                 convert_hex_to_binary(p[2]));
 7541|  43.2k|        p += 3;
 7542|  43.2k|      }
 7543|  43.2k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7543:11): [True: 42.4k, False: 820]
  |  Branch (7543:22): [True: 2.25k, False: 40.2k]
  ------------------
 7544|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7545|       |        // literally and keep scanning after it.
 7546|  2.25k|        *d++ = *p++;
 7547|  2.25k|      }
 7548|  43.2k|    } else {
 7549|  41.2k|      const char* q = static_cast<const char*>(
 7550|  41.2k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7551|  41.2k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7551:29): [True: 2.14k, False: 39.1k]
  ------------------
 7552|  41.2k|      const size_t n = static_cast<size_t>(run_end - p);
 7553|  41.2k|      std::memcpy(d, p, n);
 7554|  41.2k|      d += n;
 7555|  41.2k|      p = run_end;
 7556|  41.2k|    }
 7557|  84.5k|  }
 7558|       |
 7559|  40.1k|  out.resize(static_cast<size_t>(d - d0));
 7560|  40.1k|  return out;
 7561|  40.1k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7649|   194k|                           const uint8_t character_set[]) {
 7650|   194k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7651|   194k|    return character_sets::bit_at(character_set, c);
 7652|   194k|  });
 7653|       |  // Optimization: Don't iterate if percent encode is not required
 7654|   194k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7654:7): [True: 191k, False: 3.21k]
  ------------------
 7655|   191k|    return std::string(input);
 7656|   191k|  }
 7657|       |
 7658|  3.21k|  std::string result;
 7659|  3.21k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7660|       |                                   // produce 3 characters.
 7661|  3.21k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7662|  3.21k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7662:7): [True: 863, False: 2.35k]
  ------------------
 7663|    863|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7664|    863|                          result);
 7665|  2.35k|  } else {
 7666|  19.7k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7666:12): [True: 17.4k, False: 2.35k]
  ------------------
 7667|  17.4k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7667:11): [True: 11.3k, False: 6.02k]
  ------------------
 7668|  11.3k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7669|  11.3k|      } else {
 7670|  6.02k|        result += *pointer;
 7671|  6.02k|      }
 7672|  17.4k|    }
 7673|  2.35k|  }
 7674|  3.21k|  return result;
 7675|   194k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7720|   128k|              size_t first_percent) {
 7721|   128k|  std::string percent_decoded_buffer;
 7722|   128k|  std::string_view input = plain;
 7723|   128k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7723:7): [True: 670, False: 127k]
  ------------------
 7724|    670|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7725|    670|    input = percent_decoded_buffer;
 7726|    670|  }
 7727|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7728|   128k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7729|   128k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7729:7): [True: 1.96k, False: 126k]
  |  Branch (7729:29): [True: 802, False: 125k]
  ------------------
 7730|   126k|                                idna_ascii.data(), idna_ascii.size())) {
 7731|  2.76k|    return false;
 7732|  2.76k|  }
 7733|   125k|  out = std::move(idna_ascii);
 7734|   125k|  return true;
 7735|   128k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7738|     40|                           const uint8_t character_set[], size_t index) {
 7739|     40|  std::string out;
 7740|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7741|     40|  out.append(input.data(), index);
 7742|     40|  auto pointer = input.begin() + index;
 7743|     40|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7743:7): [True: 2, False: 38]
  ------------------
 7744|      2|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7745|      2|                          out);
 7746|     38|  } else {
 7747|    535|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7747:12): [True: 497, False: 38]
  ------------------
 7748|    497|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7748:11): [True: 182, False: 315]
  ------------------
 7749|    182|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7750|    315|      } else {
 7751|    315|        out += *pointer;
 7752|    315|      }
 7753|    497|    }
 7754|     38|  }
 7755|     40|  return out;
 7756|     40|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 8054|    865|                           const uint8_t character_set[], std::string& out) {
 8055|    865|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 8056|    865|#ifdef ADA_UNICODE_NEED_SSSE3_TARGET
 8057|    865|  static const bool ssse3_supported = __builtin_cpu_supports("ssse3") != 0;
 8058|    865|  const bool use_wide = ssse3_supported;
 8059|       |#else
 8060|       |  const bool use_wide = true;
 8061|       |#endif
 8062|    865|  if (use_wide && static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (8062:7): [True: 865, False: 0]
  |  Branch (8062:19): [True: 865, False: 0]
  ------------------
 8063|    865|    percent_encode_to_wide(p, end, character_set, out);
 8064|    865|    return;
 8065|    865|  }
 8066|      0|#endif
 8067|      0|  percent_encode_to_scalar(p, end, character_set, out);
 8068|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 8133|    840|    size_t& compress_length) noexcept {
 8134|    840|  compress = 0;
 8135|    840|  compress_length = 0;
 8136|    840|  size_t i = 0;
 8137|  3.52k|  while (i < 8) {
  ------------------
  |  Branch (8137:10): [True: 2.68k, False: 840]
  ------------------
 8138|  2.68k|    if (address[i] != 0) {
  ------------------
  |  Branch (8138:9): [True: 1.57k, False: 1.11k]
  ------------------
 8139|  1.57k|      ++i;
 8140|  1.57k|      continue;
 8141|  1.57k|    }
 8142|  1.11k|    size_t next = i + 1;
 8143|  5.14k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (8143:12): [True: 4.64k, False: 500]
  |  Branch (8143:24): [True: 4.03k, False: 612]
  ------------------
 8144|  4.03k|      ++next;
 8145|  4.03k|    }
 8146|  1.11k|    const size_t count = next - i;
 8147|  1.11k|    if (count > compress_length) {
  ------------------
  |  Branch (8147:9): [True: 900, False: 212]
  ------------------
 8148|    900|      compress_length = count;
 8149|    900|      compress = i;
 8150|    900|    }
 8151|  1.11k|    i = next;
 8152|  1.11k|  }
 8153|    840|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 8155|    840|std::string ipv6(const std::array<uint16_t, 8>& address) {
 8156|    840|  size_t compress = 0;
 8157|    840|  size_t compress_length = 0;
 8158|    840|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 8159|       |
 8160|       |  // Skip compression when the longest zero run is a single piece.
 8161|    840|  if (compress_length <= 1) {
  ------------------
  |  Branch (8161:7): [True: 88, False: 752]
  ------------------
 8162|     88|    compress = compress_length = 8;
 8163|     88|  }
 8164|       |
 8165|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 8166|    840|  char output[4 * 8 + 7 + 2];
 8167|    840|  char* point = output;
 8168|    840|  *point++ = '[';
 8169|    840|  size_t piece_index = 0;
 8170|  2.40k|  while (true) {
  ------------------
  |  Branch (8170:10): [True: 2.40k, Folded]
  ------------------
 8171|  2.40k|    if (piece_index == compress) {
  ------------------
  |  Branch (8171:9): [True: 752, False: 1.65k]
  ------------------
 8172|    752|      *point++ = ':';
 8173|       |      // If we skip a value initially, we need to write '::'.
 8174|    752|      if (piece_index == 0) {
  ------------------
  |  Branch (8174:11): [True: 478, False: 274]
  ------------------
 8175|    478|        *point++ = ':';
 8176|    478|      }
 8177|    752|      piece_index += compress_length;
 8178|    752|      if (piece_index == 8) {
  ------------------
  |  Branch (8178:11): [True: 408, False: 344]
  ------------------
 8179|    408|        break;
 8180|    408|      }
 8181|    752|    }
 8182|  1.99k|    point = write_hex_u16(point, address[piece_index]);
 8183|  1.99k|    ++piece_index;
 8184|  1.99k|    if (piece_index == 8) {
  ------------------
  |  Branch (8184:9): [True: 432, False: 1.56k]
  ------------------
 8185|    432|      break;
 8186|    432|    }
 8187|  1.56k|    *point++ = ':';
 8188|  1.56k|  }
 8189|    840|  *point++ = ']';
 8190|    840|  return std::string(output, static_cast<size_t>(point - output));
 8191|    840|}
_ZN3ada11serializers4ipv4Em:
 8193|  41.2k|std::string ipv4(const uint64_t address) {
 8194|  41.2k|  std::string output(15, '\0');
 8195|  41.2k|  char* point = output.data();
 8196|  41.2k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 8197|  41.2k|  *point++ = '.';
 8198|  41.2k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 8199|  41.2k|  *point++ = '.';
 8200|  41.2k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 8201|  41.2k|  *point++ = '.';
 8202|  41.2k|  point = write_u8(point, static_cast<uint8_t>(address));
 8203|  41.2k|  output.resize(static_cast<size_t>(point - output.data()));
 8204|  41.2k|  return output;
 8205|  41.2k|}
_ZN3ada5parseINS_3urlEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8609|   628k|    std::string_view input, const result_type* base_url) {
 8610|   628k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8611|   628k|  if (!u.is_valid) {
  ------------------
  |  Branch (8611:7): [True: 21.9k, False: 606k]
  ------------------
 8612|  21.9k|    return tl::unexpected(errors::type_error);
 8613|  21.9k|  }
 8614|   606k|  return u;
 8615|   628k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8609|   628k|    std::string_view input, const result_type* base_url) {
 8610|   628k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8611|   628k|  if (!u.is_valid) {
  ------------------
  |  Branch (8611:7): [True: 21.9k, False: 606k]
  ------------------
 8612|  21.9k|    return tl::unexpected(errors::type_error);
 8613|  21.9k|  }
 8614|   606k|  return u;
 8615|   628k|}
_ZN3ada20get_max_input_lengthEv:
 8230|  1.66M|uint32_t get_max_input_length() {
 8231|  1.66M|  return max_input_length_.load(std::memory_order_relaxed);
 8232|  1.66M|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9597|   540k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9598|   541k|  while (!input.empty() &&
  ------------------
  |  Branch (9598:10): [True: 541k, False: 0]
  ------------------
 9599|   541k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9599:10): [True: 462, False: 540k]
  ------------------
 9600|    462|    input.remove_prefix(1);
 9601|    462|  }
 9602|   544k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9602:10): [True: 544k, False: 0]
  |  Branch (9602:28): [True: 3.40k, False: 540k]
  ------------------
 9603|  3.40k|    input.remove_suffix(1);
 9604|  3.40k|  }
 9605|   540k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9769|  19.0k|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9770|  19.0k|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9771|  19.0k|          input1.size(), " bytes] is part of string '", input2, "' [",
 9772|  19.0k|          input2.size(), " bytes]");
 9773|  19.0k|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9773:10): [True: 19.0k, False: 0]
  |  Branch (9773:29): [True: 19.0k, False: 0]
  |  Branch (9773:48): [True: 19.0k, False: 4]
  ------------------
 9774|  19.0k|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9774:10): [True: 0, False: 19.0k]
  ------------------
 9775|  19.0k|}
_ZN3ada3url17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10154|    643|bool url::parse_opaque_host(std::string_view input) {
10155|    643|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
10156|    643|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (10156:7): [True: 40, False: 603]
  ------------------
10157|     40|    return is_valid = false;
10158|     40|  }
10159|       |
10160|       |  // Return the result of running UTF-8 percent-encode on input using the C0
10161|       |  // control percent-encode set.
10162|    603|  host = ada::unicode::percent_encode(
10163|    603|      input, ada::character_sets::C0_CONTROL_PERCENT_ENCODE);
10164|    603|  return true;
10165|    643|}
_ZN3ada3url10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10167|  59.1k|bool url::parse_ipv4(std::string_view input) {
10168|  59.1k|  ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
10169|  59.1k|  if (input.empty()) {
  ------------------
  |  Branch (10169:7): [True: 0, False: 59.1k]
  ------------------
10170|      0|    return is_valid = false;
10171|      0|  }
10172|  59.1k|  std::string_view original_input = input;
10173|  59.1k|  if (original_input.back() == '.') {
  ------------------
  |  Branch (10173:7): [True: 28.6k, False: 30.5k]
  ------------------
10174|  28.6k|    original_input.remove_suffix(1);
10175|  28.6k|  }
10176|  59.1k|  if (input.back() == '.') {
  ------------------
  |  Branch (10176:7): [True: 28.6k, False: 30.5k]
  ------------------
10177|  28.6k|    input.remove_suffix(1);
10178|  28.6k|    if (input.empty()) {
  ------------------
  |  Branch (10178:9): [True: 0, False: 28.6k]
  ------------------
10179|      0|      return is_valid = false;
10180|      0|    }
10181|  28.6k|  }
10182|       |
10183|  59.1k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
10184|  59.1k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (10184:7): [True: 19.0k, False: 40.0k]
  ------------------
10185|  19.0k|    host = original_input;
10186|  19.0k|    host_type = IPV4;
10187|  19.0k|    return true;
10188|  19.0k|  }
10189|       |
10190|  40.0k|  const char* p = input.data();
10191|  40.0k|  const char* end = p + input.size();
10192|  40.0k|  uint64_t ipv4 = 0;
10193|  40.0k|  int digit_count = 0;
10194|  40.0k|  int pure_decimal_count = 0;
10195|       |
10196|  50.4k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (10196:10): [True: 50.4k, False: 16]
  |  Branch (10196:29): [True: 50.4k, False: 0]
  ------------------
10197|  50.4k|    uint64_t segment = 0;
10198|  50.4k|    bool pure = false;
10199|  50.4k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (10199:9): [True: 19.3k, False: 31.0k]
  ------------------
10200|  19.3k|      return is_valid = false;
10201|  19.3k|    }
10202|  31.0k|    if (pure) {
  ------------------
  |  Branch (10202:9): [True: 11.4k, False: 19.6k]
  ------------------
10203|  11.4k|      ++pure_decimal_count;
10204|  11.4k|    }
10205|  31.0k|    if (p >= end) {
  ------------------
  |  Branch (10205:9): [True: 20.6k, False: 10.3k]
  ------------------
10206|  20.6k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
10207|  20.6k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (10207:11): [True: 24, False: 20.6k]
  ------------------
10208|     24|        return is_valid = false;
10209|     24|      }
10210|  20.6k|      ipv4 = (ipv4 << shift) | segment;
10211|  20.6k|      host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (10211:14): [True: 0, False: 20.6k]
  ------------------
10212|  20.6k|                                       : ada::serializers::ipv4(ipv4);
10213|  20.6k|      host_type = IPV4;
10214|  20.6k|      return true;
10215|  20.6k|    }
10216|  10.3k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (10216:9): [True: 42, False: 10.3k]
  |  Branch (10216:26): [True: 0, False: 10.3k]
  ------------------
10217|     42|      return is_valid = false;
10218|     42|    }
10219|  10.3k|    ipv4 = (ipv4 << 8) | segment;
10220|  10.3k|    ++p;
10221|  10.3k|  }
10222|     16|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (10222:7): [True: 0, False: 16]
  |  Branch (10222:27): [True: 16, False: 0]
  ------------------
10223|     16|    return is_valid = false;
10224|     16|  }
10225|      0|  host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (10225:10): [True: 0, False: 0]
  ------------------
10226|      0|                                   : ada::serializers::ipv4(ipv4);
10227|      0|  host_type = IPV4;
10228|      0|  return true;
10229|     16|}
_ZN3ada3url10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10231|    581|bool url::parse_ipv6(std::string_view input) {
10232|    581|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
10233|    581|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (10233:7): [True: 13, False: 568]
  |  Branch (10233:24): [True: 11, False: 557]
  ------------------
10234|     24|    return is_valid = false;
10235|     24|  }
10236|    557|  std::array<uint16_t, 8> address{};
10237|       |#if defined(ADA_AVX512_IPV6)
10238|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
10239|       |                                                     address, simd_valid)) {
10240|       |    if (!simd_valid) [[unlikely]] {
10241|       |      return is_valid = false;
10242|       |    }
10243|       |    host = ada::serializers::ipv6(address);
10244|       |    host_type = IPV6;
10245|       |    return true;
10246|       |  }
10247|       |  address = {};
10248|       |#endif
10249|    557|  const char* pointer = input.data();
10250|    557|  const char* const end = pointer + input.size();
10251|    557|  int piece_index = 0;
10252|    557|  int compress = -1;
10253|       |
10254|    557|  if (*pointer == ':') {
  ------------------
  |  Branch (10254:7): [True: 247, False: 310]
  ------------------
10255|    247|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (10255:9): [True: 3, False: 244]
  |  Branch (10255:30): [True: 3, False: 241]
  ------------------
10256|      6|      return is_valid = false;
10257|      6|    }
10258|    241|    pointer += 2;
10259|    241|    compress = ++piece_index;
10260|    241|  }
10261|       |
10262|  1.77k|  while (pointer != end) {
  ------------------
  |  Branch (10262:10): [True: 1.33k, False: 435]
  ------------------
10263|  1.33k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (10263:9): [True: 3, False: 1.33k]
  ------------------
10264|      3|      return is_valid = false;
10265|      3|    }
10266|  1.33k|    if (*pointer == ':') {
  ------------------
  |  Branch (10266:9): [True: 163, False: 1.17k]
  ------------------
10267|    163|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (10267:11): [True: 3, False: 160]
  ------------------
10268|      3|        return is_valid = false;
10269|      3|      }
10270|    160|      ++pointer;
10271|    160|      compress = ++piece_index;
10272|    160|      continue;
10273|    163|    }
10274|       |
10275|  1.17k|    uint16_t value = 0;
10276|  1.17k|    const int length = detail::parse_hex_piece(pointer, end, value);
10277|       |
10278|  1.17k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (10278:9): [True: 936, False: 237]
  |  Branch (10278:27): [True: 83, False: 853]
  ------------------
10279|     83|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (10279:11): [True: 3, False: 80]
  ------------------
10280|      3|        return is_valid = false;
10281|      3|      }
10282|     80|      pointer -= length;
10283|     80|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (10283:11): [True: 3, False: 77]
  ------------------
10284|      3|        return is_valid = false;
10285|      3|      }
10286|       |
10287|     77|      int numbers_seen = 0;
10288|    212|      while (pointer != end) {
  ------------------
  |  Branch (10288:14): [True: 194, False: 18]
  ------------------
10289|    194|        int ipv4_piece = -1;
10290|    194|        if (numbers_seen > 0) {
  ------------------
  |  Branch (10290:13): [True: 117, False: 77]
  ------------------
10291|    117|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (10291:15): [True: 102, False: 15]
  |  Branch (10291:34): [True: 97, False: 5]
  ------------------
10292|     97|            ++pointer;
10293|     97|          } else {
10294|     20|            return is_valid = false;
10295|     20|          }
10296|    117|        }
10297|    174|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (10297:13): [True: 19, False: 155]
  |  Branch (10297:31): [True: 5, False: 150]
  |  Branch (10297:49): [True: 6, False: 144]
  ------------------
10298|     30|          return is_valid = false;
10299|     30|        }
10300|    144|        ipv4_piece = *pointer - '0';
10301|    144|        ++pointer;
10302|    144|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (10302:13): [True: 134, False: 10]
  |  Branch (10302:31): [True: 59, False: 75]
  |  Branch (10302:50): [True: 56, False: 3]
  ------------------
10303|     56|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (10303:15): [True: 3, False: 53]
  ------------------
10304|      3|            return is_valid = false;
10305|      3|          }
10306|     53|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
10307|     53|          ++pointer;
10308|     53|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (10308:15): [True: 50, False: 3]
  |  Branch (10308:33): [True: 32, False: 18]
  |  Branch (10308:52): [True: 28, False: 4]
  ------------------
10309|     28|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
10310|     28|            ++pointer;
10311|     28|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (10311:17): [True: 6, False: 22]
  ------------------
10312|      6|              return is_valid = false;
10313|      6|            }
10314|     28|          }
10315|     53|        }
10316|    135|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
10317|    135|            address[static_cast<size_t>(piece_index)] * 0x100 +
10318|    135|            static_cast<uint16_t>(ipv4_piece));
10319|    135|        ++numbers_seen;
10320|    135|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (10320:13): [True: 39, False: 96]
  |  Branch (10320:34): [True: 13, False: 83]
  ------------------
10321|     52|          ++piece_index;
10322|     52|        }
10323|    135|      }
10324|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (10324:11): [True: 12, False: 6]
  ------------------
10325|     12|        return is_valid = false;
10326|     12|      }
10327|      6|      break;
10328|     18|    }
10329|       |
10330|  1.09k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (10330:9): [True: 19, False: 1.07k]
  ------------------
10331|     19|      return is_valid = false;
10332|     19|    }
10333|       |
10334|  1.07k|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (10334:9): [True: 834, False: 237]
  |  Branch (10334:27): [True: 830, False: 4]
  ------------------
10335|    830|      ++pointer;
10336|    830|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (10336:11): [True: 4, False: 826]
  ------------------
10337|      4|        return is_valid = false;
10338|      4|      }
10339|    830|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (10339:16): [True: 4, False: 237]
  ------------------
10340|      4|      return is_valid = false;
10341|      4|    }
10342|       |
10343|  1.06k|    address[static_cast<size_t>(piece_index)] = value;
10344|  1.06k|    ++piece_index;
10345|  1.06k|  }
10346|       |
10347|    441|  if (compress != -1) {
  ------------------
  |  Branch (10347:7): [True: 391, False: 50]
  ------------------
10348|    391|    const int right = piece_index - compress;
10349|    391|    if (right > 0) {
  ------------------
  |  Branch (10349:9): [True: 193, False: 198]
  ------------------
10350|    193|      const size_t dest = static_cast<size_t>(8 - right);
10351|    193|      const size_t src = static_cast<size_t>(compress);
10352|    193|      if (dest != src) {
  ------------------
  |  Branch (10352:11): [True: 175, False: 18]
  ------------------
10353|    496|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (10353:53): [True: 321, False: 175]
  ------------------
10354|    321|          address[dest + i] = address[src + i];
10355|    321|          address[src + i] = 0;
10356|    321|        }
10357|    175|      }
10358|    193|    }
10359|    391|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (10359:14): [True: 21, False: 29]
  ------------------
10360|     21|    return is_valid = false;
10361|     21|  }
10362|       |
10363|    420|  host = ada::serializers::ipv6(address);
10364|    420|  ada_log("parse_ipv6 ", *host);
10365|    420|  host_type = IPV6;
10366|    420|  return true;
10367|    441|}
_ZNK3ada3url12get_protocolEv:
10696|   202k|[[nodiscard]] std::string url::get_protocol() const {
10697|   202k|  if (is_special()) {
  ------------------
  |  Branch (10697:7): [True: 201k, False: 600]
  ------------------
10698|   201k|    return helpers::concat(ada::scheme::details::is_special_list[type], ":");
10699|   201k|  }
10700|       |  // We only move the 'scheme' if it is non-special.
10701|    600|  return helpers::concat(non_special_scheme, ":");
10702|   202k|}
_ZNK3ada3url8get_hostEv:
10704|   202k|[[nodiscard]] std::string url::get_host() const {
10705|       |  // If url's host is null, then return the empty string.
10706|       |  // If url's port is null, return url's host, serialized.
10707|       |  // Return url's host, serialized, followed by U+003A (:) and url's port,
10708|       |  // serialized.
10709|   202k|  if (!host.has_value()) {
  ------------------
  |  Branch (10709:7): [True: 370, False: 201k]
  ------------------
10710|    370|    return "";
10711|    370|  }
10712|   201k|  if (port.has_value()) {
  ------------------
  |  Branch (10712:7): [True: 21.2k, False: 180k]
  ------------------
10713|  21.2k|    return host.value() + ":" + get_port();
10714|  21.2k|  }
10715|   180k|  return host.value();
10716|   201k|}
_ZNK3ada3url12get_hostnameEv:
10718|   202k|[[nodiscard]] std::string url::get_hostname() const {
10719|   202k|  return host.value_or("");
10720|   202k|}
_ZNK3ada3url10get_searchEv:
10722|   202k|[[nodiscard]] std::string url::get_search() const {
10723|       |  // If this's URL's query is either null or the empty string, then return the
10724|       |  // empty string. Return U+003F (?), followed by this's URL's query.
10725|   202k|  return (!query.has_value() || (query->empty())) ? "" : "?" + query.value();
  ------------------
  |  Branch (10725:11): [True: 167k, False: 34.4k]
  |  Branch (10725:33): [True: 1.13k, False: 33.2k]
  ------------------
10726|   202k|}
_ZNK3ada3url12get_usernameEv:
10728|   202k|[[nodiscard]] const std::string& url::get_username() const noexcept {
10729|   202k|  return username;
10730|   202k|}
_ZNK3ada3url12get_passwordEv:
10732|   202k|[[nodiscard]] const std::string& url::get_password() const noexcept {
10733|   202k|  return password;
10734|   202k|}
_ZNK3ada3url8get_portEv:
10736|   223k|[[nodiscard]] std::string url::get_port() const {
10737|   223k|  return port.has_value() ? std::to_string(port.value()) : "";
  ------------------
  |  Branch (10737:10): [True: 42.4k, False: 181k]
  ------------------
10738|   223k|}
_ZNK3ada3url8get_hashEv:
10740|   202k|[[nodiscard]] std::string url::get_hash() const {
10741|       |  // If this's URL's fragment is either null or the empty string, then return
10742|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
10743|   202k|  return (!hash.has_value() || (hash->empty())) ? "" : "#" + hash.value();
  ------------------
  |  Branch (10743:11): [True: 177k, False: 24.8k]
  |  Branch (10743:32): [True: 1.50k, False: 23.3k]
  ------------------
10744|   202k|}
_ZN3ada3url8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11047|   202k|bool url::set_href(const std::string_view input) {
11048|   202k|  ada::result<ada::url> out = ada::parse<ada::url>(input);
11049|       |
11050|   202k|  if (out) {
  ------------------
  |  Branch (11050:7): [True: 202k, False: 0]
  ------------------
11051|       |    // The parser enforces get_max_input_length() on both the input and the
11052|       |    // normalized result. This is a defense-in-depth check.
11053|   202k|    if (out->get_href_size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (11053:9): [True: 0, False: 202k]
  ------------------
11054|      0|      return false;
11055|      0|    }
11056|   202k|    *this = std::move(*out);
11057|   202k|  }
11058|       |
11059|   202k|  return out.has_value();
11060|   202k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12329|   457k|                                                result_type& out) {
12330|   457k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12331|   457k|  constexpr bool is_aggregator =
12332|   457k|      std::is_same_v<result_type, ada::url_aggregator>;
12333|   457k|  static_assert(is_ada_url || is_aggregator);
12334|       |
12335|   457k|  const size_t len = input.size();
12336|       |  // Shortest accepted form is "ws://x" (6).
12337|   457k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12337:7): [True: 14, False: 457k]
  ------------------
12338|     14|    return false;
12339|     14|  }
12340|   457k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12341|       |
12342|   457k|  size_t pos = 0;
12343|   457k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12344|   457k|  uint32_t protocol_end = 0;
12345|   457k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12346|   457k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12347|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12348|       |  // Masked compares cover the shorter special schemes without extra loads.
12349|   457k|  if (len >= 8) {
  ------------------
  |  Branch (12349:7): [True: 457k, False: 218]
  ------------------
12350|   457k|    uint64_t first8 = 0;
12351|   457k|    std::memcpy(&first8, b, 8);
12352|   457k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12352:9): [True: 352k, False: 105k]
  ------------------
12353|   352k|      pos = 8;
12354|   352k|      scheme_type = ada::scheme::type::HTTPS;
12355|   352k|      protocol_end = 6;
12356|   352k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12356:16): [True: 99.0k, False: 6.42k]
  ------------------
12357|   105k|               0x002f2f3a70747468ull) {  // "http://"
12358|  99.0k|      pos = 7;
12359|  99.0k|      scheme_type = ada::scheme::type::HTTP;
12360|  99.0k|      protocol_end = 5;
12361|  99.0k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12361:16): [True: 8, False: 6.41k]
  ------------------
12362|  6.42k|               0x00002f2f3a737377ull) {  // "wss://"
12363|      8|      pos = 6;
12364|      8|      scheme_type = ada::scheme::type::WSS;
12365|      8|      protocol_end = 4;
12366|  6.41k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12366:16): [True: 99, False: 6.31k]
  ------------------
12367|  6.41k|               0x00002f2f3a707466ull) {  // "ftp://"
12368|     99|      pos = 6;
12369|     99|      scheme_type = ada::scheme::type::FTP;
12370|     99|      protocol_end = 4;
12371|  6.31k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12371:16): [True: 267, False: 6.05k]
  ------------------
12372|  6.31k|               0x0000002f2f3a7377ull) {  // "ws://"
12373|    267|      pos = 5;
12374|    267|      scheme_type = ada::scheme::type::WS;
12375|    267|      protocol_end = 3;
12376|  6.05k|    } else {
12377|  6.05k|      return false;
12378|  6.05k|    }
12379|   457k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12379:14): [True: 41, False: 177]
  |  Branch (12379:29): [True: 21, False: 20]
  ------------------
12380|     21|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12380:9): [True: 3, False: 18]
  |  Branch (12380:24): [True: 2, False: 1]
  |  Branch (12380:39): [True: 2, False: 0]
  ------------------
12381|      2|      pos = 5;
12382|      2|      scheme_type = ada::scheme::type::WS;
12383|      2|      protocol_end = 3;
12384|     19|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12384:16): [True: 5, False: 14]
  |  Branch (12384:31): [True: 0, False: 5]
  |  Branch (12384:46): [True: 0, False: 0]
  |  Branch (12384:61): [True: 0, False: 0]
  ------------------
12385|      0|      pos = 6;
12386|      0|      scheme_type = ada::scheme::type::WSS;
12387|      0|      protocol_end = 4;
12388|     19|    } else {
12389|     19|      return false;
12390|     19|    }
12391|    197|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12391:14): [True: 46, False: 151]
  |  Branch (12391:29): [True: 21, False: 25]
  |  Branch (12391:44): [True: 7, False: 14]
  |  Branch (12391:59): [True: 1, False: 6]
  ------------------
12392|      1|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12392:14): [True: 0, False: 1]
  |  Branch (12392:29): [True: 0, False: 0]
  ------------------
12393|      0|    pos = 6;
12394|      0|    scheme_type = ada::scheme::type::FTP;
12395|      0|    protocol_end = 4;
12396|    197|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12396:14): [True: 174, False: 23]
  |  Branch (12396:26): [True: 94, False: 80]
  |  Branch (12396:41): [True: 75, False: 19]
  |  Branch (12396:56): [True: 59, False: 16]
  ------------------
12397|     59|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12397:14): [True: 40, False: 19]
  |  Branch (12397:29): [True: 26, False: 14]
  |  Branch (12397:44): [True: 15, False: 11]
  |  Branch (12397:59): [True: 4, False: 11]
  ------------------
12398|      4|    pos = 7;
12399|      4|    scheme_type = ada::scheme::type::HTTP;
12400|      4|    protocol_end = 5;
12401|    193|  } else {
12402|    193|    return false;
12403|    193|  }
12404|       |#else
12405|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12406|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12407|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12408|       |    pos = 8;
12409|       |    scheme_type = ada::scheme::type::HTTPS;
12410|       |    protocol_end = 6;
12411|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12412|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12413|       |    pos = 7;
12414|       |    scheme_type = ada::scheme::type::HTTP;
12415|       |    protocol_end = 5;
12416|       |  } else if (b[0] == 'w' && b[1] == 's') {
12417|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12418|       |      pos = 5;
12419|       |      scheme_type = ada::scheme::type::WS;
12420|       |      protocol_end = 3;
12421|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12422|       |               b[5] == '/') {
12423|       |      pos = 6;
12424|       |      scheme_type = ada::scheme::type::WSS;
12425|       |      protocol_end = 4;
12426|       |    } else {
12427|       |      return false;
12428|       |    }
12429|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12430|       |             b[4] == '/' && b[5] == '/') {
12431|       |    pos = 6;
12432|       |    scheme_type = ada::scheme::type::FTP;
12433|       |    protocol_end = 4;
12434|       |  } else {
12435|       |    return false;
12436|       |  }
12437|       |#endif
12438|   451k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12438:7): [True: 451k, False: 5]
  |  Branch (12438:21): [True: 104, False: 451k]
  |  Branch (12438:38): [True: 20, False: 451k]
  ------------------
12439|    124|    return false;
12440|    124|  }
12441|       |
12442|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12443|   451k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12443:7): [True: 451k, False: 5]
  |  Branch (12443:22): [True: 449k, False: 2.27k]
  |  Branch (12443:39): [True: 58, False: 449k]
  |  Branch (12443:57): [True: 6, False: 451k]
  ------------------
12444|     64|    return false;
12445|     64|  }
12446|       |
12447|   451k|  const size_t host_start = pos;
12448|   451k|  bool has_upper = false;
12449|   451k|  bool has_x = false;
12450|   451k|  size_t host_end = pos;
12451|   451k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12451:7): [True: 12.3k, False: 439k]
  ------------------
12452|  12.3k|    return false;
12453|  12.3k|  }
12454|   439k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12454:7): [True: 144, False: 438k]
  ------------------
12455|    144|    return false;
12456|    144|  }
12457|   438k|  const size_t host_len = host_end - host_start;
12458|   438k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12458:7): [True: 276, False: 438k]
  ------------------
12459|    276|    return false;
12460|    276|  }
12461|   438k|  {
12462|   438k|    std::string_view hv(input.data() + host_start, host_len);
12463|   438k|    char host_buf[256];
12464|   438k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12464:9): [True: 10.3k, False: 428k]
  ------------------
12465|  10.3k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12466|  10.3k|      unicode::to_lower_ascii(host_buf, host_len);
12467|  10.3k|      hv = std::string_view(host_buf, host_len);
12468|  10.3k|    }
12469|   438k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12469:9): [True: 19.2k, False: 419k]
  ------------------
12470|  19.2k|      return false;
12471|  19.2k|    }
12472|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12473|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12474|   419k|    static constexpr std::string_view xn{"xn-", 3};
12475|   419k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12475:10): [True: 382k, False: 36.7k]
  |  Branch (12475:19): [True: 519, False: 36.2k]
  |  Branch (12475:33): [True: 60.4k, False: 322k]
  ------------------
12476|  60.4k|        [[unlikely]] {
12477|  60.4k|      return false;
12478|  60.4k|    }
12479|   419k|  }
12480|       |
12481|   359k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12481:7): [True: 349k, False: 9.75k]
  |  Branch (12481:25): [True: 62.6k, False: 286k]
  ------------------
12482|  62.6k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12483|  62.6k|                                            protocol_end, host_start, host_end,
12484|  62.6k|                                            host_len, has_upper);
12485|  62.6k|  }
12486|       |
12487|   296k|  size_t i = host_end;
12488|   296k|  size_t path_start = host_end;
12489|   296k|  size_t path_end = host_end;
12490|   296k|  size_t query_start = std::string_view::npos;
12491|   296k|  size_t hash_start = std::string_view::npos;
12492|   296k|  bool has_path = false;
12493|   296k|  bool maybe_dot_segment = false;
12494|   296k|  bool rest_simple = true;
12495|       |
12496|   296k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12496:7): [True: 286k, False: 9.75k]
  |  Branch (12496:18): [True: 267k, False: 19.4k]
  ------------------
12497|   267k|    has_path = true;
12498|   267k|    path_start = i;
12499|   267k|    ++i;
12500|   267k|    scan_path_run(b, i, len, maybe_dot_segment);
12501|   267k|    if (i < len) {
  ------------------
  |  Branch (12501:9): [True: 112k, False: 155k]
  ------------------
12502|   112k|      const uint8_t cls = k_path[b[i]];
12503|   112k|      if (cls == 1) {
  ------------------
  |  Branch (12503:11): [True: 99.7k, False: 12.3k]
  ------------------
12504|  99.7k|        path_end = i;
12505|  99.7k|        if (b[i] == '?') {
  ------------------
  |  Branch (12505:13): [True: 79.7k, False: 20.0k]
  ------------------
12506|  79.7k|          query_start = i;
12507|  79.7k|          ++i;
12508|  79.7k|          goto scan_query;
12509|  79.7k|        }
12510|  20.0k|        hash_start = i;
12511|  20.0k|        ++i;
12512|  20.0k|        goto scan_hash;
12513|  99.7k|      }
12514|  12.3k|      rest_simple = false;
12515|  12.3k|      hash_start = input.find('#', i);
12516|  12.3k|      query_start = input.substr(0, hash_start).find('?', i);
12517|  12.3k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12517:11): [True: 1.13k, False: 11.2k]
  ------------------
12518|  1.13k|        path_end = query_start;
12519|  11.2k|      } else {
12520|  11.2k|        path_end = hash_start != std::string_view::npos ? hash_start : len;
  ------------------
  |  Branch (12520:20): [True: 382, False: 10.8k]
  ------------------
12521|  11.2k|      }
12522|  12.3k|      goto after_rest;
12523|   112k|    }
12524|   155k|    path_end = i;
12525|   155k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12525:14): [True: 19.4k, False: 9.75k]
  |  Branch (12525:25): [True: 9.80k, False: 9.68k]
  ------------------
12526|  9.80k|    query_start = i;
12527|  9.80k|    ++i;
12528|  9.80k|    goto scan_query;
12529|  19.4k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12529:14): [True: 9.68k, False: 9.75k]
  |  Branch (12529:25): [True: 9.68k, False: 0]
  ------------------
12530|  9.68k|    hash_start = i;
12531|  9.68k|    ++i;
12532|  9.68k|    goto scan_hash;
12533|  9.68k|  }
12534|   164k|  goto after_rest;
12535|       |
12536|   164k|scan_query:
12537|  89.5k|  scan_query_run(b, i, len);
12538|  89.5k|  if (i < len) {
  ------------------
  |  Branch (12538:7): [True: 31.2k, False: 58.2k]
  ------------------
12539|  31.2k|    if (b[i] == '#') {
  ------------------
  |  Branch (12539:9): [True: 31.1k, False: 146]
  ------------------
12540|  31.1k|      hash_start = i;
12541|  31.1k|      ++i;
12542|  31.1k|      goto scan_hash;
12543|  31.1k|    }
12544|    146|    rest_simple = false;
12545|    146|    goto scan_query_boundary;
12546|  31.2k|  }
12547|  58.2k|  goto after_rest;
12548|       |
12549|  58.2k|scan_query_boundary:
12550|    146|  hash_start = input.find('#', i);
12551|    146|  goto after_rest;
12552|       |
12553|  60.8k|scan_hash:
12554|  60.8k|  scan_hash_run(b, i, len);
12555|  60.8k|  if (i < len) {
  ------------------
  |  Branch (12555:7): [True: 134, False: 60.6k]
  ------------------
12556|    134|    rest_simple = false;
12557|    134|  }
12558|       |
12559|   296k|after_rest:
12560|   296k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12560:7): [True: 283k, False: 12.6k]
  |  Branch (12560:22): [True: 10.4k, False: 273k]
  ------------------
12561|  10.4k|    const std::string_view path_body(input.data() + path_start,
12562|  10.4k|                                     path_end - path_start);
12563|  10.4k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12563:9): [True: 9.93k, False: 480]
  ------------------
12564|  9.93k|      rest_simple = false;
12565|  9.93k|    }
12566|  10.4k|  }
12567|       |
12568|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12569|       |  // trailing C0 control or space; this fast path does neither. A query or
12570|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12571|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12572|       |  // inputs back to the slow path.
12573|   296k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12573:7): [True: 22.5k, False: 273k]
  |  Branch (12573:24): [True: 45, False: 22.5k]
  ------------------
12574|  22.5k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12574:24): [True: 85, False: 22.4k]
  ------------------
12575|    130|    return false;
12576|    130|  }
12577|       |
12578|   296k|  out.type = scheme_type;
12579|   296k|  out.is_valid = true;
12580|   296k|  out.has_opaque_path = false;
12581|   296k|  out.host_type = DEFAULT;
12582|       |
12583|   296k|  if (!rest_simple) {
  ------------------
  |  Branch (12583:7): [True: 22.4k, False: 273k]
  ------------------
12584|       |    // Host is a plain domain. Finish path/query/hash with
12585|       |    // the regular helpers
12586|       |    // so percent-encoding and dot segments do not re-parse the authority.
12587|  22.4k|    const std::string_view path_view =
12588|  22.4k|        has_path
  ------------------
  |  Branch (12588:9): [True: 22.2k, False: 149]
  ------------------
12589|  22.4k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12590|  22.4k|            : std::string_view{};
12591|  22.4k|    auto apply_query_and_hash = [&]() {
12592|  22.4k|      if (query_start != std::string_view::npos) {
12593|  22.4k|        const size_t q_end =
12594|  22.4k|            (hash_start != std::string_view::npos) ? hash_start : len;
12595|  22.4k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|  22.4k|                                                q_end - query_start - 1),
12597|  22.4k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|  22.4k|      }
12599|  22.4k|      if (hash_start != std::string_view::npos) {
12600|  22.4k|        out.update_unencoded_base_hash(std::string_view(
12601|  22.4k|            input.data() + hash_start + 1, len - hash_start - 1));
12602|  22.4k|      }
12603|  22.4k|    };
12604|       |    if constexpr (is_aggregator) {
12605|       |      out.buffer.assign(input.substr(0, host_end));
12606|       |      if (has_upper) {
12607|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12608|       |      }
12609|       |      out.components.protocol_end = protocol_end;
12610|       |      out.components.username_end = protocol_end + 2;
12611|       |      out.components.host_start = protocol_end + 2;
12612|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12613|       |      out.components.port = url_components::omitted;
12614|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12615|       |      out.components.search_start = url_components::omitted;
12616|       |      out.components.hash_start = url_components::omitted;
12617|       |      out.parse_path(path_view);
12618|       |      apply_query_and_hash();
12619|  22.4k|    } else {
12620|  22.4k|      std::string host_str(input.substr(host_start, host_len));
12621|  22.4k|      if (has_upper) {
  ------------------
  |  Branch (12621:11): [True: 175, False: 22.2k]
  ------------------
12622|    175|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12623|    175|      }
12624|  22.4k|      out.host = std::move(host_str);
12625|  22.4k|      out.parse_path(path_view);
12626|  22.4k|      apply_query_and_hash();
12627|  22.4k|    }
12628|  22.4k|    return true;
12629|  22.4k|  }
12630|       |
12631|   273k|  const bool need_slash = !has_path;
12632|       |  if constexpr (is_aggregator) {
12633|       |    if (!need_slash) {
12634|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12635|       |      out.buffer.assign(input);
12636|       |      if (has_upper) {
12637|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12638|       |      }
12639|       |      out.components.protocol_end = protocol_end;
12640|       |      out.components.username_end = protocol_end + 2;
12641|       |      out.components.host_start = protocol_end + 2;
12642|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12643|       |      out.components.port = url_components::omitted;
12644|       |      out.components.pathname_start = static_cast<uint32_t>(path_start);
12645|       |      out.components.search_start = (query_start != std::string_view::npos)
12646|       |                                        ? static_cast<uint32_t>(query_start)
12647|       |                                        : url_components::omitted;
12648|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12649|       |                                      ? static_cast<uint32_t>(hash_start)
12650|       |                                      : url_components::omitted;
12651|       |    } else {
12652|       |      out.buffer.clear();
12653|       |      out.buffer.reserve(len + 1);
12654|       |      out.buffer.append(input.substr(0, host_end));
12655|       |      out.buffer.push_back('/');
12656|       |      if (host_end < len) {
12657|       |        out.buffer.append(input.substr(host_end));
12658|       |      }
12659|       |      if (has_upper) {
12660|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12661|       |      }
12662|       |      out.components.protocol_end = protocol_end;
12663|       |      out.components.username_end = protocol_end + 2;
12664|       |      out.components.host_start = protocol_end + 2;
12665|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12666|       |      out.components.port = url_components::omitted;
12667|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12668|       |      out.components.search_start = (query_start != std::string_view::npos)
12669|       |                                        ? static_cast<uint32_t>(query_start + 1)
12670|       |                                        : url_components::omitted;
12671|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12672|       |                                      ? static_cast<uint32_t>(hash_start + 1)
12673|       |                                      : url_components::omitted;
12674|       |    }
12675|   273k|  } else {
12676|   273k|    std::string host_str(input.substr(host_start, host_len));
12677|   273k|    if (has_upper) {
  ------------------
  |  Branch (12677:9): [True: 9.67k, False: 264k]
  ------------------
12678|  9.67k|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12679|  9.67k|    }
12680|   273k|    out.host = std::move(host_str);
12681|   273k|    if (need_slash) {
  ------------------
  |  Branch (12681:9): [True: 29.0k, False: 244k]
  ------------------
12682|  29.0k|      out.path = "/";
12683|   244k|    } else {
12684|   244k|      out.path.assign(input.data() + path_start, path_end - path_start);
12685|   244k|    }
12686|   273k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12686:9): [True: 89.1k, False: 184k]
  ------------------
12687|  89.1k|      const size_t q_end =
12688|  89.1k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12688:11): [True: 30.9k, False: 58.1k]
  ------------------
12689|  89.1k|      out.query.emplace(input.data() + query_start + 1,
12690|  89.1k|                        q_end - query_start - 1);
12691|  89.1k|    }
12692|   273k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12692:9): [True: 60.5k, False: 213k]
  ------------------
12693|  60.5k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12694|  60.5k|    }
12695|   273k|  }
12696|   273k|  return true;
12697|   296k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12329|   457k|                                                result_type& out) {
12330|   457k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12331|   457k|  constexpr bool is_aggregator =
12332|   457k|      std::is_same_v<result_type, ada::url_aggregator>;
12333|   457k|  static_assert(is_ada_url || is_aggregator);
12334|       |
12335|   457k|  const size_t len = input.size();
12336|       |  // Shortest accepted form is "ws://x" (6).
12337|   457k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12337:7): [True: 14, False: 457k]
  ------------------
12338|     14|    return false;
12339|     14|  }
12340|   457k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12341|       |
12342|   457k|  size_t pos = 0;
12343|   457k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12344|   457k|  uint32_t protocol_end = 0;
12345|   457k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12346|   457k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12347|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12348|       |  // Masked compares cover the shorter special schemes without extra loads.
12349|   457k|  if (len >= 8) {
  ------------------
  |  Branch (12349:7): [True: 457k, False: 218]
  ------------------
12350|   457k|    uint64_t first8 = 0;
12351|   457k|    std::memcpy(&first8, b, 8);
12352|   457k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12352:9): [True: 352k, False: 105k]
  ------------------
12353|   352k|      pos = 8;
12354|   352k|      scheme_type = ada::scheme::type::HTTPS;
12355|   352k|      protocol_end = 6;
12356|   352k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12356:16): [True: 99.0k, False: 6.42k]
  ------------------
12357|   105k|               0x002f2f3a70747468ull) {  // "http://"
12358|  99.0k|      pos = 7;
12359|  99.0k|      scheme_type = ada::scheme::type::HTTP;
12360|  99.0k|      protocol_end = 5;
12361|  99.0k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12361:16): [True: 8, False: 6.41k]
  ------------------
12362|  6.42k|               0x00002f2f3a737377ull) {  // "wss://"
12363|      8|      pos = 6;
12364|      8|      scheme_type = ada::scheme::type::WSS;
12365|      8|      protocol_end = 4;
12366|  6.41k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12366:16): [True: 99, False: 6.31k]
  ------------------
12367|  6.41k|               0x00002f2f3a707466ull) {  // "ftp://"
12368|     99|      pos = 6;
12369|     99|      scheme_type = ada::scheme::type::FTP;
12370|     99|      protocol_end = 4;
12371|  6.31k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12371:16): [True: 267, False: 6.05k]
  ------------------
12372|  6.31k|               0x0000002f2f3a7377ull) {  // "ws://"
12373|    267|      pos = 5;
12374|    267|      scheme_type = ada::scheme::type::WS;
12375|    267|      protocol_end = 3;
12376|  6.05k|    } else {
12377|  6.05k|      return false;
12378|  6.05k|    }
12379|   457k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12379:14): [True: 41, False: 177]
  |  Branch (12379:29): [True: 21, False: 20]
  ------------------
12380|     21|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12380:9): [True: 3, False: 18]
  |  Branch (12380:24): [True: 2, False: 1]
  |  Branch (12380:39): [True: 2, False: 0]
  ------------------
12381|      2|      pos = 5;
12382|      2|      scheme_type = ada::scheme::type::WS;
12383|      2|      protocol_end = 3;
12384|     19|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12384:16): [True: 5, False: 14]
  |  Branch (12384:31): [True: 0, False: 5]
  |  Branch (12384:46): [True: 0, False: 0]
  |  Branch (12384:61): [True: 0, False: 0]
  ------------------
12385|      0|      pos = 6;
12386|      0|      scheme_type = ada::scheme::type::WSS;
12387|      0|      protocol_end = 4;
12388|     19|    } else {
12389|     19|      return false;
12390|     19|    }
12391|    197|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12391:14): [True: 46, False: 151]
  |  Branch (12391:29): [True: 21, False: 25]
  |  Branch (12391:44): [True: 7, False: 14]
  |  Branch (12391:59): [True: 1, False: 6]
  ------------------
12392|      1|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12392:14): [True: 0, False: 1]
  |  Branch (12392:29): [True: 0, False: 0]
  ------------------
12393|      0|    pos = 6;
12394|      0|    scheme_type = ada::scheme::type::FTP;
12395|      0|    protocol_end = 4;
12396|    197|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12396:14): [True: 174, False: 23]
  |  Branch (12396:26): [True: 94, False: 80]
  |  Branch (12396:41): [True: 75, False: 19]
  |  Branch (12396:56): [True: 59, False: 16]
  ------------------
12397|     59|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12397:14): [True: 40, False: 19]
  |  Branch (12397:29): [True: 26, False: 14]
  |  Branch (12397:44): [True: 15, False: 11]
  |  Branch (12397:59): [True: 4, False: 11]
  ------------------
12398|      4|    pos = 7;
12399|      4|    scheme_type = ada::scheme::type::HTTP;
12400|      4|    protocol_end = 5;
12401|    193|  } else {
12402|    193|    return false;
12403|    193|  }
12404|       |#else
12405|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12406|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12407|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12408|       |    pos = 8;
12409|       |    scheme_type = ada::scheme::type::HTTPS;
12410|       |    protocol_end = 6;
12411|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12412|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12413|       |    pos = 7;
12414|       |    scheme_type = ada::scheme::type::HTTP;
12415|       |    protocol_end = 5;
12416|       |  } else if (b[0] == 'w' && b[1] == 's') {
12417|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12418|       |      pos = 5;
12419|       |      scheme_type = ada::scheme::type::WS;
12420|       |      protocol_end = 3;
12421|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12422|       |               b[5] == '/') {
12423|       |      pos = 6;
12424|       |      scheme_type = ada::scheme::type::WSS;
12425|       |      protocol_end = 4;
12426|       |    } else {
12427|       |      return false;
12428|       |    }
12429|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12430|       |             b[4] == '/' && b[5] == '/') {
12431|       |    pos = 6;
12432|       |    scheme_type = ada::scheme::type::FTP;
12433|       |    protocol_end = 4;
12434|       |  } else {
12435|       |    return false;
12436|       |  }
12437|       |#endif
12438|   451k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12438:7): [True: 451k, False: 5]
  |  Branch (12438:21): [True: 104, False: 451k]
  |  Branch (12438:38): [True: 20, False: 451k]
  ------------------
12439|    124|    return false;
12440|    124|  }
12441|       |
12442|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12443|   451k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12443:7): [True: 451k, False: 5]
  |  Branch (12443:22): [True: 449k, False: 2.27k]
  |  Branch (12443:39): [True: 58, False: 449k]
  |  Branch (12443:57): [True: 6, False: 451k]
  ------------------
12444|     64|    return false;
12445|     64|  }
12446|       |
12447|   451k|  const size_t host_start = pos;
12448|   451k|  bool has_upper = false;
12449|   451k|  bool has_x = false;
12450|   451k|  size_t host_end = pos;
12451|   451k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12451:7): [True: 12.3k, False: 439k]
  ------------------
12452|  12.3k|    return false;
12453|  12.3k|  }
12454|   439k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12454:7): [True: 144, False: 438k]
  ------------------
12455|    144|    return false;
12456|    144|  }
12457|   438k|  const size_t host_len = host_end - host_start;
12458|   438k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12458:7): [True: 276, False: 438k]
  ------------------
12459|    276|    return false;
12460|    276|  }
12461|   438k|  {
12462|   438k|    std::string_view hv(input.data() + host_start, host_len);
12463|   438k|    char host_buf[256];
12464|   438k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12464:9): [True: 10.3k, False: 428k]
  ------------------
12465|  10.3k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12466|  10.3k|      unicode::to_lower_ascii(host_buf, host_len);
12467|  10.3k|      hv = std::string_view(host_buf, host_len);
12468|  10.3k|    }
12469|   438k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12469:9): [True: 19.2k, False: 419k]
  ------------------
12470|  19.2k|      return false;
12471|  19.2k|    }
12472|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12473|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12474|   419k|    static constexpr std::string_view xn{"xn-", 3};
12475|   419k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12475:10): [True: 382k, False: 36.7k]
  |  Branch (12475:19): [True: 519, False: 36.2k]
  |  Branch (12475:33): [True: 60.4k, False: 322k]
  ------------------
12476|  60.4k|        [[unlikely]] {
12477|  60.4k|      return false;
12478|  60.4k|    }
12479|   419k|  }
12480|       |
12481|   359k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12481:7): [True: 349k, False: 9.75k]
  |  Branch (12481:25): [True: 62.6k, False: 286k]
  ------------------
12482|  62.6k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12483|  62.6k|                                            protocol_end, host_start, host_end,
12484|  62.6k|                                            host_len, has_upper);
12485|  62.6k|  }
12486|       |
12487|   296k|  size_t i = host_end;
12488|   296k|  size_t path_start = host_end;
12489|   296k|  size_t path_end = host_end;
12490|   296k|  size_t query_start = std::string_view::npos;
12491|   296k|  size_t hash_start = std::string_view::npos;
12492|   296k|  bool has_path = false;
12493|   296k|  bool maybe_dot_segment = false;
12494|   296k|  bool rest_simple = true;
12495|       |
12496|   296k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12496:7): [True: 286k, False: 9.75k]
  |  Branch (12496:18): [True: 267k, False: 19.4k]
  ------------------
12497|   267k|    has_path = true;
12498|   267k|    path_start = i;
12499|   267k|    ++i;
12500|   267k|    scan_path_run(b, i, len, maybe_dot_segment);
12501|   267k|    if (i < len) {
  ------------------
  |  Branch (12501:9): [True: 112k, False: 155k]
  ------------------
12502|   112k|      const uint8_t cls = k_path[b[i]];
12503|   112k|      if (cls == 1) {
  ------------------
  |  Branch (12503:11): [True: 99.7k, False: 12.3k]
  ------------------
12504|  99.7k|        path_end = i;
12505|  99.7k|        if (b[i] == '?') {
  ------------------
  |  Branch (12505:13): [True: 79.7k, False: 20.0k]
  ------------------
12506|  79.7k|          query_start = i;
12507|  79.7k|          ++i;
12508|  79.7k|          goto scan_query;
12509|  79.7k|        }
12510|  20.0k|        hash_start = i;
12511|  20.0k|        ++i;
12512|  20.0k|        goto scan_hash;
12513|  99.7k|      }
12514|  12.3k|      rest_simple = false;
12515|  12.3k|      hash_start = input.find('#', i);
12516|  12.3k|      query_start = input.substr(0, hash_start).find('?', i);
12517|  12.3k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12517:11): [True: 1.13k, False: 11.2k]
  ------------------
12518|  1.13k|        path_end = query_start;
12519|  11.2k|      } else {
12520|  11.2k|        path_end = hash_start != std::string_view::npos ? hash_start : len;
  ------------------
  |  Branch (12520:20): [True: 382, False: 10.8k]
  ------------------
12521|  11.2k|      }
12522|  12.3k|      goto after_rest;
12523|   112k|    }
12524|   155k|    path_end = i;
12525|   155k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12525:14): [True: 19.4k, False: 9.75k]
  |  Branch (12525:25): [True: 9.80k, False: 9.68k]
  ------------------
12526|  9.80k|    query_start = i;
12527|  9.80k|    ++i;
12528|  9.80k|    goto scan_query;
12529|  19.4k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12529:14): [True: 9.68k, False: 9.75k]
  |  Branch (12529:25): [True: 9.68k, False: 0]
  ------------------
12530|  9.68k|    hash_start = i;
12531|  9.68k|    ++i;
12532|  9.68k|    goto scan_hash;
12533|  9.68k|  }
12534|   164k|  goto after_rest;
12535|       |
12536|   164k|scan_query:
12537|  89.5k|  scan_query_run(b, i, len);
12538|  89.5k|  if (i < len) {
  ------------------
  |  Branch (12538:7): [True: 31.2k, False: 58.2k]
  ------------------
12539|  31.2k|    if (b[i] == '#') {
  ------------------
  |  Branch (12539:9): [True: 31.1k, False: 146]
  ------------------
12540|  31.1k|      hash_start = i;
12541|  31.1k|      ++i;
12542|  31.1k|      goto scan_hash;
12543|  31.1k|    }
12544|    146|    rest_simple = false;
12545|    146|    goto scan_query_boundary;
12546|  31.2k|  }
12547|  58.2k|  goto after_rest;
12548|       |
12549|  58.2k|scan_query_boundary:
12550|    146|  hash_start = input.find('#', i);
12551|    146|  goto after_rest;
12552|       |
12553|  60.8k|scan_hash:
12554|  60.8k|  scan_hash_run(b, i, len);
12555|  60.8k|  if (i < len) {
  ------------------
  |  Branch (12555:7): [True: 134, False: 60.6k]
  ------------------
12556|    134|    rest_simple = false;
12557|    134|  }
12558|       |
12559|   296k|after_rest:
12560|   296k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12560:7): [True: 283k, False: 12.6k]
  |  Branch (12560:22): [True: 10.4k, False: 273k]
  ------------------
12561|  10.4k|    const std::string_view path_body(input.data() + path_start,
12562|  10.4k|                                     path_end - path_start);
12563|  10.4k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12563:9): [True: 9.93k, False: 480]
  ------------------
12564|  9.93k|      rest_simple = false;
12565|  9.93k|    }
12566|  10.4k|  }
12567|       |
12568|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12569|       |  // trailing C0 control or space; this fast path does neither. A query or
12570|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12571|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12572|       |  // inputs back to the slow path.
12573|   296k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12573:7): [True: 22.5k, False: 273k]
  |  Branch (12573:24): [True: 45, False: 22.5k]
  ------------------
12574|  22.5k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12574:24): [True: 85, False: 22.4k]
  ------------------
12575|    130|    return false;
12576|    130|  }
12577|       |
12578|   296k|  out.type = scheme_type;
12579|   296k|  out.is_valid = true;
12580|   296k|  out.has_opaque_path = false;
12581|   296k|  out.host_type = DEFAULT;
12582|       |
12583|   296k|  if (!rest_simple) {
  ------------------
  |  Branch (12583:7): [True: 22.4k, False: 273k]
  ------------------
12584|       |    // Host is a plain domain. Finish path/query/hash with
12585|       |    // the regular helpers
12586|       |    // so percent-encoding and dot segments do not re-parse the authority.
12587|  22.4k|    const std::string_view path_view =
12588|  22.4k|        has_path
  ------------------
  |  Branch (12588:9): [True: 22.2k, False: 149]
  ------------------
12589|  22.4k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12590|  22.4k|            : std::string_view{};
12591|  22.4k|    auto apply_query_and_hash = [&]() {
12592|  22.4k|      if (query_start != std::string_view::npos) {
12593|  22.4k|        const size_t q_end =
12594|  22.4k|            (hash_start != std::string_view::npos) ? hash_start : len;
12595|  22.4k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|  22.4k|                                                q_end - query_start - 1),
12597|  22.4k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|  22.4k|      }
12599|  22.4k|      if (hash_start != std::string_view::npos) {
12600|  22.4k|        out.update_unencoded_base_hash(std::string_view(
12601|  22.4k|            input.data() + hash_start + 1, len - hash_start - 1));
12602|  22.4k|      }
12603|  22.4k|    };
12604|  22.4k|    if constexpr (is_aggregator) {
12605|  22.4k|      out.buffer.assign(input.substr(0, host_end));
12606|  22.4k|      if (has_upper) {
  ------------------
  |  Branch (12606:11): [True: 175, False: 22.2k]
  ------------------
12607|    175|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12608|    175|      }
12609|  22.4k|      out.components.protocol_end = protocol_end;
12610|  22.4k|      out.components.username_end = protocol_end + 2;
12611|  22.4k|      out.components.host_start = protocol_end + 2;
12612|  22.4k|      out.components.host_end = static_cast<uint32_t>(host_end);
12613|  22.4k|      out.components.port = url_components::omitted;
12614|  22.4k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12615|  22.4k|      out.components.search_start = url_components::omitted;
12616|  22.4k|      out.components.hash_start = url_components::omitted;
12617|  22.4k|      out.parse_path(path_view);
12618|  22.4k|      apply_query_and_hash();
12619|       |    } else {
12620|       |      std::string host_str(input.substr(host_start, host_len));
12621|       |      if (has_upper) {
12622|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12623|       |      }
12624|       |      out.host = std::move(host_str);
12625|       |      out.parse_path(path_view);
12626|       |      apply_query_and_hash();
12627|       |    }
12628|  22.4k|    return true;
12629|  22.4k|  }
12630|       |
12631|   273k|  const bool need_slash = !has_path;
12632|   273k|  if constexpr (is_aggregator) {
12633|   273k|    if (!need_slash) {
  ------------------
  |  Branch (12633:9): [True: 244k, False: 29.0k]
  ------------------
12634|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12635|   244k|      out.buffer.assign(input);
12636|   244k|      if (has_upper) {
  ------------------
  |  Branch (12636:11): [True: 9.57k, False: 235k]
  ------------------
12637|  9.57k|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12638|  9.57k|      }
12639|   244k|      out.components.protocol_end = protocol_end;
12640|   244k|      out.components.username_end = protocol_end + 2;
12641|   244k|      out.components.host_start = protocol_end + 2;
12642|   244k|      out.components.host_end = static_cast<uint32_t>(host_end);
12643|   244k|      out.components.port = url_components::omitted;
12644|   244k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12645|   244k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12645:37): [True: 79.4k, False: 165k]
  ------------------
12646|   244k|                                        ? static_cast<uint32_t>(query_start)
12647|   244k|                                        : url_components::omitted;
12648|   244k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12648:35): [True: 50.8k, False: 193k]
  ------------------
12649|   244k|                                      ? static_cast<uint32_t>(hash_start)
12650|   244k|                                      : url_components::omitted;
12651|   244k|    } else {
12652|  29.0k|      out.buffer.clear();
12653|  29.0k|      out.buffer.reserve(len + 1);
12654|  29.0k|      out.buffer.append(input.substr(0, host_end));
12655|  29.0k|      out.buffer.push_back('/');
12656|  29.0k|      if (host_end < len) {
  ------------------
  |  Branch (12656:11): [True: 19.2k, False: 9.75k]
  ------------------
12657|  19.2k|        out.buffer.append(input.substr(host_end));
12658|  19.2k|      }
12659|  29.0k|      if (has_upper) {
  ------------------
  |  Branch (12659:11): [True: 101, False: 28.9k]
  ------------------
12660|    101|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12661|    101|      }
12662|  29.0k|      out.components.protocol_end = protocol_end;
12663|  29.0k|      out.components.username_end = protocol_end + 2;
12664|  29.0k|      out.components.host_start = protocol_end + 2;
12665|  29.0k|      out.components.host_end = static_cast<uint32_t>(host_end);
12666|  29.0k|      out.components.port = url_components::omitted;
12667|  29.0k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12668|  29.0k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12668:37): [True: 9.69k, False: 19.3k]
  ------------------
12669|  29.0k|                                        ? static_cast<uint32_t>(query_start + 1)
12670|  29.0k|                                        : url_components::omitted;
12671|  29.0k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12671:35): [True: 9.71k, False: 19.3k]
  ------------------
12672|  29.0k|                                      ? static_cast<uint32_t>(hash_start + 1)
12673|  29.0k|                                      : url_components::omitted;
12674|  29.0k|    }
12675|       |  } else {
12676|       |    std::string host_str(input.substr(host_start, host_len));
12677|       |    if (has_upper) {
12678|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12679|       |    }
12680|       |    out.host = std::move(host_str);
12681|       |    if (need_slash) {
12682|       |      out.path = "/";
12683|       |    } else {
12684|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12685|       |    }
12686|       |    if (query_start != std::string_view::npos) {
12687|       |      const size_t q_end =
12688|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12689|       |      out.query.emplace(input.data() + query_start + 1,
12690|       |                        q_end - query_start - 1);
12691|       |    }
12692|       |    if (hash_start != std::string_view::npos) {
12693|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12694|       |    }
12695|       |  }
12696|   273k|  return true;
12697|   296k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
12057|  62.6k|    bool has_upper) {
12058|  62.6k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12059|  62.6k|  constexpr bool is_aggregator =
12060|  62.6k|      std::is_same_v<result_type, ada::url_aggregator>;
12061|  62.6k|  static_assert(is_ada_url || is_aggregator);
12062|       |
12063|  62.6k|  const size_t len = input.size();
12064|  62.6k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12065|  62.6k|  size_t p = host_end + 1;
12066|  62.6k|  uint32_t port_value = 0;
12067|  62.6k|  bool any_digit = false;
12068|   269k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12068:10): [True: 269k, False: 68]
  |  Branch (12068:21): [True: 206k, False: 62.2k]
  |  Branch (12068:36): [True: 206k, False: 307]
  ------------------
12069|   206k|    any_digit = true;
12070|   206k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12071|   206k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12071:9): [True: 15, False: 206k]
  ------------------
12072|     15|      return false;
12073|     15|    }
12074|   206k|    ++p;
12075|   206k|  }
12076|  62.6k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12076:7): [True: 62.5k, False: 68]
  |  Branch (12076:18): [True: 433, False: 62.1k]
  |  Branch (12076:33): [True: 297, False: 136]
  |  Branch (12076:48): [True: 218, False: 79]
  ------------------
12077|    218|    return false;
12078|    218|  }
12079|  62.4k|  uint32_t parsed_port = url_components::omitted;
12080|  62.4k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12081|  62.4k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12081:7): [True: 62.0k, False: 416]
  |  Branch (12081:20): [True: 62.0k, False: 3]
  ------------------
12082|  62.0k|    parsed_port = port_value;
12083|  62.0k|  }
12084|  62.4k|  const size_t authority_end = p;
12085|       |
12086|  62.4k|  size_t i = authority_end;
12087|  62.4k|  size_t path_start = host_end;
12088|  62.4k|  size_t path_end = host_end;
12089|  62.4k|  size_t query_start = std::string_view::npos;
12090|  62.4k|  size_t hash_start = std::string_view::npos;
12091|  62.4k|  bool has_path = false;
12092|  62.4k|  bool maybe_dot_segment = false;
12093|  62.4k|  bool rest_simple = true;
12094|       |
12095|  62.4k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12095:7): [True: 62.3k, False: 68]
  |  Branch (12095:18): [True: 62.1k, False: 215]
  ------------------
12096|  62.1k|    has_path = true;
12097|  62.1k|    path_start = i;
12098|  62.1k|    ++i;
12099|  62.1k|    scan_path_run(b, i, len, maybe_dot_segment);
12100|  62.1k|    if (i < len) {
  ------------------
  |  Branch (12100:9): [True: 4.34k, False: 57.8k]
  ------------------
12101|  4.34k|      const uint8_t cls = k_path[b[i]];
12102|  4.34k|      if (cls == 1) {
  ------------------
  |  Branch (12102:11): [True: 2.39k, False: 1.94k]
  ------------------
12103|  2.39k|        path_end = i;
12104|  2.39k|        if (b[i] == '?') {
  ------------------
  |  Branch (12104:13): [True: 1.89k, False: 506]
  ------------------
12105|  1.89k|          query_start = i;
12106|  1.89k|          ++i;
12107|  1.89k|          goto scan_query;
12108|  1.89k|        }
12109|    506|        hash_start = i;
12110|    506|        ++i;
12111|    506|        goto scan_hash;
12112|  2.39k|      }
12113|  1.94k|      rest_simple = false;
12114|  84.1k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12114:14): [True: 83.4k, False: 705]
  ------------------
12115|  83.4k|        if (b[i] == '?') {
  ------------------
  |  Branch (12115:13): [True: 932, False: 82.5k]
  ------------------
12116|    932|          path_end = i;
12117|    932|          query_start = i;
12118|    932|          ++i;
12119|    932|          goto scan_query_boundary;
12120|    932|        }
12121|  82.5k|        if (b[i] == '#') {
  ------------------
  |  Branch (12121:13): [True: 306, False: 82.2k]
  ------------------
12122|    306|          path_end = i;
12123|    306|          hash_start = i;
12124|    306|          ++i;
12125|    306|          goto after_rest;
12126|    306|        }
12127|  82.5k|      }
12128|    705|      path_end = i;
12129|    705|      goto after_rest;
12130|  1.94k|    }
12131|  57.8k|    path_end = i;
12132|  57.8k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12132:14): [True: 215, False: 68]
  |  Branch (12132:25): [True: 136, False: 79]
  ------------------
12133|    136|    query_start = i;
12134|    136|    ++i;
12135|    136|    goto scan_query;
12136|    147|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12136:14): [True: 79, False: 68]
  |  Branch (12136:25): [True: 79, False: 0]
  ------------------
12137|     79|    hash_start = i;
12138|     79|    ++i;
12139|     79|    goto scan_hash;
12140|     79|  }
12141|  57.8k|  goto after_rest;
12142|       |
12143|  57.8k|scan_query:
12144|  2.02k|  scan_query_run(b, i, len);
12145|  2.02k|  if (i < len) {
  ------------------
  |  Branch (12145:7): [True: 1.40k, False: 624]
  ------------------
12146|  1.40k|    if (b[i] == '#') {
  ------------------
  |  Branch (12146:9): [True: 1.29k, False: 113]
  ------------------
12147|  1.29k|      hash_start = i;
12148|  1.29k|      ++i;
12149|  1.29k|      goto scan_hash;
12150|  1.29k|    }
12151|    113|    rest_simple = false;
12152|    113|    goto scan_query_boundary;
12153|  1.40k|  }
12154|    624|  goto after_rest;
12155|       |
12156|  1.04k|scan_query_boundary:
12157|  24.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12157:10): [True: 24.5k, False: 373]
  ------------------
12158|  24.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12158:9): [True: 672, False: 23.8k]
  ------------------
12159|    672|      hash_start = i;
12160|    672|      ++i;
12161|    672|      goto after_rest;
12162|    672|    }
12163|  24.5k|  }
12164|    373|  goto after_rest;
12165|       |
12166|  1.87k|scan_hash:
12167|  1.87k|  scan_hash_run(b, i, len);
12168|  1.87k|  if (i < len) {
  ------------------
  |  Branch (12168:7): [True: 94, False: 1.78k]
  ------------------
12169|     94|    rest_simple = false;
12170|     94|  }
12171|       |
12172|  62.4k|after_rest:
12173|  62.4k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12173:7): [True: 60.2k, False: 2.15k]
  |  Branch (12173:22): [True: 577, False: 59.7k]
  ------------------
12174|    577|    const std::string_view path_body(input.data() + path_start,
12175|    577|                                     path_end - path_start);
12176|    577|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12176:9): [True: 361, False: 216]
  ------------------
12177|    361|      rest_simple = false;
12178|    361|    }
12179|    577|  }
12180|       |
12181|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12182|       |  // trailing C0 control or space; this fast path does neither. A query or
12183|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12184|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12185|       |  // inputs back to the slow path.
12186|  62.4k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12186:7): [True: 2.51k, False: 59.9k]
  |  Branch (12186:24): [True: 27, False: 2.48k]
  ------------------
12187|  2.48k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12187:24): [True: 56, False: 2.42k]
  ------------------
12188|     83|    return false;
12189|     83|  }
12190|       |
12191|  62.3k|  out.type = scheme_type;
12192|  62.3k|  out.is_valid = true;
12193|  62.3k|  out.has_opaque_path = false;
12194|  62.3k|  out.host_type = DEFAULT;
12195|       |
12196|  62.3k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12196:31): [True: 61.9k, False: 394]
  ------------------
12197|  62.3k|                                  ? (1 + port_decimal_digit_count(parsed_port))
12198|  62.3k|                                  : 0;
12199|       |
12200|  62.3k|  if (!rest_simple) {
  ------------------
  |  Branch (12200:7): [True: 2.42k, False: 59.9k]
  ------------------
12201|  2.42k|    const std::string_view path_view =
12202|  2.42k|        has_path
  ------------------
  |  Branch (12202:9): [True: 2.32k, False: 103]
  ------------------
12203|  2.42k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12204|  2.42k|            : std::string_view{};
12205|  2.42k|    auto apply_query_and_hash = [&]() {
12206|  2.42k|      if (query_start != std::string_view::npos) {
12207|  2.42k|        const size_t q_end =
12208|  2.42k|            (hash_start != std::string_view::npos) ? hash_start : len;
12209|  2.42k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|  2.42k|                                                q_end - query_start - 1),
12211|  2.42k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|  2.42k|      }
12213|  2.42k|      if (hash_start != std::string_view::npos) {
12214|  2.42k|        out.update_unencoded_base_hash(std::string_view(
12215|  2.42k|            input.data() + hash_start + 1, len - hash_start - 1));
12216|  2.42k|      }
12217|  2.42k|    };
12218|       |    if constexpr (is_aggregator) {
12219|       |      out.buffer.assign(input.substr(0, host_end));
12220|       |      if (parsed_port != url_components::omitted) {
12221|       |        append_canonical_port(out.buffer, parsed_port);
12222|       |      }
12223|       |      if (has_upper) {
12224|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12225|       |      }
12226|       |      out.components.protocol_end = protocol_end;
12227|       |      out.components.username_end = protocol_end + 2;
12228|       |      out.components.host_start = protocol_end + 2;
12229|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12230|       |      out.components.port = parsed_port;
12231|       |      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12232|       |      out.components.search_start = url_components::omitted;
12233|       |      out.components.hash_start = url_components::omitted;
12234|       |      out.parse_path(path_view);
12235|       |      apply_query_and_hash();
12236|  2.42k|    } else {
12237|  2.42k|      std::string host_str(input.substr(host_start, host_len));
12238|  2.42k|      if (has_upper) {
  ------------------
  |  Branch (12238:11): [True: 174, False: 2.25k]
  ------------------
12239|    174|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12240|    174|      }
12241|  2.42k|      out.host = std::move(host_str);
12242|  2.42k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12242:11): [True: 2.12k, False: 302]
  ------------------
12243|  2.12k|        out.port = static_cast<uint16_t>(parsed_port);
12244|  2.12k|      }
12245|  2.42k|      out.parse_path(path_view);
12246|  2.42k|      apply_query_and_hash();
12247|  2.42k|    }
12248|  2.42k|    return true;
12249|  2.42k|  }
12250|       |
12251|  59.9k|  const bool insert_slash = !has_path;
12252|       |  if constexpr (is_aggregator) {
12253|       |    const size_t out_len =
12254|       |        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
12255|       |    const bool omit_port_bytes = parsed_port == url_components::omitted;
12256|       |    if (out_len == len && !insert_slash && !omit_port_bytes) {
12257|       |      out.buffer.assign(input);
12258|       |    } else {
12259|       |      out.buffer.clear();
12260|       |      out.buffer.reserve(out_len);
12261|       |      out.buffer.append(input.substr(0, host_end));
12262|       |      if (parsed_port != url_components::omitted) {
12263|       |        append_canonical_port(out.buffer, parsed_port);
12264|       |      }
12265|       |      if (insert_slash) {
12266|       |        out.buffer.push_back('/');
12267|       |      }
12268|       |      if (authority_end < len) {
12269|       |        out.buffer.append(input.substr(authority_end));
12270|       |      }
12271|       |    }
12272|       |    if (has_upper) {
12273|       |      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12274|       |    }
12275|       |    const uint32_t pathname_start =
12276|       |        static_cast<uint32_t>(host_end) + port_bytes;
12277|       |    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12278|       |                               (insert_slash ? 1 : 0) -
12279|       |                               static_cast<int32_t>(authority_end);
12280|       |    out.components.protocol_end = protocol_end;
12281|       |    out.components.username_end = protocol_end + 2;
12282|       |    out.components.host_start = protocol_end + 2;
12283|       |    out.components.host_end = static_cast<uint32_t>(host_end);
12284|       |    out.components.port = parsed_port;
12285|       |    out.components.pathname_start = pathname_start;
12286|       |    out.components.search_start =
12287|       |        (query_start != std::string_view::npos)
12288|       |            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12289|       |                                    tail_delta)
12290|       |            : url_components::omitted;
12291|       |    out.components.hash_start =
12292|       |        (hash_start != std::string_view::npos)
12293|       |            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12294|       |                                    tail_delta)
12295|       |            : url_components::omitted;
12296|  59.9k|  } else {
12297|  59.9k|    std::string host_str(input.substr(host_start, host_len));
12298|  59.9k|    if (has_upper) {
  ------------------
  |  Branch (12298:9): [True: 54, False: 59.8k]
  ------------------
12299|     54|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12300|     54|    }
12301|  59.9k|    out.host = std::move(host_str);
12302|  59.9k|    if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12302:9): [True: 59.8k, False: 92]
  ------------------
12303|  59.8k|      out.port = static_cast<uint16_t>(parsed_port);
12304|  59.8k|    }
12305|  59.9k|    if (insert_slash) {
  ------------------
  |  Branch (12305:9): [True: 166, False: 59.7k]
  ------------------
12306|    166|      out.path = "/";
12307|  59.7k|    } else {
12308|  59.7k|      out.path.assign(input.data() + path_start, path_end - path_start);
12309|  59.7k|    }
12310|  59.9k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12310:9): [True: 1.72k, False: 58.1k]
  ------------------
12311|  1.72k|      const size_t q_end =
12312|  1.72k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12312:11): [True: 1.16k, False: 556]
  ------------------
12313|  1.72k|      out.query.emplace(input.data() + query_start + 1,
12314|  1.72k|                        q_end - query_start - 1);
12315|  1.72k|    }
12316|  59.9k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12316:9): [True: 1.63k, False: 58.2k]
  ------------------
12317|  1.63k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12318|  1.63k|    }
12319|  59.9k|  }
12320|  59.9k|  return true;
12321|  62.3k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
12057|  62.6k|    bool has_upper) {
12058|  62.6k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12059|  62.6k|  constexpr bool is_aggregator =
12060|  62.6k|      std::is_same_v<result_type, ada::url_aggregator>;
12061|  62.6k|  static_assert(is_ada_url || is_aggregator);
12062|       |
12063|  62.6k|  const size_t len = input.size();
12064|  62.6k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12065|  62.6k|  size_t p = host_end + 1;
12066|  62.6k|  uint32_t port_value = 0;
12067|  62.6k|  bool any_digit = false;
12068|   269k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12068:10): [True: 269k, False: 68]
  |  Branch (12068:21): [True: 206k, False: 62.2k]
  |  Branch (12068:36): [True: 206k, False: 307]
  ------------------
12069|   206k|    any_digit = true;
12070|   206k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12071|   206k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12071:9): [True: 15, False: 206k]
  ------------------
12072|     15|      return false;
12073|     15|    }
12074|   206k|    ++p;
12075|   206k|  }
12076|  62.6k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12076:7): [True: 62.5k, False: 68]
  |  Branch (12076:18): [True: 433, False: 62.1k]
  |  Branch (12076:33): [True: 297, False: 136]
  |  Branch (12076:48): [True: 218, False: 79]
  ------------------
12077|    218|    return false;
12078|    218|  }
12079|  62.4k|  uint32_t parsed_port = url_components::omitted;
12080|  62.4k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12081|  62.4k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12081:7): [True: 62.0k, False: 416]
  |  Branch (12081:20): [True: 62.0k, False: 3]
  ------------------
12082|  62.0k|    parsed_port = port_value;
12083|  62.0k|  }
12084|  62.4k|  const size_t authority_end = p;
12085|       |
12086|  62.4k|  size_t i = authority_end;
12087|  62.4k|  size_t path_start = host_end;
12088|  62.4k|  size_t path_end = host_end;
12089|  62.4k|  size_t query_start = std::string_view::npos;
12090|  62.4k|  size_t hash_start = std::string_view::npos;
12091|  62.4k|  bool has_path = false;
12092|  62.4k|  bool maybe_dot_segment = false;
12093|  62.4k|  bool rest_simple = true;
12094|       |
12095|  62.4k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12095:7): [True: 62.3k, False: 68]
  |  Branch (12095:18): [True: 62.1k, False: 215]
  ------------------
12096|  62.1k|    has_path = true;
12097|  62.1k|    path_start = i;
12098|  62.1k|    ++i;
12099|  62.1k|    scan_path_run(b, i, len, maybe_dot_segment);
12100|  62.1k|    if (i < len) {
  ------------------
  |  Branch (12100:9): [True: 4.34k, False: 57.8k]
  ------------------
12101|  4.34k|      const uint8_t cls = k_path[b[i]];
12102|  4.34k|      if (cls == 1) {
  ------------------
  |  Branch (12102:11): [True: 2.39k, False: 1.94k]
  ------------------
12103|  2.39k|        path_end = i;
12104|  2.39k|        if (b[i] == '?') {
  ------------------
  |  Branch (12104:13): [True: 1.89k, False: 506]
  ------------------
12105|  1.89k|          query_start = i;
12106|  1.89k|          ++i;
12107|  1.89k|          goto scan_query;
12108|  1.89k|        }
12109|    506|        hash_start = i;
12110|    506|        ++i;
12111|    506|        goto scan_hash;
12112|  2.39k|      }
12113|  1.94k|      rest_simple = false;
12114|  84.1k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12114:14): [True: 83.4k, False: 705]
  ------------------
12115|  83.4k|        if (b[i] == '?') {
  ------------------
  |  Branch (12115:13): [True: 932, False: 82.5k]
  ------------------
12116|    932|          path_end = i;
12117|    932|          query_start = i;
12118|    932|          ++i;
12119|    932|          goto scan_query_boundary;
12120|    932|        }
12121|  82.5k|        if (b[i] == '#') {
  ------------------
  |  Branch (12121:13): [True: 306, False: 82.2k]
  ------------------
12122|    306|          path_end = i;
12123|    306|          hash_start = i;
12124|    306|          ++i;
12125|    306|          goto after_rest;
12126|    306|        }
12127|  82.5k|      }
12128|    705|      path_end = i;
12129|    705|      goto after_rest;
12130|  1.94k|    }
12131|  57.8k|    path_end = i;
12132|  57.8k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12132:14): [True: 215, False: 68]
  |  Branch (12132:25): [True: 136, False: 79]
  ------------------
12133|    136|    query_start = i;
12134|    136|    ++i;
12135|    136|    goto scan_query;
12136|    147|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12136:14): [True: 79, False: 68]
  |  Branch (12136:25): [True: 79, False: 0]
  ------------------
12137|     79|    hash_start = i;
12138|     79|    ++i;
12139|     79|    goto scan_hash;
12140|     79|  }
12141|  57.8k|  goto after_rest;
12142|       |
12143|  57.8k|scan_query:
12144|  2.02k|  scan_query_run(b, i, len);
12145|  2.02k|  if (i < len) {
  ------------------
  |  Branch (12145:7): [True: 1.40k, False: 624]
  ------------------
12146|  1.40k|    if (b[i] == '#') {
  ------------------
  |  Branch (12146:9): [True: 1.29k, False: 113]
  ------------------
12147|  1.29k|      hash_start = i;
12148|  1.29k|      ++i;
12149|  1.29k|      goto scan_hash;
12150|  1.29k|    }
12151|    113|    rest_simple = false;
12152|    113|    goto scan_query_boundary;
12153|  1.40k|  }
12154|    624|  goto after_rest;
12155|       |
12156|  1.04k|scan_query_boundary:
12157|  24.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12157:10): [True: 24.5k, False: 373]
  ------------------
12158|  24.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12158:9): [True: 672, False: 23.8k]
  ------------------
12159|    672|      hash_start = i;
12160|    672|      ++i;
12161|    672|      goto after_rest;
12162|    672|    }
12163|  24.5k|  }
12164|    373|  goto after_rest;
12165|       |
12166|  1.87k|scan_hash:
12167|  1.87k|  scan_hash_run(b, i, len);
12168|  1.87k|  if (i < len) {
  ------------------
  |  Branch (12168:7): [True: 94, False: 1.78k]
  ------------------
12169|     94|    rest_simple = false;
12170|     94|  }
12171|       |
12172|  62.4k|after_rest:
12173|  62.4k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12173:7): [True: 60.2k, False: 2.15k]
  |  Branch (12173:22): [True: 577, False: 59.7k]
  ------------------
12174|    577|    const std::string_view path_body(input.data() + path_start,
12175|    577|                                     path_end - path_start);
12176|    577|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12176:9): [True: 361, False: 216]
  ------------------
12177|    361|      rest_simple = false;
12178|    361|    }
12179|    577|  }
12180|       |
12181|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12182|       |  // trailing C0 control or space; this fast path does neither. A query or
12183|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12184|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12185|       |  // inputs back to the slow path.
12186|  62.4k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12186:7): [True: 2.51k, False: 59.9k]
  |  Branch (12186:24): [True: 27, False: 2.48k]
  ------------------
12187|  2.48k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12187:24): [True: 56, False: 2.42k]
  ------------------
12188|     83|    return false;
12189|     83|  }
12190|       |
12191|  62.3k|  out.type = scheme_type;
12192|  62.3k|  out.is_valid = true;
12193|  62.3k|  out.has_opaque_path = false;
12194|  62.3k|  out.host_type = DEFAULT;
12195|       |
12196|  62.3k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12196:31): [True: 61.9k, False: 394]
  ------------------
12197|  62.3k|                                  ? (1 + port_decimal_digit_count(parsed_port))
12198|  62.3k|                                  : 0;
12199|       |
12200|  62.3k|  if (!rest_simple) {
  ------------------
  |  Branch (12200:7): [True: 2.42k, False: 59.9k]
  ------------------
12201|  2.42k|    const std::string_view path_view =
12202|  2.42k|        has_path
  ------------------
  |  Branch (12202:9): [True: 2.32k, False: 103]
  ------------------
12203|  2.42k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12204|  2.42k|            : std::string_view{};
12205|  2.42k|    auto apply_query_and_hash = [&]() {
12206|  2.42k|      if (query_start != std::string_view::npos) {
12207|  2.42k|        const size_t q_end =
12208|  2.42k|            (hash_start != std::string_view::npos) ? hash_start : len;
12209|  2.42k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|  2.42k|                                                q_end - query_start - 1),
12211|  2.42k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|  2.42k|      }
12213|  2.42k|      if (hash_start != std::string_view::npos) {
12214|  2.42k|        out.update_unencoded_base_hash(std::string_view(
12215|  2.42k|            input.data() + hash_start + 1, len - hash_start - 1));
12216|  2.42k|      }
12217|  2.42k|    };
12218|  2.42k|    if constexpr (is_aggregator) {
12219|  2.42k|      out.buffer.assign(input.substr(0, host_end));
12220|  2.42k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12220:11): [True: 2.12k, False: 302]
  ------------------
12221|  2.12k|        append_canonical_port(out.buffer, parsed_port);
12222|  2.12k|      }
12223|  2.42k|      if (has_upper) {
  ------------------
  |  Branch (12223:11): [True: 174, False: 2.25k]
  ------------------
12224|    174|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12225|    174|      }
12226|  2.42k|      out.components.protocol_end = protocol_end;
12227|  2.42k|      out.components.username_end = protocol_end + 2;
12228|  2.42k|      out.components.host_start = protocol_end + 2;
12229|  2.42k|      out.components.host_end = static_cast<uint32_t>(host_end);
12230|  2.42k|      out.components.port = parsed_port;
12231|  2.42k|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12232|  2.42k|      out.components.search_start = url_components::omitted;
12233|  2.42k|      out.components.hash_start = url_components::omitted;
12234|  2.42k|      out.parse_path(path_view);
12235|  2.42k|      apply_query_and_hash();
12236|       |    } else {
12237|       |      std::string host_str(input.substr(host_start, host_len));
12238|       |      if (has_upper) {
12239|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12240|       |      }
12241|       |      out.host = std::move(host_str);
12242|       |      if (parsed_port != url_components::omitted) {
12243|       |        out.port = static_cast<uint16_t>(parsed_port);
12244|       |      }
12245|       |      out.parse_path(path_view);
12246|       |      apply_query_and_hash();
12247|       |    }
12248|  2.42k|    return true;
12249|  2.42k|  }
12250|       |
12251|  59.9k|  const bool insert_slash = !has_path;
12252|  59.9k|  if constexpr (is_aggregator) {
12253|  59.9k|    const size_t out_len =
12254|  59.9k|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (12254:34): [True: 166, False: 59.7k]
  ------------------
12255|  59.9k|    const bool omit_port_bytes = parsed_port == url_components::omitted;
12256|  59.9k|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (12256:9): [True: 50.2k, False: 9.71k]
  |  Branch (12256:27): [True: 50.1k, False: 39]
  |  Branch (12256:44): [True: 50.1k, False: 0]
  ------------------
12257|  50.1k|      out.buffer.assign(input);
12258|  50.1k|    } else {
12259|  9.75k|      out.buffer.clear();
12260|  9.75k|      out.buffer.reserve(out_len);
12261|  9.75k|      out.buffer.append(input.substr(0, host_end));
12262|  9.75k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12262:11): [True: 9.66k, False: 92]
  ------------------
12263|  9.66k|        append_canonical_port(out.buffer, parsed_port);
12264|  9.66k|      }
12265|  9.75k|      if (insert_slash) {
  ------------------
  |  Branch (12265:11): [True: 166, False: 9.58k]
  ------------------
12266|    166|        out.buffer.push_back('/');
12267|    166|      }
12268|  9.75k|      if (authority_end < len) {
  ------------------
  |  Branch (12268:11): [True: 9.68k, False: 68]
  ------------------
12269|  9.68k|        out.buffer.append(input.substr(authority_end));
12270|  9.68k|      }
12271|  9.75k|    }
12272|  59.9k|    if (has_upper) {
  ------------------
  |  Branch (12272:9): [True: 54, False: 59.8k]
  ------------------
12273|     54|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12274|     54|    }
12275|  59.9k|    const uint32_t pathname_start =
12276|  59.9k|        static_cast<uint32_t>(host_end) + port_bytes;
12277|  59.9k|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12278|  59.9k|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (12278:33): [True: 166, False: 59.7k]
  ------------------
12279|  59.9k|                               static_cast<int32_t>(authority_end);
12280|  59.9k|    out.components.protocol_end = protocol_end;
12281|  59.9k|    out.components.username_end = protocol_end + 2;
12282|  59.9k|    out.components.host_start = protocol_end + 2;
12283|  59.9k|    out.components.host_end = static_cast<uint32_t>(host_end);
12284|  59.9k|    out.components.port = parsed_port;
12285|  59.9k|    out.components.pathname_start = pathname_start;
12286|  59.9k|    out.components.search_start =
12287|  59.9k|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (12287:9): [True: 1.72k, False: 58.1k]
  ------------------
12288|  59.9k|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12289|  1.72k|                                    tail_delta)
12290|  59.9k|            : url_components::omitted;
12291|  59.9k|    out.components.hash_start =
12292|  59.9k|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12292:9): [True: 1.63k, False: 58.2k]
  ------------------
12293|  59.9k|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12294|  1.63k|                                    tail_delta)
12295|  59.9k|            : url_components::omitted;
12296|       |  } else {
12297|       |    std::string host_str(input.substr(host_start, host_len));
12298|       |    if (has_upper) {
12299|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12300|       |    }
12301|       |    out.host = std::move(host_str);
12302|       |    if (parsed_port != url_components::omitted) {
12303|       |      out.port = static_cast<uint16_t>(parsed_port);
12304|       |    }
12305|       |    if (insert_slash) {
12306|       |      out.path = "/";
12307|       |    } else {
12308|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12309|       |    }
12310|       |    if (query_start != std::string_view::npos) {
12311|       |      const size_t q_end =
12312|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12313|       |      out.query.emplace(input.data() + query_start + 1,
12314|       |                        q_end - query_start - 1);
12315|       |    }
12316|       |    if (hash_start != std::string_view::npos) {
12317|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12318|       |    }
12319|       |  }
12320|  59.9k|  return true;
12321|  62.3k|}
_ZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12886|   628k|                           const result_type* base_url) {
12887|       |  // We can specialize the implementation per type.
12888|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12889|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12890|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12891|       |  // and ada::url **do not have to support the exact same API**.
12892|   628k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12893|   628k|  constexpr bool result_type_is_ada_url_aggregator =
12894|   628k|      std::is_same_v<url_aggregator, result_type>;
12895|   628k|  static_assert(result_type_is_ada_url ||
12896|   628k|                result_type_is_ada_url_aggregator);  // We don't support
12897|       |                                                     // anything else for now.
12898|       |
12899|   628k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12900|   628k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12901|   628k|          ")");
12902|       |
12903|   628k|  result_type url{};
12904|       |
12905|   628k|  const uint32_t max_input_length = ada::get_max_input_length();
12906|       |
12907|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12908|       |  // max_input_length even when the input fit under it. The check at the end of
12909|       |  // the state machine covers URLs that run to completion, but several states
12910|       |  // return early after appending a query or fragment, so run the same check on
12911|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12912|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12913|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12914|   628k|  const auto enforce_max_input_length = [&]() {
12915|   628k|    if constexpr (store_values) {
12916|   628k|      if (url.is_valid) {
12917|   628k|        if constexpr (result_type_is_ada_url_aggregator) {
12918|   628k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12919|   628k|            url.is_valid = false;
12920|   628k|          }
12921|   628k|        } else {
12922|   628k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12923|   628k|            url.is_valid = false;
12924|   628k|          }
12925|   628k|        }
12926|   628k|      }
12927|   628k|    }
12928|   628k|  };
12929|       |
12930|       |  // We refuse to parse URL strings that exceed the maximum input length.
12931|       |  // By default, this is 4GB but can be configured via
12932|       |  // ada::set_max_input_length().
12933|   628k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12933:7): [True: 0, False: 628k]
  ------------------
12934|      0|    url.is_valid = false;
12935|      0|  }
12936|       |  // Going forward, user_input.size() is in [0,
12937|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12938|       |  // base, or the optional_url was invalid, we must return.
12939|   628k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12939:7): [True: 0, False: 628k]
  ------------------
12940|      0|    url.is_valid &= base_url->is_valid;
12941|      0|  }
12942|   628k|  if (!url.is_valid) {
  ------------------
  |  Branch (12942:7): [True: 0, False: 628k]
  ------------------
12943|      0|    return url;
12944|      0|  }
12945|       |
12946|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12947|   628k|  if constexpr (store_values) {
12948|   628k|    bool hit_fast_path = false;
12949|   628k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12949:9): [True: 628k, False: 0]
  ------------------
12950|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12951|       |      // call so those URLs (including SetHref) do not pay for a miss.
12952|   628k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12953|   628k|      const size_t n = user_input.size();
12954|   628k|      size_t host_start = 0;
12955|   628k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12955:11): [True: 628k, False: 232]
  |  Branch (12955:21): [True: 240k, False: 388k]
  |  Branch (12955:36): [True: 239k, False: 929]
  |  Branch (12955:51): [True: 239k, False: 166]
  ------------------
12956|   239k|        host_start = 7;
12957|   389k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12957:18): [True: 389k, False: 255]
  |  Branch (12957:28): [True: 386k, False: 2.76k]
  |  Branch (12957:43): [True: 385k, False: 731]
  |  Branch (12957:58): [True: 385k, False: 94]
  ------------------
12958|   385k|        host_start = 8;
12959|   385k|      }
12960|   628k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12960:34): [True: 625k, False: 3.84k]
  ------------------
12961|   628k|      const bool skip_ip =
12962|   628k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12962:11): [True: 542, False: 628k]
  |  Branch (12962:33): [True: 621k, False: 6.77k]
  |  Branch (12962:54): [True: 140k, False: 481k]
  ------------------
12963|       |      // Only scan for userinfo when the host is not an IP literal, so
12964|       |      // IPv4/IPv6 inputs skip the SIMD '@' check entirely.
12965|   628k|      hit_fast_path =
12966|   628k|          !skip_ip &&
  ------------------
  |  Branch (12966:11): [True: 488k, False: 140k]
  ------------------
12967|   488k|          !(host_start != 0 && authority_has_at(p, host_start, n)) &&
  ------------------
  |  Branch (12967:13): [True: 484k, False: 3.84k]
  |  Branch (12967:32): [True: 30.2k, False: 454k]
  ------------------
12968|   457k|          try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12968:11): [True: 358k, False: 99.3k]
  ------------------
12969|   628k|    } else {
12970|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12971|      0|    }
12972|   628k|    if (hit_fast_path) {
  ------------------
  |  Branch (12972:9): [True: 358k, False: 270k]
  ------------------
12973|       |      if constexpr (result_type_is_ada_url_aggregator) {
12974|       |        if (url.buffer.size() > max_input_length) [[unlikely]] {
12975|       |          url.is_valid = false;
12976|       |        }
12977|   358k|      } else {
12978|       |        // For a small absolute input, even worst-case normalization cannot
12979|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12980|       |        // most 4.5x. Avoid traversing every stored component on the common
12981|       |        // default-limit path.
12982|   358k|        if ((base_url != nullptr ||
  ------------------
  |  Branch (12982:14): [True: 0, False: 358k]
  ------------------
12983|   358k|             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
  ------------------
  |  Branch (12983:14): [True: 0, False: 358k]
  ------------------
12984|      0|            url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12984:13): [True: 0, False: 0]
  ------------------
12985|      0|          url.is_valid = false;
12986|      0|        }
12987|   358k|      }
12988|   358k|      return url;
12989|   358k|    }
12990|   628k|  }
12991|       |
12992|   270k|  state state = state::SCHEME_START;
12993|       |
12994|   628k|  std::string tmp_buffer;
12995|   628k|  std::string_view url_data;
12996|   628k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12996:7): [True: 481, False: 628k]
  ------------------
12997|    481|    tmp_buffer = user_input;
12998|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12999|       |    // just directly build the string from user_input.
13000|    481|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
13001|    481|    url_data = tmp_buffer;
13002|   628k|  } else [[likely]] {
13003|   628k|    url_data = user_input;
13004|   628k|  }
13005|       |
13006|       |  // Leading and trailing control characters are uncommon and easy to deal with
13007|       |  // (no performance concern).
13008|   628k|  helpers::trim_c0_whitespace(url_data);
13009|       |
13010|       |  if constexpr (result_type_is_ada_url_aggregator && store_values) {
13011|       |    // Most of the time, we just need user_input.size().
13012|       |    // In some instances, we may need a bit more.
13013|       |    ///////////////////////////
13014|       |    // This is *very* important. This line should *not* be removed
13015|       |    // hastily. There are principled reasons why reserve is important
13016|       |    // for performance. If you have a benchmark with small inputs,
13017|       |    // it may not matter, but in other instances, it could.
13018|       |    ////
13019|       |    // This rounds up to the next power of two.
13020|       |    // We know that user_input.size() is in [0,
13021|       |    // std::numeric_limits<uint32_t>::max).
13022|       |    uint32_t reserve_capacity =
13023|       |        (0xFFFFFFFF >>
13024|       |         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
13025|       |        1;
13026|       |    url.reserve(reserve_capacity);
13027|       |  }
13028|       |
13029|       |  // Optimization opportunity. Most websites do not have fragment.
13030|   628k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
13031|       |  // We add it last so that an implementation like ada::url_aggregator
13032|       |  // can append it last to its internal buffer, thus improving performance.
13033|       |
13034|       |  // Here url_data no longer has its fragment.
13035|       |  // We are going to access the data from url_data (it is immutable).
13036|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
13037|       |  // The input_position variable should range from 0 to input_size.
13038|       |  // It is illegal to access url_data at input_size.
13039|   628k|  size_t input_position = 0;
13040|   628k|  const size_t input_size = url_data.size();
13041|       |  // Keep running the following state machine by switching on state.
13042|       |  // If after a run pointer points to the EOF code point, go to the next step.
13043|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
13044|       |  // We never decrement input_position.
13045|  2.38M|  while (input_position <= input_size) {
  ------------------
  |  Branch (13045:10): [True: 1.82M, False: 566k]
  ------------------
13046|  1.82M|    ada_log("In parsing at ", input_position, " out of ", input_size,
13047|  1.82M|            " in state ", ada::to_string(state));
13048|  1.82M|    switch (state) {
13049|   270k|      case state::SCHEME_START: {
  ------------------
  |  Branch (13049:7): [True: 270k, False: 1.55M]
  ------------------
13050|   270k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
13051|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
13052|       |        // state to scheme state.
13053|   270k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13053:13): [True: 270k, False: 1]
  ------------------
13054|   270k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (13054:13): [True: 270k, False: 149]
  ------------------
13055|   270k|          state = state::SCHEME;
13056|   270k|          input_position++;
13057|   270k|        } else {
13058|       |          // Otherwise, if state override is not given, set state to no scheme
13059|       |          // state and decrease pointer by 1.
13060|    150|          state = state::NO_SCHEME;
13061|    150|        }
13062|   270k|        break;
13063|      0|      }
13064|   270k|      case state::SCHEME: {
  ------------------
  |  Branch (13064:7): [True: 270k, False: 1.55M]
  ------------------
13065|   270k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
13066|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
13067|       |        // append c, lowercased, to buffer.
13068|  1.17M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13068:16): [True: 1.17M, False: 2]
  ------------------
13069|  1.17M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13069:16): [True: 903k, False: 270k]
  ------------------
13070|   903k|          input_position++;
13071|   903k|        }
13072|       |        // Otherwise, if c is U+003A (:), then:
13073|   270k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:13): [True: 270k, False: 2]
  ------------------
13074|   270k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13074:13): [True: 270k, False: 74]
  ------------------
13075|   270k|          ada_log("SCHEME the scheme should be ",
13076|   270k|                  url_data.substr(0, input_position));
13077|   270k|          if constexpr (result_type_is_ada_url) {
13078|   270k|            if (!url.parse_scheme(url_data.substr(0, input_position))) {
  ------------------
  |  Branch (13078:17): [True: 0, False: 270k]
  ------------------
13079|      0|              return url;
13080|      0|            }
13081|       |          } else {
13082|       |            // we pass the colon along instead of painfully adding it back.
13083|       |            if (!url.parse_scheme_with_colon(
13084|       |                    url_data.substr(0, input_position + 1))) {
13085|       |              return url;
13086|       |            }
13087|       |          }
13088|   270k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13089|       |
13090|       |          // If url's scheme is "file", then:
13091|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13092|   270k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13092:15): [True: 1.39k, False: 268k]
  ------------------
13093|       |            // Set state to file state.
13094|  1.39k|            state = state::FILE;
13095|  1.39k|          }
13096|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13097|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13098|       |          // != nullptr is false.
13099|   268k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13099:20): [True: 266k, False: 1.86k]
  |  Branch (13099:40): [True: 0, False: 266k]
  ------------------
13100|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13100:20): [True: 0, False: 0]
  ------------------
13101|       |            // Set state to special relative or authority state.
13102|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13103|      0|          }
13104|       |          // Otherwise, if url is special, set state to special authority
13105|       |          // slashes state.
13106|   268k|          else if (url.is_special()) {
  ------------------
  |  Branch (13106:20): [True: 266k, False: 1.86k]
  ------------------
13107|   266k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13108|   266k|          }
13109|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13110|       |          // path or authority state and increase pointer by 1.
13111|  1.86k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13111:20): [True: 1.72k, False: 141]
  ------------------
13112|  1.72k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13112:20): [True: 1.09k, False: 633]
  ------------------
13113|  1.09k|            state = state::PATH_OR_AUTHORITY;
13114|  1.09k|            input_position++;
13115|  1.09k|          }
13116|       |          // Otherwise, set url's path to the empty string and set state to
13117|       |          // opaque path state.
13118|    774|          else {
13119|    774|            state = state::OPAQUE_PATH;
13120|    774|          }
13121|   270k|        }
13122|       |        // Otherwise, if state override is not given, set buffer to the empty
13123|       |        // string, state to no scheme state, and start over (from the first code
13124|       |        // point in input).
13125|     76|        else {
13126|     76|          state = state::NO_SCHEME;
13127|     76|          input_position = 0;
13128|     76|          break;
13129|     76|        }
13130|   270k|        input_position++;
13131|   270k|        break;
13132|   270k|      }
13133|    226|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13133:7): [True: 226, False: 1.82M]
  ------------------
13134|    226|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13135|       |        // The fragment was pruned from url_data before the state machine ran,
13136|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13137|       |        // nothing else remains in front of it.
13138|    226|        const bool c_is_hash =
13139|    226|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13139:13): [True: 147, False: 79]
  |  Branch (13139:37): [True: 1, False: 146]
  ------------------
13140|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13141|       |        // validation error, return failure.
13142|    226|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13142:13): [True: 226, False: 0]
  |  Branch (13142:37): [True: 0, False: 0]
  |  Branch (13142:66): [True: 0, False: 0]
  ------------------
13143|    226|          ada_log("NO_SCHEME validation error");
13144|    226|          url.is_valid = false;
13145|    226|          return url;
13146|    226|        }
13147|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13148|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13149|       |        // query to base's query, and set state to fragment state.
13150|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13150:18): [True: 0, False: 0]
  |  Branch (13150:47): [True: 0, False: 0]
  ------------------
13151|      0|          ada_log("NO_SCHEME opaque base with fragment");
13152|      0|          url.copy_scheme(*base_url);
13153|      0|          url.has_opaque_path = base_url->has_opaque_path;
13154|       |
13155|      0|          if constexpr (result_type_is_ada_url) {
13156|      0|            url.path = base_url->path;
13157|      0|            url.query = base_url->query;
13158|       |          } else {
13159|       |            url.update_base_pathname(base_url->get_pathname());
13160|       |            if (base_url->has_search()) {
13161|       |              // get_search() returns "" for an empty query string (URL ends
13162|       |              // with '?'). update_base_search("") would incorrectly clear the
13163|       |              // query, so pass "?" to preserve the empty query distinction.
13164|       |              auto s = base_url->get_search();
13165|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13166|       |            }
13167|       |          }
13168|      0|          url.update_unencoded_base_hash(*fragment);
13169|      0|          enforce_max_input_length();
13170|      0|          return url;
13171|      0|        }
13172|       |        // Otherwise, if base's scheme is not "file", set state to relative
13173|       |        // state and decrease pointer by 1.
13174|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13175|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13175:18): [True: 0, False: 0]
  ------------------
13176|      0|          ada_log("NO_SCHEME non-file relative path");
13177|      0|          state = state::RELATIVE_SCHEME;
13178|      0|        }
13179|       |        // Otherwise, set state to file state and decrease pointer by 1.
13180|      0|        else {
13181|      0|          ada_log("NO_SCHEME file base type");
13182|      0|          state = state::FILE;
13183|      0|        }
13184|      0|        break;
13185|    226|      }
13186|   267k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13186:7): [True: 267k, False: 1.55M]
  ------------------
13187|   267k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13188|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13189|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13190|       |        // worry about AUTHORITY.
13191|       |        // TODO: Instead of just collecting a bool, collect the location of the
13192|       |        // '@' and do something useful with it.
13193|       |        // TODO: We could do various processing early on, using a single pass
13194|       |        // over the string to collect information about it, e.g., telling us
13195|       |        // whether there is a @ and if so, where (or how many).
13196|       |
13197|       |        // Check if url data contains an @.
13198|   267k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13198:13): [True: 226k, False: 41.2k]
  ------------------
13199|   226k|          state = state::HOST;
13200|   226k|          break;
13201|   226k|        }
13202|  41.2k|        bool at_sign_seen{false};
13203|  41.2k|        bool password_token_seen{false};
13204|       |        /**
13205|       |         * We expect something of the sort...
13206|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13207|       |         * --------^
13208|       |         */
13209|  95.1k|        do {
13210|  95.1k|          std::string_view view = url_data.substr(input_position);
13211|       |          // The delimiters are @, /, ? \\.
13212|  95.1k|          size_t location =
13213|  95.1k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13213:15): [True: 95.0k, False: 131]
  ------------------
13214|  95.1k|                               : helpers::find_authority_delimiter(view);
13215|  95.1k|          std::string_view authority_view = view.substr(0, location);
13216|  95.1k|          size_t end_of_authority = input_position + authority_view.size();
13217|       |          // If c is U+0040 (@), then:
13218|  95.1k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13218:15): [True: 85.1k, False: 10.0k]
  ------------------
13219|  85.1k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13219:15): [True: 53.9k, False: 31.2k]
  ------------------
13220|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13221|  53.9k|            if (at_sign_seen) {
  ------------------
  |  Branch (13221:17): [True: 12.9k, False: 40.9k]
  ------------------
13222|  12.9k|              if (password_token_seen) {
  ------------------
  |  Branch (13222:19): [True: 4.65k, False: 8.26k]
  ------------------
13223|  4.65k|                if constexpr (result_type_is_ada_url) {
13224|  4.65k|                  url.password += "%40";
13225|       |                } else {
13226|       |                  url.append_base_password("%40");
13227|       |                }
13228|  8.26k|              } else {
13229|  8.26k|                if constexpr (result_type_is_ada_url) {
13230|  8.26k|                  url.username += "%40";
13231|       |                } else {
13232|       |                  url.append_base_username("%40");
13233|       |                }
13234|  8.26k|              }
13235|  12.9k|            }
13236|       |
13237|  53.9k|            at_sign_seen = true;
13238|       |
13239|  53.9k|            if (!password_token_seen) {
  ------------------
  |  Branch (13239:17): [True: 49.2k, False: 4.65k]
  ------------------
13240|  49.2k|              size_t password_token_location = authority_view.find(':');
13241|  49.2k|              password_token_seen =
13242|  49.2k|                  password_token_location != std::string_view::npos;
13243|       |
13244|  49.2k|              if constexpr (store_values) {
13245|  49.2k|                if (!password_token_seen) {
  ------------------
  |  Branch (13245:21): [True: 19.1k, False: 30.0k]
  ------------------
13246|  19.1k|                  if constexpr (result_type_is_ada_url) {
13247|  19.1k|                    url.username += unicode::percent_encode(
13248|  19.1k|                        authority_view,
13249|  19.1k|                        character_sets::USERINFO_PERCENT_ENCODE);
13250|       |                  } else {
13251|       |                    url.append_base_username(unicode::percent_encode(
13252|       |                        authority_view,
13253|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13254|       |                  }
13255|  30.0k|                } else {
13256|  30.0k|                  if constexpr (result_type_is_ada_url) {
13257|  30.0k|                    url.username += unicode::percent_encode(
13258|  30.0k|                        authority_view.substr(0, password_token_location),
13259|  30.0k|                        character_sets::USERINFO_PERCENT_ENCODE);
13260|  30.0k|                    url.password += unicode::percent_encode(
13261|  30.0k|                        authority_view.substr(password_token_location + 1),
13262|  30.0k|                        character_sets::USERINFO_PERCENT_ENCODE);
13263|       |                  } else {
13264|       |                    url.append_base_username(unicode::percent_encode(
13265|       |                        authority_view.substr(0, password_token_location),
13266|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13267|       |                    url.append_base_password(unicode::percent_encode(
13268|       |                        authority_view.substr(password_token_location + 1),
13269|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13270|       |                  }
13271|  30.0k|                }
13272|  49.2k|              }
13273|  49.2k|            } else if constexpr (store_values) {
13274|  4.65k|              if constexpr (result_type_is_ada_url) {
13275|  4.65k|                url.password += unicode::percent_encode(
13276|  4.65k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13277|       |              } else {
13278|       |                url.append_base_password(unicode::percent_encode(
13279|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13280|       |              }
13281|  4.65k|            }
13282|  53.9k|          }
13283|       |          // Otherwise, if one of the following is true:
13284|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13285|       |          // - url is special and c is U+005C (\)
13286|  41.2k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13286:20): [True: 10.0k, False: 31.2k]
  ------------------
13287|  31.2k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13287:20): [True: 31.0k, False: 175]
  ------------------
13288|    175|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13288:20): [True: 134, False: 41]
  ------------------
13289|  41.2k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13289:21): [True: 41, False: 0]
  |  Branch (13289:41): [True: 41, False: 0]
  ------------------
13290|       |            // If atSignSeen is true and authority_view is the empty string,
13291|       |            // validation error, return failure.
13292|  41.2k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13292:17): [True: 40.9k, False: 290]
  |  Branch (13292:33): [True: 251, False: 40.7k]
  ------------------
13293|    251|              url.is_valid = false;
13294|    251|              return url;
13295|    251|            }
13296|  41.0k|            state = state::HOST;
13297|  41.0k|            break;
13298|  41.2k|          }
13299|  53.9k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13299:15): [True: 0, False: 53.9k]
  ------------------
13300|      0|            if constexpr (store_values) {
13301|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13301:19): [True: 0, False: 0]
  ------------------
13302|      0|                url.update_unencoded_base_hash(*fragment);
13303|      0|              }
13304|      0|            }
13305|      0|            enforce_max_input_length();
13306|      0|            return url;
13307|      0|          }
13308|  53.9k|          input_position = end_of_authority + 1;
13309|  53.9k|        } while (true);
  ------------------
  |  Branch (13309:18): [True: 53.9k, Folded]
  ------------------
13310|       |
13311|  41.0k|        break;
13312|  41.2k|      }
13313|  41.0k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13313:7): [True: 0, False: 1.82M]
  ------------------
13314|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13315|      0|                helpers::substring(url_data, input_position));
13316|       |
13317|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13318|       |        // then set state to special authority ignore slashes state and increase
13319|       |        // pointer by 1.
13320|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13320:13): [True: 0, False: 0]
  ------------------
13321|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13322|      0|          input_position += 2;
13323|      0|        } else {
13324|       |          // Otherwise, validation error, set state to relative state and
13325|       |          // decrease pointer by 1.
13326|      0|          state = state::RELATIVE_SCHEME;
13327|      0|        }
13328|       |
13329|      0|        break;
13330|  41.2k|      }
13331|  1.09k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13331:7): [True: 1.09k, False: 1.82M]
  ------------------
13332|  1.09k|        ada_log("PATH_OR_AUTHORITY ",
13333|  1.09k|                helpers::substring(url_data, input_position));
13334|       |
13335|       |        // If c is U+002F (/), then set state to authority state.
13336|  1.09k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13336:13): [True: 1.06k, False: 28]
  ------------------
13337|  1.06k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13337:13): [True: 755, False: 308]
  ------------------
13338|    755|          state = state::AUTHORITY;
13339|    755|          input_position++;
13340|    755|        } else {
13341|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13342|    336|          state = state::PATH;
13343|    336|        }
13344|       |
13345|  1.09k|        break;
13346|  41.2k|      }
13347|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13347:7): [True: 0, False: 1.82M]
  ------------------
13348|      0|        ada_log("RELATIVE_SCHEME ",
13349|      0|                helpers::substring(url_data, input_position));
13350|       |
13351|       |        // Set url's scheme to base's scheme.
13352|      0|        url.copy_scheme(*base_url);
13353|       |
13354|       |        // If c is U+002F (/), then set state to relative slash state.
13355|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13355:13): [True: 0, False: 0]
  ------------------
13356|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13357|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13357:13): [True: 0, False: 0]
  ------------------
13358|      0|          ada_log(
13359|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13360|      0|              "slash state");
13361|      0|          state = state::RELATIVE_SLASH;
13362|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13362:20): [True: 0, False: 0]
  |  Branch (13362:40): [True: 0, False: 0]
  ------------------
13363|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13363:20): [True: 0, False: 0]
  ------------------
13364|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13365|       |          // set state to relative slash state.
13366|      0|          ada_log(
13367|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13368|      0|              "error, set state to relative slash state");
13369|      0|          state = state::RELATIVE_SLASH;
13370|      0|        } else {
13371|      0|          ada_log("RELATIVE_SCHEME otherwise");
13372|       |          // Set url's username to base's username, url's password to base's
13373|       |          // password, url's host to base's host, url's port to base's port,
13374|       |          // url's path to a clone of base's path, and url's query to base's
13375|       |          // query.
13376|      0|          if constexpr (result_type_is_ada_url) {
13377|      0|            url.username = base_url->username;
13378|      0|            url.password = base_url->password;
13379|      0|            url.host = base_url->host;
13380|      0|            url.port = base_url->port;
13381|       |            // cloning the base path includes cloning the has_opaque_path flag
13382|      0|            url.has_opaque_path = base_url->has_opaque_path;
13383|      0|            url.path = base_url->path;
13384|      0|            url.query = base_url->query;
13385|       |          } else {
13386|       |            url.update_base_authority(base_url->get_href(),
13387|       |                                      base_url->get_components());
13388|       |            url.update_host_to_base_host(base_url->get_hostname());
13389|       |            url.update_base_port(base_url->retrieve_base_port());
13390|       |            // cloning the base path includes cloning the has_opaque_path flag
13391|       |            url.has_opaque_path = base_url->has_opaque_path;
13392|       |            url.update_base_pathname(base_url->get_pathname());
13393|       |            if (base_url->has_search()) {
13394|       |              // get_search() returns "" for an empty query string (URL ends
13395|       |              // with '?'). update_base_search("") would incorrectly clear the
13396|       |              // query, so pass "?" to preserve the empty query distinction.
13397|       |              auto s = base_url->get_search();
13398|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13399|       |            }
13400|       |          }
13401|       |
13402|      0|          url.has_opaque_path = base_url->has_opaque_path;
13403|       |
13404|       |          // If c is U+003F (?), then set url's query to the empty string, and
13405|       |          // state to query state.
13406|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13406:15): [True: 0, False: 0]
  ------------------
13407|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13407:15): [True: 0, False: 0]
  ------------------
13408|      0|            state = state::QUERY;
13409|      0|          }
13410|       |          // Otherwise, if c is not the EOF code point:
13411|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13411:20): [True: 0, False: 0]
  ------------------
13412|       |            // Set url's query to null.
13413|      0|            url.clear_search();
13414|      0|            if constexpr (result_type_is_ada_url) {
13415|       |              // Shorten url's path.
13416|      0|              helpers::shorten_path(url.path, url.type);
13417|       |            } else {
13418|       |              std::string_view path = url.get_pathname();
13419|       |              if (helpers::shorten_path(path, url.type)) {
13420|       |                url.update_base_pathname(std::move(std::string(path)));
13421|       |              }
13422|       |            }
13423|       |            // Set state to path state and decrease pointer by 1.
13424|      0|            state = state::PATH;
13425|      0|            break;
13426|      0|          }
13427|      0|        }
13428|      0|        input_position++;
13429|      0|        break;
13430|      0|      }
13431|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13431:7): [True: 0, False: 1.82M]
  ------------------
13432|      0|        ada_log("RELATIVE_SLASH ",
13433|      0|                helpers::substring(url_data, input_position));
13434|       |
13435|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13436|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13437|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13437:13): [True: 0, False: 0]
  |  Branch (13437:33): [True: 0, False: 0]
  ------------------
13438|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13438:14): [True: 0, False: 0]
  ------------------
13439|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13439:14): [True: 0, False: 0]
  ------------------
13440|       |          // Set state to special authority ignore slashes state.
13441|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13442|      0|        }
13443|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13444|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13444:18): [True: 0, False: 0]
  ------------------
13445|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13445:18): [True: 0, False: 0]
  ------------------
13446|      0|          state = state::AUTHORITY;
13447|      0|        }
13448|       |        // Otherwise, set
13449|       |        // - url's username to base's username,
13450|       |        // - url's password to base's password,
13451|       |        // - url's host to base's host,
13452|       |        // - url's port to base's port,
13453|       |        // - state to path state, and then, decrease pointer by 1.
13454|      0|        else {
13455|      0|          if constexpr (result_type_is_ada_url) {
13456|      0|            url.username = base_url->username;
13457|      0|            url.password = base_url->password;
13458|      0|            url.host = base_url->host;
13459|      0|            url.port = base_url->port;
13460|       |          } else {
13461|       |            url.update_base_authority(base_url->get_href(),
13462|       |                                      base_url->get_components());
13463|       |            url.update_host_to_base_host(base_url->get_hostname());
13464|       |            url.update_base_port(base_url->retrieve_base_port());
13465|       |          }
13466|      0|          state = state::PATH;
13467|      0|          break;
13468|      0|        }
13469|       |
13470|      0|        input_position++;
13471|      0|        break;
13472|      0|      }
13473|   266k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13473:7): [True: 266k, False: 1.55M]
  ------------------
13474|   266k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13475|   266k|                helpers::substring(url_data, input_position));
13476|       |
13477|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13478|       |        // then set state to special authority ignore slashes state and increase
13479|       |        // pointer by 1.
13480|   266k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13480:13): [True: 265k, False: 1.67k]
  ------------------
13481|   265k|          input_position += 2;
13482|   265k|        }
13483|       |
13484|   266k|        [[fallthrough]];
13485|   266k|      }
13486|   266k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13486:7): [True: 0, False: 1.82M]
  ------------------
13487|   266k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13488|   266k|                helpers::substring(url_data, input_position));
13489|       |
13490|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13491|       |        // authority state and decrease pointer by 1.
13492|   268k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13492:16): [True: 268k, False: 77]
  ------------------
13493|   268k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13493:17): [True: 627, False: 268k]
  ------------------
13494|   268k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13494:17): [True: 1.25k, False: 266k]
  ------------------
13495|  1.88k|          input_position++;
13496|  1.88k|        }
13497|   266k|        state = state::AUTHORITY;
13498|       |
13499|   266k|        break;
13500|   266k|      }
13501|  9.73k|      case state::QUERY: {
  ------------------
  |  Branch (13501:7): [True: 9.73k, False: 1.81M]
  ------------------
13502|  9.73k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13503|  9.73k|        if constexpr (store_values) {
13504|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13505|       |          // if url is special; otherwise the query percent-encode set.
13506|  9.73k|          const uint8_t* query_percent_encode_set =
13507|  9.73k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13507:15): [True: 8.56k, False: 1.16k]
  ------------------
13508|  9.73k|                               : character_sets::QUERY_PERCENT_ENCODE;
13509|       |
13510|       |          // Percent-encode after encoding, with encoding, buffer, and
13511|       |          // queryPercentEncodeSet, and append the result to url's query.
13512|  9.73k|          url.update_base_search(url_data.substr(input_position),
13513|  9.73k|                                 query_percent_encode_set);
13514|  9.73k|          ada_log("QUERY update_base_search completed ");
13515|  9.73k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13515:15): [True: 7.21k, False: 2.51k]
  ------------------
13516|  7.21k|            url.update_unencoded_base_hash(*fragment);
13517|  7.21k|          }
13518|  9.73k|        }
13519|  9.73k|        enforce_max_input_length();
13520|  9.73k|        return url;
13521|   266k|      }
13522|   267k|      case state::HOST: {
  ------------------
  |  Branch (13522:7): [True: 267k, False: 1.55M]
  ------------------
13523|   267k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13524|       |
13525|   267k|        std::string_view host_view = url_data.substr(input_position);
13526|   267k|        auto [location, found_colon] =
13527|   267k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13528|   267k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13528:26): [True: 267k, False: 0]
  ------------------
13529|   267k|                             ? input_position + location
13530|   267k|                             : input_size;
13531|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13532|       |        // Note: the 'found_colon' value is true if and only if a colon was
13533|       |        // encountered while not inside brackets.
13534|   267k|        if (found_colon) {
  ------------------
  |  Branch (13534:13): [True: 2.45k, False: 264k]
  ------------------
13535|       |          // If buffer is the empty string, validation error, return failure.
13536|       |          // Let host be the result of host parsing buffer with url is not
13537|       |          // special.
13538|  2.45k|          ada_log("HOST parsing ", host_view);
13539|  2.45k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13539:15): [True: 174, False: 2.28k]
  ------------------
13540|    174|            return url;
13541|    174|          }
13542|  2.28k|          ada_log("HOST parsing results in ", url.get_hostname());
13543|       |          // Set url's host to host, buffer to the empty string, and state to
13544|       |          // port state.
13545|  2.28k|          state = state::PORT;
13546|  2.28k|          input_position++;
13547|  2.28k|        }
13548|       |        // Otherwise, if one of the following is true:
13549|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13550|       |        // - url is special and c is U+005C (\)
13551|       |        // The get_host_delimiter_location function either brings us to
13552|       |        // the colon outside of the bracket, or to one of those characters.
13553|   264k|        else {
13554|       |          // If url is special and host_view is the empty string, validation
13555|       |          // error, return failure.
13556|   264k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13556:15): [True: 196, False: 264k]
  |  Branch (13556:36): [True: 109, False: 87]
  ------------------
13557|    109|            url.is_valid = false;
13558|    109|            return url;
13559|    109|          }
13560|   264k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13561|       |          // Let host be the result of host parsing host_view with url is not
13562|       |          // special.
13563|   264k|          if (host_view.empty()) {
  ------------------
  |  Branch (13563:15): [True: 87, False: 264k]
  ------------------
13564|     87|            url.update_base_hostname("");
13565|   264k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13565:22): [True: 20.8k, False: 243k]
  ------------------
13566|  20.8k|            return url;
13567|  20.8k|          }
13568|   243k|          ada_log("HOST parsing results in ", url.get_hostname(),
13569|   243k|                  " href=", url.get_href());
13570|       |
13571|       |          // Set url's host to host, and state to path start state.
13572|   243k|          state = state::PATH_START;
13573|   243k|        }
13574|       |
13575|   246k|        break;
13576|   267k|      }
13577|   246k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13577:7): [True: 774, False: 1.82M]
  ------------------
13578|    774|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13579|       |        // Opaque path, query, and fragment are structurally always valid:
13580|       |        // the parser would just percent-encode whatever is there. When we
13581|       |        // are not storing values (can_parse), we can return immediately.
13582|       |        // We must set has_opaque_path = true before returning so that when
13583|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13584|       |        // correctly rejects relative inputs against an opaque-path base
13585|       |        // (e.g. can_parse("", &"W:") must return false).
13586|       |        if constexpr (!store_values) {
13587|       |          url.has_opaque_path = true;
13588|       |          return url;
13589|       |        }
13590|    774|        std::string_view view = url_data.substr(input_position);
13591|       |        // If c is U+003F (?), then set url's query to the empty string and
13592|       |        // state to query state.
13593|    774|        size_t location = view.find('?');
13594|    774|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13594:13): [True: 501, False: 273]
  ------------------
13595|    501|          view.remove_suffix(view.size() - location);
13596|    501|          state = state::QUERY;
13597|    501|          input_position += location + 1;
13598|    501|        } else {
13599|    273|          input_position = input_size + 1;
13600|    273|        }
13601|    774|        url.has_opaque_path = true;
13602|       |
13603|       |        // This is a really unlikely scenario in real world. We should not seek
13604|       |        // to optimize it.
13605|    774|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13605:13): [True: 12, False: 762]
  ------------------
13606|     12|          std::string modified_view =
13607|     12|              std::string(view.substr(0, view.size() - 1)) + "%20";
13608|     12|          url.update_base_pathname(unicode::percent_encode(
13609|     12|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13610|    762|        } else {
13611|    762|          url.update_base_pathname(unicode::percent_encode(
13612|    762|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13613|    762|        }
13614|    774|        break;
13615|   267k|      }
13616|  2.28k|      case state::PORT: {
  ------------------
  |  Branch (13616:7): [True: 2.28k, False: 1.81M]
  ------------------
13617|  2.28k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13618|  2.28k|        std::string_view port_view = url_data.substr(input_position);
13619|  2.28k|        input_position += url.parse_port(port_view, true);
13620|  2.28k|        if (!url.is_valid) {
  ------------------
  |  Branch (13620:13): [True: 238, False: 2.04k]
  ------------------
13621|    238|          return url;
13622|    238|        }
13623|  2.04k|        state = state::PATH_START;
13624|  2.04k|        [[fallthrough]];
13625|  2.04k|      }
13626|   247k|      case state::PATH_START: {
  ------------------
  |  Branch (13626:7): [True: 245k, False: 1.57M]
  ------------------
13627|   247k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13628|       |        // Path, query, and fragment are structurally always valid: the
13629|       |        // parser would just percent-encode whatever is there. When we are
13630|       |        // not storing values (can_parse), we can return immediately since
13631|       |        // no subsequent state can invalidate the URL.
13632|       |        if constexpr (!store_values) {
13633|       |          return url;
13634|       |        }
13635|       |
13636|       |        // If url is special, then:
13637|   247k|        if (url.is_special()) {
  ------------------
  |  Branch (13637:13): [True: 246k, False: 690]
  ------------------
13638|       |          // Set state to path state.
13639|   246k|          state = state::PATH;
13640|       |
13641|       |          // Optimization: Avoiding going into PATH state improves the
13642|       |          // performance of urls ending with /.
13643|   246k|          if (input_position == input_size) {
  ------------------
  |  Branch (13643:15): [True: 30.7k, False: 215k]
  ------------------
13644|  30.7k|            if constexpr (store_values) {
13645|  30.7k|              url.update_base_pathname("/");
13646|  30.7k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13646:19): [True: 257, False: 30.5k]
  ------------------
13647|    257|                url.update_unencoded_base_hash(*fragment);
13648|    257|              }
13649|  30.7k|            }
13650|  30.7k|            enforce_max_input_length();
13651|  30.7k|            return url;
13652|  30.7k|          }
13653|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13654|       |          // by 1. We know that (input_position == input_size) is impossible
13655|       |          // here, because of the previous if-check.
13656|   215k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13656:15): [True: 1.01k, False: 214k]
  ------------------
13657|  1.01k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13657:15): [True: 616, False: 403]
  ------------------
13658|    616|            break;
13659|    616|          }
13660|   215k|        }
13661|       |        // Otherwise, if state override is not given and c is U+003F (?),
13662|       |        // set url's query to the empty string and state to query state.
13663|    690|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13663:18): [True: 540, False: 150]
  ------------------
13664|    540|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13664:18): [True: 111, False: 429]
  ------------------
13665|    111|          state = state::QUERY;
13666|    111|        }
13667|       |        // Otherwise, if c is not the EOF code point:
13668|    579|        else if (input_position != input_size) {
  ------------------
  |  Branch (13668:18): [True: 429, False: 150]
  ------------------
13669|       |          // Set state to path state.
13670|    429|          state = state::PATH;
13671|       |
13672|       |          // If c is not U+002F (/), then decrease pointer by 1.
13673|    429|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13673:15): [True: 0, False: 429]
  ------------------
13674|      0|            break;
13675|      0|          }
13676|    429|        }
13677|       |
13678|   215k|        input_position++;
13679|   215k|        break;
13680|   247k|      }
13681|   216k|      case state::PATH: {
  ------------------
  |  Branch (13681:7): [True: 216k, False: 1.60M]
  ------------------
13682|   216k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13683|       |        // Path, query, and fragment are structurally always valid: the
13684|       |        // parser would just percent-encode whatever is there. When we are
13685|       |        // not storing values (can_parse), we can return immediately since
13686|       |        // no subsequent state can invalidate the URL.
13687|       |        if constexpr (!store_values) {
13688|       |          return url;
13689|       |        }
13690|   216k|        std::string_view view = url_data.substr(input_position);
13691|       |
13692|       |        // Most time, we do not need percent encoding.
13693|       |        // Furthermore, we can immediately locate the '?'.
13694|   216k|        size_t locofquestionmark = view.find('?');
13695|   216k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13695:13): [True: 9.11k, False: 207k]
  ------------------
13696|  9.11k|          state = state::QUERY;
13697|  9.11k|          view.remove_suffix(view.size() - locofquestionmark);
13698|  9.11k|          input_position += locofquestionmark + 1;
13699|   207k|        } else {
13700|   207k|          input_position = input_size + 1;
13701|   207k|        }
13702|   216k|        if constexpr (store_values) {
13703|   216k|          if constexpr (result_type_is_ada_url) {
13704|   216k|            helpers::parse_prepared_path(view, url.type, url.path);
13705|       |          } else {
13706|       |            url.consume_prepared_path(view);
13707|       |            ADA_ASSERT_TRUE(url.validate());
13708|       |          }
13709|   216k|        }
13710|   216k|        break;
13711|   247k|      }
13712|  1.29k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13712:7): [True: 1.29k, False: 1.82M]
  ------------------
13713|  1.29k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13714|       |
13715|       |        // If c is U+002F (/) or U+005C (\), then:
13716|  1.29k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13716:13): [True: 1.28k, False: 1]
  ------------------
13717|  1.28k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13717:14): [True: 1.27k, False: 15]
  ------------------
13718|  1.27k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13718:14): [True: 3, False: 12]
  ------------------
13719|  1.27k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13720|       |          // Set state to file host state.
13721|  1.27k|          state = state::FILE_HOST;
13722|  1.27k|          input_position++;
13723|  1.27k|        } else {
13724|     13|          ada_log("FILE_SLASH otherwise");
13725|       |          // If base is non-null and base's scheme is "file", then:
13726|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13727|       |          // base_url_has_value() is true.
13728|     13|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13728:15): [True: 0, False: 13]
  |  Branch (13728:38): [True: 0, False: 0]
  ------------------
13729|       |            // Set url's host to base's host.
13730|      0|            if constexpr (result_type_is_ada_url) {
13731|      0|              url.host = base_url->host;
13732|       |            } else {
13733|       |              url.update_host_to_base_host(base_url->get_host());
13734|       |            }
13735|       |            // If the code point substring from pointer to the end of input does
13736|       |            // not start with a Windows drive letter and base's path[0] is a
13737|       |            // normalized Windows drive letter, then append base's path[0] to
13738|       |            // url's path.
13739|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13739:17): [True: 0, False: 0]
  ------------------
13740|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13740:19): [True: 0, False: 0]
  ------------------
13741|      0|                      url_data.substr(input_position))) {
13742|      0|                std::string_view first_base_url_path =
13743|      0|                    base_url->get_pathname().substr(1);
13744|      0|                size_t loc = first_base_url_path.find('/');
13745|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13745:21): [True: 0, False: 0]
  ------------------
13746|      0|                  helpers::resize(first_base_url_path, loc);
13747|      0|                }
13748|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13748:21): [True: 0, False: 0]
  ------------------
13749|      0|                        first_base_url_path)) {
13750|      0|                  if constexpr (result_type_is_ada_url) {
13751|      0|                    url.path += '/';
13752|      0|                    url.path += first_base_url_path;
13753|       |                  } else {
13754|       |                    url.append_base_pathname(
13755|       |                        helpers::concat("/", first_base_url_path));
13756|       |                  }
13757|      0|                }
13758|      0|              }
13759|      0|            }
13760|      0|          }
13761|       |
13762|       |          // Set state to path state, and decrease pointer by 1.
13763|     13|          state = state::PATH;
13764|     13|        }
13765|       |
13766|  1.29k|        break;
13767|   247k|      }
13768|  1.27k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13768:7): [True: 1.27k, False: 1.82M]
  ------------------
13769|  1.27k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13770|  1.27k|        std::string_view view = url_data.substr(input_position);
13771|       |
13772|  1.27k|        size_t location = view.find_first_of("/\\?");
13773|  1.27k|        std::string_view file_host_buffer = view.substr(
13774|  1.27k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13774:16): [True: 1.23k, False: 41]
  ------------------
13775|       |
13776|  1.27k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13776:13): [True: 1, False: 1.27k]
  ------------------
13777|      1|          state = state::PATH;
13778|  1.27k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13778:20): [True: 264, False: 1.01k]
  ------------------
13779|       |          // Set url's host to the empty string.
13780|    264|          if constexpr (result_type_is_ada_url) {
13781|    264|            url.host = "";
13782|       |          } else {
13783|       |            url.update_base_hostname("");
13784|       |          }
13785|       |          // Set state to path start state.
13786|    264|          state = state::PATH_START;
13787|  1.01k|        } else {
13788|  1.01k|          size_t consumed_bytes = file_host_buffer.size();
13789|  1.01k|          input_position += consumed_bytes;
13790|       |          // Let host be the result of host parsing buffer with url is not
13791|       |          // special.
13792|  1.01k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13792:15): [True: 100, False: 912]
  ------------------
13793|    100|            return url;
13794|    100|          }
13795|       |
13796|    912|          if constexpr (result_type_is_ada_url) {
13797|       |            // If host is "localhost", then set host to the empty string.
13798|    912|            if (url.host.has_value() && url.host.value() == "localhost") {
  ------------------
  |  Branch (13798:17): [True: 912, False: 0]
  |  Branch (13798:41): [True: 3, False: 909]
  ------------------
13799|      3|              url.host = "";
13800|      3|            }
13801|       |          } else {
13802|       |            if (url.get_hostname() == "localhost") {
13803|       |              url.update_base_hostname("");
13804|       |            }
13805|       |          }
13806|       |
13807|       |          // Set buffer to the empty string and state to path start state.
13808|    912|          state = state::PATH_START;
13809|    912|        }
13810|       |
13811|  1.17k|        break;
13812|  1.27k|      }
13813|  1.39k|      case state::FILE: {
  ------------------
  |  Branch (13813:7): [True: 1.39k, False: 1.82M]
  ------------------
13814|  1.39k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13815|  1.39k|        std::string_view file_view = url_data.substr(input_position);
13816|       |
13817|  1.39k|        url.set_protocol_as_file();
13818|  1.39k|        if constexpr (result_type_is_ada_url) {
13819|       |          // Set url's host to the empty string.
13820|  1.39k|          url.host = "";
13821|       |        } else {
13822|       |          url.update_base_hostname("");
13823|       |        }
13824|       |        // If c is U+002F (/) or U+005C (\), then:
13825|  1.39k|        if (input_position != input_size &&
  ------------------
  |  Branch (13825:13): [True: 1.39k, False: 1]
  ------------------
13826|  1.39k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13826:14): [True: 1.28k, False: 110]
  ------------------
13827|  1.29k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13827:14): [True: 2, False: 108]
  ------------------
13828|  1.29k|          ada_log("FILE c is U+002F or U+005C");
13829|       |          // Set state to file slash state.
13830|  1.29k|          state = state::FILE_SLASH;
13831|  1.29k|        }
13832|       |        // Otherwise, if base is non-null and base's scheme is "file":
13833|    109|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13833:18): [True: 0, False: 109]
  |  Branch (13833:41): [True: 0, False: 0]
  ------------------
13834|       |          // Set url's host to base's host, url's path to a clone of base's
13835|       |          // path, and url's query to base's query.
13836|      0|          ada_log("FILE base non-null");
13837|      0|          if constexpr (result_type_is_ada_url) {
13838|      0|            url.host = base_url->host;
13839|      0|            url.path = base_url->path;
13840|      0|            url.query = base_url->query;
13841|       |          } else {
13842|       |            url.update_host_to_base_host(base_url->get_hostname());
13843|       |            url.update_base_pathname(base_url->get_pathname());
13844|       |            if (base_url->has_search()) {
13845|       |              // get_search() returns "" for an empty query string (URL ends
13846|       |              // with '?'). update_base_search("") would incorrectly clear the
13847|       |              // query, so pass "?" to preserve the empty query distinction.
13848|       |              auto s = base_url->get_search();
13849|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13850|       |            }
13851|       |          }
13852|      0|          url.has_opaque_path = base_url->has_opaque_path;
13853|       |
13854|       |          // If c is U+003F (?), then set url's query to the empty string and
13855|       |          // state to query state.
13856|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13856:15): [True: 0, False: 0]
  |  Branch (13856:47): [True: 0, False: 0]
  ------------------
13857|      0|            state = state::QUERY;
13858|      0|          }
13859|       |          // Otherwise, if c is not the EOF code point:
13860|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13860:20): [True: 0, False: 0]
  ------------------
13861|       |            // Set url's query to null.
13862|      0|            url.clear_search();
13863|       |            // If the code point substring from pointer to the end of input does
13864|       |            // not start with a Windows drive letter, then shorten url's path.
13865|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13865:17): [True: 0, False: 0]
  ------------------
13866|      0|              if constexpr (result_type_is_ada_url) {
13867|      0|                helpers::shorten_path(url.path, url.type);
13868|       |              } else {
13869|       |                std::string_view path = url.get_pathname();
13870|       |                if (helpers::shorten_path(path, url.type)) {
13871|       |                  url.update_base_pathname(std::move(std::string(path)));
13872|       |                }
13873|       |              }
13874|      0|            }
13875|       |            // Otherwise:
13876|      0|            else {
13877|       |              // Set url's path to an empty list.
13878|      0|              url.clear_pathname();
13879|      0|            }
13880|       |
13881|       |            // Set state to path state and decrease pointer by 1.
13882|      0|            state = state::PATH;
13883|      0|            break;
13884|      0|          }
13885|      0|        }
13886|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13887|    109|        else {
13888|    109|          ada_log("FILE go to path");
13889|    109|          state = state::PATH;
13890|    109|          break;
13891|    109|        }
13892|       |
13893|  1.29k|        input_position++;
13894|  1.29k|        break;
13895|  1.39k|      }
13896|      0|      default:
  ------------------
  |  Branch (13896:7): [True: 0, False: 1.82M]
  ------------------
13897|      0|        unreachable();
13898|  1.82M|    }
13899|  1.82M|  }
13900|   566k|  if constexpr (store_values) {
13901|   566k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13901:9): [True: 2.23k, False: 564k]
  ------------------
13902|  2.23k|      url.update_unencoded_base_hash(*fragment);
13903|  2.23k|    }
13904|   566k|  }
13905|   566k|  enforce_max_input_length();
13906|   566k|  return url;
13907|   628k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12886|   628k|                           const result_type* base_url) {
12887|       |  // We can specialize the implementation per type.
12888|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12889|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12890|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12891|       |  // and ada::url **do not have to support the exact same API**.
12892|   628k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12893|   628k|  constexpr bool result_type_is_ada_url_aggregator =
12894|   628k|      std::is_same_v<url_aggregator, result_type>;
12895|   628k|  static_assert(result_type_is_ada_url ||
12896|   628k|                result_type_is_ada_url_aggregator);  // We don't support
12897|       |                                                     // anything else for now.
12898|       |
12899|   628k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12900|   628k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12901|   628k|          ")");
12902|       |
12903|   628k|  result_type url{};
12904|       |
12905|   628k|  const uint32_t max_input_length = ada::get_max_input_length();
12906|       |
12907|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12908|       |  // max_input_length even when the input fit under it. The check at the end of
12909|       |  // the state machine covers URLs that run to completion, but several states
12910|       |  // return early after appending a query or fragment, so run the same check on
12911|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12912|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12913|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12914|   628k|  const auto enforce_max_input_length = [&]() {
12915|   628k|    if constexpr (store_values) {
12916|   628k|      if (url.is_valid) {
12917|   628k|        if constexpr (result_type_is_ada_url_aggregator) {
12918|   628k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12919|   628k|            url.is_valid = false;
12920|   628k|          }
12921|   628k|        } else {
12922|   628k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12923|   628k|            url.is_valid = false;
12924|   628k|          }
12925|   628k|        }
12926|   628k|      }
12927|   628k|    }
12928|   628k|  };
12929|       |
12930|       |  // We refuse to parse URL strings that exceed the maximum input length.
12931|       |  // By default, this is 4GB but can be configured via
12932|       |  // ada::set_max_input_length().
12933|   628k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12933:7): [True: 0, False: 628k]
  ------------------
12934|      0|    url.is_valid = false;
12935|      0|  }
12936|       |  // Going forward, user_input.size() is in [0,
12937|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12938|       |  // base, or the optional_url was invalid, we must return.
12939|   628k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12939:7): [True: 0, False: 628k]
  ------------------
12940|      0|    url.is_valid &= base_url->is_valid;
12941|      0|  }
12942|   628k|  if (!url.is_valid) {
  ------------------
  |  Branch (12942:7): [True: 0, False: 628k]
  ------------------
12943|      0|    return url;
12944|      0|  }
12945|       |
12946|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12947|   628k|  if constexpr (store_values) {
12948|   628k|    bool hit_fast_path = false;
12949|   628k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12949:9): [True: 628k, False: 0]
  ------------------
12950|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12951|       |      // call so those URLs (including SetHref) do not pay for a miss.
12952|   628k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12953|   628k|      const size_t n = user_input.size();
12954|   628k|      size_t host_start = 0;
12955|   628k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12955:11): [True: 628k, False: 232]
  |  Branch (12955:21): [True: 240k, False: 388k]
  |  Branch (12955:36): [True: 239k, False: 929]
  |  Branch (12955:51): [True: 239k, False: 166]
  ------------------
12956|   239k|        host_start = 7;
12957|   389k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12957:18): [True: 389k, False: 255]
  |  Branch (12957:28): [True: 386k, False: 2.76k]
  |  Branch (12957:43): [True: 385k, False: 731]
  |  Branch (12957:58): [True: 385k, False: 94]
  ------------------
12958|   385k|        host_start = 8;
12959|   385k|      }
12960|   628k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12960:34): [True: 625k, False: 3.84k]
  ------------------
12961|   628k|      const bool skip_ip =
12962|   628k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12962:11): [True: 542, False: 628k]
  |  Branch (12962:33): [True: 621k, False: 6.77k]
  |  Branch (12962:54): [True: 140k, False: 481k]
  ------------------
12963|       |      // Only scan for userinfo when the host is not an IP literal, so
12964|       |      // IPv4/IPv6 inputs skip the SIMD '@' check entirely.
12965|   628k|      hit_fast_path =
12966|   628k|          !skip_ip &&
  ------------------
  |  Branch (12966:11): [True: 488k, False: 140k]
  ------------------
12967|   488k|          !(host_start != 0 && authority_has_at(p, host_start, n)) &&
  ------------------
  |  Branch (12967:13): [True: 484k, False: 3.84k]
  |  Branch (12967:32): [True: 30.2k, False: 454k]
  ------------------
12968|   457k|          try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12968:11): [True: 358k, False: 99.3k]
  ------------------
12969|   628k|    } else {
12970|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12971|      0|    }
12972|   628k|    if (hit_fast_path) {
  ------------------
  |  Branch (12972:9): [True: 358k, False: 270k]
  ------------------
12973|   358k|      if constexpr (result_type_is_ada_url_aggregator) {
12974|   358k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12974:13): [True: 0, False: 358k]
  ------------------
12975|      0|          url.is_valid = false;
12976|      0|        }
12977|       |      } else {
12978|       |        // For a small absolute input, even worst-case normalization cannot
12979|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12980|       |        // most 4.5x. Avoid traversing every stored component on the common
12981|       |        // default-limit path.
12982|       |        if ((base_url != nullptr ||
12983|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12984|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12985|       |          url.is_valid = false;
12986|       |        }
12987|       |      }
12988|   358k|      return url;
12989|   358k|    }
12990|   628k|  }
12991|       |
12992|   270k|  state state = state::SCHEME_START;
12993|       |
12994|   628k|  std::string tmp_buffer;
12995|   628k|  std::string_view url_data;
12996|   628k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12996:7): [True: 481, False: 628k]
  ------------------
12997|    481|    tmp_buffer = user_input;
12998|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12999|       |    // just directly build the string from user_input.
13000|    481|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
13001|    481|    url_data = tmp_buffer;
13002|   628k|  } else [[likely]] {
13003|   628k|    url_data = user_input;
13004|   628k|  }
13005|       |
13006|       |  // Leading and trailing control characters are uncommon and easy to deal with
13007|       |  // (no performance concern).
13008|   628k|  helpers::trim_c0_whitespace(url_data);
13009|       |
13010|   628k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
13011|       |    // Most of the time, we just need user_input.size().
13012|       |    // In some instances, we may need a bit more.
13013|       |    ///////////////////////////
13014|       |    // This is *very* important. This line should *not* be removed
13015|       |    // hastily. There are principled reasons why reserve is important
13016|       |    // for performance. If you have a benchmark with small inputs,
13017|       |    // it may not matter, but in other instances, it could.
13018|       |    ////
13019|       |    // This rounds up to the next power of two.
13020|       |    // We know that user_input.size() is in [0,
13021|       |    // std::numeric_limits<uint32_t>::max).
13022|   628k|    uint32_t reserve_capacity =
13023|   628k|        (0xFFFFFFFF >>
13024|   628k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
13025|   628k|        1;
13026|   628k|    url.reserve(reserve_capacity);
13027|   628k|  }
13028|       |
13029|       |  // Optimization opportunity. Most websites do not have fragment.
13030|   628k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
13031|       |  // We add it last so that an implementation like ada::url_aggregator
13032|       |  // can append it last to its internal buffer, thus improving performance.
13033|       |
13034|       |  // Here url_data no longer has its fragment.
13035|       |  // We are going to access the data from url_data (it is immutable).
13036|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
13037|       |  // The input_position variable should range from 0 to input_size.
13038|       |  // It is illegal to access url_data at input_size.
13039|   628k|  size_t input_position = 0;
13040|   628k|  const size_t input_size = url_data.size();
13041|       |  // Keep running the following state machine by switching on state.
13042|       |  // If after a run pointer points to the EOF code point, go to the next step.
13043|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
13044|       |  // We never decrement input_position.
13045|  2.38M|  while (input_position <= input_size) {
  ------------------
  |  Branch (13045:10): [True: 1.82M, False: 566k]
  ------------------
13046|  1.82M|    ada_log("In parsing at ", input_position, " out of ", input_size,
13047|  1.82M|            " in state ", ada::to_string(state));
13048|  1.82M|    switch (state) {
13049|   270k|      case state::SCHEME_START: {
  ------------------
  |  Branch (13049:7): [True: 270k, False: 1.55M]
  ------------------
13050|   270k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
13051|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
13052|       |        // state to scheme state.
13053|   270k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13053:13): [True: 270k, False: 1]
  ------------------
13054|   270k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (13054:13): [True: 270k, False: 149]
  ------------------
13055|   270k|          state = state::SCHEME;
13056|   270k|          input_position++;
13057|   270k|        } else {
13058|       |          // Otherwise, if state override is not given, set state to no scheme
13059|       |          // state and decrease pointer by 1.
13060|    150|          state = state::NO_SCHEME;
13061|    150|        }
13062|   270k|        break;
13063|      0|      }
13064|   270k|      case state::SCHEME: {
  ------------------
  |  Branch (13064:7): [True: 270k, False: 1.55M]
  ------------------
13065|   270k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
13066|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
13067|       |        // append c, lowercased, to buffer.
13068|  1.17M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13068:16): [True: 1.17M, False: 2]
  ------------------
13069|  1.17M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13069:16): [True: 903k, False: 270k]
  ------------------
13070|   903k|          input_position++;
13071|   903k|        }
13072|       |        // Otherwise, if c is U+003A (:), then:
13073|   270k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:13): [True: 270k, False: 2]
  ------------------
13074|   270k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13074:13): [True: 270k, False: 74]
  ------------------
13075|   270k|          ada_log("SCHEME the scheme should be ",
13076|   270k|                  url_data.substr(0, input_position));
13077|       |          if constexpr (result_type_is_ada_url) {
13078|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
13079|       |              return url;
13080|       |            }
13081|   270k|          } else {
13082|       |            // we pass the colon along instead of painfully adding it back.
13083|   270k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (13083:17): [True: 0, False: 270k]
  ------------------
13084|   270k|                    url_data.substr(0, input_position + 1))) {
13085|      0|              return url;
13086|      0|            }
13087|   270k|          }
13088|   270k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13089|       |
13090|       |          // If url's scheme is "file", then:
13091|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13092|   270k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13092:15): [True: 1.39k, False: 268k]
  ------------------
13093|       |            // Set state to file state.
13094|  1.39k|            state = state::FILE;
13095|  1.39k|          }
13096|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13097|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13098|       |          // != nullptr is false.
13099|   268k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13099:20): [True: 266k, False: 1.86k]
  |  Branch (13099:40): [True: 0, False: 266k]
  ------------------
13100|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13100:20): [True: 0, False: 0]
  ------------------
13101|       |            // Set state to special relative or authority state.
13102|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13103|      0|          }
13104|       |          // Otherwise, if url is special, set state to special authority
13105|       |          // slashes state.
13106|   268k|          else if (url.is_special()) {
  ------------------
  |  Branch (13106:20): [True: 266k, False: 1.86k]
  ------------------
13107|   266k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13108|   266k|          }
13109|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13110|       |          // path or authority state and increase pointer by 1.
13111|  1.86k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13111:20): [True: 1.72k, False: 141]
  ------------------
13112|  1.72k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13112:20): [True: 1.09k, False: 633]
  ------------------
13113|  1.09k|            state = state::PATH_OR_AUTHORITY;
13114|  1.09k|            input_position++;
13115|  1.09k|          }
13116|       |          // Otherwise, set url's path to the empty string and set state to
13117|       |          // opaque path state.
13118|    774|          else {
13119|    774|            state = state::OPAQUE_PATH;
13120|    774|          }
13121|   270k|        }
13122|       |        // Otherwise, if state override is not given, set buffer to the empty
13123|       |        // string, state to no scheme state, and start over (from the first code
13124|       |        // point in input).
13125|     76|        else {
13126|     76|          state = state::NO_SCHEME;
13127|     76|          input_position = 0;
13128|     76|          break;
13129|     76|        }
13130|   270k|        input_position++;
13131|   270k|        break;
13132|   270k|      }
13133|    226|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13133:7): [True: 226, False: 1.82M]
  ------------------
13134|    226|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13135|       |        // The fragment was pruned from url_data before the state machine ran,
13136|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13137|       |        // nothing else remains in front of it.
13138|    226|        const bool c_is_hash =
13139|    226|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13139:13): [True: 147, False: 79]
  |  Branch (13139:37): [True: 1, False: 146]
  ------------------
13140|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13141|       |        // validation error, return failure.
13142|    226|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13142:13): [True: 226, False: 0]
  |  Branch (13142:37): [True: 0, False: 0]
  |  Branch (13142:66): [True: 0, False: 0]
  ------------------
13143|    226|          ada_log("NO_SCHEME validation error");
13144|    226|          url.is_valid = false;
13145|    226|          return url;
13146|    226|        }
13147|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13148|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13149|       |        // query to base's query, and set state to fragment state.
13150|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13150:18): [True: 0, False: 0]
  |  Branch (13150:47): [True: 0, False: 0]
  ------------------
13151|      0|          ada_log("NO_SCHEME opaque base with fragment");
13152|      0|          url.copy_scheme(*base_url);
13153|      0|          url.has_opaque_path = base_url->has_opaque_path;
13154|       |
13155|       |          if constexpr (result_type_is_ada_url) {
13156|       |            url.path = base_url->path;
13157|       |            url.query = base_url->query;
13158|      0|          } else {
13159|      0|            url.update_base_pathname(base_url->get_pathname());
13160|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13160:17): [True: 0, False: 0]
  ------------------
13161|       |              // get_search() returns "" for an empty query string (URL ends
13162|       |              // with '?'). update_base_search("") would incorrectly clear the
13163|       |              // query, so pass "?" to preserve the empty query distinction.
13164|      0|              auto s = base_url->get_search();
13165|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13165:38): [True: 0, False: 0]
  ------------------
13166|      0|            }
13167|      0|          }
13168|      0|          url.update_unencoded_base_hash(*fragment);
13169|      0|          enforce_max_input_length();
13170|      0|          return url;
13171|      0|        }
13172|       |        // Otherwise, if base's scheme is not "file", set state to relative
13173|       |        // state and decrease pointer by 1.
13174|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13175|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13175:18): [True: 0, False: 0]
  ------------------
13176|      0|          ada_log("NO_SCHEME non-file relative path");
13177|      0|          state = state::RELATIVE_SCHEME;
13178|      0|        }
13179|       |        // Otherwise, set state to file state and decrease pointer by 1.
13180|      0|        else {
13181|      0|          ada_log("NO_SCHEME file base type");
13182|      0|          state = state::FILE;
13183|      0|        }
13184|      0|        break;
13185|    226|      }
13186|   267k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13186:7): [True: 267k, False: 1.55M]
  ------------------
13187|   267k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13188|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13189|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13190|       |        // worry about AUTHORITY.
13191|       |        // TODO: Instead of just collecting a bool, collect the location of the
13192|       |        // '@' and do something useful with it.
13193|       |        // TODO: We could do various processing early on, using a single pass
13194|       |        // over the string to collect information about it, e.g., telling us
13195|       |        // whether there is a @ and if so, where (or how many).
13196|       |
13197|       |        // Check if url data contains an @.
13198|   267k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13198:13): [True: 226k, False: 41.2k]
  ------------------
13199|   226k|          state = state::HOST;
13200|   226k|          break;
13201|   226k|        }
13202|  41.2k|        bool at_sign_seen{false};
13203|  41.2k|        bool password_token_seen{false};
13204|       |        /**
13205|       |         * We expect something of the sort...
13206|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13207|       |         * --------^
13208|       |         */
13209|  95.1k|        do {
13210|  95.1k|          std::string_view view = url_data.substr(input_position);
13211|       |          // The delimiters are @, /, ? \\.
13212|  95.1k|          size_t location =
13213|  95.1k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13213:15): [True: 95.0k, False: 131]
  ------------------
13214|  95.1k|                               : helpers::find_authority_delimiter(view);
13215|  95.1k|          std::string_view authority_view = view.substr(0, location);
13216|  95.1k|          size_t end_of_authority = input_position + authority_view.size();
13217|       |          // If c is U+0040 (@), then:
13218|  95.1k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13218:15): [True: 85.1k, False: 10.0k]
  ------------------
13219|  85.1k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13219:15): [True: 53.9k, False: 31.2k]
  ------------------
13220|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13221|  53.9k|            if (at_sign_seen) {
  ------------------
  |  Branch (13221:17): [True: 12.9k, False: 40.9k]
  ------------------
13222|  12.9k|              if (password_token_seen) {
  ------------------
  |  Branch (13222:19): [True: 4.65k, False: 8.26k]
  ------------------
13223|       |                if constexpr (result_type_is_ada_url) {
13224|       |                  url.password += "%40";
13225|  4.65k|                } else {
13226|  4.65k|                  url.append_base_password("%40");
13227|  4.65k|                }
13228|  8.26k|              } else {
13229|       |                if constexpr (result_type_is_ada_url) {
13230|       |                  url.username += "%40";
13231|  8.26k|                } else {
13232|  8.26k|                  url.append_base_username("%40");
13233|  8.26k|                }
13234|  8.26k|              }
13235|  12.9k|            }
13236|       |
13237|  53.9k|            at_sign_seen = true;
13238|       |
13239|  53.9k|            if (!password_token_seen) {
  ------------------
  |  Branch (13239:17): [True: 49.2k, False: 4.65k]
  ------------------
13240|  49.2k|              size_t password_token_location = authority_view.find(':');
13241|  49.2k|              password_token_seen =
13242|  49.2k|                  password_token_location != std::string_view::npos;
13243|       |
13244|  49.2k|              if constexpr (store_values) {
13245|  49.2k|                if (!password_token_seen) {
  ------------------
  |  Branch (13245:21): [True: 19.1k, False: 30.0k]
  ------------------
13246|       |                  if constexpr (result_type_is_ada_url) {
13247|       |                    url.username += unicode::percent_encode(
13248|       |                        authority_view,
13249|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13250|  19.1k|                  } else {
13251|  19.1k|                    url.append_base_username(unicode::percent_encode(
13252|  19.1k|                        authority_view,
13253|  19.1k|                        character_sets::USERINFO_PERCENT_ENCODE));
13254|  19.1k|                  }
13255|  30.0k|                } else {
13256|       |                  if constexpr (result_type_is_ada_url) {
13257|       |                    url.username += unicode::percent_encode(
13258|       |                        authority_view.substr(0, password_token_location),
13259|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13260|       |                    url.password += unicode::percent_encode(
13261|       |                        authority_view.substr(password_token_location + 1),
13262|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13263|  30.0k|                  } else {
13264|  30.0k|                    url.append_base_username(unicode::percent_encode(
13265|  30.0k|                        authority_view.substr(0, password_token_location),
13266|  30.0k|                        character_sets::USERINFO_PERCENT_ENCODE));
13267|  30.0k|                    url.append_base_password(unicode::percent_encode(
13268|  30.0k|                        authority_view.substr(password_token_location + 1),
13269|  30.0k|                        character_sets::USERINFO_PERCENT_ENCODE));
13270|  30.0k|                  }
13271|  30.0k|                }
13272|  49.2k|              }
13273|  49.2k|            } else if constexpr (store_values) {
13274|       |              if constexpr (result_type_is_ada_url) {
13275|       |                url.password += unicode::percent_encode(
13276|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13277|  4.65k|              } else {
13278|  4.65k|                url.append_base_password(unicode::percent_encode(
13279|  4.65k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13280|  4.65k|              }
13281|  4.65k|            }
13282|  53.9k|          }
13283|       |          // Otherwise, if one of the following is true:
13284|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13285|       |          // - url is special and c is U+005C (\)
13286|  41.2k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13286:20): [True: 10.0k, False: 31.2k]
  ------------------
13287|  31.2k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13287:20): [True: 31.0k, False: 175]
  ------------------
13288|    175|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13288:20): [True: 134, False: 41]
  ------------------
13289|  41.2k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13289:21): [True: 41, False: 0]
  |  Branch (13289:41): [True: 41, False: 0]
  ------------------
13290|       |            // If atSignSeen is true and authority_view is the empty string,
13291|       |            // validation error, return failure.
13292|  41.2k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13292:17): [True: 40.9k, False: 290]
  |  Branch (13292:33): [True: 251, False: 40.7k]
  ------------------
13293|    251|              url.is_valid = false;
13294|    251|              return url;
13295|    251|            }
13296|  41.0k|            state = state::HOST;
13297|  41.0k|            break;
13298|  41.2k|          }
13299|  53.9k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13299:15): [True: 0, False: 53.9k]
  ------------------
13300|      0|            if constexpr (store_values) {
13301|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13301:19): [True: 0, False: 0]
  ------------------
13302|      0|                url.update_unencoded_base_hash(*fragment);
13303|      0|              }
13304|      0|            }
13305|      0|            enforce_max_input_length();
13306|      0|            return url;
13307|      0|          }
13308|  53.9k|          input_position = end_of_authority + 1;
13309|  53.9k|        } while (true);
  ------------------
  |  Branch (13309:18): [True: 53.9k, Folded]
  ------------------
13310|       |
13311|  41.0k|        break;
13312|  41.2k|      }
13313|  41.0k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13313:7): [True: 0, False: 1.82M]
  ------------------
13314|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13315|      0|                helpers::substring(url_data, input_position));
13316|       |
13317|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13318|       |        // then set state to special authority ignore slashes state and increase
13319|       |        // pointer by 1.
13320|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13320:13): [True: 0, False: 0]
  ------------------
13321|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13322|      0|          input_position += 2;
13323|      0|        } else {
13324|       |          // Otherwise, validation error, set state to relative state and
13325|       |          // decrease pointer by 1.
13326|      0|          state = state::RELATIVE_SCHEME;
13327|      0|        }
13328|       |
13329|      0|        break;
13330|  41.2k|      }
13331|  1.09k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13331:7): [True: 1.09k, False: 1.82M]
  ------------------
13332|  1.09k|        ada_log("PATH_OR_AUTHORITY ",
13333|  1.09k|                helpers::substring(url_data, input_position));
13334|       |
13335|       |        // If c is U+002F (/), then set state to authority state.
13336|  1.09k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13336:13): [True: 1.06k, False: 28]
  ------------------
13337|  1.06k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13337:13): [True: 755, False: 308]
  ------------------
13338|    755|          state = state::AUTHORITY;
13339|    755|          input_position++;
13340|    755|        } else {
13341|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13342|    336|          state = state::PATH;
13343|    336|        }
13344|       |
13345|  1.09k|        break;
13346|  41.2k|      }
13347|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13347:7): [True: 0, False: 1.82M]
  ------------------
13348|      0|        ada_log("RELATIVE_SCHEME ",
13349|      0|                helpers::substring(url_data, input_position));
13350|       |
13351|       |        // Set url's scheme to base's scheme.
13352|      0|        url.copy_scheme(*base_url);
13353|       |
13354|       |        // If c is U+002F (/), then set state to relative slash state.
13355|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13355:13): [True: 0, False: 0]
  ------------------
13356|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13357|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13357:13): [True: 0, False: 0]
  ------------------
13358|      0|          ada_log(
13359|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13360|      0|              "slash state");
13361|      0|          state = state::RELATIVE_SLASH;
13362|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13362:20): [True: 0, False: 0]
  |  Branch (13362:40): [True: 0, False: 0]
  ------------------
13363|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13363:20): [True: 0, False: 0]
  ------------------
13364|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13365|       |          // set state to relative slash state.
13366|      0|          ada_log(
13367|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13368|      0|              "error, set state to relative slash state");
13369|      0|          state = state::RELATIVE_SLASH;
13370|      0|        } else {
13371|      0|          ada_log("RELATIVE_SCHEME otherwise");
13372|       |          // Set url's username to base's username, url's password to base's
13373|       |          // password, url's host to base's host, url's port to base's port,
13374|       |          // url's path to a clone of base's path, and url's query to base's
13375|       |          // query.
13376|       |          if constexpr (result_type_is_ada_url) {
13377|       |            url.username = base_url->username;
13378|       |            url.password = base_url->password;
13379|       |            url.host = base_url->host;
13380|       |            url.port = base_url->port;
13381|       |            // cloning the base path includes cloning the has_opaque_path flag
13382|       |            url.has_opaque_path = base_url->has_opaque_path;
13383|       |            url.path = base_url->path;
13384|       |            url.query = base_url->query;
13385|      0|          } else {
13386|      0|            url.update_base_authority(base_url->get_href(),
13387|      0|                                      base_url->get_components());
13388|      0|            url.update_host_to_base_host(base_url->get_hostname());
13389|      0|            url.update_base_port(base_url->retrieve_base_port());
13390|       |            // cloning the base path includes cloning the has_opaque_path flag
13391|      0|            url.has_opaque_path = base_url->has_opaque_path;
13392|      0|            url.update_base_pathname(base_url->get_pathname());
13393|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13393:17): [True: 0, False: 0]
  ------------------
13394|       |              // get_search() returns "" for an empty query string (URL ends
13395|       |              // with '?'). update_base_search("") would incorrectly clear the
13396|       |              // query, so pass "?" to preserve the empty query distinction.
13397|      0|              auto s = base_url->get_search();
13398|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13398:38): [True: 0, False: 0]
  ------------------
13399|      0|            }
13400|      0|          }
13401|       |
13402|      0|          url.has_opaque_path = base_url->has_opaque_path;
13403|       |
13404|       |          // If c is U+003F (?), then set url's query to the empty string, and
13405|       |          // state to query state.
13406|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13406:15): [True: 0, False: 0]
  ------------------
13407|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13407:15): [True: 0, False: 0]
  ------------------
13408|      0|            state = state::QUERY;
13409|      0|          }
13410|       |          // Otherwise, if c is not the EOF code point:
13411|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13411:20): [True: 0, False: 0]
  ------------------
13412|       |            // Set url's query to null.
13413|      0|            url.clear_search();
13414|       |            if constexpr (result_type_is_ada_url) {
13415|       |              // Shorten url's path.
13416|       |              helpers::shorten_path(url.path, url.type);
13417|      0|            } else {
13418|      0|              std::string_view path = url.get_pathname();
13419|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13419:19): [True: 0, False: 0]
  ------------------
13420|      0|                url.update_base_pathname(std::move(std::string(path)));
13421|      0|              }
13422|      0|            }
13423|       |            // Set state to path state and decrease pointer by 1.
13424|      0|            state = state::PATH;
13425|      0|            break;
13426|      0|          }
13427|      0|        }
13428|      0|        input_position++;
13429|      0|        break;
13430|      0|      }
13431|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13431:7): [True: 0, False: 1.82M]
  ------------------
13432|      0|        ada_log("RELATIVE_SLASH ",
13433|      0|                helpers::substring(url_data, input_position));
13434|       |
13435|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13436|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13437|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13437:13): [True: 0, False: 0]
  |  Branch (13437:33): [True: 0, False: 0]
  ------------------
13438|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13438:14): [True: 0, False: 0]
  ------------------
13439|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13439:14): [True: 0, False: 0]
  ------------------
13440|       |          // Set state to special authority ignore slashes state.
13441|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13442|      0|        }
13443|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13444|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13444:18): [True: 0, False: 0]
  ------------------
13445|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13445:18): [True: 0, False: 0]
  ------------------
13446|      0|          state = state::AUTHORITY;
13447|      0|        }
13448|       |        // Otherwise, set
13449|       |        // - url's username to base's username,
13450|       |        // - url's password to base's password,
13451|       |        // - url's host to base's host,
13452|       |        // - url's port to base's port,
13453|       |        // - state to path state, and then, decrease pointer by 1.
13454|      0|        else {
13455|       |          if constexpr (result_type_is_ada_url) {
13456|       |            url.username = base_url->username;
13457|       |            url.password = base_url->password;
13458|       |            url.host = base_url->host;
13459|       |            url.port = base_url->port;
13460|      0|          } else {
13461|      0|            url.update_base_authority(base_url->get_href(),
13462|      0|                                      base_url->get_components());
13463|      0|            url.update_host_to_base_host(base_url->get_hostname());
13464|      0|            url.update_base_port(base_url->retrieve_base_port());
13465|      0|          }
13466|      0|          state = state::PATH;
13467|      0|          break;
13468|      0|        }
13469|       |
13470|      0|        input_position++;
13471|      0|        break;
13472|      0|      }
13473|   266k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13473:7): [True: 266k, False: 1.55M]
  ------------------
13474|   266k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13475|   266k|                helpers::substring(url_data, input_position));
13476|       |
13477|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13478|       |        // then set state to special authority ignore slashes state and increase
13479|       |        // pointer by 1.
13480|   266k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13480:13): [True: 265k, False: 1.67k]
  ------------------
13481|   265k|          input_position += 2;
13482|   265k|        }
13483|       |
13484|   266k|        [[fallthrough]];
13485|   266k|      }
13486|   266k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13486:7): [True: 0, False: 1.82M]
  ------------------
13487|   266k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13488|   266k|                helpers::substring(url_data, input_position));
13489|       |
13490|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13491|       |        // authority state and decrease pointer by 1.
13492|   268k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13492:16): [True: 268k, False: 77]
  ------------------
13493|   268k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13493:17): [True: 627, False: 268k]
  ------------------
13494|   268k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13494:17): [True: 1.25k, False: 266k]
  ------------------
13495|  1.88k|          input_position++;
13496|  1.88k|        }
13497|   266k|        state = state::AUTHORITY;
13498|       |
13499|   266k|        break;
13500|   266k|      }
13501|  9.73k|      case state::QUERY: {
  ------------------
  |  Branch (13501:7): [True: 9.73k, False: 1.81M]
  ------------------
13502|  9.73k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13503|  9.73k|        if constexpr (store_values) {
13504|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13505|       |          // if url is special; otherwise the query percent-encode set.
13506|  9.73k|          const uint8_t* query_percent_encode_set =
13507|  9.73k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13507:15): [True: 8.56k, False: 1.16k]
  ------------------
13508|  9.73k|                               : character_sets::QUERY_PERCENT_ENCODE;
13509|       |
13510|       |          // Percent-encode after encoding, with encoding, buffer, and
13511|       |          // queryPercentEncodeSet, and append the result to url's query.
13512|  9.73k|          url.update_base_search(url_data.substr(input_position),
13513|  9.73k|                                 query_percent_encode_set);
13514|  9.73k|          ada_log("QUERY update_base_search completed ");
13515|  9.73k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13515:15): [True: 7.21k, False: 2.51k]
  ------------------
13516|  7.21k|            url.update_unencoded_base_hash(*fragment);
13517|  7.21k|          }
13518|  9.73k|        }
13519|  9.73k|        enforce_max_input_length();
13520|  9.73k|        return url;
13521|   266k|      }
13522|   267k|      case state::HOST: {
  ------------------
  |  Branch (13522:7): [True: 267k, False: 1.55M]
  ------------------
13523|   267k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13524|       |
13525|   267k|        std::string_view host_view = url_data.substr(input_position);
13526|   267k|        auto [location, found_colon] =
13527|   267k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13528|   267k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13528:26): [True: 267k, False: 0]
  ------------------
13529|   267k|                             ? input_position + location
13530|   267k|                             : input_size;
13531|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13532|       |        // Note: the 'found_colon' value is true if and only if a colon was
13533|       |        // encountered while not inside brackets.
13534|   267k|        if (found_colon) {
  ------------------
  |  Branch (13534:13): [True: 2.45k, False: 264k]
  ------------------
13535|       |          // If buffer is the empty string, validation error, return failure.
13536|       |          // Let host be the result of host parsing buffer with url is not
13537|       |          // special.
13538|  2.45k|          ada_log("HOST parsing ", host_view);
13539|  2.45k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13539:15): [True: 174, False: 2.28k]
  ------------------
13540|    174|            return url;
13541|    174|          }
13542|  2.28k|          ada_log("HOST parsing results in ", url.get_hostname());
13543|       |          // Set url's host to host, buffer to the empty string, and state to
13544|       |          // port state.
13545|  2.28k|          state = state::PORT;
13546|  2.28k|          input_position++;
13547|  2.28k|        }
13548|       |        // Otherwise, if one of the following is true:
13549|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13550|       |        // - url is special and c is U+005C (\)
13551|       |        // The get_host_delimiter_location function either brings us to
13552|       |        // the colon outside of the bracket, or to one of those characters.
13553|   264k|        else {
13554|       |          // If url is special and host_view is the empty string, validation
13555|       |          // error, return failure.
13556|   264k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13556:15): [True: 196, False: 264k]
  |  Branch (13556:36): [True: 109, False: 87]
  ------------------
13557|    109|            url.is_valid = false;
13558|    109|            return url;
13559|    109|          }
13560|   264k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13561|       |          // Let host be the result of host parsing host_view with url is not
13562|       |          // special.
13563|   264k|          if (host_view.empty()) {
  ------------------
  |  Branch (13563:15): [True: 87, False: 264k]
  ------------------
13564|     87|            url.update_base_hostname("");
13565|   264k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13565:22): [True: 20.8k, False: 243k]
  ------------------
13566|  20.8k|            return url;
13567|  20.8k|          }
13568|   243k|          ada_log("HOST parsing results in ", url.get_hostname(),
13569|   243k|                  " href=", url.get_href());
13570|       |
13571|       |          // Set url's host to host, and state to path start state.
13572|   243k|          state = state::PATH_START;
13573|   243k|        }
13574|       |
13575|   246k|        break;
13576|   267k|      }
13577|   246k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13577:7): [True: 774, False: 1.82M]
  ------------------
13578|    774|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13579|       |        // Opaque path, query, and fragment are structurally always valid:
13580|       |        // the parser would just percent-encode whatever is there. When we
13581|       |        // are not storing values (can_parse), we can return immediately.
13582|       |        // We must set has_opaque_path = true before returning so that when
13583|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13584|       |        // correctly rejects relative inputs against an opaque-path base
13585|       |        // (e.g. can_parse("", &"W:") must return false).
13586|       |        if constexpr (!store_values) {
13587|       |          url.has_opaque_path = true;
13588|       |          return url;
13589|       |        }
13590|    774|        std::string_view view = url_data.substr(input_position);
13591|       |        // If c is U+003F (?), then set url's query to the empty string and
13592|       |        // state to query state.
13593|    774|        size_t location = view.find('?');
13594|    774|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13594:13): [True: 501, False: 273]
  ------------------
13595|    501|          view.remove_suffix(view.size() - location);
13596|    501|          state = state::QUERY;
13597|    501|          input_position += location + 1;
13598|    501|        } else {
13599|    273|          input_position = input_size + 1;
13600|    273|        }
13601|    774|        url.has_opaque_path = true;
13602|       |
13603|       |        // This is a really unlikely scenario in real world. We should not seek
13604|       |        // to optimize it.
13605|    774|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13605:13): [True: 12, False: 762]
  ------------------
13606|     12|          std::string modified_view =
13607|     12|              std::string(view.substr(0, view.size() - 1)) + "%20";
13608|     12|          url.update_base_pathname(unicode::percent_encode(
13609|     12|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13610|    762|        } else {
13611|    762|          url.update_base_pathname(unicode::percent_encode(
13612|    762|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13613|    762|        }
13614|    774|        break;
13615|   267k|      }
13616|  2.28k|      case state::PORT: {
  ------------------
  |  Branch (13616:7): [True: 2.28k, False: 1.81M]
  ------------------
13617|  2.28k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13618|  2.28k|        std::string_view port_view = url_data.substr(input_position);
13619|  2.28k|        input_position += url.parse_port(port_view, true);
13620|  2.28k|        if (!url.is_valid) {
  ------------------
  |  Branch (13620:13): [True: 238, False: 2.04k]
  ------------------
13621|    238|          return url;
13622|    238|        }
13623|  2.04k|        state = state::PATH_START;
13624|  2.04k|        [[fallthrough]];
13625|  2.04k|      }
13626|   247k|      case state::PATH_START: {
  ------------------
  |  Branch (13626:7): [True: 245k, False: 1.57M]
  ------------------
13627|   247k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13628|       |        // Path, query, and fragment are structurally always valid: the
13629|       |        // parser would just percent-encode whatever is there. When we are
13630|       |        // not storing values (can_parse), we can return immediately since
13631|       |        // no subsequent state can invalidate the URL.
13632|       |        if constexpr (!store_values) {
13633|       |          return url;
13634|       |        }
13635|       |
13636|       |        // If url is special, then:
13637|   247k|        if (url.is_special()) {
  ------------------
  |  Branch (13637:13): [True: 246k, False: 690]
  ------------------
13638|       |          // Set state to path state.
13639|   246k|          state = state::PATH;
13640|       |
13641|       |          // Optimization: Avoiding going into PATH state improves the
13642|       |          // performance of urls ending with /.
13643|   246k|          if (input_position == input_size) {
  ------------------
  |  Branch (13643:15): [True: 30.7k, False: 215k]
  ------------------
13644|  30.7k|            if constexpr (store_values) {
13645|  30.7k|              url.update_base_pathname("/");
13646|  30.7k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13646:19): [True: 257, False: 30.5k]
  ------------------
13647|    257|                url.update_unencoded_base_hash(*fragment);
13648|    257|              }
13649|  30.7k|            }
13650|  30.7k|            enforce_max_input_length();
13651|  30.7k|            return url;
13652|  30.7k|          }
13653|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13654|       |          // by 1. We know that (input_position == input_size) is impossible
13655|       |          // here, because of the previous if-check.
13656|   215k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13656:15): [True: 1.01k, False: 214k]
  ------------------
13657|  1.01k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13657:15): [True: 616, False: 403]
  ------------------
13658|    616|            break;
13659|    616|          }
13660|   215k|        }
13661|       |        // Otherwise, if state override is not given and c is U+003F (?),
13662|       |        // set url's query to the empty string and state to query state.
13663|    690|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13663:18): [True: 540, False: 150]
  ------------------
13664|    540|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13664:18): [True: 111, False: 429]
  ------------------
13665|    111|          state = state::QUERY;
13666|    111|        }
13667|       |        // Otherwise, if c is not the EOF code point:
13668|    579|        else if (input_position != input_size) {
  ------------------
  |  Branch (13668:18): [True: 429, False: 150]
  ------------------
13669|       |          // Set state to path state.
13670|    429|          state = state::PATH;
13671|       |
13672|       |          // If c is not U+002F (/), then decrease pointer by 1.
13673|    429|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13673:15): [True: 0, False: 429]
  ------------------
13674|      0|            break;
13675|      0|          }
13676|    429|        }
13677|       |
13678|   215k|        input_position++;
13679|   215k|        break;
13680|   247k|      }
13681|   216k|      case state::PATH: {
  ------------------
  |  Branch (13681:7): [True: 216k, False: 1.60M]
  ------------------
13682|   216k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13683|       |        // Path, query, and fragment are structurally always valid: the
13684|       |        // parser would just percent-encode whatever is there. When we are
13685|       |        // not storing values (can_parse), we can return immediately since
13686|       |        // no subsequent state can invalidate the URL.
13687|       |        if constexpr (!store_values) {
13688|       |          return url;
13689|       |        }
13690|   216k|        std::string_view view = url_data.substr(input_position);
13691|       |
13692|       |        // Most time, we do not need percent encoding.
13693|       |        // Furthermore, we can immediately locate the '?'.
13694|   216k|        size_t locofquestionmark = view.find('?');
13695|   216k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13695:13): [True: 9.11k, False: 207k]
  ------------------
13696|  9.11k|          state = state::QUERY;
13697|  9.11k|          view.remove_suffix(view.size() - locofquestionmark);
13698|  9.11k|          input_position += locofquestionmark + 1;
13699|   207k|        } else {
13700|   207k|          input_position = input_size + 1;
13701|   207k|        }
13702|   216k|        if constexpr (store_values) {
13703|       |          if constexpr (result_type_is_ada_url) {
13704|       |            helpers::parse_prepared_path(view, url.type, url.path);
13705|   216k|          } else {
13706|   216k|            url.consume_prepared_path(view);
13707|   216k|            ADA_ASSERT_TRUE(url.validate());
13708|   216k|          }
13709|   216k|        }
13710|   216k|        break;
13711|   247k|      }
13712|  1.29k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13712:7): [True: 1.29k, False: 1.82M]
  ------------------
13713|  1.29k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13714|       |
13715|       |        // If c is U+002F (/) or U+005C (\), then:
13716|  1.29k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13716:13): [True: 1.28k, False: 1]
  ------------------
13717|  1.28k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13717:14): [True: 1.27k, False: 15]
  ------------------
13718|  1.27k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13718:14): [True: 3, False: 12]
  ------------------
13719|  1.27k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13720|       |          // Set state to file host state.
13721|  1.27k|          state = state::FILE_HOST;
13722|  1.27k|          input_position++;
13723|  1.27k|        } else {
13724|     13|          ada_log("FILE_SLASH otherwise");
13725|       |          // If base is non-null and base's scheme is "file", then:
13726|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13727|       |          // base_url_has_value() is true.
13728|     13|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13728:15): [True: 0, False: 13]
  |  Branch (13728:38): [True: 0, False: 0]
  ------------------
13729|       |            // Set url's host to base's host.
13730|       |            if constexpr (result_type_is_ada_url) {
13731|       |              url.host = base_url->host;
13732|      0|            } else {
13733|      0|              url.update_host_to_base_host(base_url->get_host());
13734|      0|            }
13735|       |            // If the code point substring from pointer to the end of input does
13736|       |            // not start with a Windows drive letter and base's path[0] is a
13737|       |            // normalized Windows drive letter, then append base's path[0] to
13738|       |            // url's path.
13739|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13739:17): [True: 0, False: 0]
  ------------------
13740|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13740:19): [True: 0, False: 0]
  ------------------
13741|      0|                      url_data.substr(input_position))) {
13742|      0|                std::string_view first_base_url_path =
13743|      0|                    base_url->get_pathname().substr(1);
13744|      0|                size_t loc = first_base_url_path.find('/');
13745|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13745:21): [True: 0, False: 0]
  ------------------
13746|      0|                  helpers::resize(first_base_url_path, loc);
13747|      0|                }
13748|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13748:21): [True: 0, False: 0]
  ------------------
13749|      0|                        first_base_url_path)) {
13750|       |                  if constexpr (result_type_is_ada_url) {
13751|       |                    url.path += '/';
13752|       |                    url.path += first_base_url_path;
13753|      0|                  } else {
13754|      0|                    url.append_base_pathname(
13755|      0|                        helpers::concat("/", first_base_url_path));
13756|      0|                  }
13757|      0|                }
13758|      0|              }
13759|      0|            }
13760|      0|          }
13761|       |
13762|       |          // Set state to path state, and decrease pointer by 1.
13763|     13|          state = state::PATH;
13764|     13|        }
13765|       |
13766|  1.29k|        break;
13767|   247k|      }
13768|  1.27k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13768:7): [True: 1.27k, False: 1.82M]
  ------------------
13769|  1.27k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13770|  1.27k|        std::string_view view = url_data.substr(input_position);
13771|       |
13772|  1.27k|        size_t location = view.find_first_of("/\\?");
13773|  1.27k|        std::string_view file_host_buffer = view.substr(
13774|  1.27k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13774:16): [True: 1.23k, False: 41]
  ------------------
13775|       |
13776|  1.27k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13776:13): [True: 1, False: 1.27k]
  ------------------
13777|      1|          state = state::PATH;
13778|  1.27k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13778:20): [True: 264, False: 1.01k]
  ------------------
13779|       |          // Set url's host to the empty string.
13780|       |          if constexpr (result_type_is_ada_url) {
13781|       |            url.host = "";
13782|    264|          } else {
13783|    264|            url.update_base_hostname("");
13784|    264|          }
13785|       |          // Set state to path start state.
13786|    264|          state = state::PATH_START;
13787|  1.01k|        } else {
13788|  1.01k|          size_t consumed_bytes = file_host_buffer.size();
13789|  1.01k|          input_position += consumed_bytes;
13790|       |          // Let host be the result of host parsing buffer with url is not
13791|       |          // special.
13792|  1.01k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13792:15): [True: 100, False: 912]
  ------------------
13793|    100|            return url;
13794|    100|          }
13795|       |
13796|       |          if constexpr (result_type_is_ada_url) {
13797|       |            // If host is "localhost", then set host to the empty string.
13798|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13799|       |              url.host = "";
13800|       |            }
13801|    912|          } else {
13802|    912|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13802:17): [True: 3, False: 909]
  ------------------
13803|      3|              url.update_base_hostname("");
13804|      3|            }
13805|    912|          }
13806|       |
13807|       |          // Set buffer to the empty string and state to path start state.
13808|    912|          state = state::PATH_START;
13809|    912|        }
13810|       |
13811|  1.17k|        break;
13812|  1.27k|      }
13813|  1.39k|      case state::FILE: {
  ------------------
  |  Branch (13813:7): [True: 1.39k, False: 1.82M]
  ------------------
13814|  1.39k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13815|  1.39k|        std::string_view file_view = url_data.substr(input_position);
13816|       |
13817|  1.39k|        url.set_protocol_as_file();
13818|       |        if constexpr (result_type_is_ada_url) {
13819|       |          // Set url's host to the empty string.
13820|       |          url.host = "";
13821|  1.39k|        } else {
13822|  1.39k|          url.update_base_hostname("");
13823|  1.39k|        }
13824|       |        // If c is U+002F (/) or U+005C (\), then:
13825|  1.39k|        if (input_position != input_size &&
  ------------------
  |  Branch (13825:13): [True: 1.39k, False: 1]
  ------------------
13826|  1.39k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13826:14): [True: 1.28k, False: 110]
  ------------------
13827|  1.29k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13827:14): [True: 2, False: 108]
  ------------------
13828|  1.29k|          ada_log("FILE c is U+002F or U+005C");
13829|       |          // Set state to file slash state.
13830|  1.29k|          state = state::FILE_SLASH;
13831|  1.29k|        }
13832|       |        // Otherwise, if base is non-null and base's scheme is "file":
13833|    109|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13833:18): [True: 0, False: 109]
  |  Branch (13833:41): [True: 0, False: 0]
  ------------------
13834|       |          // Set url's host to base's host, url's path to a clone of base's
13835|       |          // path, and url's query to base's query.
13836|      0|          ada_log("FILE base non-null");
13837|       |          if constexpr (result_type_is_ada_url) {
13838|       |            url.host = base_url->host;
13839|       |            url.path = base_url->path;
13840|       |            url.query = base_url->query;
13841|      0|          } else {
13842|      0|            url.update_host_to_base_host(base_url->get_hostname());
13843|      0|            url.update_base_pathname(base_url->get_pathname());
13844|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13844:17): [True: 0, False: 0]
  ------------------
13845|       |              // get_search() returns "" for an empty query string (URL ends
13846|       |              // with '?'). update_base_search("") would incorrectly clear the
13847|       |              // query, so pass "?" to preserve the empty query distinction.
13848|      0|              auto s = base_url->get_search();
13849|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13849:38): [True: 0, False: 0]
  ------------------
13850|      0|            }
13851|      0|          }
13852|      0|          url.has_opaque_path = base_url->has_opaque_path;
13853|       |
13854|       |          // If c is U+003F (?), then set url's query to the empty string and
13855|       |          // state to query state.
13856|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13856:15): [True: 0, False: 0]
  |  Branch (13856:47): [True: 0, False: 0]
  ------------------
13857|      0|            state = state::QUERY;
13858|      0|          }
13859|       |          // Otherwise, if c is not the EOF code point:
13860|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13860:20): [True: 0, False: 0]
  ------------------
13861|       |            // Set url's query to null.
13862|      0|            url.clear_search();
13863|       |            // If the code point substring from pointer to the end of input does
13864|       |            // not start with a Windows drive letter, then shorten url's path.
13865|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13865:17): [True: 0, False: 0]
  ------------------
13866|       |              if constexpr (result_type_is_ada_url) {
13867|       |                helpers::shorten_path(url.path, url.type);
13868|      0|              } else {
13869|      0|                std::string_view path = url.get_pathname();
13870|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13870:21): [True: 0, False: 0]
  ------------------
13871|      0|                  url.update_base_pathname(std::move(std::string(path)));
13872|      0|                }
13873|      0|              }
13874|      0|            }
13875|       |            // Otherwise:
13876|      0|            else {
13877|       |              // Set url's path to an empty list.
13878|      0|              url.clear_pathname();
13879|      0|            }
13880|       |
13881|       |            // Set state to path state and decrease pointer by 1.
13882|      0|            state = state::PATH;
13883|      0|            break;
13884|      0|          }
13885|      0|        }
13886|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13887|    109|        else {
13888|    109|          ada_log("FILE go to path");
13889|    109|          state = state::PATH;
13890|    109|          break;
13891|    109|        }
13892|       |
13893|  1.29k|        input_position++;
13894|  1.29k|        break;
13895|  1.39k|      }
13896|      0|      default:
  ------------------
  |  Branch (13896:7): [True: 0, False: 1.82M]
  ------------------
13897|      0|        unreachable();
13898|  1.82M|    }
13899|  1.82M|  }
13900|   566k|  if constexpr (store_values) {
13901|   566k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13901:9): [True: 2.23k, False: 564k]
  ------------------
13902|  2.23k|      url.update_unencoded_base_hash(*fragment);
13903|  2.23k|    }
13904|   566k|  }
13905|   566k|  enforce_max_input_length();
13906|   566k|  return url;
13907|   628k|}
_ZN3ada14url_aggregator8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14510|   202k|bool url_aggregator::set_href(const std::string_view input) {
14511|   202k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14512|   202k|  ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
14513|   202k|  ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
14514|   202k|  ada_log("url_aggregator::set_href, success :", out.has_value());
14515|       |
14516|   202k|  if (out) {
  ------------------
  |  Branch (14516:7): [True: 202k, False: 0]
  ------------------
14517|       |    // The parser enforces get_max_input_length() on both the input and the
14518|       |    // normalized result. This is a defense-in-depth check.
14519|   202k|    if (out->buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (14519:9): [True: 0, False: 202k]
  ------------------
14520|      0|      return false;
14521|      0|    }
14522|   202k|    ada_log("url_aggregator::set_href, parsed ", out->to_string());
14523|       |    // TODO: Figure out why the following line puts test to never finish.
14524|   202k|    *this = std::move(*out);
14525|   202k|  }
14526|       |
14527|   202k|  return out.has_value();
14528|   202k|}
_ZNK3ada14url_aggregator12get_usernameEv:
14906|   202k|    ada_lifetime_bound {
14907|   202k|  ada_log("url_aggregator::get_username");
14908|   202k|  if (has_non_empty_username()) {
  ------------------
  |  Branch (14908:7): [True: 10.3k, False: 191k]
  ------------------
14909|  10.3k|    return helpers::substring(buffer, components.protocol_end + 2,
14910|  10.3k|                              components.username_end);
14911|  10.3k|  }
14912|   191k|  return "";
14913|   202k|}
_ZNK3ada14url_aggregator12get_passwordEv:
14916|   202k|    ada_lifetime_bound {
14917|   202k|  ada_log("url_aggregator::get_password");
14918|   202k|  if (has_non_empty_password()) {
  ------------------
  |  Branch (14918:7): [True: 9.97k, False: 192k]
  ------------------
14919|  9.97k|    return helpers::substring(buffer, components.username_end + 1,
14920|  9.97k|                              components.host_start);
14921|  9.97k|  }
14922|   192k|  return "";
14923|   202k|}
_ZNK3ada14url_aggregator8get_portEv:
14926|   202k|    ada_lifetime_bound {
14927|   202k|  ada_log("url_aggregator::get_port");
14928|   202k|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (14928:7): [True: 181k, False: 21.2k]
  ------------------
14929|   181k|    return "";
14930|   181k|  }
14931|  21.2k|  return helpers::substring(buffer, components.host_end + 1,
14932|  21.2k|                            components.pathname_start);
14933|   202k|}
_ZNK3ada14url_aggregator8get_hashEv:
14936|   202k|    ada_lifetime_bound {
14937|   202k|  ada_log("url_aggregator::get_hash");
14938|       |  // If this's URL's fragment is either null or the empty string, then return
14939|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
14940|   202k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (14940:7): [True: 177k, False: 24.8k]
  ------------------
14941|   177k|    return "";
14942|   177k|  }
14943|  24.8k|  if (buffer.size() - components.hash_start <= 1) {
  ------------------
  |  Branch (14943:7): [True: 1.50k, False: 23.3k]
  ------------------
14944|  1.50k|    return "";
14945|  1.50k|  }
14946|  23.3k|  return helpers::substring(buffer, components.hash_start);
14947|  24.8k|}
_ZNK3ada14url_aggregator8get_hostEv:
14950|   202k|    ada_lifetime_bound {
14951|   202k|  ada_log("url_aggregator::get_host");
14952|       |  // Technically, we should check if there is a hostname, but
14953|       |  // the code below works even if there isn't.
14954|       |  // if(!has_hostname()) { return ""; }
14955|   202k|  size_t start = components.host_start;
14956|   202k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14956:7): [True: 201k, False: 529]
  ------------------
14957|   201k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14957:7): [True: 10.3k, False: 191k]
  ------------------
14958|  10.3k|    start++;
14959|  10.3k|  }
14960|       |  // if we have an empty host, then the space between components.host_end and
14961|       |  // components.pathname_start may be occupied by /.
14962|   202k|  if (start == components.host_end) {
  ------------------
  |  Branch (14962:7): [True: 529, False: 201k]
  ------------------
14963|    529|    return {};
14964|    529|  }
14965|   201k|  return helpers::substring(buffer, start, components.pathname_start);
14966|   202k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14969|   267k|    ada_lifetime_bound {
14970|   267k|  ada_log("url_aggregator::get_hostname");
14971|       |  // Technically, we should check if there is a hostname, but
14972|       |  // the code below works even if there isn't.
14973|       |  // if(!has_hostname()) { return ""; }
14974|   267k|  size_t start = components.host_start;
14975|       |  // So host_start is not where the host begins.
14976|   267k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14976:7): [True: 202k, False: 64.9k]
  ------------------
14977|   202k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14977:7): [True: 10.5k, False: 192k]
  ------------------
14978|  10.5k|    start++;
14979|  10.5k|  }
14980|   267k|  return helpers::substring(buffer, start, components.host_end);
14981|   267k|}
_ZNK3ada14url_aggregator10get_searchEv:
14984|   202k|    ada_lifetime_bound {
14985|   202k|  ada_log("url_aggregator::get_search");
14986|       |  // If this's URL's query is either null or the empty string, then return the
14987|       |  // empty string. Return U+003F (?), followed by this's URL's query.
14988|   202k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (14988:7): [True: 167k, False: 34.4k]
  ------------------
14989|   167k|    return "";
14990|   167k|  }
14991|  34.4k|  auto ending_index = uint32_t(buffer.size());
14992|  34.4k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (14992:7): [True: 13.6k, False: 20.7k]
  ------------------
14993|  13.6k|    ending_index = components.hash_start;
14994|  13.6k|  }
14995|  34.4k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (14995:7): [True: 1.13k, False: 33.2k]
  ------------------
14996|  1.13k|    return "";
14997|  1.13k|  }
14998|  33.2k|  return helpers::substring(buffer, components.search_start, ending_index);
14999|  34.4k|}
_ZNK3ada14url_aggregator12get_protocolEv:
15002|   202k|    ada_lifetime_bound {
15003|   202k|  ada_log("url_aggregator::get_protocol");
15004|   202k|  return helpers::substring(buffer, 0, components.protocol_end);
15005|   202k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
15114|  59.1k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
15115|  59.1k|  ada_log("parse_ipv4 ", input, " [", input.size(),
15116|  59.1k|          " bytes], overlaps with buffer: ",
15117|  59.1k|          helpers::overlaps(input, buffer) ? "yes" : "no");
15118|  59.1k|  ADA_ASSERT_TRUE(validate());
15119|  59.1k|  if (input.empty()) {
  ------------------
  |  Branch (15119:7): [True: 0, False: 59.1k]
  ------------------
15120|      0|    return is_valid = false;
15121|      0|  }
15122|  59.1k|  const bool trailing_dot = (input.back() == '.');
15123|  59.1k|  if (trailing_dot) {
  ------------------
  |  Branch (15123:7): [True: 28.6k, False: 30.5k]
  ------------------
15124|  28.6k|    input.remove_suffix(1);
15125|  28.6k|    if (input.empty()) {
  ------------------
  |  Branch (15125:9): [True: 0, False: 28.6k]
  ------------------
15126|      0|      return is_valid = false;
15127|      0|    }
15128|  28.6k|  }
15129|       |
15130|  59.1k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
15131|  59.1k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (15131:7): [True: 19.0k, False: 40.0k]
  ------------------
15132|       |    // Pure decimal: keep the buffer when it already holds the address.
15133|       |    // Otherwise write the (trailing-dot-stripped) input.
15134|  19.0k|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (15134:11): [True: 0, False: 19.0k]
  |  Branch (15134:23): [True: 0, False: 0]
  ------------------
15135|  19.0k|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (15135:11): [True: 0, False: 19.0k]
  ------------------
15136|      0|        update_base_hostname(std::string(input));
15137|  19.0k|      } else {
15138|  19.0k|        update_base_hostname(input);
15139|  19.0k|      }
15140|  19.0k|    }
15141|  19.0k|    host_type = IPV4;
15142|  19.0k|    ADA_ASSERT_TRUE(validate());
15143|  19.0k|    return true;
15144|  19.0k|  }
15145|       |
15146|  40.0k|  const char* p = input.data();
15147|  40.0k|  const char* end = p + input.size();
15148|  40.0k|  uint64_t ipv4 = 0;
15149|  40.0k|  int digit_count = 0;
15150|  40.0k|  int pure_decimal_count = 0;
15151|       |
15152|  50.4k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (15152:10): [True: 50.4k, False: 16]
  |  Branch (15152:29): [True: 50.4k, False: 0]
  ------------------
15153|  50.4k|    uint64_t segment = 0;
15154|  50.4k|    bool pure = false;
15155|  50.4k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (15155:9): [True: 19.3k, False: 31.0k]
  ------------------
15156|  19.3k|      return is_valid = false;
15157|  19.3k|    }
15158|  31.0k|    if (pure) {
  ------------------
  |  Branch (15158:9): [True: 11.4k, False: 19.6k]
  ------------------
15159|  11.4k|      ++pure_decimal_count;
15160|  11.4k|    }
15161|  31.0k|    if (p >= end) {
  ------------------
  |  Branch (15161:9): [True: 20.6k, False: 10.3k]
  ------------------
15162|  20.6k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
15163|  20.6k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (15163:11): [True: 24, False: 20.6k]
  ------------------
15164|     24|        return is_valid = false;
15165|     24|      }
15166|  20.6k|      ipv4 = (ipv4 << shift) | segment;
15167|  20.6k|      goto ipv4_done;
15168|  20.6k|    }
15169|  10.3k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (15169:9): [True: 42, False: 10.3k]
  |  Branch (15169:26): [True: 0, False: 10.3k]
  ------------------
15170|     42|      return is_valid = false;
15171|     42|    }
15172|  10.3k|    ipv4 = (ipv4 << 8) | segment;
15173|  10.3k|    ++p;
15174|  10.3k|  }
15175|     16|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (15175:7): [True: 0, False: 16]
  |  Branch (15175:27): [True: 16, False: 0]
  ------------------
15176|     16|    return is_valid = false;
15177|     16|  }
15178|  20.6k|ipv4_done:
15179|  20.6k|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
15180|  20.6k|          " host: ", get_host());
15181|  20.6k|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (15181:7): [True: 0, False: 20.6k]
  |  Branch (15181:19): [True: 0, False: 0]
  |  Branch (15181:46): [True: 0, False: 0]
  ------------------
15182|      0|    ada_log(
15183|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
15184|      0|        "buffer");
15185|  20.6k|  } else {
15186|  20.6k|    update_base_hostname(ada::serializers::ipv4(ipv4));
15187|  20.6k|  }
15188|  20.6k|  host_type = IPV4;
15189|  20.6k|  ADA_ASSERT_TRUE(validate());
15190|  20.6k|  return true;
15191|     16|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15193|    581|bool url_aggregator::parse_ipv6(std::string_view input) {
15194|    581|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
15195|    581|  ADA_ASSERT_TRUE(validate());
15196|    581|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15197|    581|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (15197:7): [True: 13, False: 568]
  |  Branch (15197:24): [True: 11, False: 557]
  ------------------
15198|     24|    return is_valid = false;
15199|     24|  }
15200|    557|  std::array<uint16_t, 8> address{};
15201|       |#if defined(ADA_AVX512_IPV6)
15202|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
15203|       |                                                     address, simd_valid)) {
15204|       |    if (!simd_valid) [[unlikely]] {
15205|       |      return is_valid = false;
15206|       |    }
15207|       |    const std::string serialized = ada::serializers::ipv6(address);
15208|       |    if (get_hostname() != serialized) {
15209|       |      update_base_hostname(serialized);
15210|       |    }
15211|       |    host_type = IPV6;
15212|       |    return true;
15213|       |  }
15214|       |  address = {};
15215|       |#endif
15216|    557|  const char* pointer = input.data();
15217|    557|  const char* const end = pointer + input.size();
15218|    557|  int piece_index = 0;
15219|    557|  int compress = -1;
15220|       |
15221|    557|  if (*pointer == ':') {
  ------------------
  |  Branch (15221:7): [True: 247, False: 310]
  ------------------
15222|    247|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (15222:9): [True: 3, False: 244]
  |  Branch (15222:30): [True: 3, False: 241]
  ------------------
15223|      6|      return is_valid = false;
15224|      6|    }
15225|    241|    pointer += 2;
15226|    241|    compress = ++piece_index;
15227|    241|  }
15228|       |
15229|  1.77k|  while (pointer != end) {
  ------------------
  |  Branch (15229:10): [True: 1.33k, False: 435]
  ------------------
15230|  1.33k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (15230:9): [True: 3, False: 1.33k]
  ------------------
15231|      3|      return is_valid = false;
15232|      3|    }
15233|  1.33k|    if (*pointer == ':') {
  ------------------
  |  Branch (15233:9): [True: 163, False: 1.17k]
  ------------------
15234|    163|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (15234:11): [True: 3, False: 160]
  ------------------
15235|      3|        return is_valid = false;
15236|      3|      }
15237|    160|      ++pointer;
15238|    160|      compress = ++piece_index;
15239|    160|      continue;
15240|    163|    }
15241|       |
15242|  1.17k|    uint16_t value = 0;
15243|  1.17k|    const int length = detail::parse_hex_piece(pointer, end, value);
15244|       |
15245|  1.17k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (15245:9): [True: 936, False: 237]
  |  Branch (15245:27): [True: 83, False: 853]
  ------------------
15246|     83|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15246:11): [True: 3, False: 80]
  ------------------
15247|      3|        return is_valid = false;
15248|      3|      }
15249|     80|      pointer -= length;
15250|     80|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (15250:11): [True: 3, False: 77]
  ------------------
15251|      3|        return is_valid = false;
15252|      3|      }
15253|       |
15254|     77|      int numbers_seen = 0;
15255|    212|      while (pointer != end) {
  ------------------
  |  Branch (15255:14): [True: 194, False: 18]
  ------------------
15256|    194|        int ipv4_piece = -1;
15257|    194|        if (numbers_seen > 0) {
  ------------------
  |  Branch (15257:13): [True: 117, False: 77]
  ------------------
15258|    117|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (15258:15): [True: 102, False: 15]
  |  Branch (15258:34): [True: 97, False: 5]
  ------------------
15259|     97|            ++pointer;
15260|     97|          } else {
15261|     20|            return is_valid = false;
15262|     20|          }
15263|    117|        }
15264|    174|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (15264:13): [True: 19, False: 155]
  |  Branch (15264:31): [True: 5, False: 150]
  |  Branch (15264:49): [True: 6, False: 144]
  ------------------
15265|     30|          return is_valid = false;
15266|     30|        }
15267|    144|        ipv4_piece = *pointer - '0';
15268|    144|        ++pointer;
15269|    144|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15269:13): [True: 134, False: 10]
  |  Branch (15269:31): [True: 59, False: 75]
  |  Branch (15269:50): [True: 56, False: 3]
  ------------------
15270|     56|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (15270:15): [True: 3, False: 53]
  ------------------
15271|      3|            return is_valid = false;
15272|      3|          }
15273|     53|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15274|     53|          ++pointer;
15275|     53|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15275:15): [True: 50, False: 3]
  |  Branch (15275:33): [True: 32, False: 18]
  |  Branch (15275:52): [True: 28, False: 4]
  ------------------
15276|     28|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15277|     28|            ++pointer;
15278|     28|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (15278:17): [True: 6, False: 22]
  ------------------
15279|      6|              return is_valid = false;
15280|      6|            }
15281|     28|          }
15282|     53|        }
15283|    135|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
15284|    135|            address[static_cast<size_t>(piece_index)] * 0x100 +
15285|    135|            static_cast<uint16_t>(ipv4_piece));
15286|    135|        ++numbers_seen;
15287|    135|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (15287:13): [True: 39, False: 96]
  |  Branch (15287:34): [True: 13, False: 83]
  ------------------
15288|     52|          ++piece_index;
15289|     52|        }
15290|    135|      }
15291|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (15291:11): [True: 12, False: 6]
  ------------------
15292|     12|        return is_valid = false;
15293|     12|      }
15294|      6|      break;
15295|     18|    }
15296|       |
15297|  1.09k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15297:9): [True: 19, False: 1.07k]
  ------------------
15298|     19|      return is_valid = false;
15299|     19|    }
15300|       |
15301|  1.07k|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (15301:9): [True: 834, False: 237]
  |  Branch (15301:27): [True: 830, False: 4]
  ------------------
15302|    830|      ++pointer;
15303|    830|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (15303:11): [True: 4, False: 826]
  ------------------
15304|      4|        return is_valid = false;
15305|      4|      }
15306|    830|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (15306:16): [True: 4, False: 237]
  ------------------
15307|      4|      return is_valid = false;
15308|      4|    }
15309|       |
15310|  1.06k|    address[static_cast<size_t>(piece_index)] = value;
15311|  1.06k|    ++piece_index;
15312|  1.06k|  }
15313|       |
15314|    441|  if (compress != -1) {
  ------------------
  |  Branch (15314:7): [True: 391, False: 50]
  ------------------
15315|    391|    const int right = piece_index - compress;
15316|    391|    if (right > 0) {
  ------------------
  |  Branch (15316:9): [True: 193, False: 198]
  ------------------
15317|    193|      const size_t dest = static_cast<size_t>(8 - right);
15318|    193|      const size_t src = static_cast<size_t>(compress);
15319|    193|      if (dest != src) {
  ------------------
  |  Branch (15319:11): [True: 175, False: 18]
  ------------------
15320|    496|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (15320:53): [True: 321, False: 175]
  ------------------
15321|    321|          address[dest + i] = address[src + i];
15322|    321|          address[src + i] = 0;
15323|    321|        }
15324|    175|      }
15325|    193|    }
15326|    391|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (15326:14): [True: 21, False: 29]
  ------------------
15327|     21|    return is_valid = false;
15328|     21|  }
15329|       |
15330|       |  // Serialize once; skip rewrite when hostname is already canonical.
15331|    420|  const std::string serialized = ada::serializers::ipv6(address);
15332|    420|  const std::string_view current = get_hostname();
15333|    420|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (15333:7): [True: 0, False: 420]
  ------------------
15334|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (15334:7): [True: 0, False: 0]
  ------------------
15335|      0|    ada_log("parse_ipv6 in-place canonical match");
15336|    420|  } else {
15337|    420|    update_base_hostname(serialized);
15338|    420|  }
15339|    420|  ada_log("parse_ipv6 ", get_hostname());
15340|    420|  ADA_ASSERT_TRUE(validate());
15341|    420|  host_type = IPV6;
15342|    420|  return true;
15343|    441|}
_ZN3ada14url_aggregator17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15345|    643|bool url_aggregator::parse_opaque_host(std::string_view input) {
15346|    643|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
15347|    643|  ADA_ASSERT_TRUE(validate());
15348|    643|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15349|    643|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (15349:7): [True: 40, False: 603]
  ------------------
15350|     40|    return is_valid = false;
15351|     40|  }
15352|       |
15353|       |  // Return the result of running UTF-8 percent-encode on input using the C0
15354|       |  // control percent-encode set.
15355|    603|  size_t idx = ada::unicode::percent_encode_index(
15356|    603|      input, character_sets::C0_CONTROL_PERCENT_ENCODE);
15357|    603|  if (idx == input.size()) {
  ------------------
  |  Branch (15357:7): [True: 563, False: 40]
  ------------------
15358|    563|    update_base_hostname(input);
15359|    563|  } else {
15360|       |    // We only create a temporary string if we need to.
15361|     40|    update_base_hostname(ada::unicode::percent_encode(
15362|     40|        input, character_sets::C0_CONTROL_PERCENT_ENCODE, idx));
15363|     40|  }
15364|    603|  ADA_ASSERT_TRUE(validate());
15365|    603|  return true;
15366|    643|}
simple_absolute.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  274|   216k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  275|       |    // -65 is 0b10111111, anything larger in two-complement's
  276|       |    // should start a new code point.
  277|   216k|    return c > -65;
  278|   216k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  481|      2|inline Huff make_fixed_litlen_huff() {
  482|      2|  Huff h;
  483|      2|  uint8_t lens[288];
  484|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  485|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (485:19): [True: 288, False: 2]
  ------------------
  486|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (486:21): [True: 224, False: 2]
  ------------------
  487|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (487:21): [True: 48, False: 2]
  ------------------
  488|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (488:21): [True: 16, False: 2]
  ------------------
  489|      2|  h.build(lens, 288);
  490|      2|  return h;
  491|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  430|     16|  bool build(const uint8_t* lens, int n) {
  431|     16|    std::memset(counts, 0, sizeof(counts));
  432|     16|    std::memset(first_code, 0, sizeof(first_code));
  433|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  434|     16|    nsymbols = n;
  435|     16|    max_bits = 0;
  436|  1.99k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (436:21): [True: 1.97k, False: 16]
  ------------------
  437|  1.97k|      lengths[i] = lens[i];
  438|  1.97k|      if (lens[i]) {
  ------------------
  |  Branch (438:11): [True: 1.93k, False: 41]
  ------------------
  439|  1.93k|        counts[lens[i]]++;
  440|  1.93k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (440:13): [True: 48, False: 1.88k]
  ------------------
  441|  1.93k|      }
  442|  1.97k|    }
  443|       |    // Canonical first code for each bit length (RFC 1951).
  444|     16|    int code = 0;
  445|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (445:24): [True: 240, False: 16]
  ------------------
  446|    240|      code = (code + counts[bits - 1]) << 1;
  447|    240|      first_code[bits] = code;
  448|    240|    }
  449|     16|    int idx = 0;
  450|    157|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (450:24): [True: 141, False: 16]
  ------------------
  451|    141|      base_idx[bits] = idx;
  452|       |      // assign symbols in symbol order for codes of this length
  453|  21.7k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (453:25): [True: 21.6k, False: 141]
  ------------------
  454|  21.6k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (454:13): [True: 1.93k, False: 19.6k]
  ------------------
  455|  1.93k|          symbols[idx++] = static_cast<int16_t>(sym);
  456|  1.93k|        }
  457|  21.6k|      }
  458|    141|    }
  459|     16|    return true;
  460|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  493|      2|inline Huff make_fixed_dist_huff() {
  494|      2|  Huff h;
  495|      2|  uint8_t lens[32];
  496|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (496:19): [True: 64, False: 2]
  ------------------
  497|      2|  h.build(lens, 32);
  498|      2|  return h;
  499|      2|}
simple_absolute.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5260|   370k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5261|   370k|    return 0x101010101010101ull * v;
 5262|   370k|  };
_ZN3ada4idna13ensure_tablesEv:
 4983|  33.4k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4984|  33.4k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4985|  33.4k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4985:7): [True: 33.4k, False: 1]
  ------------------
 4986|  33.4k|    return true;
 4987|  33.4k|  }
 4988|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4988:7): [True: 0, False: 1]
  ------------------
 4989|      0|    return false;
 4990|      0|  }
 4991|       |
 4992|      1|  uint8_t expected = kTablesUninit;
 4993|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4993:7): [True: 1, False: 0]
  ------------------
 4994|      1|                                                std::memory_order_acq_rel,
 4995|      1|                                                std::memory_order_acquire)) {
 4996|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4997|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4997:9): [True: 0, False: 1]
  ------------------
 4998|       |      // Leave the state uninitialized so a later call can retry. A corrupt
 4999|       |      // blob (below) is permanent; running out of memory may not be.
 5000|       |      // LCOV_EXCL_START
 5001|      0|      tables_init_state.store(kTablesUninit, std::memory_order_release);
 5002|      0|      return false;
 5003|       |      // LCOV_EXCL_STOP
 5004|      0|    }
 5005|       |
 5006|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 5007|      1|                                          table_blob::compressed_size, buffer,
 5008|      1|                                          table_blob::uncompressed_size);
 5009|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (5009:9): [True: 0, False: 1]
  ------------------
 5010|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (5010:9): [True: 0, False: 1]
  ------------------
 5011|      0|      delete[] buffer;
 5012|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5013|      0|      return false;
 5014|      0|    }
 5015|       |
 5016|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 5017|      1|    detail::convert_table_blob_to_host_endian(buffer);
 5018|       |
 5019|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|      1|      return buffer + off;
 5021|      1|    };
 5022|       |
 5023|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 5024|       |    // acquire on tables_init_state and then observe these writes.
 5025|      1|    idna_stage1 =
 5026|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 5027|      1|    idna_stage2 =
 5028|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 5029|      1|    idna_bool_blocks =
 5030|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 5031|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 5032|       |
 5033|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 5034|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 5035|      1|        at(table_blob::off_decomposition_block));
 5036|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 5037|      1|        at(table_blob::off_decomposition_data));
 5038|      1|    ccc_index = at(table_blob::off_ccc_index);
 5039|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 5040|      1|    composition_index = at(table_blob::off_composition_index);
 5041|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 5042|      1|        at(table_blob::off_composition_block));
 5043|      1|    composition_data =
 5044|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 5045|      1|    nfc_qc_index = at(table_blob::off_nfc_qc_index);
 5046|      1|    nfc_qc_block_flat = at(table_blob::off_nfc_qc_block);
 5047|       |
 5048|      1|    id_continue =
 5049|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 5050|      1|    id_start =
 5051|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 5052|       |
 5053|      1|    dir_index = at(table_blob::off_dir_index);
 5054|      1|    dir_block_flat = at(table_blob::off_dir_block);
 5055|      1|    combining_ranges =
 5056|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 5057|      1|    joining_start =
 5058|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_start));
 5059|      1|    joining_final =
 5060|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_final));
 5061|      1|    joining_value = at(table_blob::off_joining_value);
 5062|       |
 5063|      1|    tables_buffer = buffer;
 5064|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 5065|      1|    return true;
 5066|      1|  }
 5067|       |
 5068|       |  // Another thread owns init (or finished between our loads).
 5069|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (5069:28): [True: 0, False: 0]
  ------------------
 5070|      0|    state = tables_init_state.load(std::memory_order_acquire);
 5071|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (5071:9): [True: 0, False: 0]
  ------------------
 5072|      0|      return true;
 5073|      0|    }
 5074|       |    // Failed is permanent. Uninit means the peer gave up after a failed
 5075|       |    // allocation: do not spin, the next call can take the init slot. One
 5076|       |    // comparison, same shape as the old Failed check, so this wait loop does
 5077|       |    // not grow the unity translation unit.
 5078|       |    // LCOV_EXCL_START
 5079|      0|    if (state != kTablesInProgress) {
  ------------------
  |  Branch (5079:9): [True: 0, False: 0]
  ------------------
 5080|      0|      return false;
 5081|      0|    }
 5082|       |    // LCOV_EXCL_STOP
 5083|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 5084|      0|    defined(_M_IX86)
 5085|      0|#if defined(__GNUC__) || defined(__clang__)
 5086|      0|    __builtin_ia32_pause();
 5087|      0|#endif
 5088|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 5089|       |#if defined(__GNUC__) || defined(__clang__)
 5090|       |    asm volatile("yield" ::: "memory");
 5091|       |#endif
 5092|       |#endif
 5093|      0|  }
 5094|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 5095|      0|  return false;
 5096|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  526|      1|                          size_t dst_cap) {
  527|      1|  BitReader br(src, src_len);
  528|      1|  size_t out = 0;
  529|      4|  for (;;) {
  530|      4|    uint32_t bfinal = br.get(1);
  531|      4|    uint32_t btype = br.get(2);
  532|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (532:9): [True: 0, False: 4]
  |  Branch (532:33): [True: 0, False: 4]
  ------------------
  533|      4|    if (btype == 0) {
  ------------------
  |  Branch (533:9): [True: 0, False: 4]
  ------------------
  534|       |      // stored
  535|      0|      br.align_byte();
  536|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (536:11): [True: 0, False: 0]
  ------------------
  537|       |      // read 16+16 from bit buffer awkwardly - use byte path
  538|       |      // Align: bits is multiple of 8
  539|       |      // Get len from remaining bits then bytes
  540|      0|      uint32_t len = br.get(16);
  541|      0|      uint32_t nlen = br.get(16);
  542|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  |  Branch (542:32): [True: 0, False: 0]
  ------------------
  543|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (543:11): [True: 0, False: 0]
  ------------------
  544|       |      // After get, may have bits in acc from previous - for stored, should be
  545|       |      // byte aligned Copy len bytes from p
  546|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (546:11): [True: 0, False: 0]
  ------------------
  547|       |        // leftover bits should be 0 if aligned
  548|      0|      }
  549|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (550:11): [True: 0, False: 0]
  ------------------
  551|      0|      std::memcpy(dst + out, br.p, len);
  552|      0|      br.p += len;
  553|      0|      out += len;
  554|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (554:16): [True: 0, False: 4]
  |  Branch (554:30): [True: 4, False: 0]
  ------------------
  555|      4|      Huff lit, dist;
  556|      4|      if (btype == 1) {
  ------------------
  |  Branch (556:11): [True: 0, False: 4]
  ------------------
  557|       |        // use fixed via functions
  558|      4|      } else {
  559|       |        // dynamic
  560|      4|        uint32_t hlit = br.get(5);
  561|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (561:13): [True: 0, False: 4]
  ------------------
  562|      4|        hlit += 257;
  563|      4|        uint32_t hdist = br.get(5);
  564|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (564:13): [True: 0, False: 4]
  ------------------
  565|      4|        hdist += 1;
  566|      4|        uint32_t hclen = br.get(4);
  567|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (567:13): [True: 0, False: 4]
  ------------------
  568|      4|        hclen += 4;
  569|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  570|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  571|      4|        uint8_t clen[19]{};
  572|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (572:30): [True: 65, False: 4]
  ------------------
  573|     65|          uint32_t v = br.get(3);
  574|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (574:15): [True: 0, False: 65]
  ------------------
  575|     65|          clen[order[i]] = uint8_t(v);
  576|     65|        }
  577|      4|        Huff cl;
  578|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (578:13): [True: 0, False: 4]
  ------------------
  579|      4|        uint8_t lens[288 + 32]{};
  580|      4|        uint32_t n = hlit + hdist;
  581|  1.06k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (581:30): [True: 1.06k, False: 4]
  ------------------
  582|  1.06k|          int sym = cl.decode(br);
  583|  1.06k|          if (sym < 0) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 1.06k]
  ------------------
  584|  1.06k|          if (sym < 16) {
  ------------------
  |  Branch (584:15): [True: 1.00k, False: 60]
  ------------------
  585|  1.00k|            lens[i++] = uint8_t(sym);
  586|  1.00k|          } else if (sym == 16) {
  ------------------
  |  Branch (586:22): [True: 60, False: 0]
  ------------------
  587|     60|            uint32_t rep = br.get(2);
  588|     60|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (588:17): [True: 0, False: 60]
  ------------------
  589|     60|            rep += 3;
  590|     60|            if (i == 0) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 60]
  ------------------
  591|     60|            uint8_t v = lens[i - 1];
  592|    318|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (592:20): [True: 258, False: 60]
  ------------------
  593|     60|          } else if (sym == 17) {
  ------------------
  |  Branch (593:22): [True: 0, False: 0]
  ------------------
  594|      0|            uint32_t rep = br.get(3);
  595|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (595:17): [True: 0, False: 0]
  ------------------
  596|      0|            rep += 3;
  597|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (597:20): [True: 0, False: 0]
  ------------------
  598|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (598:22): [True: 0, False: 0]
  ------------------
  599|      0|            uint32_t rep = br.get(7);
  600|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|            rep += 11;
  602|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (602:20): [True: 0, False: 0]
  ------------------
  603|      0|          } else
  604|      0|            return 0;
  605|  1.06k|        }
  606|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (606:13): [True: 0, False: 4]
  ------------------
  607|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (607:13): [True: 0, False: 4]
  ------------------
  608|      4|      }
  609|  53.6k|      for (;;) {
  610|  53.6k|        int sym;
  611|  53.6k|        if (btype == 1)
  ------------------
  |  Branch (611:13): [True: 0, False: 53.6k]
  ------------------
  612|      0|          sym = fixed_litlen(br);
  613|  53.6k|        else
  614|  53.6k|          sym = lit.decode(br);
  615|  53.6k|        if (sym < 0) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 53.6k]
  ------------------
  616|  53.6k|        if (sym < 256) {
  ------------------
  |  Branch (616:13): [True: 38.1k, False: 15.5k]
  ------------------
  617|  38.1k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (617:15): [True: 0, False: 38.1k]
  ------------------
  618|  38.1k|          dst[out++] = uint8_t(sym);
  619|  38.1k|        } else if (sym == 256) {
  ------------------
  |  Branch (619:20): [True: 4, False: 15.5k]
  ------------------
  620|      4|          break;
  621|  15.5k|        } else {
  622|  15.5k|          int len_code = sym - 257;
  623|  15.5k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (623:15): [True: 0, False: 15.5k]
  |  Branch (623:31): [True: 0, False: 15.5k]
  ------------------
  624|  15.5k|          uint32_t extra = br.get(len_extra[len_code]);
  625|  15.5k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (625:15): [True: 2.60k, False: 12.9k]
  |  Branch (625:38): [True: 0, False: 2.60k]
  ------------------
  626|  15.5k|          uint32_t length =
  627|  15.5k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (627:37): [True: 2.60k, False: 12.9k]
  ------------------
  628|  15.5k|          int dsym;
  629|  15.5k|          if (btype == 1)
  ------------------
  |  Branch (629:15): [True: 0, False: 15.5k]
  ------------------
  630|      0|            dsym = fixed_dist(br);
  631|  15.5k|          else
  632|  15.5k|            dsym = dist.decode(br);
  633|  15.5k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (633:15): [True: 0, False: 15.5k]
  |  Branch (633:27): [True: 0, False: 15.5k]
  ------------------
  634|  15.5k|          uint32_t dextra = br.get(dist_extra[dsym]);
  635|  15.5k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (635:15): [True: 9.94k, False: 5.58k]
  |  Branch (635:35): [True: 0, False: 9.94k]
  ------------------
  636|  15.5k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (636:50): [True: 9.94k, False: 5.58k]
  ------------------
  637|  15.5k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (637:15): [True: 0, False: 15.5k]
  |  Branch (637:33): [True: 0, False: 15.5k]
  ------------------
  638|   236k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (638:32): [True: 220k, False: 15.5k]
  ------------------
  639|   220k|            dst[out] = dst[out - distance];
  640|   220k|            out++;
  641|   220k|          }
  642|  15.5k|        }
  643|  53.6k|      }
  644|      4|    } else {
  645|      0|      return 0;  // reserved
  646|      0|    }
  647|      4|    if (bfinal) break;
  ------------------
  |  Branch (647:9): [True: 1, False: 3]
  ------------------
  648|      4|  }
  649|      1|  return out;
  650|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  393|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  403|   471k|  uint32_t get(int n) {
  404|   471k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (404:9): [True: 0, False: 471k]
  ------------------
  405|   471k|    uint32_t v = acc & ((1u << n) - 1);
  406|   471k|    acc >>= n;
  407|   471k|    bits -= n;
  408|   471k|    return v;
  409|   471k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  395|   471k|  bool ensure(int n) {
  396|   534k|    while (bits < n) {
  ------------------
  |  Branch (396:12): [True: 63.5k, False: 471k]
  ------------------
  397|  63.5k|      if (p >= end) return false;
  ------------------
  |  Branch (397:11): [True: 0, False: 63.5k]
  ------------------
  398|  63.5k|      acc |= uint32_t(*p++) << bits;
  399|  63.5k|      bits += 8;
  400|  63.5k|    }
  401|   471k|    return true;
  402|   471k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  462|  70.2k|  int decode(BitReader& br) const {
  463|  70.2k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (463:9): [True: 0, False: 70.2k]
  ------------------
  464|  70.2k|    int code = 0;
  465|   439k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (465:23): [True: 439k, False: 0]
  ------------------
  466|   439k|      uint32_t b = br.get(1);
  467|   439k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (467:11): [True: 0, False: 439k]
  ------------------
  468|   439k|      code = (code << 1) | int(b);
  469|   439k|      int first = first_code[len];
  470|   439k|      int cnt = counts[len];
  471|   439k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (471:11): [True: 271k, False: 168k]
  |  Branch (471:18): [True: 70.2k, False: 201k]
  ------------------
  472|  70.2k|        return symbols[base_idx[len] + (code - first)];
  473|  70.2k|      }
  474|   439k|    }
  475|      0|    return -1;
  476|  70.2k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4966|      1|                                         size_t len) noexcept {
 4967|      1|  uint32_t c = 0xFFFFFFFFu;
 4968|   258k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4968:22): [True: 258k, False: 1]
  ------------------
 4969|   258k|    c ^= data[i];
 4970|  2.32M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4970:21): [True: 2.06M, False: 258k]
  ------------------
 4971|  2.06M|      const uint32_t mask = 0u - (c & 1u);
 4972|  2.06M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4973|  2.06M|    }
 4974|   258k|  }
 4975|      1|  return ~c;
 4976|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4766|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4767|      1|  if constexpr (std::endian::native == std::endian::little) {
 4768|      1|    (void)buffer;
 4769|      1|    return;
 4770|      1|  }
 4771|      0|  auto u16 = [&](size_t off, size_t count) {
 4772|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4773|      1|  };
 4774|      1|  auto u32 = [&](size_t off, size_t count) {
 4775|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4776|      1|  };
 4777|      1|  auto u64 = [&](size_t off, size_t count) {
 4778|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4779|      1|  };
 4780|       |
 4781|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4782|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4783|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4784|      1|  u16(table_blob::off_decomposition_block,
 4785|      1|      table_blob::count_decomposition_block);
 4786|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4787|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4788|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4789|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4790|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4791|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4792|      1|  u32(table_blob::off_joining_start, table_blob::count_joining_start);
 4793|      1|  u32(table_blob::off_joining_final, table_blob::count_joining_final);
 4794|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 5019|     22|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5020|     22|      return buffer + off;
 5021|     22|    };
simple_absolute.cc:_ZN3ada4idnaL11idna_lookupEj:
 5198|   307k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5199|   307k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5199:7): [True: 303k, False: 3.89k]
  ------------------
 5200|   303k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5201|   303k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5201:9): [True: 114k, False: 188k]
  ------------------
 5202|   114k|      uint32_t bit_idx =
 5203|   114k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5204|   114k|          (cp & IDNA_BLOCK_MASK);
 5205|   114k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5206|   114k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5206:14): [True: 114k, False: 46]
  ------------------
 5207|   114k|    }
 5208|   188k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5209|   303k|  }
 5210|       |
 5211|  3.89k|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5211:7): [True: 3.83k, False: 62]
  |  Branch (5211:40): [True: 3.61k, False: 224]
  ------------------
 5212|  3.61k|    return IDNA_IGNORED;
 5213|  3.61k|  }
 5214|       |
 5215|    286|  return IDNA_DISALLOWED;
 5216|  3.89k|}
simple_absolute.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5241|  55.5k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5242|  55.5k|  size_t n = 0;
 5243|   270k|  while (*ptr != 0) {
  ------------------
  |  Branch (5243:10): [True: 214k, False: 55.5k]
  ------------------
 5244|   214k|    ++n;
 5245|   214k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5245:9): [True: 86.3k, False: 128k]
  ------------------
 5246|  86.3k|      ++ptr;
 5247|   128k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5247:16): [True: 85.0k, False: 43.5k]
  ------------------
 5248|  85.0k|      ptr += 2;
 5249|  85.0k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5249:16): [True: 42.6k, False: 920]
  ------------------
 5250|  42.6k|      ptr += 3;
 5251|  42.6k|    } else {
 5252|    920|      ptr += 4;
 5253|    920|    }
 5254|   214k|  }
 5255|  55.5k|  return n;
 5256|  55.5k|}
simple_absolute.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5219|   214k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5220|   214k|  uint8_t b0 = *ptr++;
 5221|   214k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5221:7): [True: 86.1k, False: 128k]
  ------------------
 5222|   128k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5222:7): [True: 84.7k, False: 43.5k]
  ------------------
 5223|  84.7k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5224|  84.7k|    cp |= (*ptr++ & 0x3Fu);
 5225|  84.7k|    return static_cast<char32_t>(cp);
 5226|  84.7k|  }
 5227|  43.5k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5227:7): [True: 42.6k, False: 920]
  ------------------
 5228|  42.6k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5229|  42.6k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5230|  42.6k|    cp |= (*ptr++ & 0x3Fu);
 5231|  42.6k|    return static_cast<char32_t>(cp);
 5232|  42.6k|  }
 5233|    920|  uint32_t cp = (b0 & 0x07u) << 18;
 5234|    920|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5235|    920|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5236|    920|  cp |= (*ptr++ & 0x3Fu);
 5237|    920|  return static_cast<char32_t>(cp);
 5238|  43.5k|}
_ZN3ada4idna23decomposition_block_rowEh:
 5101|   329k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 5102|   329k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (5102:7): [True: 0, False: 329k]
  ------------------
 5103|      0|    bi = 0;
 5104|      0|  }
 5105|   329k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 5106|   329k|}
_ZN3ada4idna13ccc_block_rowEh:
 5108|   599k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 5109|   599k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (5109:7): [True: 0, False: 599k]
  ------------------
 5110|      0|    bi = 0;
 5111|      0|  }
 5112|   599k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5113|   599k|}
_ZN3ada4idna16tables_are_readyEv:
 4978|  5.86k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4979|  5.86k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4980|  5.86k|}
simple_absolute.cc:_ZN3ada4idnaL19get_nfc_quick_checkEDi:
 5645|   155k|static nfc_quick_check get_nfc_quick_check(char32_t c) noexcept {
 5646|   155k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5646:7): [True: 0, False: 155k]
  ------------------
 5647|      0|    return nfc_quick_check::yes;
 5648|      0|  }
 5649|   155k|  return static_cast<nfc_quick_check>(
 5650|   155k|      nfc_qc_block_row(nfc_qc_index[c >> 8])[c % 256]);
 5651|   155k|}
_ZN3ada4idna16nfc_qc_block_rowEh:
 5122|   155k|inline const uint8_t* nfc_qc_block_row(uint8_t bi) noexcept {
 5123|   155k|  if (bi >= kNfcQcBlockRows) {
  ------------------
  |  Branch (5123:7): [True: 0, False: 155k]
  ------------------
 5124|      0|    bi = 0;
 5125|      0|  }
 5126|   155k|  return nfc_qc_block_flat + static_cast<size_t>(bi) * kNfcQcBlockCols;
 5127|   155k|}
simple_absolute.cc:_ZN3ada4idnaL12maybe_is_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5656|  1.90k|static bool maybe_is_nfc(std::u32string_view input) noexcept {
 5657|       |  // 1) A character whose decomposition starts with a code point that composes
 5658|       |  //    with the previous character (e.g. U+1611E U+16121).
 5659|  1.90k|  char32_t previous = 0x110000;  // none
 5660|   113k|  for (char32_t c : input) {
  ------------------
  |  Branch (5660:19): [True: 113k, False: 1.88k]
  ------------------
 5661|   113k|    if (decomposition_composes_with_previous(previous, c)) {
  ------------------
  |  Branch (5661:9): [True: 20, False: 113k]
  ------------------
 5662|     20|      return false;
 5663|     20|    }
 5664|   113k|    previous = c;
 5665|   113k|  }
 5666|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5667|       |  //    trailing class of the previous character's canonical decomposition so a
 5668|       |  //    composite starter followed by a lower-class mark is caught.
 5669|  1.88k|  uint8_t prev_ccc = 0;
 5670|   112k|  for (char32_t c : input) {
  ------------------
  |  Branch (5670:19): [True: 112k, False: 1.79k]
  ------------------
 5671|   112k|    uint8_t ccc = get_ccc(c);
 5672|   112k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5672:9): [True: 4.14k, False: 108k]
  |  Branch (5672:21): [True: 88, False: 4.05k]
  ------------------
 5673|     88|      return false;
 5674|     88|    }
 5675|   112k|    prev_ccc = trailing_ccc(c);
 5676|   112k|  }
 5677|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5678|  1.79k|  return !would_compose(input);
 5679|  1.88k|}
simple_absolute.cc:_ZN3ada4idnaL36decomposition_composes_with_previousEDiDi:
 5620|   113k|                                                 char32_t c) noexcept {
 5621|   113k|  const size_t length = canonical_decomp_length(c);
 5622|   113k|  if (length < 2 || previous >= 0x110000) {
  ------------------
  |  Branch (5622:7): [True: 109k, False: 3.52k]
  |  Branch (5622:21): [True: 160, False: 3.36k]
  ------------------
 5623|   109k|    return false;
 5624|   109k|  }
 5625|  3.36k|  const uint16_t* const decomposition =
 5626|  3.36k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5627|  3.36k|  const size_t base = decomposition[0] >> 2;
 5628|  3.36k|  if (base + length > decomposition_data_size) {
  ------------------
  |  Branch (5628:7): [True: 0, False: 3.36k]
  ------------------
 5629|      0|    return false;
 5630|      0|  }
 5631|  3.36k|  return has_composition(
 5632|  3.36k|      composition_block_row(composition_index[previous >> 8]) +
 5633|  3.36k|          (previous % 256),
 5634|  3.36k|      decomposition_data[base]);
 5635|  3.36k|}
simple_absolute.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5399|   225k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5400|   225k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5400:7): [True: 10.2k, False: 215k]
  ------------------
 5401|  10.2k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5401:7): [True: 4.08k, False: 6.18k]
  ------------------
 5402|       |    // Hangul precomposed syllables are NFC.
 5403|  4.08k|    return 0;
 5404|  4.08k|  }
 5405|   221k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5405:7): [True: 0, False: 221k]
  ------------------
 5406|      0|    return 0;
 5407|      0|  }
 5408|   221k|  const uint8_t di = decomposition_index[current_character >> 8];
 5409|   221k|  const uint16_t* const decomposition =
 5410|   221k|      decomposition_block_row(di) + (current_character % 256);
 5411|   221k|  size_t decomposition_length =
 5412|   221k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5413|   221k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5413:7): [True: 6.95k, False: 214k]
  |  Branch (5413:37): [True: 0, False: 6.95k]
  ------------------
 5414|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5415|      0|  }
 5416|   221k|  return decomposition_length;
 5417|   221k|}
simple_absolute.cc:_ZN3ada4idnaL15has_compositionEPKtDi:
 5532|  22.7k|                            char32_t second) noexcept {
 5533|  22.7k|  int left = composition[0];
 5534|  22.7k|  int right = composition[1];
 5535|  22.7k|  if (left < 0 || right <= left ||
  ------------------
  |  Branch (5535:7): [True: 0, False: 22.7k]
  |  Branch (5535:19): [True: 1.96k, False: 20.7k]
  ------------------
 5536|  20.7k|      static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5536:7): [True: 0, False: 20.7k]
  ------------------
 5537|  1.96k|    return false;
 5538|  1.96k|  }
 5539|  36.2k|  while (left + 2 < right) {
  ------------------
  |  Branch (5539:10): [True: 15.4k, False: 20.7k]
  ------------------
 5540|  15.4k|    int middle = left + (((right - left) >> 1) & ~1);
 5541|  15.4k|    if (composition_data[static_cast<size_t>(middle)] <= second) {
  ------------------
  |  Branch (5541:9): [True: 2.71k, False: 12.7k]
  ------------------
 5542|  2.71k|      left = middle;
 5543|  2.71k|    }
 5544|  15.4k|    if (composition_data[static_cast<size_t>(middle)] >= second) {
  ------------------
  |  Branch (5544:9): [True: 13.5k, False: 1.94k]
  ------------------
 5545|  13.5k|      right = middle;
 5546|  13.5k|    }
 5547|  15.4k|  }
 5548|  20.7k|  return static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5548:10): [True: 20.7k, False: 0]
  ------------------
 5549|  20.7k|         composition_data[static_cast<size_t>(left)] == second;
  ------------------
  |  Branch (5549:10): [True: 1.28k, False: 19.4k]
  ------------------
 5550|  22.7k|}
simple_absolute.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5605|   112k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5606|   112k|  const size_t length = canonical_decomp_length(c);
 5607|   112k|  if (length == 0) {
  ------------------
  |  Branch (5607:7): [True: 109k, False: 3.42k]
  ------------------
 5608|   109k|    return get_ccc(c);
 5609|   109k|  }
 5610|  3.42k|  const uint16_t* const decomposition =
 5611|  3.42k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5612|  3.42k|  const size_t base = decomposition[0] >> 2;
 5613|  3.42k|  return get_ccc(decomposition_data[base + length - 1]);
 5614|   112k|}
simple_absolute.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5553|  1.79k|static bool would_compose(std::u32string_view input) noexcept {
 5554|  95.0k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5554:32): [True: 94.7k, False: 344]
  ------------------
 5555|  94.7k|    const char32_t current = input[input_count];
 5556|  94.7k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5556:9): [True: 8.63k, False: 86.1k]
  |  Branch (5556:36): [True: 1.59k, False: 7.04k]
  ------------------
 5557|  1.59k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5557:11): [True: 1.52k, False: 62]
  ------------------
 5558|  1.52k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5558:11): [True: 690, False: 838]
  ------------------
 5559|    690|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5559:11): [True: 148, False: 542]
  ------------------
 5560|    148|        return true;
 5561|    148|      }
 5562|  1.44k|      ++input_count;
 5563|  1.44k|      continue;
 5564|  1.59k|    }
 5565|  93.1k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5565:9): [True: 3.17k, False: 89.9k]
  |  Branch (5565:36): [True: 1.87k, False: 1.30k]
  ------------------
 5566|  1.87k|      if ((current - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5566:11): [True: 1.60k, False: 264]
  ------------------
 5567|  1.60k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5567:11): [True: 1.60k, False: 8]
  ------------------
 5568|  1.60k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5568:11): [True: 1.00k, False: 598]
  ------------------
 5569|  1.00k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5569:11): [True: 36, False: 966]
  ------------------
 5570|     36|        return true;
 5571|     36|      }
 5572|  1.83k|      ++input_count;
 5573|  1.83k|      continue;
 5574|  1.87k|    }
 5575|  91.2k|    if (current < 0x110000) {
  ------------------
  |  Branch (5575:9): [True: 91.2k, False: 0]
  ------------------
 5576|  91.2k|      const uint16_t* composition =
 5577|  91.2k|          composition_block_row(composition_index[current >> 8]) +
 5578|  91.2k|          (current % 256);
 5579|  91.2k|      int32_t previous_ccc = -1;
 5580|  91.2k|      size_t j = input_count;
 5581|  93.1k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5581:14): [True: 92.8k, False: 264]
  ------------------
 5582|  92.8k|        uint8_t ccc = get_ccc(input[j + 1]);
 5583|  92.8k|        if (composition[1] != composition[0] && previous_ccc < ccc &&
  ------------------
  |  Branch (5583:13): [True: 20.5k, False: 72.3k]
  |  Branch (5583:49): [True: 19.3k, False: 1.16k]
  ------------------
 5584|  19.3k|            has_composition(composition, input[j + 1])) {
  ------------------
  |  Branch (5584:13): [True: 1.26k, False: 18.0k]
  ------------------
 5585|  1.26k|          return true;
 5586|  1.26k|        }
 5587|  91.6k|        if (ccc == 0) {
  ------------------
  |  Branch (5587:13): [True: 89.7k, False: 1.85k]
  ------------------
 5588|  89.7k|          break;
 5589|  89.7k|        }
 5590|  1.85k|        previous_ccc = ccc;
 5591|  1.85k|      }
 5592|  90.0k|      input_count = j + 1;
 5593|  90.0k|      continue;
 5594|  91.2k|    }
 5595|      0|    ++input_count;
 5596|      0|  }
 5597|    344|  return false;
 5598|  1.79k|}
_ZN3ada4idna21composition_block_rowEh:
 5115|   149k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5116|   149k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5116:7): [True: 0, False: 149k]
  ------------------
 5117|      0|    bi = 0;
 5118|      0|  }
 5119|   149k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5120|   149k|}
simple_absolute.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5853|  35.9k|static constexpr int32_t char_to_digit_value(char value) {
 5854|  35.9k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5854:7): [True: 32.3k, False: 3.63k]
  |  Branch (5854:23): [True: 32.3k, False: 6]
  ------------------
 5855|  3.63k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5855:7): [True: 3.61k, False: 28]
  |  Branch (5855:23): [True: 3.60k, False: 8]
  ------------------
 5856|     36|  return -1;
 5857|  3.63k|}
simple_absolute.cc:_ZN3ada4idnaL5adaptEiib:
 5863|  77.1k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5864|  77.1k|  if (firsttime) {
  ------------------
  |  Branch (5864:7): [True: 23.5k, False: 53.5k]
  ------------------
 5865|  23.5k|    d = d / damp;
 5866|  53.5k|  } else {
 5867|  53.5k|    d = d / 2;
 5868|  53.5k|  }
 5869|  77.1k|  d += d / n;
 5870|  77.1k|  int32_t k = 0;
 5871|  99.6k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5871:10): [True: 22.5k, False: 77.1k]
  ------------------
 5872|  22.5k|    d /= base - tmin;
 5873|  22.5k|    k += base;
 5874|  22.5k|  }
 5875|  77.1k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5876|  77.1k|}
simple_absolute.cc:_ZN3ada4idnaL13digit_to_charEi:
 5859|   170k|static constexpr char digit_to_char(int32_t digit) {
 5860|   170k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5860:10): [True: 76.0k, False: 94.5k]
  ------------------
 5861|   170k|}
simple_absolute.cc:_ZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6260|  26.2k|static label_check check_label(const std::u32string_view label) {
 6261|  26.2k|  if (label.empty()) {
  ------------------
  |  Branch (6261:7): [True: 0, False: 26.2k]
  ------------------
 6262|      0|    return {true, false, true};
 6263|      0|  }
 6264|  26.2k|  if (!ensure_tables() || combining_ranges == nullptr || dir_index == nullptr ||
  ------------------
  |  Branch (6264:7): [True: 0, False: 26.2k]
  |  Branch (6264:27): [True: 0, False: 26.2k]
  |  Branch (6264:58): [True: 0, False: 26.2k]
  ------------------
 6265|  26.2k|      dir_block_flat == nullptr || joining_start == nullptr ||
  ------------------
  |  Branch (6265:7): [True: 0, False: 26.2k]
  |  Branch (6265:36): [True: 0, False: 26.2k]
  ------------------
 6266|  26.2k|      joining_final == nullptr || joining_value == nullptr) {
  ------------------
  |  Branch (6266:7): [True: 0, False: 26.2k]
  |  Branch (6266:35): [True: 0, False: 26.2k]
  ------------------
 6267|      0|    return {};
 6268|      0|  }
 6269|       |
 6270|       |  // An invalid RTL label still makes the domain a Bidi domain name, so `rtl`
 6271|       |  // is reported even when another criterion fails.
 6272|  26.2k|  uint32_t directions = 0;
 6273|  26.2k|  direction last = direction::NSM;  // last direction that is not NSM
 6274|   190k|  for (char32_t c : label) {
  ------------------
  |  Branch (6274:19): [True: 190k, False: 26.2k]
  ------------------
 6275|   190k|    const direction d = find_direction(c);
 6276|   190k|    directions |= 1u << d;
 6277|   190k|    if (d != direction::NSM) {
  ------------------
  |  Branch (6277:9): [True: 187k, False: 3.30k]
  ------------------
 6278|   187k|      last = d;
 6279|   187k|    }
 6280|   190k|  }
 6281|  26.2k|  const bool rtl = (directions & rtl_directions) != 0;
 6282|       |
 6283|       |  ///////////////
 6284|       |  // We have a normalization step which ensures that we are in NFC.
 6285|       |  // If we receive punycode, we normalize and check that the normalized
 6286|       |  // version matches the original.
 6287|       |  // --------------------------------------
 6288|       |  // The label must be in Unicode Normalization Form NFC.
 6289|       |
 6290|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 6291|       |  // ---------------------------------------
 6292|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 6293|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 6294|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 6295|       |
 6296|       |  // This is not necessary because we segment the
 6297|       |  // labels by '.'.
 6298|       |  // ---------------------------------------
 6299|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 6300|       |  // if (label.find('.') != std::string_view::npos) return false;
 6301|       |
 6302|       |  // The label must not begin with a combining mark.
 6303|       |  // Range membership via lower_bound on range end.
 6304|  26.2k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 6305|  26.2k|                                               combining_range_count};
 6306|  26.2k|  const auto comb_it = std::ranges::lower_bound(
 6307|  26.2k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 6308|  26.2k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (6308:7): [True: 26.2k, False: 0]
  |  Branch (6308:7): [True: 122, False: 26.1k]
  |  Branch (6308:37): [True: 122, False: 26.1k]
  ------------------
 6309|    122|    return {false, rtl, false};
 6310|    122|  }
 6311|       |  // We verify this next step as part of the mapping:
 6312|       |  // ---------------------------------------------
 6313|       |  // Each code point in the label must only have certain status values
 6314|       |  // according to Section 5, IDNA Mapping Table:
 6315|       |  // - For Transitional Processing, each value must be valid.
 6316|       |  // - For Nontransitional Processing, each value must be either valid or
 6317|       |  // deviation.
 6318|       |
 6319|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6320|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6321|       |  // Applications (IDNA) [IDNA2008].
 6322|  26.1k|  if (!is_contextj_valid(label)) {
  ------------------
  |  Branch (6322:7): [True: 208, False: 25.9k]
  ------------------
 6323|    208|    return {false, rtl, false};
 6324|    208|  }
 6325|       |
 6326|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6327|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6328|       |  // Section 2.
 6329|       |
 6330|       |  // The following rule, consisting of six conditions, applies to labels
 6331|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6332|       |  // described in Section 3.  All of the conditions must be satisfied for
 6333|       |  // the rule to be satisfied.
 6334|       |  //
 6335|       |  //  1.  The first character must be a character with Bidi property L, R,
 6336|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6337|       |  //     has the L property, it is an LTR label.
 6338|       |  //
 6339|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6340|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6341|       |  //
 6342|       |  //   3.  In an RTL label, the end of the label must be a character with
 6343|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6344|       |  //       characters with Bidi property NSM.
 6345|       |  //
 6346|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6347|       |  //       vice versa.
 6348|       |  //
 6349|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6350|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6351|       |  //
 6352|       |  //   6.  In an LTR label, the end of the label must be a character with
 6353|       |  //       Bidi property L or EN, followed by zero or more characters with
 6354|       |  //       Bidi property NSM.
 6355|       |  //
 6356|       |  // Every character after the last non-NSM character is NSM, which both the
 6357|       |  // LTR and the RTL rules allow, so conditions 2, 4 and 5 only depend on the
 6358|       |  // set of directions in the whole label.
 6359|  25.9k|  if (last == direction::NSM) {
  ------------------
  |  Branch (6359:7): [True: 0, False: 25.9k]
  ------------------
 6360|      0|    return {false, rtl, false};
 6361|      0|  }
 6362|       |
 6363|  25.9k|  label_check result{true, rtl, false};
 6364|  25.9k|  const direction first = find_direction(label[0]);
 6365|  25.9k|  if (first == direction::L) {
  ------------------
  |  Branch (6365:7): [True: 5.00k, False: 20.9k]
  ------------------
 6366|  5.00k|    constexpr uint32_t ltr_allowed =
 6367|  5.00k|        (1u << direction::L) | (1u << direction::EN) | (1u << direction::ES) |
 6368|  5.00k|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6369|  5.00k|        (1u << direction::BN) | (1u << direction::NSM);
 6370|  5.00k|    result.bidi = (directions & ~ltr_allowed) == 0 &&
  ------------------
  |  Branch (6370:19): [True: 4.90k, False: 102]
  ------------------
 6371|  4.90k|                  (last == direction::L || last == direction::EN);
  ------------------
  |  Branch (6371:20): [True: 4.10k, False: 804]
  |  Branch (6371:44): [True: 316, False: 488]
  ------------------
 6372|  20.9k|  } else if (first == direction::R || first == direction::AL) {
  ------------------
  |  Branch (6372:14): [True: 808, False: 20.1k]
  |  Branch (6372:39): [True: 806, False: 19.3k]
  ------------------
 6373|  1.61k|    constexpr uint32_t rtl_allowed =
 6374|  1.61k|        rtl_directions | (1u << direction::EN) | (1u << direction::ES) |
 6375|  1.61k|        (1u << direction::CS) | (1u << direction::ET) | (1u << direction::ON) |
 6376|  1.61k|        (1u << direction::BN) | (1u << direction::NSM);
 6377|  1.61k|    constexpr uint32_t en_and_an =
 6378|  1.61k|        (1u << direction::EN) | (1u << direction::AN);
 6379|  1.61k|    result.bidi = (directions & ~rtl_allowed) == 0 &&
  ------------------
  |  Branch (6379:19): [True: 1.53k, False: 84]
  ------------------
 6380|  1.53k|                  (directions & en_and_an) != en_and_an &&
  ------------------
  |  Branch (6380:19): [True: 1.52k, False: 6]
  ------------------
 6381|  1.52k|                  (last == direction::R || last == direction::AL ||
  ------------------
  |  Branch (6381:20): [True: 432, False: 1.09k]
  |  Branch (6381:44): [True: 698, False: 394]
  ------------------
 6382|    394|                   last == direction::AN || last == direction::EN);
  ------------------
  |  Branch (6382:20): [True: 190, False: 204]
  |  Branch (6382:45): [True: 200, False: 4]
  ------------------
 6383|  1.61k|  }
 6384|  25.9k|  return result;
 6385|  25.9k|}
simple_absolute.cc:_ZN3ada4idnaL14find_directionEj:
 6165|   216k|inline static direction find_direction(uint32_t code_point) noexcept {
 6166|   216k|  if (code_point >= 0x110000) {
  ------------------
  |  Branch (6166:7): [True: 0, False: 216k]
  ------------------
 6167|      0|    return direction::NONE;
 6168|      0|  }
 6169|   216k|  return static_cast<direction>(
 6170|   216k|      dir_block_row(dir_index[code_point >> 8])[code_point & 0xFF]);
 6171|   216k|}
_ZN3ada4idna13dir_block_rowEh:
 5129|   216k|inline const uint8_t* dir_block_row(uint8_t bi) noexcept {
 5130|   216k|  if (bi >= kDirBlockRows) {
  ------------------
  |  Branch (5130:7): [True: 0, False: 216k]
  ------------------
 5131|      0|    bi = 0;
 5132|      0|  }
 5133|   216k|  return dir_block_flat + static_cast<size_t>(bi) * kDirBlockCols;
 5134|   216k|}
simple_absolute.cc:_ZZN3ada4idnaL11check_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 6307|   233k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
simple_absolute.cc:_ZN3ada4idnaL17is_contextj_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6182|  26.1k|inline static bool is_contextj_valid(std::u32string_view label) noexcept {
 6183|  26.1k|  constexpr uint8_t virama_ccc = 9;
 6184|   202k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6184:22): [True: 177k, False: 25.9k]
  ------------------
 6185|   177k|    if (label[i] != 0x200C && label[i] != 0x200D) {
  ------------------
  |  Branch (6185:9): [True: 176k, False: 870]
  |  Branch (6185:31): [True: 176k, False: 74]
  ------------------
 6186|   176k|      continue;
 6187|   176k|    }
 6188|       |    // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
 6189|    944|    if (i > 0 && get_ccc(label[i - 1]) == virama_ccc) {
  ------------------
  |  Branch (6189:9): [True: 930, False: 14]
  |  Branch (6189:18): [True: 240, False: 690]
  ------------------
 6190|    240|      continue;
 6191|    240|    }
 6192|    704|    if (label[i] == 0x200D) {
  ------------------
  |  Branch (6192:9): [True: 12, False: 692]
  ------------------
 6193|     12|      return false;
 6194|     12|    }
 6195|       |    // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
 6196|       |    //    (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
 6197|    692|    joining_type before = joining_type::U;
 6198|  1.13k|    for (size_t j = i; j > 0;) {
  ------------------
  |  Branch (6198:24): [True: 1.12k, False: 8]
  ------------------
 6199|  1.12k|      before = find_joining_type(label[--j]);
 6200|  1.12k|      if (before != joining_type::T) {
  ------------------
  |  Branch (6200:11): [True: 684, False: 440]
  ------------------
 6201|    684|        break;
 6202|    684|      }
 6203|  1.12k|    }
 6204|    692|    if (before != joining_type::L && before != joining_type::D) {
  ------------------
  |  Branch (6204:9): [True: 684, False: 8]
  |  Branch (6204:38): [True: 104, False: 580]
  ------------------
 6205|    104|      return false;
 6206|    104|    }
 6207|    588|    joining_type after = joining_type::U;
 6208|  1.00k|    for (size_t j = i + 1; j < label.size(); j++) {
  ------------------
  |  Branch (6208:28): [True: 964, False: 44]
  ------------------
 6209|    964|      after = find_joining_type(label[j]);
 6210|    964|      if (after != joining_type::T) {
  ------------------
  |  Branch (6210:11): [True: 544, False: 420]
  ------------------
 6211|    544|        break;
 6212|    544|      }
 6213|    964|    }
 6214|    588|    if (after != joining_type::R && after != joining_type::D) {
  ------------------
  |  Branch (6214:9): [True: 396, False: 192]
  |  Branch (6214:37): [True: 92, False: 304]
  ------------------
 6215|     92|      return false;
 6216|     92|    }
 6217|    588|  }
 6218|  25.9k|  return true;
 6219|  26.1k|}
simple_absolute.cc:_ZN3ada4idnaL17find_joining_typeEj:
 6174|  2.08k|inline static joining_type find_joining_type(uint32_t code_point) noexcept {
 6175|  2.08k|  size_t i =
 6176|  2.08k|      find_range(joining_start, joining_final, joining_table_count, code_point);
 6177|  2.08k|  return i == joining_table_count ? joining_type::U
  ------------------
  |  Branch (6177:10): [True: 140, False: 1.94k]
  ------------------
 6178|  2.08k|                                  : static_cast<joining_type>(joining_value[i]);
 6179|  2.08k|}
simple_absolute.cc:_ZN3ada4idnaL10find_rangeEPKjS2_mj:
 6151|  2.08k|                                size_t count, uint32_t code_point) noexcept {
 6152|  2.08k|  size_t lo = 0, hi = count;
 6153|  21.7k|  while (lo < hi) {
  ------------------
  |  Branch (6153:10): [True: 19.6k, False: 2.08k]
  ------------------
 6154|  19.6k|    size_t mid = lo + (hi - lo) / 2;
 6155|  19.6k|    if (last[mid] < code_point) {
  ------------------
  |  Branch (6155:9): [True: 4.77k, False: 14.9k]
  ------------------
 6156|  4.77k|      lo = mid + 1;
 6157|  14.9k|    } else {
 6158|  14.9k|      hi = mid;
 6159|  14.9k|    }
 6160|  19.6k|  }
 6161|  2.08k|  return lo < count && code_point >= start[lo] ? lo : count;
  ------------------
  |  Branch (6161:10): [True: 2.08k, False: 0]
  |  Branch (6161:24): [True: 1.94k, False: 140]
  ------------------
 6162|  2.08k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6490|   128k|bool constexpr is_ascii(std::string_view view) {
 6491|  1.95M|  for (uint8_t c : view) {
  ------------------
  |  Branch (6491:18): [True: 1.95M, False: 123k]
  ------------------
 6492|  1.95M|    if (c >= 0x80) {
  ------------------
  |  Branch (6492:9): [True: 4.80k, False: 1.94M]
  ------------------
 6493|  4.80k|      return false;
 6494|  4.80k|    }
 6495|  1.95M|  }
 6496|   123k|  return true;
 6497|   128k|}
simple_absolute.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6527|   123k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6528|   123k|  out.assign(ut8_string);
 6529|   123k|  ascii_map(out.data(), out.size());
 6530|   123k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6481|  32.7k|bool constexpr is_ascii(std::u32string_view view) {
 6482|   117k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6482:19): [True: 117k, False: 3.85k]
  ------------------
 6483|   117k|    if (c >= 0x80) {
  ------------------
  |  Branch (6483:9): [True: 28.8k, False: 88.2k]
  ------------------
 6484|  28.8k|      return false;
 6485|  28.8k|    }
 6486|   117k|  }
 6487|  3.85k|  return true;
 6488|  32.7k|}
simple_absolute.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6543|  27.0k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6544|  27.0k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6544:10): [True: 21.9k, False: 5.15k]
  |  Branch (6544:31): [True: 2.99k, False: 18.9k]
  |  Branch (6544:51): [True: 2.72k, False: 270]
  ------------------
 6545|  2.72k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6545:10): [True: 2.45k, False: 272]
  |  Branch (6545:30): [True: 2.19k, False: 254]
  ------------------
 6546|  27.0k|}
simple_absolute.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6533|  5.09k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6534|  5.09k|  const size_t old = out.size();
 6535|  5.09k|  out.resize(old + label.size());
 6536|  5.09k|  char* dest = out.data() + old;
 6537|  73.4k|  for (char32_t c : label) {
  ------------------
  |  Branch (6537:19): [True: 73.4k, False: 5.09k]
  ------------------
 6538|  73.4k|    *dest++ = static_cast<char>(c);
 6539|  73.4k|  }
 6540|  5.09k|}
simple_absolute.cc:_ZZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEEENK3$_0clERKNS0_11label_checkE:
 6609|  26.2k|  auto accept = [&](const label_check& check) {
 6610|  26.2k|    bidi_domain = bidi_domain || check.rtl;
  ------------------
  |  Branch (6610:19): [True: 1.64k, False: 24.6k]
  |  Branch (6610:34): [True: 612, False: 24.0k]
  ------------------
 6611|  26.2k|    bidi_rule_holds = bidi_rule_holds && check.bidi;
  ------------------
  |  Branch (6611:23): [True: 6.75k, False: 19.5k]
  |  Branch (6611:42): [True: 4.84k, False: 1.90k]
  ------------------
 6612|  26.2k|    return check.valid && (bidi_rule_holds || !bidi_domain);
  ------------------
  |  Branch (6612:12): [True: 25.9k, False: 330]
  |  Branch (6612:28): [True: 4.84k, False: 21.1k]
  |  Branch (6612:47): [True: 20.9k, False: 184]
  ------------------
 6613|  26.2k|  };
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7682|   292k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7683|   292k|    return character_sets::bit_at(character_set, c);
 7684|   292k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7416|  89.2k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7417|  89.2k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7417:11): [True: 87.4k, False: 1.79k]
  |  Branch (7417:23): [True: 44.1k, False: 43.2k]
  |  Branch (7417:37): [True: 43.2k, False: 1.80k]
  |  Branch (7417:49): [True: 41.4k, False: 1.80k]
  ------------------
 7418|  3.60k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7418:11): [True: 1.78k, False: 1.82k]
  |  Branch (7418:23): [True: 1.60k, False: 184]
  ------------------
 7419|  89.2k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7506|  86.5k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7507|  86.5k|  return hex_to_binary_table[c - '0'];
 7508|  86.5k|}
simple_absolute.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7650|  1.01M|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7651|  1.01M|    return character_sets::bit_at(character_set, c);
 7652|  1.01M|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7343|   126k|    const char* input, size_t length) noexcept {
 7344|   126k|  size_t i = 0;
 7345|   126k|  uint8_t accumulator{};
 7346|   683k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7346:10): [True: 557k, False: 126k]
  ------------------
 7347|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7348|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7349|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7350|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7351|   557k|  }
 7352|   199k|  for (; i < length; i++) {
  ------------------
  |  Branch (7352:10): [True: 73.3k, False: 126k]
  ------------------
 7353|  73.3k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7354|  73.3k|  }
 7355|   126k|  return accumulator;
 7356|   126k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 8036|    865|                            const uint8_t character_set[], std::string& out) {
 8037|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 8038|    865|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 8039|    865|#if ADA_UNICODE_SSSE3
 8040|    865|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 8041|    865|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 8042|       |#elif ADA_NEON
 8043|       |  percent_encode_to_neon(p, end, character_set,
 8044|       |                         load_neon_percent_table(character_set), out);
 8045|       |#elif ADA_RVV
 8046|       |  percent_encode_to_rvv(p, end, character_set, out);
 8047|       |#endif
 8048|    865|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7863|    865|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7864|    865|  ssse3_percent_tables t{};
 7865|    865|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7866|    865|  t.cs_hi =
 7867|    865|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7868|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7869|    865|  t.pow2 =
 7870|    865|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7871|    865|  t.mask_0f = _mm_set1_epi8(0x0F);
 7872|    865|  t.mask_07 = _mm_set1_epi8(0x07);
 7873|    865|  t.zero = _mm_setzero_si128();
 7874|    865|  return t;
 7875|    865|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7894|    865|    const ssse3_percent_tables& tables, std::string& out) {
 7895|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7896|  3.42k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7896:10): [True: 2.56k, False: 865]
  ------------------
 7897|  2.56k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7898|  2.56k|    const __m128i word1 =
 7899|  2.56k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7900|  2.56k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7901|  2.56k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7902|  2.56k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7902:9): [True: 251, False: 2.31k]
  ------------------
 7903|    251|      out.append(p, 32);
 7904|  2.31k|    } else {
 7905|  2.31k|      if (mask0 == 0) {
  ------------------
  |  Branch (7905:11): [True: 62, False: 2.24k]
  ------------------
 7906|     62|        out.append(p, 16);
 7907|  2.24k|      } else {
 7908|  2.24k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7909|  2.24k|      }
 7910|  2.31k|      if (mask1 == 0) {
  ------------------
  |  Branch (7910:11): [True: 281, False: 2.02k]
  ------------------
 7911|    281|        out.append(p + 16, 16);
 7912|  2.02k|      } else {
 7913|  2.02k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7914|  2.02k|      }
 7915|  2.31k|    }
 7916|  2.56k|    p += 32;
 7917|  2.56k|  }
 7918|    865|  if (p + 16 <= end) {
  ------------------
  |  Branch (7918:7): [True: 556, False: 309]
  ------------------
 7919|    556|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7920|    556|    const int mask = ssse3_percent_mask(word, tables);
 7921|    556|    if (mask == 0) {
  ------------------
  |  Branch (7921:9): [True: 170, False: 386]
  ------------------
 7922|    170|      out.append(p, 16);
 7923|    386|    } else {
 7924|    386|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7925|    386|    }
 7926|    556|    p += 16;
 7927|    556|  }
 7928|    865|  percent_encode_to_scalar(p, end, character_set, out);
 7929|    865|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7878|  5.67k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7879|  5.67k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7880|  5.67k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7881|  5.67k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7882|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7883|  5.67k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7884|  5.67k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7885|  5.67k|                                       _mm_andnot_si128(high_byte, lo));
 7886|  5.67k|  const __m128i bits =
 7887|  5.67k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7888|  5.67k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7889|  5.67k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7890|  5.67k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7818|  4.66k|                                          size_t width, std::string& out) {
 7819|  4.66k|  uint64_t bits = mask;
 7820|  4.66k|  size_t off = 0;
 7821|  66.6k|  while (bits != 0) {
  ------------------
  |  Branch (7821:10): [True: 61.9k, False: 4.66k]
  ------------------
 7822|  61.9k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7823|  61.9k|    if (zero_run != 0) {
  ------------------
  |  Branch (7823:9): [True: 2.74k, False: 59.2k]
  ------------------
 7824|  2.74k|      out.append(p + off, static_cast<size_t>(zero_run));
 7825|  2.74k|    }
 7826|  61.9k|    off += static_cast<size_t>(zero_run);
 7827|  61.9k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7828|  61.9k|    ++off;
 7829|  61.9k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7830|  61.9k|  }
 7831|  4.66k|  if (off < width) {
  ------------------
  |  Branch (7831:7): [True: 927, False: 3.73k]
  ------------------
 7832|    927|    out.append(p + off, width - off);
 7833|    927|  }
 7834|  4.66k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7806|  61.9k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7807|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7808|       |  unsigned long ret;
 7809|       |  _BitScanForward(&ret, input_num);
 7810|       |  return static_cast<int>(ret);
 7811|       |#else
 7812|  61.9k|  return __builtin_ctz(input_num);
 7813|  61.9k|#endif
 7814|  61.9k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7839|    865|                                                std::string& out) {
 7840|  4.61k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7840:10): [True: 3.74k, False: 865]
  ------------------
 7841|  3.74k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7841:9): [True: 2.01k, False: 1.73k]
  ------------------
 7842|  2.01k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7843|  2.01k|    } else {
 7844|  1.73k|      out += *p;
 7845|  1.73k|    }
 7846|  3.74k|  }
 7847|    865|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 8109|  1.99k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 8110|  1.99k|  static constexpr char kHex[] = "0123456789abcdef";
 8111|  1.99k|  if (v >= 0x1000) {
  ------------------
  |  Branch (8111:7): [True: 150, False: 1.84k]
  ------------------
 8112|    150|    *p++ = kHex[(v >> 12) & 0xf];
 8113|    150|    *p++ = kHex[(v >> 8) & 0xf];
 8114|    150|    *p++ = kHex[(v >> 4) & 0xf];
 8115|    150|    *p++ = kHex[v & 0xf];
 8116|  1.84k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (8116:14): [True: 302, False: 1.54k]
  ------------------
 8117|    302|    *p++ = kHex[(v >> 8) & 0xf];
 8118|    302|    *p++ = kHex[(v >> 4) & 0xf];
 8119|    302|    *p++ = kHex[v & 0xf];
 8120|  1.54k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (8120:14): [True: 322, False: 1.22k]
  ------------------
 8121|    322|    *p++ = kHex[(v >> 4) & 0xf];
 8122|    322|    *p++ = kHex[v & 0xf];
 8123|  1.22k|  } else {
 8124|  1.22k|    *p++ = kHex[v & 0xf];
 8125|  1.22k|  }
 8126|  1.99k|  return p;
 8127|  1.99k|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 8095|   165k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 8096|   165k|  if (v < 10) {
  ------------------
  |  Branch (8096:7): [True: 67.1k, False: 98.0k]
  ------------------
 8097|  67.1k|    *p++ = static_cast<char>('0' + v);
 8098|  98.0k|  } else if (v < 100) {
  ------------------
  |  Branch (8098:14): [True: 370, False: 97.7k]
  ------------------
 8099|    370|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 8100|    370|    p += 2;
 8101|  97.7k|  } else {
 8102|  97.7k|    *p++ = static_cast<char>('0' + v / 100);
 8103|  97.7k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 8104|  97.7k|    p += 2;
 8105|  97.7k|  }
 8106|   165k|  return p;
 8107|   165k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7192|   641k|    std::string_view user_input) noexcept {
 7193|       |  // first check for short strings in which case we do it naively.
 7194|   641k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (7194:7): [True: 125k, False: 515k]
  ------------------
 7195|   125k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 7196|   125k|  }
 7197|       |  // fast path for long strings (expected to be common)
 7198|   515k|  size_t i = 0;
 7199|   515k|  const __m128i mask1 = _mm_set1_epi8('\r');
 7200|   515k|  const __m128i mask2 = _mm_set1_epi8('\n');
 7201|   515k|  const __m128i mask3 = _mm_set1_epi8('\t');
 7202|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 7203|   515k|  __m128i running{0};
 7204|  1.24M|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (7204:10): [True: 727k, False: 515k]
  ------------------
 7205|   727k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 7206|   727k|    running = _mm_or_si128(
 7207|   727k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7208|   727k|                                           _mm_cmpeq_epi8(word, mask2))),
 7209|   727k|        _mm_cmpeq_epi8(word, mask3));
 7210|   727k|  }
 7211|   515k|  if (i < user_input.size()) {
  ------------------
  |  Branch (7211:7): [True: 510k, False: 4.56k]
  ------------------
 7212|   510k|    __m128i word = _mm_loadu_si128(
 7213|   510k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 7214|   510k|    running = _mm_or_si128(
 7215|   510k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7216|   510k|                                           _mm_cmpeq_epi8(word, mask2))),
 7217|   510k|        _mm_cmpeq_epi8(word, mask3));
 7218|   510k|  }
 7219|   515k|  return _mm_movemask_epi8(running) != 0;
 7220|   641k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 7078|  1.60M|constexpr bool is_tabs_or_newline(char c) noexcept {
 7079|  1.60M|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (7079:10): [True: 62, False: 1.60M]
  |  Branch (7079:23): [True: 66, False: 1.60M]
  |  Branch (7079:36): [True: 70, False: 1.60M]
  ------------------
 7080|  1.60M|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8904|    962|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8905|       |  // Fast path: inputs with no tab/newline (the common case) avoid the
 8906|       |  // per-character erase_if scan. has_tabs_or_newline uses SIMD for inputs
 8907|       |  // >= 16 bytes, making this check much cheaper than erase_if's scalar
 8908|       |  // predicate walk when there is nothing to remove.
 8909|    962|  if (!ada::unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (8909:7): [True: 0, False: 962]
  ------------------
 8910|      0|    return;
 8911|      0|  }
 8912|    962|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8913|    962|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7437|  69.3k|    const char c) noexcept {
 7438|  69.3k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7438:10): [True: 1.77k, False: 67.6k]
  |  Branch (7438:23): [True: 368, False: 67.2k]
  |  Branch (7438:36): [True: 174, False: 67.0k]
  ------------------
 7439|  69.3k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7432|  1.13M|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7433|  1.13M|  return (unsigned char)c <= ' ';
 7434|  1.13M|}
_ZN3ada7helpers19parse_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS_6scheme4typeERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9609|   241k|                                           std::string& path) {
 9610|   241k|  ada_log("parse_prepared_path ", input);
 9611|   241k|  uint8_t accumulator = checkers::path_signature(input);
 9612|       |  // Let us first detect a trivial case.
 9613|       |  // If it is special, we check that we have no dot, no %,  no \ and no
 9614|       |  // character needing percent encoding. Otherwise, we check that we have no %,
 9615|       |  // no dot, and no character needing percent encoding.
 9616|   241k|  constexpr uint8_t need_encoding = 1;
 9617|   241k|  constexpr uint8_t backslash_char = 2;
 9618|   241k|  constexpr uint8_t dot_char = 4;
 9619|   241k|  constexpr uint8_t percent_char = 8;
 9620|   241k|  bool special = type != ada::scheme::NOT_SPECIAL;
 9621|   241k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (9621:39): [True: 1.26k, False: 239k]
  ------------------
 9622|  1.26k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (9622:39): [True: 37, False: 1.23k]
  ------------------
 9623|   241k|  bool trivial_path =
 9624|   241k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (9624:7): [True: 210k, False: 30.9k]
  |  Branch (9624:8): [True: 240k, False: 765]
  ------------------
 9625|   241k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
 9626|    765|                  0)) &&
 9627|   210k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (9627:7): [True: 210k, False: 20]
  ------------------
 9628|   241k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (9628:7): [True: 12.9k, False: 228k]
  |  Branch (9628:34): [True: 12.8k, False: 12]
  ------------------
 9629|       |    // '4' means that we have at least one dot, but nothing that requires
 9630|       |    // percent encoding or decoding. The only part that is not trivial is
 9631|       |    // that we may have single dots and double dots path segments.
 9632|       |    // If we have such segments, then we either have a path that begins
 9633|       |    // with '.' (easy to check), or we have the sequence './'.
 9634|       |    // Note: input cannot be empty, it must at least contain one character ('.')
 9635|       |    // Note: we know that '\' is not present.
 9636|  12.8k|    if (input[0] != '.') {
  ------------------
  |  Branch (9636:9): [True: 11.6k, False: 1.27k]
  ------------------
 9637|  11.6k|      size_t slashdot = 0;
 9638|  11.6k|      bool dot_is_file = true;
 9639|  38.4k|      for (;;) {
 9640|  38.4k|        slashdot = input.find("/.", slashdot);
 9641|  38.4k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (9641:13): [True: 11.6k, False: 26.8k]
  ------------------
 9642|  11.6k|          break;
 9643|  26.8k|        } else {  // uncommon
 9644|       |          // only three cases matter: /./, /.. or a final /
 9645|  26.8k|          slashdot += 2;
 9646|  26.8k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (9646:28): [True: 66, False: 26.7k]
  |  Branch (9646:56): [True: 12.4k, False: 14.2k]
  ------------------
 9647|  14.2k|                           input[slashdot] == '/');
  ------------------
  |  Branch (9647:28): [True: 12.5k, False: 1.67k]
  ------------------
 9648|  26.8k|        }
 9649|  38.4k|      }
 9650|  11.6k|      trivial_path = dot_is_file;
 9651|  11.6k|    }
 9652|  12.8k|  }
 9653|   241k|  if (trivial_path) {
  ------------------
  |  Branch (9653:7): [True: 211k, False: 30.0k]
  ------------------
 9654|   211k|    ada_log("parse_path trivial");
 9655|   211k|    path += '/';
 9656|   211k|    path += input;
 9657|   211k|    return;
 9658|   211k|  }
 9659|       |  // We are going to need to look a bit at the path, but let us see if we can
 9660|       |  // ignore percent encoding *and* backslashes *and* percent characters.
 9661|       |  // Except for the trivial case, this is likely to capture 99% of paths out
 9662|       |  // there.
 9663|  30.0k|  bool fast_path =
 9664|  30.0k|      (special &&
  ------------------
  |  Branch (9664:8): [True: 29.6k, False: 422]
  ------------------
 9665|  29.6k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (9665:8): [True: 11.8k, False: 17.7k]
  ------------------
 9666|  11.8k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (9666:7): [True: 11.7k, False: 100]
  ------------------
 9667|  30.0k|  if (fast_path) {
  ------------------
  |  Branch (9667:7): [True: 11.7k, False: 18.2k]
  ------------------
 9668|  11.7k|    ada_log("parse_prepared_path fast");
 9669|       |    // Here we don't need to worry about \ or percent encoding.
 9670|       |    // We also do not have a file protocol. We might have dots, however,
 9671|       |    // but dots must as appear as '.', and they cannot be encoded because
 9672|       |    // the symbol '%' is not present.
 9673|  11.7k|    size_t previous_location = 0;  // We start at 0.
 9674|  73.9k|    do {
 9675|  73.9k|      size_t new_location = input.find('/', previous_location);
 9676|       |      // std::string_view path_view = input;
 9677|       |      //  We process the last segment separately:
 9678|  73.9k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (9678:11): [True: 11.7k, False: 62.1k]
  ------------------
 9679|  11.7k|        std::string_view path_view = input.substr(previous_location);
 9680|  11.7k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (9680:13): [True: 81, False: 11.7k]
  ------------------
 9681|       |          // e.g., if you receive ".." with an empty path, you go to "/".
 9682|     81|          if (path.empty()) {
  ------------------
  |  Branch (9682:15): [True: 22, False: 59]
  ------------------
 9683|     22|            path = '/';
 9684|     22|            return;
 9685|     22|          }
 9686|       |          // Fast case where we have nothing to do:
 9687|     59|          if (path.back() == '/') {
  ------------------
  |  Branch (9687:15): [True: 16, False: 43]
  ------------------
 9688|     16|            return;
 9689|     16|          }
 9690|       |          // If you have the path "/joe/myfriend",
 9691|       |          // then you delete 'myfriend'.
 9692|     43|          path.resize(path.rfind('/') + 1);
 9693|     43|          return;
 9694|     59|        }
 9695|  11.7k|        path += '/';
 9696|  11.7k|        if (path_view != ".") {
  ------------------
  |  Branch (9696:13): [True: 11.6k, False: 98]
  ------------------
 9697|  11.6k|          path.append(path_view);
 9698|  11.6k|        }
 9699|  11.7k|        return;
 9700|  62.1k|      } else {
 9701|       |        // This is a non-final segment.
 9702|  62.1k|        std::string_view path_view =
 9703|  62.1k|            input.substr(previous_location, new_location - previous_location);
 9704|  62.1k|        previous_location = new_location + 1;
 9705|  62.1k|        if (path_view == "..") {
  ------------------
  |  Branch (9705:13): [True: 13.1k, False: 48.9k]
  ------------------
 9706|  13.1k|          size_t last_delimiter = path.rfind('/');
 9707|  13.1k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (9707:15): [True: 11.1k, False: 2.00k]
  ------------------
 9708|  11.1k|            path.erase(last_delimiter);
 9709|  11.1k|          }
 9710|  48.9k|        } else if (path_view != ".") {
  ------------------
  |  Branch (9710:20): [True: 35.4k, False: 13.4k]
  ------------------
 9711|  35.4k|          path += '/';
 9712|  35.4k|          path.append(path_view);
 9713|  35.4k|        }
 9714|  62.1k|      }
 9715|  73.9k|    } while (true);
  ------------------
  |  Branch (9715:14): [True: 62.1k, Folded]
  ------------------
 9716|  18.2k|  } else {
 9717|  18.2k|    ada_log("parse_path slow");
 9718|       |    // we have reached the general case
 9719|  18.2k|    bool needs_percent_encoding = (accumulator & 1);
 9720|  65.5k|    do {
 9721|  65.5k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (9721:26): [True: 63.7k, False: 1.81k]
  |  Branch (9721:37): [True: 4.56k, False: 59.2k]
  ------------------
 9722|  65.5k|                            ? input.find_first_of("/\\")
 9723|  65.5k|                            : input.find('/');
 9724|  65.5k|      std::string_view path_view = input;
 9725|  65.5k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (9725:11): [True: 47.3k, False: 18.2k]
  ------------------
 9726|  47.3k|        path_view.remove_suffix(path_view.size() - location);
 9727|  47.3k|        input.remove_prefix(location + 1);
 9728|  47.3k|      }
 9729|       |      // Path encoding preserves dots and percent signs, so normalize first.
 9730|  65.5k|      if (unicode::is_double_dot_path_segment(path_view)) {
  ------------------
  |  Branch (9730:11): [True: 13.1k, False: 52.4k]
  ------------------
 9731|  13.1k|        helpers::shorten_path(path, type);
 9732|  13.1k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9732:13): [True: 9.88k, False: 3.22k]
  ------------------
 9733|  9.88k|          path += '/';
 9734|  9.88k|        }
 9735|  52.4k|      } else if (unicode::is_single_dot_path_segment(path_view) &&
  ------------------
  |  Branch (9735:18): [True: 2.18k, False: 50.2k]
  ------------------
 9736|  2.18k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (9736:18): [True: 375, False: 1.80k]
  ------------------
 9737|    375|        path += '/';
 9738|    375|      }
 9739|       |      // Otherwise, if path_view is not a single-dot path segment, then:
 9740|  52.0k|      else if (!unicode::is_single_dot_path_segment(path_view)) {
  ------------------
  |  Branch (9740:16): [True: 50.2k, False: 1.80k]
  ------------------
 9741|       |        // If url's scheme is "file", url's path is empty, and path_view is a
 9742|       |        // Windows drive letter, then replace the second code point in
 9743|       |        // path_view with U+003A (:).
 9744|  50.2k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (9744:13): [True: 1.96k, False: 48.3k]
  |  Branch (9744:48): [True: 543, False: 1.42k]
  ------------------
 9745|    543|            path_view.size() == 2 &&
  ------------------
  |  Branch (9745:13): [True: 67, False: 476]
  ------------------
 9746|     67|            checkers::is_windows_drive_letter(path_view)) {
  ------------------
  |  Branch (9746:13): [True: 39, False: 28]
  ------------------
 9747|     39|          path += '/';
 9748|     39|          path += path_view[0];
 9749|     39|          path += ':';
 9750|     39|          path_view.remove_prefix(2);
 9751|     39|          path.append(path_view);
 9752|  50.2k|        } else {
 9753|       |          // Append encoded bytes directly to the pathname.
 9754|  50.2k|          path += '/';
 9755|  50.2k|          if (!needs_percent_encoding ||
  ------------------
  |  Branch (9755:15): [True: 39.3k, False: 10.9k]
  ------------------
 9756|  10.9k|              !ada::unicode::percent_encode<true>(
  ------------------
  |  Branch (9756:15): [True: 7.28k, False: 3.65k]
  ------------------
 9757|  46.6k|                  path_view, character_sets::PATH_PERCENT_ENCODE, path)) {
 9758|  46.6k|            path.append(path_view);
 9759|  46.6k|          }
 9760|  50.2k|        }
 9761|  50.2k|      }
 9762|  65.5k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (9762:11): [True: 18.2k, False: 47.3k]
  ------------------
 9763|  18.2k|        return;
 9764|  18.2k|      }
 9765|  65.5k|    } while (true);
  ------------------
  |  Branch (9765:14): [True: 47.3k, Folded]
  ------------------
 9766|  18.2k|  }
 9767|  30.0k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   77|   482k|    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|   482k|  size_t i = 0;
   84|   482k|  uint8_t accumulator{};
   85|   649k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (85:10): [True: 166k, False: 482k]
  ------------------
   86|   166k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   87|   166k|                           path_signature_table[uint8_t(input[i + 1])] |
   88|   166k|                           path_signature_table[uint8_t(input[i + 2])] |
   89|   166k|                           path_signature_table[uint8_t(input[i + 3])] |
   90|   166k|                           path_signature_table[uint8_t(input[i + 4])] |
   91|   166k|                           path_signature_table[uint8_t(input[i + 5])] |
   92|   166k|                           path_signature_table[uint8_t(input[i + 6])] |
   93|   166k|                           path_signature_table[uint8_t(input[i + 7])]);
   94|   166k|  }
   95|   774k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (95:10): [True: 292k, False: 482k]
  ------------------
   96|   292k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   97|   292k|  }
   98|   482k|  return accumulator;
   99|   482k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7445|   131k|    std::string_view input) noexcept {
 7446|       |  // This will catch most cases:
 7447|       |  // The length must be 2,4 or 6.
 7448|       |  // We divide by two and require
 7449|       |  // that the result be between 1 and 3 inclusively.
 7450|   131k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7451|   131k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7451:7): [True: 59.5k, False: 71.6k]
  ------------------
 7452|  59.5k|    return false;
 7453|  59.5k|  }
 7454|       |  // We have a string of length 2, 4 or 6.
 7455|       |  // We now check the first character:
 7456|  71.6k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7456:7): [True: 58.9k, False: 12.7k]
  |  Branch (7456:28): [True: 28.0k, False: 30.8k]
  ------------------
 7457|  28.0k|    return false;
 7458|  28.0k|  }
 7459|       |  // We are unlikely the get beyond this point.
 7460|  43.5k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7461|  43.5k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7462|  43.5k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7462:7): [True: 8.11k, False: 35.4k]
  ------------------
 7463|  8.11k|    return false;
 7464|  8.11k|  }
 7465|       |  // We almost never get here.
 7466|       |  // Optimizing the rest is relatively unimportant.
 7467|  35.4k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7468|  35.4k|    uint16_t A, B;
 7469|  35.4k|    memcpy(&A, a.data(), sizeof(A));
 7470|  35.4k|    memcpy(&B, b.data(), sizeof(B));
 7471|  35.4k|    return A == B;
 7472|  35.4k|  };
 7473|  35.4k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7473:7): [True: 3.49k, False: 31.9k]
  ------------------
 7474|  3.49k|    return false;
 7475|  3.49k|  }
 7476|   118k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7476:22): [True: 92.3k, False: 26.2k]
  ------------------
 7477|  92.3k|    char c = input[i];
 7478|  92.3k|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7478:9): [True: 5.75k, False: 86.6k]
  |  Branch (7478:10): [True: 44.4k, False: 47.9k]
  ------------------
 7479|  5.75k|      return false;
 7480|  5.75k|    }
 7481|  92.3k|  }
 7482|  26.2k|  return true;
 7483|       |  // The above code might be a bit better than the code below. Compilers
 7484|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7485|       |  // 6 and other tricks.
 7486|       |  // return input == ".." ||
 7487|       |  //  input == ".%2e" || input == ".%2E" ||
 7488|       |  //  input == "%2e." || input == "%2E." ||
 7489|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7490|       |  //  "%2e%2E";
 7491|  31.9k|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7467|  35.4k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7468|  35.4k|    uint16_t A, B;
 7469|  35.4k|    memcpy(&A, a.data(), sizeof(A));
 7470|  35.4k|    memcpy(&B, b.data(), sizeof(B));
 7471|  35.4k|    return A == B;
 7472|  35.4k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7494|   209k|    std::string_view input) noexcept {
 7495|   209k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7495:10): [True: 4.16k, False: 204k]
  |  Branch (7495:26): [True: 3.81k, False: 201k]
  |  Branch (7495:44): [True: 10, False: 201k]
  ------------------
 7496|   209k|}
_ZN3ada7unicode28is_forbidden_host_code_pointEc:
 7315|  17.0k|    const char c) noexcept {
 7316|  17.0k|  return is_forbidden_host_code_point_table[uint8_t(c)];
 7317|  17.0k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9891|   100k|                              bool& is_pure_decimal) noexcept {
 9892|   100k|  is_pure_decimal = false;
 9893|   100k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9893:7): [True: 0, False: 100k]
  ------------------
 9894|      0|    return false;
 9895|      0|  }
 9896|   100k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9896:7): [True: 79.5k, False: 21.2k]
  |  Branch (9896:23): [True: 39.5k, False: 40.0k]
  |  Branch (9896:38): [True: 39.2k, False: 306]
  ------------------
 9897|  39.2k|    p += 2;
 9898|  39.2k|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9898:9): [True: 66, False: 39.1k]
  |  Branch (9898:21): [True: 30, False: 39.1k]
  ------------------
 9899|     96|      value = 0;
 9900|     96|      return true;
 9901|     96|    }
 9902|  39.1k|    uint64_t v = 0;
 9903|  39.1k|    int digits = 0;
 9904|   236k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9904:12): [True: 216k, False: 19.4k]
  |  Branch (9904:23): [True: 197k, False: 19.6k]
  ------------------
 9905|   197k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9906|   197k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9906:11): [True: 6, False: 197k]
  ------------------
 9907|      6|        return false;
 9908|      6|      }
 9909|   197k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9909:11): [True: 80, False: 196k]
  ------------------
 9910|     80|        return false;
 9911|     80|      }
 9912|   196k|      v = (v << 4) | nib;
 9913|   196k|      ++p;
 9914|   196k|      ++digits;
 9915|   196k|    }
 9916|  39.0k|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9916:9): [True: 0, False: 39.0k]
  ------------------
 9917|      0|      return false;
 9918|      0|    }
 9919|  39.0k|    value = v;
 9920|  39.0k|    return true;
 9921|  39.0k|  }
 9922|  61.6k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9922:7): [True: 40.3k, False: 21.2k]
  |  Branch (9922:23): [True: 306, False: 40.0k]
  |  Branch (9922:38): [True: 172, False: 134]
  |  Branch (9922:53): [True: 164, False: 8]
  ------------------
 9923|    164|    ++p;
 9924|    164|    uint64_t v = 0;
 9925|  1.24k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9925:12): [True: 1.18k, False: 62]
  |  Branch (9925:23): [True: 1.15k, False: 32]
  ------------------
 9926|  1.15k|      const char c = *p;
 9927|  1.15k|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9927:11): [True: 6, False: 1.14k]
  |  Branch (9927:22): [True: 14, False: 1.13k]
  ------------------
 9928|     20|        return false;
 9929|     20|      }
 9930|  1.13k|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9930:11): [True: 50, False: 1.08k]
  ------------------
 9931|     50|        return false;
 9932|     50|      }
 9933|  1.08k|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9934|  1.08k|      ++p;
 9935|  1.08k|    }
 9936|     94|    value = v;
 9937|     94|    return true;
 9938|    164|  }
 9939|  61.4k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9939:7): [True: 70, False: 61.3k]
  |  Branch (9939:19): [True: 38.3k, False: 23.0k]
  ------------------
 9940|  38.4k|    return false;
 9941|  38.4k|  }
 9942|  23.0k|  is_pure_decimal = true;
 9943|  23.0k|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9944|  23.0k|  ++p;
 9945|  29.4k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9945:10): [True: 7.65k, False: 21.8k]
  |  Branch (9945:21): [True: 6.61k, False: 1.04k]
  ------------------
 9946|  6.61k|    const char c = *p;
 9947|  6.61k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9947:9): [True: 24, False: 6.58k]
  |  Branch (9947:20): [True: 38, False: 6.55k]
  ------------------
 9948|     62|      return false;
 9949|     62|    }
 9950|  6.55k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9950:9): [True: 82, False: 6.46k]
  ------------------
 9951|     82|      return false;
 9952|     82|    }
 9953|  6.46k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9954|  6.46k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9954:9): [True: 8, False: 6.46k]
  ------------------
 9955|      8|      return false;
 9956|      8|    }
 9957|  6.46k|    ++p;
 9958|  6.46k|  }
 9959|  22.8k|  value = v;
 9960|  22.8k|  return true;
 9961|  23.0k|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9965|  2.34k|                           uint16_t& value) noexcept {
 9966|  2.34k|  if (pointer == end) {
  ------------------
  |  Branch (9966:7): [True: 0, False: 2.34k]
  ------------------
 9967|      0|    return 0;
 9968|      0|  }
 9969|  2.34k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9970|  2.34k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9970:7): [True: 44, False: 2.30k]
  ------------------
 9971|     44|    return 0;
 9972|     44|  }
 9973|  2.30k|  uint32_t v = n0;
 9974|  2.30k|  ++pointer;
 9975|  2.30k|  int length = 1;
 9976|  2.30k|  if (pointer != end) {
  ------------------
  |  Branch (9976:7): [True: 2.05k, False: 244]
  ------------------
 9977|  2.05k|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9978|  2.05k|    if (n1 != 0xff) {
  ------------------
  |  Branch (9978:9): [True: 860, False: 1.19k]
  ------------------
 9979|    860|      v = (v << 4) | n1;
 9980|    860|      ++pointer;
 9981|    860|      ++length;
 9982|    860|      if (pointer != end) {
  ------------------
  |  Branch (9982:11): [True: 796, False: 64]
  ------------------
 9983|    796|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9984|    796|        if (n2 != 0xff) {
  ------------------
  |  Branch (9984:13): [True: 510, False: 286]
  ------------------
 9985|    510|          v = (v << 4) | n2;
 9986|    510|          ++pointer;
 9987|    510|          ++length;
 9988|    510|          if (pointer != end) {
  ------------------
  |  Branch (9988:15): [True: 420, False: 90]
  ------------------
 9989|    420|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9990|    420|            if (n3 != 0xff) {
  ------------------
  |  Branch (9990:17): [True: 164, False: 256]
  ------------------
 9991|    164|              v = (v << 4) | n3;
 9992|    164|              ++pointer;
 9993|    164|              ++length;
 9994|    164|            }
 9995|    420|          }
 9996|    510|        }
 9997|    796|      }
 9998|    860|    }
 9999|  2.05k|  }
10000|  2.30k|  value = static_cast<uint16_t>(v);
10001|  2.30k|  return length;
10002|  2.34k|}
_ZN3ada3url10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10577|  24.8k|ada_really_inline void url::parse_path(std::string_view input) {
10578|  24.8k|  ada_log("parse_path ", input);
10579|  24.8k|  std::string tmp_buffer;
10580|  24.8k|  std::string_view internal_input;
10581|  24.8k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (10581:7): [True: 0, False: 24.8k]
  ------------------
10582|      0|    tmp_buffer = input;
10583|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10584|       |    // just directly build the string from user_input.
10585|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10586|      0|    internal_input = tmp_buffer;
10587|  24.8k|  } else {
10588|  24.8k|    internal_input = input;
10589|  24.8k|  }
10590|       |
10591|       |  // If url is special, then:
10592|  24.8k|  if (is_special()) {
  ------------------
  |  Branch (10592:7): [True: 24.8k, False: 0]
  ------------------
10593|  24.8k|    if (internal_input.empty()) {
  ------------------
  |  Branch (10593:9): [True: 252, False: 24.6k]
  ------------------
10594|    252|      path = "/";
10595|  24.6k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (10595:16): [True: 24.6k, False: 0]
  |  Branch (10595:46): [True: 0, False: 0]
  ------------------
10596|  24.6k|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10597|  24.6k|    } else {
10598|      0|      helpers::parse_prepared_path(internal_input, type, path);
10599|      0|    }
10600|  24.8k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (10600:14): [True: 0, False: 0]
  ------------------
10601|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (10601:9): [True: 0, False: 0]
  ------------------
10602|      0|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10603|      0|    } else {
10604|      0|      helpers::parse_prepared_path(internal_input, type, path);
10605|      0|    }
10606|      0|  } else {
10607|      0|    if (!host.has_value()) {
  ------------------
  |  Branch (10607:9): [True: 0, False: 0]
  ------------------
10608|      0|      path = "/";
10609|      0|    }
10610|      0|  }
10611|  24.8k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7409|  2.34M|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7410|  2.34M|  return is_alnum_plus_table[uint8_t(c)];
 7411|       |  // A table is almost surely much faster than the
 7412|       |  // following under most compilers: return
 7413|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7414|  2.34M|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 7086|  52.5k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 7087|  52.5k|  uint64_t broadcast_80 = broadcast(0x80);
 7088|  52.5k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 7089|  52.5k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 7090|  52.5k|  uint64_t non_ascii = 0;
 7091|  52.5k|  size_t i = 0;
 7092|       |
 7093|   100k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (7093:10): [True: 47.5k, False: 52.5k]
  ------------------
 7094|  47.5k|    uint64_t word{};
 7095|  47.5k|    memcpy(&word, input + i, sizeof(word));
 7096|  47.5k|    non_ascii |= (word & broadcast_80);
 7097|  47.5k|    word ^=
 7098|  47.5k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7099|  47.5k|    memcpy(input + i, &word, sizeof(word));
 7100|  47.5k|  }
 7101|  52.5k|  if (i < length) {
  ------------------
  |  Branch (7101:7): [True: 51.9k, False: 512]
  ------------------
 7102|  51.9k|    uint64_t word{};
 7103|  51.9k|    memcpy(&word, input + i, length - i);
 7104|  51.9k|    non_ascii |= (word & broadcast_80);
 7105|  51.9k|    word ^=
 7106|  51.9k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7107|  51.9k|    memcpy(input + i, &word, length - i);
 7108|  51.9k|  }
 7109|  52.5k|  return non_ascii == 0;
 7110|  52.5k|}
_ZN3ada7unicode9broadcastEh:
 7082|   157k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 7083|   157k|  return 0x101010101010101ull * v;
 7084|   157k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12591|  22.4k|    auto apply_query_and_hash = [&]() {
12592|  22.4k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12592:11): [True: 1.47k, False: 20.9k]
  ------------------
12593|  1.47k|        const size_t q_end =
12594|  1.47k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12594:13): [True: 935, False: 539]
  ------------------
12595|  1.47k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|  1.47k|                                                q_end - query_start - 1),
12597|  1.47k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|  1.47k|      }
12599|  22.4k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12599:11): [True: 1.42k, False: 21.0k]
  ------------------
12600|  1.42k|        out.update_unencoded_base_hash(std::string_view(
12601|  1.42k|            input.data() + hash_start + 1, len - hash_start - 1));
12602|  1.42k|      }
12603|  22.4k|    };
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12591|  22.4k|    auto apply_query_and_hash = [&]() {
12592|  22.4k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12592:11): [True: 1.47k, False: 20.9k]
  ------------------
12593|  1.47k|        const size_t q_end =
12594|  1.47k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12594:13): [True: 935, False: 539]
  ------------------
12595|  1.47k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12596|  1.47k|                                                q_end - query_start - 1),
12597|  1.47k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12598|  1.47k|      }
12599|  22.4k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12599:11): [True: 1.42k, False: 21.0k]
  ------------------
12600|  1.42k|        out.update_unencoded_base_hash(std::string_view(
12601|  1.42k|            input.data() + hash_start + 1, len - hash_start - 1));
12602|  1.42k|      }
12603|  22.4k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12205|  2.42k|    auto apply_query_and_hash = [&]() {
12206|  2.42k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12206:11): [True: 1.18k, False: 1.24k]
  ------------------
12207|  1.18k|        const size_t q_end =
12208|  1.18k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12208:13): [True: 758, False: 430]
  ------------------
12209|  1.18k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|  1.18k|                                                q_end - query_start - 1),
12211|  1.18k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|  1.18k|      }
12213|  2.42k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12213:11): [True: 1.16k, False: 1.26k]
  ------------------
12214|  1.16k|        out.update_unencoded_base_hash(std::string_view(
12215|  1.16k|            input.data() + hash_start + 1, len - hash_start - 1));
12216|  1.16k|      }
12217|  2.42k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12205|  2.42k|    auto apply_query_and_hash = [&]() {
12206|  2.42k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12206:11): [True: 1.18k, False: 1.24k]
  ------------------
12207|  1.18k|        const size_t q_end =
12208|  1.18k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12208:13): [True: 758, False: 430]
  ------------------
12209|  1.18k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12210|  1.18k|                                                q_end - query_start - 1),
12211|  1.18k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12212|  1.18k|      }
12213|  2.42k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12213:11): [True: 1.16k, False: 1.26k]
  ------------------
12214|  1.16k|        out.update_unencoded_base_hash(std::string_view(
12215|  1.16k|            input.data() + hash_start + 1, len - hash_start - 1));
12216|  1.16k|      }
12217|  2.42k|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8844|   540k|    std::string_view& input) noexcept {
 8845|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8846|       |  // function). this function should be quite fast.
 8847|   540k|  size_t location_of_first = input.find('#');
 8848|   540k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8848:7): [True: 519k, False: 21.4k]
  ------------------
 8849|   519k|    return std::nullopt;
 8850|   519k|  }
 8851|  21.4k|  std::string_view hash = input;
 8852|  21.4k|  hash.remove_prefix(location_of_first + 1);
 8853|  21.4k|  input.remove_suffix(input.size() - location_of_first);
 8854|  21.4k|  return hash;
 8855|   540k|}
_ZZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12914|   248k|  const auto enforce_max_input_length = [&]() {
12915|   248k|    if constexpr (store_values) {
12916|   248k|      if (url.is_valid) {
  ------------------
  |  Branch (12916:11): [True: 248k, False: 0]
  ------------------
12917|       |        if constexpr (result_type_is_ada_url_aggregator) {
12918|       |          if (url.buffer.size() > max_input_length) [[unlikely]] {
12919|       |            url.is_valid = false;
12920|       |          }
12921|   248k|        } else {
12922|   248k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12922:15): [True: 0, False: 248k]
  ------------------
12923|      0|            url.is_valid = false;
12924|      0|          }
12925|   248k|        }
12926|   248k|      }
12927|   248k|    }
12928|   248k|  };
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9802|   190k|find_authority_delimiter_special(std::string_view view) noexcept {
 9803|       |  // performance note: we might be able to gain further performance
 9804|       |  // with SIMD intrinsics.
 9805|  2.02M|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9805:33): [True: 2.00M, False: 20.0k]
  ------------------
 9806|  2.00M|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9806:9): [True: 170k, False: 1.83M]
  ------------------
 9807|   170k|      return pos - view.begin();
 9808|   170k|    }
 9809|  2.00M|  }
 9810|  20.0k|  return size_t(view.size());
 9811|   190k|}
_ZN3ada7helpers24find_authority_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9823|    262|find_authority_delimiter(std::string_view view) noexcept {
 9824|       |  // performance note: we might be able to gain further performance
 9825|       |  // with SIMD instrinsics.
 9826|  3.57k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9826:33): [True: 3.55k, False: 20]
  ------------------
 9827|  3.55k|    if (authority_delimiter[(uint8_t)*pos]) {
  ------------------
  |  Branch (9827:9): [True: 242, False: 3.30k]
  ------------------
 9828|    242|      return pos - view.begin();
 9829|    242|    }
 9830|  3.55k|  }
 9831|     20|  return size_t(view.size());
 9832|    262|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8857|  26.2k|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8858|       |  // Let path be url's path.
 8859|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8860|       |  // Windows drive letter, then return.
 8861|  26.2k|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8861:7): [True: 346, False: 25.8k]
  ------------------
 8862|    346|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8862:7): [True: 168, False: 178]
  |  Branch (8862:54): [True: 122, False: 46]
  ------------------
 8863|    122|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8863:9): [True: 20, False: 102]
  ------------------
 8864|    122|            helpers::substring(path, 1))) {
 8865|     20|      return false;
 8866|     20|    }
 8867|    122|  }
 8868|       |
 8869|       |  // Remove path's last item, if any.
 8870|  26.2k|  size_t last_delimiter = path.rfind('/');
 8871|  26.2k|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8871:7): [True: 22.6k, False: 3.59k]
  ------------------
 8872|  22.6k|    path.erase(last_delimiter);
 8873|  22.6k|    return true;
 8874|  22.6k|  }
 8875|       |
 8876|  3.59k|  return false;
 8877|  26.2k|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9518|   534k|    const bool is_special, std::string_view& view) noexcept {
 9519|       |  /**
 9520|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9521|       |   * compute a variable called insideBrackets but this variable is only used
 9522|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9523|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9524|       |   * It is conceptually simpler and arguably more efficient to just return a
 9525|       |   * Boolean indicating whether ':' was found outside brackets.
 9526|       |   */
 9527|   534k|  const size_t view_size = view.size();
 9528|   534k|  size_t location = 0;
 9529|   534k|  bool found_colon = false;
 9530|       |  /**
 9531|       |   * Performance analysis:
 9532|       |   *
 9533|       |   * We are basically seeking the end of the hostname which can be indicated
 9534|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9535|       |   * (where '\\' is only applicable for special URLs). However, these must
 9536|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9537|       |   * '?' does not count.
 9538|       |   *
 9539|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9540|       |   * the set of delimiters, and that we handle it first.
 9541|       |   *
 9542|       |   * So the trick is to have a fast function that locates the next delimiter.
 9543|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9544|       |   * function would be provided by the C++ standard library, but it seems that
 9545|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9546|       |   *
 9547|       |   * We do not break into two loops for speed, but for clarity.
 9548|       |   */
 9549|   534k|  if (is_special) {
  ------------------
  |  Branch (9549:7): [True: 533k, False: 1.50k]
  ------------------
 9550|       |    // We move to the next delimiter.
 9551|   533k|    location = find_next_host_delimiter_special(view, location);
 9552|       |    // Unless we find '[' then we are going only going to have to call
 9553|       |    // find_next_host_delimiter_special once.
 9554|   535k|    for (; location < view_size;
  ------------------
  |  Branch (9554:12): [True: 472k, False: 62.9k]
  ------------------
 9555|   533k|         location = find_next_host_delimiter_special(view, location)) {
 9556|   472k|      if (view[location] == '[') {
  ------------------
  |  Branch (9556:11): [True: 2.64k, False: 470k]
  ------------------
 9557|  2.64k|        location = view.find(']', location);
 9558|  2.64k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9558:13): [True: 136, False: 2.50k]
  ------------------
 9559|       |          // performance: view.find might get translated to a memchr, which
 9560|       |          // has no notion of std::string_view::npos, so the code does not
 9561|       |          // reflect the assembly.
 9562|    136|          location = view_size;
 9563|    136|          break;
 9564|    136|        }
 9565|   470k|      } else {
 9566|   470k|        found_colon = view[location] == ':';
 9567|   470k|        break;
 9568|   470k|      }
 9569|   472k|    }
 9570|   533k|  } else {
 9571|       |    // We move to the next delimiter.
 9572|  1.50k|    location = find_next_host_delimiter(view, location);
 9573|       |    // Unless we find '[' then we are going only going to have to call
 9574|       |    // find_next_host_delimiter_special once.
 9575|  1.63k|    for (; location < view_size;
  ------------------
  |  Branch (9575:12): [True: 1.37k, False: 260]
  ------------------
 9576|  1.50k|         location = find_next_host_delimiter(view, location)) {
 9577|  1.37k|      if (view[location] == '[') {
  ------------------
  |  Branch (9577:11): [True: 132, False: 1.24k]
  ------------------
 9578|    132|        location = view.find(']', location);
 9579|    132|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9579:13): [True: 4, False: 128]
  ------------------
 9580|       |          // performance: view.find might get translated to a memchr, which
 9581|       |          // has no notion of std::string_view::npos, so the code does not
 9582|       |          // reflect the assembly.
 9583|      4|          location = view_size;
 9584|      4|          break;
 9585|      4|        }
 9586|  1.24k|      } else {
 9587|  1.24k|        found_colon = view[location] == ':';
 9588|  1.24k|        break;
 9589|  1.24k|      }
 9590|  1.37k|    }
 9591|  1.50k|  }
 9592|       |  // performance: remove_suffix may translate into a single instruction.
 9593|   534k|  view.remove_suffix(view_size - location);
 9594|   534k|  return {location, found_colon};
 9595|   534k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9108|   535k|    std::string_view view, size_t location) noexcept {
 9109|       |  // first check for short strings in which case we do it naively.
 9110|   535k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9110:7): [True: 415k, False: 120k]
  ------------------
 9111|  4.42M|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9111:31): [True: 4.36M, False: 61.2k]
  ------------------
 9112|  4.36M|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (9112:11): [True: 1.38k, False: 4.36M]
  |  Branch (9112:29): [True: 350k, False: 4.01M]
  |  Branch (9112:47): [True: 216, False: 4.01M]
  ------------------
 9113|  4.01M|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (9113:11): [True: 478, False: 4.00M]
  |  Branch (9113:29): [True: 1.02k, False: 4.00M]
  ------------------
 9114|   353k|        return i;
 9115|   353k|      }
 9116|  4.36M|    }
 9117|  61.2k|    return size_t(view.size());
 9118|   415k|  }
 9119|       |  // fast path for long strings (expected to be common)
 9120|   120k|  size_t i = location;
 9121|   120k|  const __m128i mask1 = _mm_set1_epi8(':');
 9122|   120k|  const __m128i mask2 = _mm_set1_epi8('/');
 9123|   120k|  const __m128i mask3 = _mm_set1_epi8('\\');
 9124|   120k|  const __m128i mask4 = _mm_set1_epi8('?');
 9125|   120k|  const __m128i mask5 = _mm_set1_epi8('[');
 9126|       |
 9127|   236k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9127:10): [True: 174k, False: 62.8k]
  ------------------
 9128|   174k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9129|   174k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9130|   174k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9131|   174k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9132|   174k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9133|   174k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9134|   174k|    __m128i m = _mm_or_si128(
 9135|   174k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9136|   174k|    int mask = _mm_movemask_epi8(m);
 9137|   174k|    if (mask != 0) {
  ------------------
  |  Branch (9137:9): [True: 57.6k, False: 116k]
  ------------------
 9138|  57.6k|      return i + trailing_zeroes(mask);
 9139|  57.6k|    }
 9140|   174k|  }
 9141|  62.8k|  if (i < view.size()) {
  ------------------
  |  Branch (9141:7): [True: 62.6k, False: 256]
  ------------------
 9142|  62.6k|    __m128i word =
 9143|  62.6k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9144|  62.6k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9145|  62.6k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9146|  62.6k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9147|  62.6k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9148|  62.6k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9149|  62.6k|    __m128i m = _mm_or_si128(
 9150|  62.6k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9151|  62.6k|    int mask = _mm_movemask_epi8(m);
 9152|  62.6k|    if (mask != 0) {
  ------------------
  |  Branch (9152:9): [True: 61.1k, False: 1.44k]
  ------------------
 9153|  61.1k|      return view.length() - 16 + trailing_zeroes(mask);
 9154|  61.1k|    }
 9155|  62.6k|  }
 9156|  1.70k|  return size_t(view.length());
 9157|  62.8k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8930|   119k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8931|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8932|       |  unsigned long ret;
 8933|       |  // Search the mask data from least significant bit (LSB)
 8934|       |  // to the most significant bit (MSB) for a set bit (1).
 8935|       |  _BitScanForward(&ret, input_num);
 8936|       |  return (int)ret;
 8937|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8938|   119k|  return __builtin_ctzl(input_num);
 8939|   119k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8940|   119k|}
_ZN3ada7helpers24find_next_host_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9384|  1.63k|                                                  size_t location) noexcept {
 9385|       |  // first check for short strings in which case we do it naively.
 9386|  1.63k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9386:7): [True: 534, False: 1.10k]
  ------------------
 9387|  2.93k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9387:31): [True: 2.74k, False: 196]
  ------------------
 9388|  2.74k|      if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
  ------------------
  |  Branch (9388:11): [True: 84, False: 2.65k]
  |  Branch (9388:29): [True: 146, False: 2.51k]
  |  Branch (9388:47): [True: 64, False: 2.44k]
  ------------------
 9389|  2.44k|          view[i] == '[') {
  ------------------
  |  Branch (9389:11): [True: 44, False: 2.40k]
  ------------------
 9390|    338|        return i;
 9391|    338|      }
 9392|  2.74k|    }
 9393|    196|    return size_t(view.size());
 9394|    534|  }
 9395|       |  // fast path for long strings (expected to be common)
 9396|  1.10k|  size_t i = location;
 9397|  1.10k|  const __m128i mask1 = _mm_set1_epi8(':');
 9398|  1.10k|  const __m128i mask2 = _mm_set1_epi8('/');
 9399|  1.10k|  const __m128i mask4 = _mm_set1_epi8('?');
 9400|  1.10k|  const __m128i mask5 = _mm_set1_epi8('[');
 9401|       |
 9402|  1.61k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9402:10): [True: 1.45k, False: 160]
  ------------------
 9403|  1.45k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9404|  1.45k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9405|  1.45k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9406|  1.45k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9407|  1.45k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9408|  1.45k|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9409|  1.45k|    int mask = _mm_movemask_epi8(m);
 9410|  1.45k|    if (mask != 0) {
  ------------------
  |  Branch (9410:9): [True: 942, False: 510]
  ------------------
 9411|    942|      return i + trailing_zeroes(mask);
 9412|    942|    }
 9413|  1.45k|  }
 9414|    160|  if (i < view.size()) {
  ------------------
  |  Branch (9414:7): [True: 128, False: 32]
  ------------------
 9415|    128|    __m128i word =
 9416|    128|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9417|    128|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9418|    128|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9419|    128|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9420|    128|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9421|    128|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9422|    128|    int mask = _mm_movemask_epi8(m);
 9423|    128|    if (mask != 0) {
  ------------------
  |  Branch (9423:9): [True: 96, False: 32]
  ------------------
 9424|     96|      return view.length() - 16 + trailing_zeroes(mask);
 9425|     96|    }
 9426|    128|  }
 9427|     64|  return size_t(view.length());
 9428|    160|}
_ZN3ada3url10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10468|   268k|ada_really_inline bool url::parse_host(std::string_view input) {
10469|   268k|  ada_log("parse_host ", input, " [", input.size(), " bytes]");
10470|   268k|  if (input.empty()) {
  ------------------
  |  Branch (10470:7): [True: 4, False: 268k]
  ------------------
10471|      4|    return is_valid = false;
10472|      4|  }  // technically unnecessary.
10473|       |  // If input starts with U+005B ([), then:
10474|   268k|  if (input[0] == '[') {
  ------------------
  |  Branch (10474:7): [True: 643, False: 267k]
  ------------------
10475|       |    // If input does not end with U+005D (]), validation error, return failure.
10476|    643|    if (input.back() != ']') {
  ------------------
  |  Branch (10476:9): [True: 62, False: 581]
  ------------------
10477|     62|      return is_valid = false;
10478|     62|    }
10479|    581|    ada_log("parse_host ipv6");
10480|       |
10481|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
10482|       |    // trailing U+005D (]) removed.
10483|    581|    input.remove_prefix(1);
10484|    581|    input.remove_suffix(1);
10485|    581|    return parse_ipv6(input);
10486|    643|  }
10487|       |
10488|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
10489|       |  // input.
10490|   267k|  if (!is_special()) {
  ------------------
  |  Branch (10490:7): [True: 643, False: 266k]
  ------------------
10491|    643|    return parse_opaque_host(input);
10492|    643|  }
10493|       |
10494|       |  // Fast path: try to parse as pure decimal IPv4 first.
10495|   266k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
10496|   266k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (10496:7): [True: 108k, False: 157k]
  ------------------
10497|   108k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (10497:9): [True: 108k, False: 0]
  |  Branch (10497:27): [True: 10, False: 108k]
  ------------------
10498|     10|      host = input.substr(0, input.size() - 1);
10499|   108k|    } else {
10500|   108k|      host = input;
10501|   108k|    }
10502|   108k|    host_type = IPV4;
10503|   108k|    is_valid = true;
10504|   108k|    ada_log("parse_host fast path decimal ipv4");
10505|   108k|    return true;
10506|   108k|  }
10507|       |  // Let domain be the result of running UTF-8 decode without BOM on the
10508|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
10509|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
10510|       |  // which case we do not need to call the expensive 'to_ascii' if a few
10511|       |  // conditions are met: no '%' and no 'xn-' subsequence.
10512|   157k|  const uint8_t forbidden_or_upper =
10513|   157k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
10514|   157k|                                                             input.size());
10515|   157k|  static constexpr std::string_view xn_dash{"xn-", 3};
10516|   157k|  if ((forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (10516:7): [True: 135k, False: 22.1k]
  ------------------
10517|   135k|    host = std::string(input);
10518|   135k|    if ((forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (10518:9): [True: 907, False: 134k]
  ------------------
10519|    907|      unicode::to_lower_ascii(host->data(), host->size());
10520|    907|    }
10521|   135k|    if (host->find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10521:9): [True: 74.1k, False: 61.6k]
  ------------------
10522|  74.3k|        host->find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10522:9): [True: 251, False: 61.4k]
  ------------------
10523|  74.3k|      if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10523:11): [True: 39.8k, False: 34.5k]
  ------------------
10524|  39.8k|        ada_log("parse_host fast path ipv4");
10525|  39.8k|        return parse_ipv4(*host);
10526|  39.8k|      }
10527|  34.5k|      ada_log("parse_host fast path ", *host);
10528|  34.5k|      is_valid = true;
10529|  34.5k|      return true;
10530|  74.3k|    }
10531|   135k|  } else if (const size_t first_percent = input.find('%');
10532|  22.1k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (10532:14): [True: 19.7k, False: 2.37k]
  ------------------
10533|  19.7k|    std::string decoded = unicode::percent_decode(input, first_percent);
10534|  19.7k|    const uint8_t decoded_flags =
10535|  19.7k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
10536|  19.7k|                                                               decoded.size());
10537|  19.7k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (10537:9): [True: 19.4k, False: 304]
  ------------------
10538|  19.4k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (10538:11): [True: 130, False: 19.3k]
  ------------------
10539|    130|        unicode::to_lower_ascii(decoded.data(), decoded.size());
10540|    130|      }
10541|  19.4k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10541:11): [True: 19.3k, False: 59]
  ------------------
10542|  19.4k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10542:11): [True: 28, False: 31]
  ------------------
10543|  19.4k|        host = std::move(decoded);
10544|  19.4k|        if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10544:13): [True: 19.2k, False: 186]
  ------------------
10545|  19.2k|          return parse_ipv4(*host);
10546|  19.2k|        }
10547|    186|        is_valid = true;
10548|    186|        return true;
10549|  19.4k|      }
10550|  19.4k|    }
10551|  19.7k|  }
10552|  64.1k|  ada_log("parse_host calling to_ascii");
10553|  64.1k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
10554|  64.1k|  if (!is_valid || !host.has_value()) {
  ------------------
  |  Branch (10554:7): [True: 1.38k, False: 62.7k]
  |  Branch (10554:20): [True: 0, False: 62.7k]
  ------------------
10555|  1.38k|    ada_log("parse_host to_ascii returns false");
10556|  1.38k|    return is_valid = false;
10557|  1.38k|  }
10558|  62.7k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
10559|  62.7k|          " bytes]");
10560|       |
10561|  62.7k|  if (std::any_of(host->begin(), host->end(),
  ------------------
  |  Branch (10561:7): [True: 0, False: 62.7k]
  ------------------
10562|  62.7k|                  ada::unicode::is_forbidden_domain_code_point)) {
10563|      0|    host = std::nullopt;
10564|      0|    return is_valid = false;
10565|      0|  }
10566|       |
10567|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
10568|       |  // asciiDomain.
10569|  62.7k|  if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10569:7): [True: 128, False: 62.6k]
  ------------------
10570|    128|    ada_log("parse_host got ipv4 ", *host);
10571|    128|    return parse_ipv4(*host);
10572|    128|  }
10573|       |
10574|  62.6k|  return true;
10575|  62.7k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7379|   355k|                                              size_t length) noexcept {
 7380|   355k|  size_t i = 0;
 7381|   355k|  uint8_t accumulator{};
 7382|  1.38M|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7382:10): [True: 1.03M, False: 355k]
  ------------------
 7383|  1.03M|    accumulator |=
 7384|  1.03M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7385|  1.03M|    accumulator |=
 7386|  1.03M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7387|  1.03M|    accumulator |=
 7388|  1.03M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7389|  1.03M|    accumulator |=
 7390|  1.03M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7391|  1.03M|  }
 7392|   960k|  for (; i < length; i++) {
  ------------------
  |  Branch (7392:10): [True: 605k, False: 355k]
  ------------------
 7393|   605k|    accumulator |=
 7394|   605k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7395|   605k|  }
 7396|   355k|  return accumulator;
 7397|   355k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7338|  2.27M|    const char c) noexcept {
 7339|  2.27M|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7340|  2.27M|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12914|   248k|  const auto enforce_max_input_length = [&]() {
12915|   248k|    if constexpr (store_values) {
12916|   248k|      if (url.is_valid) {
  ------------------
  |  Branch (12916:11): [True: 248k, False: 0]
  ------------------
12917|   248k|        if constexpr (result_type_is_ada_url_aggregator) {
12918|   248k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12918:15): [True: 0, False: 248k]
  ------------------
12919|      0|            url.is_valid = false;
12920|      0|          }
12921|       |        } else {
12922|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12923|       |            url.is_valid = false;
12924|       |          }
12925|       |        }
12926|   248k|      }
12927|   248k|    }
12928|   248k|  };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
11252|   123k|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
11253|   123k|  uint32_t digits = 1;
11254|   370k|  while (port >= 10) {
  ------------------
  |  Branch (11254:10): [True: 246k, False: 123k]
  ------------------
11255|   246k|    port /= 10;
11256|   246k|    ++digits;
11257|   246k|  }
11258|   123k|  return digits;
11259|   123k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
11262|  11.7k|                                             uint32_t port) {
11263|  11.7k|  buffer += ':';
11264|  11.7k|  char port_buf[5];
11265|  11.7k|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
11266|  11.7k|  (void)ec;
11267|  11.7k|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
11268|  11.7k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11412|   968k|                                        size_t n) noexcept {
11413|   968k|  const size_t rem = n - host_start;
11414|       |#if ADA_NEON
11415|       |  if (rem >= 16) {
11416|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11417|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11418|       |    if (at == 0) {
11419|       |      return false;
11420|       |    }
11421|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11422|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11423|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11424|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11425|       |  }
11426|       |#elif ADA_SSE2
11427|   968k|  if (rem >= 16) {
  ------------------
  |  Branch (11427:7): [True: 632k, False: 336k]
  ------------------
11428|   632k|    const __m128i w =
11429|   632k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11430|   632k|    const uint16_t at = static_cast<uint16_t>(
11431|   632k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11432|   632k|    if (at == 0) {
  ------------------
  |  Branch (11432:9): [True: 571k, False: 61.1k]
  ------------------
11433|   571k|      return false;
11434|   571k|    }
11435|  61.1k|    const uint16_t delim = static_cast<uint16_t>(
11436|  61.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11437|  61.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11438|  61.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11439|  61.1k|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11439:12): [True: 60.3k, False: 830]
  |  Branch (11439:26): [True: 142, False: 688]
  ------------------
11440|   632k|  }
11441|       |#else
11442|       |  (void)p;
11443|       |  (void)rem;
11444|       |#endif
11445|   336k|  return false;
11446|   968k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11467|   902k|                                     bool& has_x) noexcept {
11468|   902k|  has_upper = false;
11469|   902k|  has_x = false;
11470|   902k|  size_t i = start;
11471|   902k|#if ADA_PARSER_SSSE3
11472|   902k|  if (parser_use_ssse3() && (len - start >= 16)) {
  ------------------
  |  Branch (11472:7): [True: 902k, False: 0]
  |  Branch (11472:29): [True: 567k, False: 335k]
  ------------------
11473|   567k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11474|   567k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11475|   567k|    const __m128i x_splat = _mm_set1_epi8('x');
11476|   567k|    auto visit = [&](size_t at) noexcept -> bool {
11477|   567k|      const __m128i w =
11478|   567k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11479|   567k|      const int up = sse2_uppercase(w);
11480|   567k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11481|   567k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11482|   567k|      if (mask == 0) {
11483|   567k|        if (up != 0) {
11484|   567k|          has_upper = true;
11485|   567k|        }
11486|   567k|        if (xs != 0) {
11487|   567k|          has_x = true;
11488|   567k|        }
11489|   567k|        return false;
11490|   567k|      }
11491|   567k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11492|   567k|      const int valid = (1 << hit) - 1;
11493|   567k|      if ((up & valid) != 0) {
11494|   567k|        has_upper = true;
11495|   567k|      }
11496|   567k|      if ((xs & valid) != 0) {
11497|   567k|        has_x = true;
11498|   567k|      }
11499|   567k|      end = at + static_cast<size_t>(hit);
11500|   567k|      return true;
11501|   567k|    };
11502|   586k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11502:12): [True: 95.8k, False: 490k]
  ------------------
11503|  95.8k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11503:11): [True: 75.3k, False: 20.4k]
  |  Branch (11503:23): [True: 1.52k, False: 18.9k]
  ------------------
11504|  76.8k|        return k_host_class[b[end]] == 1;
11505|  76.8k|      }
11506|  95.8k|    }
11507|   550k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11507:12): [True: 489k, False: 60.7k]
  ------------------
11508|   489k|      if (visit(i)) {
  ------------------
  |  Branch (11508:11): [True: 429k, False: 59.8k]
  ------------------
11509|   429k|        return k_host_class[b[end]] == 1;
11510|   429k|      }
11511|   489k|    }
11512|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11513|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11514|  60.7k|    if (i > start && i < len) {
  ------------------
  |  Branch (11514:9): [True: 60.7k, False: 0]
  |  Branch (11514:22): [True: 60.6k, False: 42]
  ------------------
11515|  60.6k|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11515:11): [True: 60.5k, False: 142]
  |  Branch (11515:30): [True: 60.5k, False: 0]
  ------------------
11516|  60.5k|        return k_host_class[b[end]] == 1;
11517|  60.5k|      }
11518|    142|      end = len;
11519|    142|      return true;
11520|  60.6k|    }
11521|  60.7k|  }
11522|       |#elif ADA_SSE2
11523|       |  const __m128i x_splat = _mm_set1_epi8('x');
11524|       |  for (; i + 32 <= len; i += 32) {
11525|       |    for (size_t off = 0; off < 32; off += 16) {
11526|       |      const __m128i w =
11527|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11528|       |      const int up = sse2_uppercase(w);
11529|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11530|       |      const int mask = sse2_host_stop(w);
11531|       |      if (mask != 0) {
11532|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11533|       |        const int valid = (1 << hit) - 1;
11534|       |        if ((up & valid) != 0) {
11535|       |          has_upper = true;
11536|       |        }
11537|       |        if ((xs & valid) != 0) {
11538|       |          has_x = true;
11539|       |        }
11540|       |        end = i + off + static_cast<size_t>(hit);
11541|       |        return k_host_class[b[end]] == 1;
11542|       |      }
11543|       |      if (up != 0) {
11544|       |        has_upper = true;
11545|       |      }
11546|       |      if (xs != 0) {
11547|       |        has_x = true;
11548|       |      }
11549|       |    }
11550|       |  }
11551|       |  for (; i + 16 <= len; i += 16) {
11552|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11553|       |    const int up = sse2_uppercase(w);
11554|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11555|       |    const int mask = sse2_host_stop(w);
11556|       |    if (mask != 0) {
11557|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11558|       |      const int valid = (1 << hit) - 1;
11559|       |      if ((up & valid) != 0) {
11560|       |        has_upper = true;
11561|       |      }
11562|       |      if ((xs & valid) != 0) {
11563|       |        has_x = true;
11564|       |      }
11565|       |      end = i + static_cast<size_t>(hit);
11566|       |      return k_host_class[b[end]] == 1;
11567|       |    }
11568|       |    if (up != 0) {
11569|       |      has_upper = true;
11570|       |    }
11571|       |    if (xs != 0) {
11572|       |      has_x = true;
11573|       |    }
11574|       |  }
11575|       |#elif ADA_NEON
11576|       |  if (len - start >= 16) {
11577|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11578|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11579|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11580|       |    auto visit = [&](size_t at) noexcept -> bool {
11581|       |      const uint8x16_t w = vld1q_u8(b + at);
11582|       |      const uint64_t up = neon_uppercase(w);
11583|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11584|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11585|       |      if (bits == 0) {
11586|       |        if (up != 0) {
11587|       |          has_upper = true;
11588|       |        }
11589|       |        if (xs != 0) {
11590|       |          has_x = true;
11591|       |        }
11592|       |        return false;
11593|       |      }
11594|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11595|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11596|       |      if ((up & valid) != 0) {
11597|       |        has_upper = true;
11598|       |      }
11599|       |      if ((xs & valid) != 0) {
11600|       |        has_x = true;
11601|       |      }
11602|       |      end = at + hit;
11603|       |      return true;
11604|       |    };
11605|       |    for (; i + 32 <= len; i += 32) {
11606|       |      if (visit(i) || visit(i + 16)) {
11607|       |        return k_host_class[b[end]] == 1;
11608|       |      }
11609|       |    }
11610|       |    for (; i + 16 <= len; i += 16) {
11611|       |      if (visit(i)) {
11612|       |        return k_host_class[b[end]] == 1;
11613|       |      }
11614|       |    }
11615|       |    if (i > start && i < len) {
11616|       |      if (visit(len - 16) && end >= i) {
11617|       |        return k_host_class[b[end]] == 1;
11618|       |      }
11619|       |      end = len;
11620|       |      return true;
11621|       |    }
11622|       |  }
11623|       |#endif
11624|  3.42M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11624:10): [True: 3.40M, False: 19.4k]
  ------------------
11625|  3.40M|    const uint8_t c = b[i];
11626|  3.40M|    const uint8_t cls = k_host_class[c];
11627|  3.40M|    if (cls == 1) {
  ------------------
  |  Branch (11627:9): [True: 294k, False: 3.11M]
  ------------------
11628|   294k|      end = i;
11629|   294k|      return true;
11630|   294k|    }
11631|  3.11M|    if (cls == 2) {
  ------------------
  |  Branch (11631:9): [True: 21.7k, False: 3.09M]
  ------------------
11632|  21.7k|      return false;
11633|  21.7k|    }
11634|  3.09M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11634:9): [True: 2.67M, False: 412k]
  |  Branch (11634:21): [True: 1.02k, False: 2.67M]
  ------------------
11635|  1.02k|      has_upper = true;
11636|  3.09M|    } else if (c == 'x') {
  ------------------
  |  Branch (11636:16): [True: 328k, False: 2.76M]
  ------------------
11637|   328k|      has_x = true;
11638|   328k|    }
11639|  3.09M|  }
11640|  19.4k|  end = len;
11641|  19.4k|  return true;
11642|   335k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116parser_use_ssse3Ev:
11452|  1.86M|ada_really_inline bool parser_use_ssse3() noexcept {
11453|  1.86M|#ifdef ADA_PARSER_NEED_SSSE3_TARGET
11454|  1.86M|  static const bool supported = __builtin_cpu_supports("ssse3") != 0;
11455|  1.86M|  return supported;
11456|       |#else
11457|       |  return true;
11458|       |#endif
11459|  1.86M|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
11291|  1.29M|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
11292|  1.29M|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
11293|  1.29M|}
simple_absolute.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENKUlmE_clEm:
11476|   666k|    auto visit = [&](size_t at) noexcept -> bool {
11477|   666k|      const __m128i w =
11478|   666k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11479|   666k|      const int up = sse2_uppercase(w);
11480|   666k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11481|   666k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11482|   666k|      if (mask == 0) {
  ------------------
  |  Branch (11482:11): [True: 99.3k, False: 567k]
  ------------------
11483|  99.3k|        if (up != 0) {
  ------------------
  |  Branch (11483:13): [True: 1.58k, False: 97.7k]
  ------------------
11484|  1.58k|          has_upper = true;
11485|  1.58k|        }
11486|  99.3k|        if (xs != 0) {
  ------------------
  |  Branch (11486:13): [True: 93.7k, False: 5.62k]
  ------------------
11487|  93.7k|          has_x = true;
11488|  93.7k|        }
11489|  99.3k|        return false;
11490|  99.3k|      }
11491|   567k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11492|   567k|      const int valid = (1 << hit) - 1;
11493|   567k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11493:11): [True: 20.4k, False: 546k]
  ------------------
11494|  20.4k|        has_upper = true;
11495|  20.4k|      }
11496|   567k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11496:11): [True: 493k, False: 73.9k]
  ------------------
11497|   493k|        has_x = true;
11498|   493k|      }
11499|   567k|      end = at + static_cast<size_t>(hit);
11500|   567k|      return true;
11501|   666k|    };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11378|   666k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11379|   666k|  return _mm_movemask_epi8(_mm_and_si128(
11380|   666k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11381|   666k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11382|   666k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
11298|   793k|                                          __m128i hi_tbl) noexcept {
11299|   793k|  const __m128i nibble = _mm_set1_epi8(0x0F);
11300|   793k|  const __m128i lo = _mm_and_si128(w, nibble);
11301|   793k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
11302|   793k|  const __m128i hit =
11303|   793k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
11304|   793k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
11305|   793k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
11270|   644k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
11271|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
11272|       |  unsigned long ret;
11273|       |  _BitScanForward(&ret, input_num);
11274|       |  return static_cast<int>(ret);
11275|       |#else
11276|   644k|  return __builtin_ctz(input_num);
11277|   644k|#endif
11278|   644k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11702|   658k|                                   bool& maybe_dot_segment) noexcept {
11703|   658k|  const size_t run_start = i;
11704|   658k|#if ADA_PARSER_SSSE3
11705|   658k|  if (parser_use_ssse3() && (i + 16 <= len)) {
  ------------------
  |  Branch (11705:7): [True: 658k, False: 0]
  |  Branch (11705:29): [True: 74.0k, False: 584k]
  ------------------
11706|  74.0k|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11707|  74.0k|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11708|  81.9k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11708:12): [True: 17.2k, False: 64.7k]
  ------------------
11709|  17.2k|      const __m128i w0 =
11710|  17.2k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11711|  17.2k|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11712|  17.2k|      if (m0 != 0) {
  ------------------
  |  Branch (11712:11): [True: 7.93k, False: 9.28k]
  ------------------
11713|  7.93k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11714|  7.93k|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11715|  7.93k|                            maybe_dot_segment);
11716|  7.93k|        i += static_cast<size_t>(hit_bit);
11717|  7.93k|        return;
11718|  7.93k|      }
11719|  9.28k|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11720|  9.28k|      const __m128i w1 =
11721|  9.28k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11722|  9.28k|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11723|  9.28k|      if (m1 != 0) {
  ------------------
  |  Branch (11723:11): [True: 1.39k, False: 7.89k]
  ------------------
11724|  1.39k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11725|  1.39k|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11726|  1.39k|                            maybe_dot_segment);
11727|  1.39k|        i += 16 + static_cast<size_t>(hit_bit);
11728|  1.39k|        return;
11729|  1.39k|      }
11730|  7.89k|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11731|  7.89k|    }
11732|  66.7k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11732:12): [True: 63.8k, False: 2.85k]
  ------------------
11733|  63.8k|      const __m128i w =
11734|  63.8k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11735|  63.8k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11736|  63.8k|      if (mask != 0) {
  ------------------
  |  Branch (11736:11): [True: 61.8k, False: 1.96k]
  ------------------
11737|  61.8k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11738|  61.8k|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11739|  61.8k|                            maybe_dot_segment);
11740|  61.8k|        i += static_cast<size_t>(hit_bit);
11741|  61.8k|        return;
11742|  61.8k|      }
11743|  1.96k|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11744|  1.96k|    }
11745|  2.85k|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11745:9): [True: 2.85k, False: 0]
  |  Branch (11745:26): [True: 2.29k, False: 554]
  ------------------
11746|  2.29k|      const __m128i w =
11747|  2.29k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11748|  2.29k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11749|  2.29k|      if (mask != 0) {
  ------------------
  |  Branch (11749:11): [True: 1.22k, False: 1.07k]
  ------------------
11750|  1.22k|        const size_t hit =
11751|  1.22k|            len - 16 +
11752|  1.22k|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11753|  1.22k|        if (hit >= i) {
  ------------------
  |  Branch (11753:13): [True: 1.22k, False: 0]
  ------------------
11754|  5.26k|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11754:30): [True: 4.04k, False: 1.22k]
  ------------------
11755|  4.04k|            if (b[j] == '.') {
  ------------------
  |  Branch (11755:17): [True: 908, False: 3.13k]
  ------------------
11756|    908|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11757|    908|            }
11758|  4.04k|          }
11759|  1.22k|          i = hit;
11760|  1.22k|          return;
11761|  1.22k|        }
11762|  1.22k|      }
11763|  9.40k|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11763:26): [True: 8.32k, False: 1.07k]
  ------------------
11764|  8.32k|        if (b[j] == '.') {
  ------------------
  |  Branch (11764:13): [True: 1.96k, False: 6.35k]
  ------------------
11765|  1.96k|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11766|  1.96k|        }
11767|  8.32k|      }
11768|  1.07k|      i = len;
11769|  1.07k|      return;
11770|  2.29k|    }
11771|  2.85k|  }
11772|       |#elif ADA_SSE2
11773|       |  for (; i + 16 <= len; i += 16) {
11774|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11775|       |    const int mask = sse2_path_stop(w);
11776|       |    if (mask != 0) {
11777|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11778|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11779|       |                          maybe_dot_segment);
11780|       |      i += static_cast<size_t>(hit_bit);
11781|       |      return;
11782|       |    }
11783|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11784|       |  }
11785|       |#elif ADA_NEON
11786|       |  if (i + 16 <= len) {
11787|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11788|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11789|       |    for (; i + 32 <= len; i += 32) {
11790|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11791|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11792|       |      if (bits0 != 0) {
11793|       |        const size_t hit_off =
11794|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11795|       |        const uint64_t valid =
11796|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11797|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11798|       |        i += hit_off;
11799|       |        return;
11800|       |      }
11801|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11802|       |                               maybe_dot_segment);
11803|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11804|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11805|       |      if (bits1 != 0) {
11806|       |        const size_t hit_off =
11807|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11808|       |        const uint64_t valid =
11809|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11810|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11811|       |                                 maybe_dot_segment);
11812|       |        i += 16 + hit_off;
11813|       |        return;
11814|       |      }
11815|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11816|       |                               maybe_dot_segment);
11817|       |    }
11818|       |    for (; i + 16 <= len; i += 16) {
11819|       |      const uint8x16_t w = vld1q_u8(b + i);
11820|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11821|       |      if (bits != 0) {
11822|       |        const size_t hit_off =
11823|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11824|       |        const uint64_t valid =
11825|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11826|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11827|       |        i += hit_off;
11828|       |        return;
11829|       |      }
11830|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11831|       |                               maybe_dot_segment);
11832|       |    }
11833|       |    if (i > run_start && i < len) {
11834|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11835|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11836|       |      if (bits != 0) {
11837|       |        const size_t hit =
11838|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11839|       |        if (hit >= i) {
11840|       |          for (size_t j = i; j < hit; ++j) {
11841|       |            if (b[j] == '.') {
11842|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11843|       |            }
11844|       |          }
11845|       |          i = hit;
11846|       |          return;
11847|       |        }
11848|       |      }
11849|       |      for (size_t j = i; j < len; ++j) {
11850|       |        if (b[j] == '.') {
11851|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11852|       |        }
11853|       |      }
11854|       |      i = len;
11855|       |      return;
11856|       |    }
11857|       |  }
11858|       |#endif
11859|  2.18M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11859:10): [True: 1.76M, False: 424k]
  ------------------
11860|  1.76M|    const uint8_t c = b[i];
11861|  1.76M|    const uint8_t cls = k_path[c];
11862|  1.76M|    if (cls != 0) {
  ------------------
  |  Branch (11862:9): [True: 160k, False: 1.60M]
  ------------------
11863|   160k|      return;
11864|   160k|    }
11865|  1.60M|    if (c == '.') {
  ------------------
  |  Branch (11865:9): [True: 174k, False: 1.42M]
  ------------------
11866|   174k|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11867|   174k|    }
11868|  1.60M|  }
11869|   585k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11659|  90.3k|                                           bool& maybe_dot_segment) noexcept {
11660|  90.3k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11660:7): [True: 5.72k, False: 84.6k]
  |  Branch (11660:28): [True: 5.35k, False: 79.2k]
  ------------------
11661|  11.0k|    return;
11662|  11.0k|  }
11663|  79.2k|  const int dots =
11664|  79.2k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11665|  79.2k|  if (dots == 0) {
  ------------------
  |  Branch (11665:7): [True: 68.7k, False: 10.5k]
  ------------------
11666|  68.7k|    return;
11667|  68.7k|  }
11668|  10.5k|  const int slashes =
11669|  10.5k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11670|  10.5k|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11670:8): [True: 4.00k, False: 6.54k]
  |  Branch (11670:28): [True: 1.35k, False: 2.64k]
  |  Branch (11670:46): [True: 310, False: 2.33k]
  ------------------
11671|  8.88k|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11671:7): [True: 1.56k, False: 7.31k]
  ------------------
11672|  3.23k|    maybe_dot_segment = true;
11673|  3.23k|  }
11674|  10.5k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11646|   177k|    bool& maybe_dot_segment) noexcept {
11647|   177k|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11647:7): [True: 634, False: 176k]
  |  Branch (11647:27): [True: 40.2k, False: 136k]
  ------------------
11648|  40.8k|    maybe_dot_segment = true;
11649|  40.8k|  }
11650|   177k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
12012|   183k|                                    size_t len) noexcept {
12013|   183k|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11875|   183k|  do {                                                                       \
  |  |11876|   183k|    const size_t scan_start = i;                                             \
  |  |11877|   183k|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11877:9): [True: 183k, False: 0]
  |  |  |  Branch (11877:31): [True: 5.40k, False: 177k]
  |  |  ------------------
  |  |11878|  5.40k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11879|  5.40k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11880|  13.6k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11880:14): [True: 9.04k, False: 4.60k]
  |  |  ------------------
  |  |11881|  9.04k|        const __m128i w0 =                                                   \
  |  |11882|  9.04k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11883|  9.04k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11884|  9.04k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11884:13): [True: 544, False: 8.49k]
  |  |  ------------------
  |  |11885|    544|          i += static_cast<size_t>(                                          \
  |  |11886|    544|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11887|    544|          return;                                                            \
  |  |11888|    544|        }                                                                    \
  |  |11889|  9.04k|        const __m128i w1 =                                                   \
  |  |11890|  8.49k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11891|  8.49k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11892|  8.49k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11892:13): [True: 256, False: 8.24k]
  |  |  ------------------
  |  |11893|    256|          i += 16 + static_cast<size_t>(                                     \
  |  |11894|    256|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11895|    256|          return;                                                            \
  |  |11896|    256|        }                                                                    \
  |  |11897|  8.49k|      }                                                                      \
  |  |11898|  5.40k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11898:14): [True: 1.77k, False: 3.38k]
  |  |  ------------------
  |  |11899|  1.77k|        const __m128i w =                                                    \
  |  |11900|  1.77k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11901|  1.77k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11902|  1.77k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11902:13): [True: 1.22k, False: 552]
  |  |  ------------------
  |  |11903|  1.22k|          i += static_cast<size_t>(                                          \
  |  |11904|  1.22k|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11905|  1.22k|          return;                                                            \
  |  |11906|  1.22k|        }                                                                    \
  |  |11907|  1.77k|      }                                                                      \
  |  |11908|  4.60k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11908:11): [True: 3.38k, False: 0]
  |  |  |  Branch (11908:29): [True: 3.29k, False: 90]
  |  |  ------------------
  |  |11909|  3.29k|        const __m128i w =                                                    \
  |  |11910|  3.29k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11911|  3.29k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11912|  3.29k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11912:13): [True: 2.30k, False: 990]
  |  |  ------------------
  |  |11913|  2.30k|          const size_t hit = len - 16 +                                      \
  |  |11914|  2.30k|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11915|  2.30k|                                 static_cast<uint32_t>(mask)));              \
  |  |11916|  2.30k|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11916:15): [True: 2.30k, False: 0]
  |  |  ------------------
  |  |11917|  2.30k|            i = hit;                                                         \
  |  |11918|  2.30k|            return;                                                          \
  |  |11919|  2.30k|          }                                                                  \
  |  |11920|  2.30k|        }                                                                    \
  |  |11921|  3.29k|        i = len;                                                             \
  |  |11922|    990|        return;                                                              \
  |  |11923|  3.29k|      }                                                                      \
  |  |11924|  3.38k|    }                                                                        \
  |  |11925|  1.23M|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11925:12): [True: 1.11M, False: 116k]
  |  |  ------------------
  |  |11926|  1.11M|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11926:11): [True: 61.0k, False: 1.05M]
  |  |  ------------------
  |  |11927|  61.0k|        return;                                                              \
  |  |11928|  61.0k|      }                                                                      \
  |  |11929|  1.11M|    }                                                                        \
  |  |11930|   177k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11930:12): [Folded, False: 116k]
  |  |  ------------------
  ------------------
12014|   183k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
12017|   125k|                                   size_t len) noexcept {
12018|   125k|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11875|   125k|  do {                                                                       \
  |  |11876|   125k|    const size_t scan_start = i;                                             \
  |  |11877|   125k|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11877:9): [True: 125k, False: 0]
  |  |  |  Branch (11877:31): [True: 1.49k, False: 123k]
  |  |  ------------------
  |  |11878|  1.49k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11879|  1.49k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11880|  6.23k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11880:14): [True: 4.95k, False: 1.28k]
  |  |  ------------------
  |  |11881|  4.95k|        const __m128i w0 =                                                   \
  |  |11882|  4.95k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11883|  4.95k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11884|  4.95k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11884:13): [True: 158, False: 4.79k]
  |  |  ------------------
  |  |11885|    158|          i += static_cast<size_t>(                                          \
  |  |11886|    158|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11887|    158|          return;                                                            \
  |  |11888|    158|        }                                                                    \
  |  |11889|  4.95k|        const __m128i w1 =                                                   \
  |  |11890|  4.79k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11891|  4.79k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11892|  4.79k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11892:13): [True: 52, False: 4.74k]
  |  |  ------------------
  |  |11893|     52|          i += 16 + static_cast<size_t>(                                     \
  |  |11894|     52|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11895|     52|          return;                                                            \
  |  |11896|     52|        }                                                                    \
  |  |11897|  4.79k|      }                                                                      \
  |  |11898|  2.01k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11898:14): [True: 774, False: 1.23k]
  |  |  ------------------
  |  |11899|    774|        const __m128i w =                                                    \
  |  |11900|    774|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11901|    774|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11902|    774|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11902:13): [True: 44, False: 730]
  |  |  ------------------
  |  |11903|     44|          i += static_cast<size_t>(                                          \
  |  |11904|     44|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11905|     44|          return;                                                            \
  |  |11906|     44|        }                                                                    \
  |  |11907|    774|      }                                                                      \
  |  |11908|  1.28k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11908:11): [True: 1.23k, False: 0]
  |  |  |  Branch (11908:29): [True: 1.11k, False: 126]
  |  |  ------------------
  |  |11909|  1.11k|        const __m128i w =                                                    \
  |  |11910|  1.11k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11911|  1.11k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11912|  1.11k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11912:13): [True: 70, False: 1.04k]
  |  |  ------------------
  |  |11913|     70|          const size_t hit = len - 16 +                                      \
  |  |11914|     70|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11915|     70|                                 static_cast<uint32_t>(mask)));              \
  |  |11916|     70|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11916:15): [True: 70, False: 0]
  |  |  ------------------
  |  |11917|     70|            i = hit;                                                         \
  |  |11918|     70|            return;                                                          \
  |  |11919|     70|          }                                                                  \
  |  |11920|     70|        }                                                                    \
  |  |11921|  1.11k|        i = len;                                                             \
  |  |11922|  1.04k|        return;                                                              \
  |  |11923|  1.11k|      }                                                                      \
  |  |11924|  1.23k|    }                                                                        \
  |  |11925|   606k|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11925:12): [True: 482k, False: 123k]
  |  |  ------------------
  |  |11926|   482k|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11926:11): [True: 132, False: 482k]
  |  |  ------------------
  |  |11927|    132|        return;                                                              \
  |  |11928|    132|      }                                                                      \
  |  |11929|   482k|    }                                                                        \
  |  |11930|   124k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11930:12): [Folded, False: 123k]
  |  |  ------------------
  ------------------
12019|   125k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
12023|  21.9k|bool path_has_dot_segment(std::string_view path) noexcept {
12024|  21.9k|  if (path.empty()) {
  ------------------
  |  Branch (12024:7): [True: 0, False: 21.9k]
  ------------------
12025|      0|    return false;
12026|      0|  }
12027|       |  // "." / ".." at the start, with or without a leading '/'.
12028|  21.9k|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (12028:20): [True: 21.9k, False: 0]
  ------------------
12029|  21.9k|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (12029:7): [True: 21.9k, False: 0]
  |  Branch (12029:26): [True: 1.16k, False: 20.8k]
  ------------------
12030|  1.16k|    const size_t after = i + 1;
12031|  1.16k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (12031:9): [True: 32, False: 1.13k]
  |  Branch (12031:33): [True: 206, False: 926]
  ------------------
12032|    926|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (12032:10): [True: 926, False: 0]
  |  Branch (12032:33): [True: 516, False: 410]
  ------------------
12033|    516|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (12033:11): [True: 14, False: 502]
  |  Branch (12033:39): [True: 224, False: 278]
  ------------------
12034|    476|      return true;
12035|    476|    }
12036|  1.16k|  }
12037|  21.5k|  static constexpr std::string_view slash_dot{"/.", 2};
12038|  21.5k|  size_t p = i;
12039|  24.8k|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (12039:10): [True: 23.4k, False: 1.39k]
  ------------------
12040|  23.4k|    const size_t after = p + 2;
12041|  23.4k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (12041:9): [True: 74, False: 23.3k]
  |  Branch (12041:33): [True: 19.7k, False: 3.60k]
  ------------------
12042|  3.60k|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (12042:10): [True: 3.60k, False: 0]
  |  Branch (12042:33): [True: 958, False: 2.64k]
  ------------------
12043|  20.1k|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (12043:11): [True: 56, False: 902]
  |  Branch (12043:39): [True: 214, False: 688]
  ------------------
12044|  20.1k|      return true;
12045|  20.1k|    }
12046|  3.33k|    p = after;
12047|  3.33k|  }
12048|  1.39k|  return false;
12049|  21.5k|}
simple_absolute.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
14010|   270k|    ada::url_components& components, uint32_t new_difference) {
14011|   270k|  components.username_end += new_difference;
14012|   270k|  components.host_start += new_difference;
14013|   270k|  components.host_end += new_difference;
14014|   270k|  components.pathname_start += new_difference;
14015|   270k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (14015:7): [True: 0, False: 270k]
  ------------------
14016|      0|    components.search_start += new_difference;
14017|      0|  }
14018|   270k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (14018:7): [True: 0, False: 270k]
  ------------------
14019|      0|    components.hash_start += new_difference;
14020|      0|  }
14021|   270k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14389|  24.8k|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14390|  24.8k|  ada_log("url_aggregator::parse_path ", input);
14391|  24.8k|  ADA_ASSERT_TRUE(validate());
14392|  24.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14393|  24.8k|  std::string tmp_buffer;
14394|  24.8k|  std::string_view internal_input;
14395|  24.8k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14395:7): [True: 0, False: 24.8k]
  ------------------
14396|      0|    tmp_buffer = input;
14397|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14398|       |    // just directly build the string from user_input.
14399|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14400|      0|    internal_input = tmp_buffer;
14401|  24.8k|  } else {
14402|  24.8k|    internal_input = input;
14403|  24.8k|  }
14404|       |
14405|       |  // If url is special, then:
14406|  24.8k|  if (is_special()) {
  ------------------
  |  Branch (14406:7): [True: 24.8k, False: 0]
  ------------------
14407|  24.8k|    if (internal_input.empty()) {
  ------------------
  |  Branch (14407:9): [True: 252, False: 24.6k]
  ------------------
14408|    252|      update_base_pathname("/");
14409|  24.6k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14409:16): [True: 24.6k, False: 0]
  |  Branch (14409:46): [True: 0, False: 0]
  ------------------
14410|  24.6k|      consume_prepared_path(internal_input.substr(1));
14411|  24.6k|    } else {
14412|      0|      consume_prepared_path(internal_input);
14413|      0|    }
14414|  24.8k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14414:14): [True: 0, False: 0]
  ------------------
14415|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14415:9): [True: 0, False: 0]
  ------------------
14416|      0|      consume_prepared_path(internal_input.substr(1));
14417|      0|    } else {
14418|      0|      consume_prepared_path(internal_input);
14419|      0|    }
14420|      0|  } else {
14421|       |    // Non-special URLs with an empty host can have their paths erased
14422|       |    // Path-only URLs cannot have their paths erased
14423|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14423:9): [True: 0, False: 0]
  |  Branch (14423:57): [True: 0, False: 0]
  ------------------
14424|      0|      update_base_pathname("/");
14425|      0|    }
14426|      0|  }
14427|  24.8k|  ADA_ASSERT_TRUE(validate());
14428|  24.8k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14530|   268k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14531|   268k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14532|   268k|          " bytes]");
14533|   268k|  ADA_ASSERT_TRUE(validate());
14534|   268k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14535|   268k|  if (input.empty()) {
  ------------------
  |  Branch (14535:7): [True: 4, False: 268k]
  ------------------
14536|      4|    return is_valid = false;
14537|      4|  }  // technically unnecessary.
14538|       |  // If input starts with U+005B ([), then:
14539|   268k|  if (input[0] == '[') {
  ------------------
  |  Branch (14539:7): [True: 643, False: 267k]
  ------------------
14540|       |    // If input does not end with U+005D (]), validation error, return failure.
14541|    643|    if (input.back() != ']') {
  ------------------
  |  Branch (14541:9): [True: 62, False: 581]
  ------------------
14542|     62|      return is_valid = false;
14543|     62|    }
14544|    581|    ada_log("parse_host ipv6");
14545|       |
14546|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14547|       |    // trailing U+005D (]) removed.
14548|    581|    input.remove_prefix(1);
14549|    581|    input.remove_suffix(1);
14550|    581|    return parse_ipv6(input);
14551|    643|  }
14552|       |
14553|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14554|       |  // input.
14555|   267k|  if (!is_special()) {
  ------------------
  |  Branch (14555:7): [True: 643, False: 266k]
  ------------------
14556|    643|    return parse_opaque_host(input);
14557|    643|  }
14558|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14559|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14560|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14561|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14562|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14563|       |
14564|       |  // Often, the input does not contain any forbidden code points, and no upper
14565|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14566|       |  // optimize for such a common case.
14567|       |
14568|       |  // Fast path: try to parse as pure decimal IPv4 first.
14569|   266k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14570|   266k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14570:7): [True: 108k, False: 157k]
  ------------------
14571|   108k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14571:9): [True: 108k, False: 0]
  |  Branch (14571:27): [True: 10, False: 108k]
  ------------------
14572|     10|      update_base_hostname(input.substr(0, input.size() - 1));
14573|   108k|    } else {
14574|   108k|      update_base_hostname(input);
14575|   108k|    }
14576|   108k|    host_type = IPV4;
14577|   108k|    is_valid = true;
14578|   108k|    ada_log("parse_host fast path decimal ipv4");
14579|   108k|    ADA_ASSERT_TRUE(validate());
14580|   108k|    return true;
14581|   108k|  }
14582|   157k|  uint8_t is_forbidden_or_upper =
14583|   157k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14584|   157k|                                                             input.size());
14585|   157k|  static constexpr std::string_view xn_dash{"xn-", 3};
14586|   157k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14586:7): [True: 135k, False: 22.1k]
  ------------------
14587|   135k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14587:9): [True: 907, False: 134k]
  ------------------
14588|    907|      std::string lowered(input);
14589|    907|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14590|    907|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14590:11): [True: 619, False: 288]
  ------------------
14591|    672|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14591:11): [True: 53, False: 235]
  ------------------
14592|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14593|       |        // This also avoids a double buffer rewrite for hex/octal IPv4.
14594|    672|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14594:13): [True: 148, False: 524]
  ------------------
14595|    148|          ada_log("parse_host fast path ipv4");
14596|    148|          return parse_ipv4(lowered, false);
14597|    148|        }
14598|    524|        update_base_hostname(lowered);
14599|    524|        ada_log("parse_host fast path ", get_hostname());
14600|    524|        is_valid = true;
14601|    524|        return true;
14602|    672|      }
14603|   134k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14603:16): [True: 73.5k, False: 61.4k]
  ------------------
14604|  73.7k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14604:16): [True: 198, False: 61.2k]
  ------------------
14605|       |      // Check IPv4 before mutating so failures leave the buffer untouched.
14606|  73.7k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14606:11): [True: 39.6k, False: 34.0k]
  ------------------
14607|  39.6k|        ada_log("parse_host fast path ipv4");
14608|  39.6k|        return parse_ipv4(input, false);
14609|  39.6k|      }
14610|  34.0k|      update_base_hostname(input);
14611|  34.0k|      ada_log("parse_host fast path ", get_hostname());
14612|  34.0k|      is_valid = true;
14613|  34.0k|      return true;
14614|  73.7k|    }
14615|   135k|  } else if (const size_t first_percent = input.find('%');
14616|  22.1k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14616:14): [True: 19.7k, False: 2.37k]
  ------------------
14617|  19.7k|    std::string decoded = unicode::percent_decode(input, first_percent);
14618|  19.7k|    const uint8_t decoded_flags =
14619|  19.7k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14620|  19.7k|                                                               decoded.size());
14621|  19.7k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14621:9): [True: 19.4k, False: 304]
  ------------------
14622|  19.4k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14622:11): [True: 130, False: 19.3k]
  ------------------
14623|    130|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14624|    130|      }
14625|  19.4k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14625:11): [True: 19.3k, False: 59]
  ------------------
14626|  19.4k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14626:11): [True: 28, False: 31]
  ------------------
14627|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14628|  19.4k|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14628:13): [True: 19.2k, False: 186]
  ------------------
14629|  19.2k|          return parse_ipv4(decoded, false);
14630|  19.2k|        }
14631|    186|        update_base_hostname(decoded);
14632|    186|        is_valid = true;
14633|    186|        return true;
14634|  19.4k|      }
14635|  19.4k|    }
14636|  19.7k|  }
14637|       |  // We have encountered at least one forbidden code point or the input contains
14638|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14639|       |  // conversion.
14640|       |
14641|  64.1k|  ada_log("parse_host calling to_ascii");
14642|  64.1k|  std::optional<std::string> host = std::string(get_hostname());
14643|  64.1k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14644|  64.1k|  if (!is_valid) {
  ------------------
  |  Branch (14644:7): [True: 1.38k, False: 62.7k]
  ------------------
14645|  1.38k|    ada_log("parse_host to_ascii returns false");
14646|  1.38k|    return is_valid = false;
14647|  1.38k|  }
14648|  62.7k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14649|  62.7k|          " bytes]");
14650|       |
14651|  62.7k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14651:7): [True: 0, False: 62.7k]
  ------------------
14652|  62.7k|                          ada::unicode::is_forbidden_domain_code_point)) {
14653|      0|    return is_valid = false;
14654|      0|  }
14655|       |
14656|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14657|       |  // asciiDomain.
14658|  62.7k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14658:7): [True: 128, False: 62.6k]
  ------------------
14659|    128|    ada_log("parse_host got ipv4 ", *host);
14660|    128|    return parse_ipv4(host.value(), false);
14661|    128|  }
14662|       |
14663|  62.6k|  update_base_hostname(host.value());
14664|  62.6k|  ADA_ASSERT_TRUE(validate());
14665|  62.6k|  return true;
14666|  62.7k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8916|  23.4k|                                                       size_t pos) {
 8917|  23.4k|  ADA_ASSERT_TRUE(pos <= input.size());
 8918|       |  // The following is safer but unneeded if we have the above line:
 8919|       |  // return pos > input.size() ? std::string_view() : input.substr(pos);
 8920|  23.4k|  return input.substr(pos);
 8921|  23.4k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15541|   241k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15542|   241k|  ada_log("url_aggregator::consume_prepared_path ", input);
15543|       |  /***
15544|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15545|       |   * unfortunate. This particular function is nearly identical, except that it
15546|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15547|       |   * very common) merely appends to the buffer. This is the same trivial path as
15548|       |   * with helpers::parse_prepared_path, except that we have the additional check
15549|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15550|       |   * modify it, and then insert it back into the buffer.
15551|       |   */
15552|   241k|  uint8_t accumulator = checkers::path_signature(input);
15553|       |  // Let us first detect a trivial case.
15554|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15555|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15556|       |  // no dot, and no character needing percent encoding.
15557|   241k|  constexpr uint8_t need_encoding = 1;
15558|   241k|  constexpr uint8_t backslash_char = 2;
15559|   241k|  constexpr uint8_t dot_char = 4;
15560|   241k|  constexpr uint8_t percent_char = 8;
15561|   241k|  bool special = type != ada::scheme::NOT_SPECIAL;
15562|   241k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15562:39): [True: 1.26k, False: 239k]
  ------------------
15563|  1.26k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15563:39): [True: 37, False: 1.23k]
  ------------------
15564|   241k|  bool trivial_path =
15565|   241k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15565:7): [True: 210k, False: 30.9k]
  |  Branch (15565:8): [True: 240k, False: 765]
  ------------------
15566|   241k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15567|    765|                  0)) &&
15568|   210k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15568:7): [True: 210k, False: 20]
  ------------------
15569|   241k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15569:7): [True: 12.9k, False: 228k]
  |  Branch (15569:34): [True: 12.8k, False: 12]
  ------------------
15570|       |    // '4' means that we have at least one dot, but nothing that requires
15571|       |    // percent encoding or decoding. The only part that is not trivial is
15572|       |    // that we may have single dots and double dots path segments.
15573|       |    // If we have such segments, then we either have a path that begins
15574|       |    // with '.' (easy to check), or we have the sequence './'.
15575|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15576|       |    // Note: we know that '\' is not present.
15577|  12.8k|    if (input[0] != '.') {
  ------------------
  |  Branch (15577:9): [True: 11.6k, False: 1.27k]
  ------------------
15578|  11.6k|      size_t slashdot = 0;
15579|  11.6k|      bool dot_is_file = true;
15580|  38.4k|      for (;;) {
15581|  38.4k|        slashdot = input.find("/.", slashdot);
15582|  38.4k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15582:13): [True: 11.6k, False: 26.8k]
  ------------------
15583|  11.6k|          break;
15584|  26.8k|        } else {  // uncommon
15585|       |          // only three cases matter: /./, /.. or a final /
15586|  26.8k|          slashdot += 2;
15587|  26.8k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15587:28): [True: 66, False: 26.7k]
  |  Branch (15587:56): [True: 12.4k, False: 14.2k]
  ------------------
15588|  14.2k|                           input[slashdot] == '/');
  ------------------
  |  Branch (15588:28): [True: 12.5k, False: 1.67k]
  ------------------
15589|  26.8k|        }
15590|  38.4k|      }
15591|  11.6k|      trivial_path = dot_is_file;
15592|  11.6k|    }
15593|  12.8k|  }
15594|   241k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15594:7): [True: 211k, False: 30.0k]
  |  Branch (15594:23): [True: 211k, False: 0]
  ------------------
15595|   211k|    ada_log("parse_path trivial");
15596|   211k|    buffer += '/';
15597|   211k|    buffer += input;
15598|   211k|    return;
15599|   211k|  }
15600|  30.0k|  std::string path = std::string(get_pathname());
15601|       |  // We are going to need to look a bit at the path, but let us see if we can
15602|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15603|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15604|       |  // there.
15605|  30.0k|  bool fast_path =
15606|  30.0k|      (special &&
  ------------------
  |  Branch (15606:8): [True: 29.6k, False: 422]
  ------------------
15607|  29.6k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15607:8): [True: 11.8k, False: 17.7k]
  ------------------
15608|  11.8k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15608:7): [True: 11.7k, False: 100]
  ------------------
15609|  30.0k|  if (fast_path) {
  ------------------
  |  Branch (15609:7): [True: 11.7k, False: 18.2k]
  ------------------
15610|  11.7k|    ada_log("parse_prepared_path fast");
15611|       |    // Here we don't need to worry about \ or percent encoding.
15612|       |    // We also do not have a file protocol. We might have dots, however,
15613|       |    // but dots must as appear as '.', and they cannot be encoded because
15614|       |    // the symbol '%' is not present.
15615|  11.7k|    size_t previous_location = 0;  // We start at 0.
15616|  73.9k|    do {
15617|  73.9k|      size_t new_location = input.find('/', previous_location);
15618|       |      // std::string_view path_view = input;
15619|       |      //  We process the last segment separately:
15620|  73.9k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15620:11): [True: 11.7k, False: 62.1k]
  ------------------
15621|  11.7k|        std::string_view path_view = input.substr(previous_location);
15622|  11.7k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15622:13): [True: 81, False: 11.7k]
  ------------------
15623|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15624|     81|          if (path.empty()) {
  ------------------
  |  Branch (15624:15): [True: 22, False: 59]
  ------------------
15625|     22|            path = '/';
15626|     22|            update_base_pathname(path);
15627|     22|            return;
15628|     22|          }
15629|       |          // Fast case where we have nothing to do:
15630|     59|          if (path.back() == '/') {
  ------------------
  |  Branch (15630:15): [True: 16, False: 43]
  ------------------
15631|     16|            update_base_pathname(path);
15632|     16|            return;
15633|     16|          }
15634|       |          // If you have the path "/joe/myfriend",
15635|       |          // then you delete 'myfriend'.
15636|     43|          path.resize(path.rfind('/') + 1);
15637|     43|          update_base_pathname(path);
15638|     43|          return;
15639|     59|        }
15640|  11.7k|        path += '/';
15641|  11.7k|        if (path_view != ".") {
  ------------------
  |  Branch (15641:13): [True: 11.6k, False: 98]
  ------------------
15642|  11.6k|          path.append(path_view);
15643|  11.6k|        }
15644|  11.7k|        update_base_pathname(path);
15645|  11.7k|        return;
15646|  62.1k|      } else {
15647|       |        // This is a non-final segment.
15648|  62.1k|        std::string_view path_view =
15649|  62.1k|            input.substr(previous_location, new_location - previous_location);
15650|  62.1k|        previous_location = new_location + 1;
15651|  62.1k|        if (path_view == "..") {
  ------------------
  |  Branch (15651:13): [True: 13.1k, False: 48.9k]
  ------------------
15652|  13.1k|          size_t last_delimiter = path.rfind('/');
15653|  13.1k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15653:15): [True: 11.1k, False: 2.00k]
  ------------------
15654|  11.1k|            path.erase(last_delimiter);
15655|  11.1k|          }
15656|  48.9k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15656:20): [True: 35.4k, False: 13.4k]
  ------------------
15657|  35.4k|          path += '/';
15658|  35.4k|          path.append(path_view);
15659|  35.4k|        }
15660|  62.1k|      }
15661|  73.9k|    } while (true);
  ------------------
  |  Branch (15661:14): [True: 62.1k, Folded]
  ------------------
15662|  18.2k|  } else {
15663|  18.2k|    ada_log("parse_path slow");
15664|       |    // we have reached the general case
15665|  18.2k|    bool needs_percent_encoding = (accumulator & 1);
15666|  65.5k|    do {
15667|  65.5k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15667:26): [True: 63.7k, False: 1.81k]
  |  Branch (15667:37): [True: 4.56k, False: 59.2k]
  ------------------
15668|  65.5k|                            ? input.find_first_of("/\\")
15669|  65.5k|                            : input.find('/');
15670|  65.5k|      std::string_view path_view = input;
15671|  65.5k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15671:11): [True: 47.3k, False: 18.2k]
  ------------------
15672|  47.3k|        path_view.remove_suffix(path_view.size() - location);
15673|  47.3k|        input.remove_prefix(location + 1);
15674|  47.3k|      }
15675|       |      // Path encoding preserves dots and percent signs, so normalize first.
15676|  65.5k|      if (unicode::is_double_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15676:11): [True: 13.1k, False: 52.4k]
  ------------------
15677|  13.1k|        helpers::shorten_path(path, type);
15678|  13.1k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15678:13): [True: 9.88k, False: 3.22k]
  ------------------
15679|  9.88k|          path += '/';
15680|  9.88k|        }
15681|  52.4k|      } else if (unicode::is_single_dot_path_segment(path_view) &&
  ------------------
  |  Branch (15681:18): [True: 2.18k, False: 50.2k]
  ------------------
15682|  2.18k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15682:18): [True: 375, False: 1.80k]
  ------------------
15683|    375|        path += '/';
15684|    375|      }
15685|       |      // Otherwise, if path_view is not a single-dot path segment, then:
15686|  52.0k|      else if (!unicode::is_single_dot_path_segment(path_view)) {
  ------------------
  |  Branch (15686:16): [True: 50.2k, False: 1.80k]
  ------------------
15687|       |        // If url's scheme is "file", url's path is empty, and path_view is a
15688|       |        // Windows drive letter, then replace the second code point in
15689|       |        // path_view with U+003A (:).
15690|  50.2k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15690:13): [True: 1.96k, False: 48.3k]
  |  Branch (15690:48): [True: 543, False: 1.42k]
  ------------------
15691|    543|            path_view.size() == 2 &&
  ------------------
  |  Branch (15691:13): [True: 67, False: 476]
  ------------------
15692|     67|            checkers::is_windows_drive_letter(path_view)) {
  ------------------
  |  Branch (15692:13): [True: 39, False: 28]
  ------------------
15693|     39|          path += '/';
15694|     39|          path += path_view[0];
15695|     39|          path += ':';
15696|     39|          path_view.remove_prefix(2);
15697|     39|          path.append(path_view);
15698|  50.2k|        } else {
15699|       |          // Append encoded bytes directly to the pathname.
15700|  50.2k|          path += '/';
15701|  50.2k|          if (!needs_percent_encoding ||
  ------------------
  |  Branch (15701:15): [True: 39.3k, False: 10.9k]
  ------------------
15702|  10.9k|              !ada::unicode::percent_encode<true>(
  ------------------
  |  Branch (15702:15): [True: 7.28k, False: 3.65k]
  ------------------
15703|  46.6k|                  path_view, character_sets::PATH_PERCENT_ENCODE, path)) {
15704|  46.6k|            path.append(path_view);
15705|  46.6k|          }
15706|  50.2k|        }
15707|  50.2k|      }
15708|  65.5k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15708:11): [True: 18.2k, False: 47.3k]
  ------------------
15709|  18.2k|        update_base_pathname(path);
15710|  18.2k|        return;
15711|  18.2k|      }
15712|  65.5k|    } while (true);
  ------------------
  |  Branch (15712:14): [True: 47.3k, Folded]
  ------------------
15713|  18.2k|  }
15714|  30.0k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   14|   313k|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|   313k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (16:7): [True: 192k, False: 120k]
  ------------------
   17|   192k|    return false;
   18|   192k|  }
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|   120k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 57.4k, False: 63.1k]
  ------------------
   21|  57.4k|    view.remove_suffix(1);
   22|  57.4k|  }
   23|       |  // From the last character, find the last dot.
   24|   120k|  size_t last_dot = view.rfind('.');
   25|   120k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (25:7): [True: 97.7k, False: 22.7k]
  ------------------
   26|       |    // We have at least one dot.
   27|  97.7k|    view.remove_prefix(last_dot + 1);
   28|  97.7k|  }
   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|   120k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (32:7): [True: 60.6k, False: 59.9k]
  ------------------
   33|  60.6k|    return true;
   34|  60.6k|  }
   35|       |  // It could be hex (0x), but not if there is a single character.
   36|  59.9k|  if (view.size() == 1) {
  ------------------
  |  Branch (36:7): [True: 0, False: 59.9k]
  ------------------
   37|      0|    return false;
   38|      0|  }
   39|       |  // It must start with 0x.
   40|  59.9k|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (40:7): [True: 1.39k, False: 58.5k]
  ------------------
   41|  1.39k|    return false;
   42|  1.39k|  }
   43|       |  // We must allow "0x".
   44|  58.5k|  if (view.size() == 2) {
  ------------------
  |  Branch (44:7): [True: 19.1k, False: 39.3k]
  ------------------
   45|  19.1k|    return true;
   46|  19.1k|  }
   47|       |  // We have 0x followed by some characters, we need to check that they are
   48|       |  // hexadecimals.
   49|  39.3k|  view.remove_prefix(2);
   50|  39.3k|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   51|  58.5k|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7498|   336k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7499|   336k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7499:11): [True: 336k, False: 0]
  |  Branch (7499:23): [True: 7.67k, False: 328k]
  |  Branch (7499:37): [True: 328k, False: 0]
  |  Branch (7499:49): [True: 327k, False: 822]
  ------------------
 7500|   336k|}
_ZN3ada3url12parse_schemeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
10370|   270k|ada_really_inline bool url::parse_scheme(const std::string_view input) {
10371|   270k|  auto parsed_type = ada::scheme::get_scheme_type(input);
10372|   270k|  bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
10373|       |  /**
10374|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
10375|       |   *http, https), in which case, we can go really fast.
10376|       |   **/
10377|   270k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (10377:7): [True: 265k, False: 4.77k]
  ------------------
10378|       |    if constexpr (has_state_override) {
10379|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
10380|       |      // then return.
10381|       |      if (is_special() != is_input_special) {
10382|       |        return false;
10383|       |      }
10384|       |
10385|       |      // If url includes credentials or has a non-null port, and buffer is
10386|       |      // "file", then return.
10387|       |      if ((has_credentials() || port.has_value()) &&
10388|       |          parsed_type == ada::scheme::type::FILE) {
10389|       |        return false;
10390|       |      }
10391|       |
10392|       |      // If url's scheme is "file" and its host is an empty host, then return.
10393|       |      // An empty host is the empty string.
10394|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10395|       |          host->empty()) {
10396|       |        return false;
10397|       |      }
10398|       |    }
10399|       |
10400|   265k|    type = parsed_type;
10401|       |
10402|       |    if constexpr (has_state_override) {
10403|       |      // This is uncommon.
10404|       |      uint16_t urls_scheme_port = get_special_port();
10405|       |
10406|       |      if (urls_scheme_port) {
10407|       |        // If url's port is url's scheme's default port, then set url's port to
10408|       |        // null.
10409|       |        if (port.has_value() && *port == urls_scheme_port) {
10410|       |          port = std::nullopt;
10411|       |        }
10412|       |      }
10413|       |    }
10414|   265k|  } else {  // slow path
10415|  4.77k|    std::string _buffer(input);
10416|       |    // Next function is only valid if the input is ASCII and returns false
10417|       |    // otherwise, but it seems that we always have ascii content so we do not
10418|       |    // need to check the return value.
10419|       |    // bool is_ascii =
10420|  4.77k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
10421|       |
10422|       |    if constexpr (has_state_override) {
10423|       |      // The state-override validation errors below ("return" in the WHATWG URL
10424|       |      // parser) leave the URL unchanged. The setter contract is
10425|       |      // "true on success, false if the scheme is invalid" -- the fast path
10426|       |      // above already returns false here, so the slow path must agree.
10427|       |
10428|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
10429|       |      // then return. If url's scheme is not a special scheme and buffer is a
10430|       |      // special scheme, then return.
10431|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
10432|       |        return false;
10433|       |      }
10434|       |
10435|       |      // If url includes credentials or has a non-null port, and buffer is
10436|       |      // "file", then return.
10437|       |      if ((has_credentials() || port.has_value()) && _buffer == "file") {
10438|       |        return false;
10439|       |      }
10440|       |
10441|       |      // If url's scheme is "file" and its host is an empty host, then return.
10442|       |      // An empty host is the empty string.
10443|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10444|       |          host->empty()) {
10445|       |        return false;
10446|       |      }
10447|       |    }
10448|       |
10449|  4.77k|    set_scheme(std::move(_buffer));
10450|       |
10451|       |    if constexpr (has_state_override) {
10452|       |      // This is uncommon.
10453|       |      uint16_t urls_scheme_port = get_special_port();
10454|       |
10455|       |      if (urls_scheme_port) {
10456|       |        // If url's port is url's scheme's default port, then set url's port to
10457|       |        // null.
10458|       |        if (port.has_value() && *port == urls_scheme_port) {
10459|       |          port = std::nullopt;
10460|       |        }
10461|       |      }
10462|       |    }
10463|  4.77k|  }
10464|       |
10465|   270k|  return true;
10466|   270k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
14028|   270k|    const std::string_view input_with_colon) {
14029|   270k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
14030|   270k|  ADA_ASSERT_TRUE(validate());
14031|   270k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
14032|   270k|  std::string_view input{input_with_colon};
14033|   270k|  input.remove_suffix(1);
14034|   270k|  auto parsed_type = ada::scheme::get_scheme_type(input);
14035|   270k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
14036|       |  /**
14037|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
14038|       |   *http, https), in which case, we can go really fast.
14039|       |   **/
14040|   270k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (14040:7): [True: 265k, False: 4.77k]
  ------------------
14041|       |    if constexpr (has_state_override) {
14042|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
14043|       |      // then return.
14044|       |      if (is_special() != is_input_special) {
14045|       |        return false;
14046|       |      }
14047|       |
14048|       |      // If url includes credentials or has a non-null port, and buffer is
14049|       |      // "file", then return.
14050|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14051|       |          parsed_type == ada::scheme::type::FILE) {
14052|       |        return false;
14053|       |      }
14054|       |
14055|       |      // If url's scheme is "file" and its host is an empty host, then return.
14056|       |      // An empty host is the empty string.
14057|       |      if (type == ada::scheme::type::FILE &&
14058|       |          components.host_start == components.host_end) {
14059|       |        return false;
14060|       |      }
14061|       |    }
14062|       |
14063|   265k|    type = parsed_type;
14064|   265k|    set_scheme_from_view_with_colon(input_with_colon);
14065|       |
14066|       |    if constexpr (has_state_override) {
14067|       |      // This is uncommon.
14068|       |      uint16_t urls_scheme_port = get_special_port();
14069|       |
14070|       |      if (urls_scheme_port) {
14071|       |        // If url's port is url's scheme's default port, then set url's port to
14072|       |        // null.
14073|       |        if (components.port == urls_scheme_port) {
14074|       |          clear_port();
14075|       |        }
14076|       |      }
14077|       |    }
14078|   265k|  } else {  // slow path
14079|  4.77k|    std::string _buffer(input);
14080|       |    // Next function is only valid if the input is ASCII and returns false
14081|       |    // otherwise, but it seems that we always have ascii content so we do not
14082|       |    // need to check the return value.
14083|  4.77k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
14084|       |
14085|       |    if constexpr (has_state_override) {
14086|       |      // The state-override validation errors below ("return" in the WHATWG URL
14087|       |      // parser) leave the URL unchanged. The setter contract is
14088|       |      // "true on success, false if the scheme is invalid" -- the fast path
14089|       |      // above already returns false here, so the slow path must agree.
14090|       |
14091|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
14092|       |      // then return. If url's scheme is not a special scheme and buffer is a
14093|       |      // special scheme, then return.
14094|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
14095|       |        return false;
14096|       |      }
14097|       |
14098|       |      // If url includes credentials or has a non-null port, and buffer is
14099|       |      // "file", then return.
14100|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14101|       |          _buffer == "file") {
14102|       |        return false;
14103|       |      }
14104|       |
14105|       |      // If url's scheme is "file" and its host is an empty host, then return.
14106|       |      // An empty host is the empty string.
14107|       |      if (type == ada::scheme::type::FILE &&
14108|       |          components.host_start == components.host_end) {
14109|       |        return false;
14110|       |      }
14111|       |    }
14112|       |
14113|  4.77k|    set_scheme(_buffer);
14114|       |
14115|       |    if constexpr (has_state_override) {
14116|       |      // This is uncommon.
14117|       |      uint16_t urls_scheme_port = get_special_port();
14118|       |
14119|       |      if (urls_scheme_port) {
14120|       |        // If url's port is url's scheme's default port, then set url's port to
14121|       |        // null.
14122|       |        if (components.port == urls_scheme_port) {
14123|       |          clear_port();
14124|       |        }
14125|       |      }
14126|       |    }
14127|  4.77k|  }
14128|   270k|  ADA_ASSERT_TRUE(validate());
14129|   270k|  return true;
14130|   270k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14154|   265k|    std::string_view new_scheme_with_colon) {
14155|   265k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
14156|   265k|          new_scheme_with_colon);
14157|   265k|  ADA_ASSERT_TRUE(validate());
14158|   265k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
14159|   265k|                  new_scheme_with_colon.back() == ':');
14160|       |  // next line could overflow but unsigned arithmetic has well-defined
14161|       |  // overflows.
14162|   265k|  uint32_t new_difference =
14163|   265k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
14164|       |
14165|   265k|  if (buffer.empty()) {
  ------------------
  |  Branch (14165:7): [True: 265k, False: 0]
  ------------------
14166|   265k|    buffer.append(new_scheme_with_colon);
14167|   265k|  } else {
14168|      0|    buffer.erase(0, components.protocol_end);
14169|      0|    buffer.insert(0, new_scheme_with_colon);
14170|      0|  }
14171|   265k|  components.protocol_end += new_difference;
14172|       |
14173|   265k|  apply_shifted_non_scheme_offsets(components, new_difference);
14174|   265k|  ADA_ASSERT_TRUE(validate());
14175|   265k|}
_ZN3ada14url_aggregator10set_schemeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14177|  4.77k|inline void url_aggregator::set_scheme(std::string_view new_scheme) {
14178|  4.77k|  ada_log("url_aggregator::set_scheme ", new_scheme);
14179|  4.77k|  ADA_ASSERT_TRUE(validate());
14180|  4.77k|  ADA_ASSERT_TRUE(new_scheme.empty() || new_scheme.back() != ':');
14181|       |  // next line could overflow but unsigned arithmetic has well-defined
14182|       |  // overflows.
14183|  4.77k|  uint32_t new_difference =
14184|  4.77k|      uint32_t(new_scheme.size()) - components.protocol_end + 1;
14185|       |
14186|  4.77k|  type = ada::scheme::get_scheme_type(new_scheme);
14187|  4.77k|  if (buffer.empty()) {
  ------------------
  |  Branch (14187:7): [True: 4.77k, False: 0]
  ------------------
14188|  4.77k|    buffer.append(helpers::concat(new_scheme, ":"));
14189|  4.77k|  } else {
14190|      0|    buffer.erase(0, components.protocol_end);
14191|      0|    buffer.insert(0, helpers::concat(new_scheme, ":"));
14192|      0|  }
14193|  4.77k|  components.protocol_end = uint32_t(new_scheme.size() + 1);
14194|       |
14195|  4.77k|  apply_shifted_non_scheme_offsets(components, new_difference);
14196|  4.77k|  ADA_ASSERT_TRUE(validate());
14197|  4.77k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 6341|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1086|  1.46M|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1087|  1.46M|  return !!(a[i >> 3] & (1 << (i & 7)));
 1088|  1.46M|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2688|  87.6k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 4174|  21.9k|      : impl_base(unexpect, std::move(e.value())),
 4175|  21.9k|        ctor_base(detail::default_constructor_tag{}) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2702|  43.8k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 3160|  21.9k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada3urlENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3778|   628k|  constexpr explicit expected_default_ctor_base(default_constructor_tag) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IS2_TnPNSt3__19enable_ifIXsr3std14is_convertibleIOT_S2_EE5valueEvE4typeELPv0ETnPNS7_IXaaaaaasr3std16is_constructibleIS2_S9_EE5valuentsr3std7is_sameINS6_5decayIS8_E4typeENS_10in_place_tEEE5valuentsr3std7is_sameIS4_SG_EE5valuentsr3std7is_sameINS_10unexpectedIS3_EESG_EE5valueEvE4typeELSD_0EEES9_:
 4260|   606k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 4133|   606k|      : impl_base(in_place, std::forward<Args>(args)...),
 4134|   606k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 3148|   606k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada3urlC2EOS0_:
 5580|   606k|  url(url&& u) noexcept = default;
_ZN3ada8url_baseD2Ev:
 2184|  2.47M|  virtual ~url_base() = default;
_ZN3ada3urlD2Ev:
 5583|  1.23M|  ~url() override = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 4174|  21.9k|      : impl_base(unexpect, std::move(e.value())),
 4175|  21.9k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 3160|  21.9k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3778|   628k|  constexpr explicit expected_default_ctor_base(default_constructor_tag) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS2_TnPNSt3__19enable_ifIXsr3std14is_convertibleIOT_S2_EE5valueEvE4typeELPv0ETnPNS7_IXaaaaaasr3std16is_constructibleIS2_S9_EE5valuentsr3std7is_sameINS6_5decayIS8_E4typeENS_10in_place_tEEE5valuentsr3std7is_sameIS4_SG_EE5valuentsr3std7is_sameINS_10unexpectedIS3_EESG_EE5valueEvE4typeELSD_0EEES9_:
 4260|   606k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 4133|   606k|      : impl_base(in_place, std::forward<Args>(args)...),
 4134|   606k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 3148|   606k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 8424|   606k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 8427|  1.23M|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7425|   549k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 7426|   549k|  if (scheme.empty()) {
  ------------------
  |  Branch (7426:7): [True: 0, False: 549k]
  ------------------
 7427|      0|    return ada::scheme::NOT_SPECIAL;
 7428|      0|  }
 7429|   549k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 7430|   549k|  const std::string_view target = details::is_special_list[hash_value];
 7431|   549k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (7431:7): [True: 544k, False: 5.09k]
  ------------------
 7432|   544k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (7432:7): [True: 536k, False: 8.19k]
  ------------------
 7433|   544k|          details::scheme_keys[hash_value]) {
 7434|   536k|    return ada::scheme::type(hash_value);
 7435|   536k|  } else {
 7436|  13.2k|    return ada::scheme::NOT_SPECIAL;
 7437|  13.2k|  }
 7438|   549k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 7366|   544k|inline uint64_t branchless_load5(const char* p, size_t n) {
 7367|   544k|  uint64_t input = (uint8_t)p[0];
 7368|   544k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 7369|   544k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 7370|   544k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 7371|   544k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 7372|   544k|  return input;
 7373|   544k|}
_ZN3ada14url_aggregatorC2Ev:
 8422|   628k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 5489|   628k|  url_components() = default;
_ZN3ada14url_aggregatoraSEOS0_:
 8425|   202k|  url_aggregator& operator=(url_aggregator&& u) noexcept = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1930|   652k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1931|   652k|  const size_t len = input.size();
 1932|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1933|   652k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1933:7): [True: 108k, False: 543k]
  |  Branch (1933:18): [True: 6.72k, False: 536k]
  ------------------
 1934|   115k|    return ipv4_fast_fail;
 1935|   115k|  }
 1936|   536k|  const char* data = input.data();
 1937|       |
 1938|       |#if defined(ADA_AVX512_IPV4)
 1939|       |  return detail::try_parse_ipv4_avx512(data, len);
 1940|       |#elif defined(ADA_HYBRID_IPV4)
 1941|       |  return detail::try_parse_ipv4_hybrid(data, len);
 1942|       |#else
 1943|   536k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1944|   652k|#endif
 1945|   652k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1579|   536k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1580|   536k|  uint32_t ipv4 = 0;
 1581|  1.56M|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1581:19): [True: 1.30M, False: 256k]
  ------------------
 1582|  1.30M|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1582:9): [True: 16, False: 1.30M]
  ------------------
 1583|     16|      return ipv4_fast_fail;
 1584|     16|    }
 1585|  1.30M|    uint32_t val;
 1586|  1.30M|    char c = *p;
 1587|  1.30M|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1587:9): [True: 1.30M, False: 838]
  |  Branch (1587:21): [True: 1.10M, False: 200k]
  ------------------
 1588|  1.10M|      val = static_cast<uint32_t>(c - '0');
 1589|  1.10M|      ++p;
 1590|  1.10M|    } else {
 1591|   201k|      return ipv4_fast_fail;
 1592|   201k|    }
 1593|  1.10M|    if (p < pend) {
  ------------------
  |  Branch (1593:9): [True: 1.00M, False: 102k]
  ------------------
 1594|  1.00M|      c = *p;
 1595|  1.00M|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1595:11): [True: 737k, False: 264k]
  |  Branch (1595:23): [True: 698k, False: 38.8k]
  ------------------
 1596|   698k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1596:13): [True: 210, False: 698k]
  ------------------
 1597|    210|          return ipv4_fast_fail;
 1598|    210|        }
 1599|   698k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1600|   698k|        ++p;
 1601|   698k|        if (p < pend) {
  ------------------
  |  Branch (1601:13): [True: 583k, False: 114k]
  ------------------
 1602|   583k|          c = *p;
 1603|   583k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1603:15): [True: 315k, False: 267k]
  |  Branch (1603:27): [True: 315k, False: 96]
  ------------------
 1604|   315k|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1605|   315k|            ++p;
 1606|   315k|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1606:17): [True: 1.23k, False: 314k]
  ------------------
 1607|  1.23k|              return ipv4_fast_fail;
 1608|  1.23k|            }
 1609|   315k|          }
 1610|   583k|        }
 1611|   698k|      }
 1612|  1.00M|    }
 1613|  1.10M|    ipv4 = (ipv4 << 8) | val;
 1614|  1.10M|    if (i < 3) {
  ------------------
  |  Branch (1614:9): [True: 846k, False: 256k]
  ------------------
 1615|   846k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1615:11): [True: 78, False: 846k]
  |  Branch (1615:24): [True: 77.2k, False: 769k]
  ------------------
 1616|  77.2k|        return ipv4_fast_fail;
 1617|  77.2k|      }
 1618|   769k|      ++p;
 1619|   769k|    }
 1620|  1.10M|  }
 1621|   256k|  if (p != pend) {
  ------------------
  |  Branch (1621:7): [True: 280, False: 255k]
  ------------------
 1622|    280|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1622:9): [True: 130, False: 150]
  |  Branch (1622:26): [True: 20, False: 110]
  ------------------
 1623|     20|      return ipv4;
 1624|     20|    }
 1625|    260|    return ipv4_fast_fail;
 1626|    280|  }
 1627|   255k|  return ipv4;
 1628|   256k|}
_ZNK3ada3url15has_credentialsEv:
 7953|  1.29M|[[nodiscard]] ada_really_inline bool url::has_credentials() const noexcept {
 7954|  1.29M|  return !username.empty() || !password.empty();
  ------------------
  |  Branch (7954:10): [True: 206k, False: 1.09M]
  |  Branch (7954:31): [True: 920, False: 1.08M]
  ------------------
 7955|  1.29M|}
_ZNK3ada8url_base10is_specialEv:
 7913|  5.82M|    const noexcept {
 7914|  5.82M|  return type != ada::scheme::NOT_SPECIAL;
 7915|  5.82M|}
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEEcvbEv:
 4573|   628k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEptEv:
 4542|  1.01M|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4543|  1.01M|    TL_ASSERT(has_value());
  ------------------
  |  | 2595|  1.01M|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4543:5): [True: 1.01M, False: 0]
  ------------------
 4544|  1.01M|    return valptr();
 4545|  1.01M|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE6valptrEv:
 3838|  1.01M|  T* valptr() { return std::addressof(this->m_val); }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EED2Ev:
 3170|   628k|  ~expected_storage_base() {
 3171|   628k|    if (m_has_val) {
  ------------------
  |  Branch (3171:9): [True: 606k, False: 21.9k]
  ------------------
 3172|   606k|      m_val.~T();
 3173|   606k|    }
 3174|   628k|  }
_ZNK3ada3url13get_href_sizeEv:
 8211|  1.08M|[[nodiscard]] inline size_t url::get_href_size() const noexcept {
 8212|  1.08M|  size_t size = 0;
 8213|  1.08M|  if (is_special()) {
  ------------------
  |  Branch (8213:7): [True: 1.07M, False: 7.80k]
  ------------------
 8214|  1.07M|    size += ada::scheme::details::is_special_list[type].size() + 1;
 8215|  1.07M|  } else {
 8216|  7.80k|    size += non_special_scheme.size() + 1;
 8217|  7.80k|  }
 8218|  1.08M|  if (host.has_value()) {
  ------------------
  |  Branch (8218:7): [True: 1.07M, False: 4.81k]
  ------------------
 8219|  1.07M|    size += host->size();
 8220|  1.07M|    size += 2;
 8221|  1.07M|    if (has_credentials()) {
  ------------------
  |  Branch (8221:9): [True: 134k, False: 940k]
  ------------------
 8222|   134k|      size += username.size();
 8223|   134k|      if (!password.empty()) {
  ------------------
  |  Branch (8223:11): [True: 129k, False: 5.25k]
  ------------------
 8224|   129k|        size += 1 + password.size();
 8225|   129k|      }
 8226|   134k|      size += 1;
 8227|   134k|    }
 8228|  1.07M|    if (port.has_value()) {
  ------------------
  |  Branch (8228:9): [True: 213k, False: 861k]
  ------------------
 8229|   213k|      size += 1;
 8230|   213k|      uint16_t p = *port;
 8231|   213k|      size += (p >= 10000)  ? 5
  ------------------
  |  Branch (8231:15): [True: 5.93k, False: 207k]
  ------------------
 8232|   213k|              : (p >= 1000) ? 4
  ------------------
  |  Branch (8232:17): [True: 100k, False: 107k]
  ------------------
 8233|   207k|              : (p >= 100)  ? 3
  ------------------
  |  Branch (8233:17): [True: 377, False: 107k]
  ------------------
 8234|   107k|              : (p >= 10)   ? 2
  ------------------
  |  Branch (8234:17): [True: 95.7k, False: 11.3k]
  ------------------
 8235|   107k|                            : 1;
 8236|   213k|    }
 8237|  1.07M|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (8237:14): [True: 1.45k, False: 3.35k]
  |  Branch (8237:34): [True: 65, False: 1.39k]
  ------------------
 8238|     65|    size += 2;
 8239|     65|  }
 8240|  1.08M|  size += path.size();
 8241|  1.08M|  if (query.has_value()) {
  ------------------
  |  Branch (8241:7): [True: 127k, False: 952k]
  ------------------
 8242|   127k|    size += 1 + query->size();
 8243|   127k|  }
 8244|  1.08M|  if (hash.has_value()) {
  ------------------
  |  Branch (8244:7): [True: 98.1k, False: 982k]
  ------------------
 8245|  98.1k|    size += 1 + hash->size();
 8246|  98.1k|  }
 8247|  1.08M|  return size;
 8248|  1.08M|}
_ZN3ada8checkers8is_alphaEc:
 1559|   544k|constexpr bool is_alpha(char x) noexcept {
 1560|   544k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1560:10): [True: 542k, False: 1.81k]
  |  Branch (1560:34): [True: 542k, False: 42]
  ------------------
 1561|   544k|}
_ZN3ada8checkers8to_lowerEc:
 1557|  1.08M|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada3urlaSEOS0_:
 5581|   202k|  url& operator=(url&& u) noexcept = default;
_ZNR2tl8expectedIN3ada3urlENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4555|  1.01M|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4556|  1.01M|    TL_ASSERT(has_value());
  ------------------
  |  | 2595|  1.01M|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4556:5): [True: 1.01M, False: 0]
  ------------------
 4557|  1.01M|    return val();
 4558|  1.01M|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3847|  1.01M|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3848|  1.01M|    return this->m_val;
 3849|  1.01M|  }
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEE9has_valueEv:
 4572|  2.44M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1532|  1.19M|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1533|  1.19M|  if (view.empty()) {
  ------------------
  |  Branch (1533:7): [True: 0, False: 1.19M]
  ------------------
 1534|      0|    return false;
 1535|      0|  }
 1536|  1.19M|  const char* start = view.data();
 1537|  1.19M|  const char* end = start + view.size();
 1538|  1.19M|  if (end[-1] == '.') {
  ------------------
  |  Branch (1538:7): [True: 60.5k, False: 1.13M]
  ------------------
 1539|  60.5k|    --end;
 1540|  60.5k|    if (end == start) {
  ------------------
  |  Branch (1540:9): [True: 1.82k, False: 58.7k]
  ------------------
 1541|  1.82k|      return false;
 1542|  1.82k|    }
 1543|  60.5k|  }
 1544|  1.18M|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1544:7): [True: 894k, False: 293k]
  ------------------
 1545|   894k|    return false;
 1546|   894k|  }
 1547|   293k|  const char* label = end;
 1548|  1.32M|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1548:10): [True: 1.29M, False: 28.6k]
  |  Branch (1548:28): [True: 1.03M, False: 265k]
  ------------------
 1549|  1.03M|    --label;
 1550|  1.03M|  }
 1551|   293k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1551:7): [True: 265k, False: 28.6k]
  |  Branch (1551:25): [True: 126k, False: 138k]
  ------------------
 1552|   126k|    return false;
 1553|   126k|  }
 1554|   167k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1554:10): [True: 167k, False: 0]
  |  Branch (1554:26): [True: 159k, False: 8.24k]
  ------------------
 1555|   293k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1526|  2.48M|constexpr bool is_ipv4_number_char(char x) noexcept {
 1527|  2.48M|  const unsigned char c = static_cast<unsigned char>(x);
 1528|  2.48M|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1528:11): [True: 2.22M, False: 260k]
  |  Branch (1528:23): [True: 308k, False: 1.91M]
  |  Branch (1528:37): [True: 1.91M, False: 261k]
  |  Branch (1528:49): [True: 848k, False: 1.06M]
  ------------------
 1529|  1.33M|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1529:11): [True: 1.06M, False: 261k]
  |  Branch (1529:23): [True: 0, False: 1.06M]
  |  Branch (1529:36): [True: 170k, False: 1.16M]
  |  Branch (1529:48): [True: 0, False: 1.16M]
  ------------------
 1530|  2.48M|}
_ZN3ada8checkers8is_digitEc:
 1524|   405k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 7422|   128k|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 7423|   128k|  return details::special_ports[int(type)];
 7424|   128k|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9155|  61.8k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 9156|  61.8k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 9157|  61.8k|          " bytes] \n", to_diagram());
 9158|  61.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9159|  61.8k|  ADA_ASSERT_TRUE(validate());
 9160|       |
 9161|  61.8k|  const bool begins_with_dashdash = input.starts_with("//");
 9162|  61.8k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (9162:7): [True: 61.0k, False: 825]
  |  Branch (9162:32): [True: 0, False: 61.0k]
  ------------------
 9163|       |    // We must delete the ./
 9164|      0|    delete_dash_dot();
 9165|      0|  }
 9166|       |
 9167|  61.8k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (9167:7): [True: 825, False: 61.0k]
  |  Branch (9167:31): [True: 825, False: 0]
  |  Branch (9167:51): [True: 15, False: 810]
  ------------------
 9168|     15|      !has_dash_dot()) {
  ------------------
  |  Branch (9168:7): [True: 15, False: 0]
  ------------------
 9169|       |    // If url's host is null, url does not have an opaque path, url's path's
 9170|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 9171|       |    // output.
 9172|     15|    buffer.insert(components.pathname_start, "/.");
 9173|     15|    components.pathname_start += 2;
 9174|     15|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9174:9): [True: 0, False: 15]
  ------------------
 9175|      0|      components.search_start += 2;
 9176|      0|    }
 9177|     15|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9177:9): [True: 0, False: 15]
  ------------------
 9178|      0|      components.hash_start += 2;
 9179|      0|    }
 9180|     15|  }
 9181|       |
 9182|  61.8k|  uint32_t difference = replace_and_resize(
 9183|  61.8k|      components.pathname_start,
 9184|  61.8k|      components.pathname_start + get_pathname_length(), input);
 9185|  61.8k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9185:7): [True: 0, False: 61.8k]
  ------------------
 9186|      0|    components.search_start += difference;
 9187|      0|  }
 9188|  61.8k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9188:7): [True: 0, False: 61.8k]
  ------------------
 9189|      0|    components.hash_start += difference;
 9190|      0|  }
 9191|  61.8k|  ADA_ASSERT_TRUE(validate());
 9192|  61.8k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8997|   310k|    uint32_t start, uint32_t end, std::string_view input) {
 8998|   310k|  uint32_t current_length = end - start;
 8999|   310k|  uint32_t input_size = uint32_t(input.size());
 9000|   310k|  uint32_t new_difference = input_size - current_length;
 9001|       |
 9002|   310k|  if (current_length == 0) {
  ------------------
  |  Branch (9002:7): [True: 279k, False: 31.1k]
  ------------------
 9003|   279k|    buffer.insert(start, input);
 9004|   279k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (9004:14): [True: 522, False: 30.6k]
  ------------------
 9005|    522|    if (input_size != 0) {
  ------------------
  |  Branch (9005:9): [True: 522, False: 0]
  ------------------
 9006|    522|      std::memmove(buffer.data() + start, input.data(), input_size);
 9007|    522|    }
 9008|  30.6k|  } else if (input_size < current_length) {
  ------------------
  |  Branch (9008:14): [True: 3, False: 30.6k]
  ------------------
 9009|      3|    buffer.erase(start, current_length - input_size);
 9010|      3|    buffer.replace(start, input_size, input);
 9011|  30.6k|  } else {
 9012|  30.6k|    buffer.replace(start, current_length, input.substr(0, current_length));
 9013|  30.6k|    buffer.insert(start + current_length, input.substr(current_length));
 9014|  30.6k|  }
 9015|       |
 9016|   310k|  return new_difference;
 9017|   310k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 9048|  61.8k|url_aggregator::get_pathname_length() const noexcept {
 9049|  61.8k|  ada_log("url_aggregator::get_pathname_length");
 9050|  61.8k|  uint32_t ending_index = uint32_t(buffer.size());
 9051|  61.8k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9051:7): [True: 0, False: 61.8k]
  ------------------
 9052|      0|    ending_index = components.search_start;
 9053|  61.8k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9053:14): [True: 0, False: 61.8k]
  ------------------
 9054|      0|    ending_index = components.hash_start;
 9055|      0|  }
 9056|  61.8k|  return ending_index - components.pathname_start;
 9057|  61.8k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9990|   232k|    ada_lifetime_bound {
 9991|   232k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9992|   232k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9993|   232k|          " components.search_start = ", components.search_start,
 9994|   232k|          " components.hash_start = ", components.hash_start);
 9995|   232k|  auto ending_index = uint32_t(buffer.size());
 9996|   232k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9996:7): [True: 34.4k, False: 197k]
  ------------------
 9997|  34.4k|    ending_index = components.search_start;
 9998|   197k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9998:14): [True: 11.1k, False: 186k]
  ------------------
 9999|  11.1k|    ending_index = components.hash_start;
10000|  11.1k|  }
10001|   232k|  return helpers::substring(buffer, components.pathname_start, ending_index);
10002|   232k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8973|  12.2k|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8974|  12.2k|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8975|  12.2k|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8976|  12.2k|          " bytes] components.hash_start = ", components.hash_start);
 8977|  12.2k|  ADA_ASSERT_TRUE(validate());
 8978|  12.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8979|  12.2k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8979:7): [True: 0, False: 12.2k]
  ------------------
 8980|      0|    buffer.resize(components.hash_start);
 8981|      0|  }
 8982|  12.2k|  components.hash_start = uint32_t(buffer.size());
 8983|  12.2k|  buffer += "#";
 8984|  12.2k|  bool encoding_required = unicode::percent_encode<true>(
 8985|  12.2k|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8986|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8987|       |  // encoding was not deemed required.
 8988|  12.2k|  if (!encoding_required) {
  ------------------
  |  Branch (8988:7): [True: 12.0k, False: 291]
  ------------------
 8989|  12.0k|    buffer.append(input);
 8990|  12.0k|  }
 8991|  12.2k|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8992|  12.2k|          buffer, "' [", buffer.size(), " bytes]");
 8993|  12.2k|  ADA_ASSERT_TRUE(validate());
 8994|  12.2k|}
_ZN3ada3urlC2Ev:
 5578|   628k|  url() = default;
_ZN3ada3url26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8061|  12.2k|inline void url::update_unencoded_base_hash(std::string_view input) {
 8062|       |  // We do the percent encoding
 8063|  12.2k|  hash = unicode::percent_encode(input,
 8064|  12.2k|                                 ada::character_sets::FRAGMENT_PERCENT_ENCODE);
 8065|  12.2k|}
_ZN3ada3url18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8068|  12.3k|                                    const uint8_t query_percent_encode_set[]) {
 8069|  12.3k|  query = ada::unicode::percent_encode(input, query_percent_encode_set);
 8070|  12.3k|}
_ZN3ada3url20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8059|     87|inline void url::update_base_hostname(std::string_view input) { host = input; }
_ZN3ada3url20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8076|  31.5k|inline void url::update_base_pathname(const std::string_view input) {
 8077|  31.5k|  path = input;
 8078|  31.5k|}
_ZN3ada3url10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 8251|  2.28k|                                         bool check_trailing_content) noexcept {
 8252|  2.28k|  ada_log("parse_port('", view, "') ", view.size());
 8253|  2.28k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (8253:7): [True: 2.07k, False: 205]
  |  Branch (8253:24): [True: 5, False: 2.07k]
  ------------------
 8254|      5|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 8255|      5|    is_valid = false;
 8256|      5|    return 0;
 8257|      5|  }
 8258|  2.27k|  uint16_t parsed_port{};
 8259|  2.27k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 8260|  2.27k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (8260:7): [True: 24, False: 2.25k]
  ------------------
 8261|     24|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 8262|     24|    is_valid = false;
 8263|     24|    return 0;
 8264|     24|  }
 8265|  2.25k|  ada_log("parse_port: ", parsed_port);
 8266|  2.25k|  const auto consumed = size_t(r.ptr - view.data());
 8267|  2.25k|  ada_log("parse_port: consumed ", consumed);
 8268|  2.25k|  if (check_trailing_content) {
  ------------------
  |  Branch (8268:7): [True: 2.25k, False: 0]
  ------------------
 8269|  2.25k|    is_valid &=
 8270|  2.25k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (8270:10): [True: 419, False: 1.83k]
  |  Branch (8270:37): [True: 1.44k, False: 388]
  ------------------
 8271|    388|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (8271:10): [True: 116, False: 272]
  |  Branch (8271:36): [True: 260, False: 12]
  |  Branch (8271:52): [True: 63, False: 197]
  ------------------
 8272|  2.25k|  }
 8273|  2.25k|  ada_log("parse_port: is_valid = ", is_valid);
 8274|  2.25k|  if (is_valid) {
  ------------------
  |  Branch (8274:7): [True: 2.04k, False: 209]
  ------------------
 8275|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 8276|  2.04k|    auto default_port = scheme_default_port();
 8277|  2.04k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (8277:27): [True: 190, False: 1.85k]
  |  Branch (8277:48): [True: 97, False: 93]
  ------------------
 8278|  1.94k|                         (default_port != parsed_port);
  ------------------
  |  Branch (8278:26): [True: 1.94k, False: 4]
  ------------------
 8279|  2.04k|    port = (r.ec == std::errc() && is_port_valid) ? std::optional(parsed_port)
  ------------------
  |  Branch (8279:13): [True: 1.68k, False: 358]
  |  Branch (8279:36): [True: 1.68k, False: 4]
  ------------------
 8280|  2.04k|                                                  : std::nullopt;
 8281|  2.04k|  }
 8282|  2.25k|  return consumed;
 8283|  2.27k|}
_ZNK3ada8url_base19scheme_default_portEv:
 7922|  4.08k|url_base::scheme_default_port() const noexcept {
 7923|  4.08k|  return scheme::get_special_port(type);
 7924|  4.08k|}
_ZNK3ada3url12get_pathnameEv:
 7979|   202k|[[nodiscard]] constexpr std::string_view url::get_pathname() const noexcept {
 7980|   202k|  return path;
 7981|   202k|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1563|  5.22k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1564|  5.22k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1564:10): [True: 3.98k, False: 1.23k]
  ------------------
 1565|  3.98k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1565:11): [True: 2.44k, False: 1.54k]
  |  Branch (1565:34): [True: 196, False: 2.24k]
  |  Branch (1565:55): [True: 50, False: 2.19k]
  ------------------
 1566|    246|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1566:11): [True: 100, False: 146]
  |  Branch (1566:35): [True: 50, False: 96]
  |  Branch (1566:54): [True: 4, False: 92]
  ------------------
 1567|     92|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1567:35): [True: 0, False: 92]
  |  Branch (1567:54): [True: 0, False: 92]
  ------------------
 1568|  5.22k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1571|    122|    std::string_view input) noexcept {
 1572|    122|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1572:10): [True: 38, False: 84]
  |  Branch (1572:32): [True: 22, False: 16]
  |  Branch (1572:54): [True: 20, False: 2]
  ------------------
 1573|    122|}
_ZN3ada3url20set_protocol_as_fileEv:
 8104|  1.39k|constexpr void url::set_protocol_as_file() { type = ada::scheme::type::FILE; }
_ZN3ada7helpers14leading_zeroesEj:
 2473|   291k|inline int leading_zeroes(uint32_t input_num) noexcept {
 2474|       |#if ADA_REGULAR_VISUAL_STUDIO
 2475|       |  unsigned long leading_zero(0);
 2476|       |  unsigned long in(input_num);
 2477|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 2478|       |#else
 2479|   291k|  return __builtin_clz(input_num);
 2480|   291k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 2481|   291k|}
_ZN3ada14url_aggregator7reserveEj:
 9663|   270k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9664|   270k|  buffer.reserve(capacity);
 9665|   270k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9381|  39.3k|inline void url_aggregator::append_base_password(const std::string_view input) {
 9382|  39.3k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 9383|  39.3k|          "\n", to_diagram());
 9384|  39.3k|  ADA_ASSERT_TRUE(validate());
 9385|  39.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9386|       |#if ADA_DEVELOPMENT_CHECKS
 9387|       |  // computing the expected password.
 9388|       |  std::string password_expected = std::string(get_password());
 9389|       |  password_expected.append(input);
 9390|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9391|  39.3k|  add_authority_slashes_if_needed();
 9392|       |
 9393|       |  // If input is empty, do nothing.
 9394|  39.3k|  if (input.empty()) {
  ------------------
  |  Branch (9394:7): [True: 3.96k, False: 35.3k]
  ------------------
 9395|  3.96k|    return;
 9396|  3.96k|  }
 9397|       |
 9398|  35.3k|  uint32_t difference = uint32_t(input.size());
 9399|  35.3k|  if (has_password()) {
  ------------------
  |  Branch (9399:7): [True: 5.35k, False: 30.0k]
  ------------------
 9400|  5.35k|    buffer.insert(components.host_start, input);
 9401|  30.0k|  } else {
 9402|  30.0k|    difference++;  // Increment for ":"
 9403|  30.0k|    buffer.insert(components.username_end, ":");
 9404|  30.0k|    buffer.insert(components.username_end + 1, input);
 9405|  30.0k|  }
 9406|  35.3k|  components.host_start += difference;
 9407|       |
 9408|       |  // The following line is required to add "@" to hostname. When updating
 9409|       |  // password if hostname does not start with "@", it is "append_base_password"s
 9410|       |  // responsibility to set it.
 9411|  35.3k|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9411:7): [True: 199, False: 35.1k]
  ------------------
 9412|    199|    buffer.insert(components.host_start, "@");
 9413|    199|    difference++;
 9414|    199|  }
 9415|       |
 9416|  35.3k|  components.host_end += difference;
 9417|  35.3k|  components.pathname_start += difference;
 9418|  35.3k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9418:7): [True: 0, False: 35.3k]
  ------------------
 9419|      0|    components.search_start += difference;
 9420|      0|  }
 9421|  35.3k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9421:7): [True: 0, False: 35.3k]
  ------------------
 9422|      0|    components.hash_start += difference;
 9423|      0|  }
 9424|       |#if ADA_DEVELOPMENT_CHECKS
 9425|       |  std::string password_after(get_password());
 9426|       |  ADA_ASSERT_EQUAL(
 9427|       |      password_expected, password_after,
 9428|       |      "append_base_password problem after inserting " + std::string(input));
 9429|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9430|  35.3k|  ADA_ASSERT_TRUE(validate());
 9431|  35.3k|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9637|   345k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9638|   345k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9639|   345k|  ADA_ASSERT_TRUE(validate());
 9640|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9641|       |  // to insert
 9642|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9643|   345k|  if (has_authority()) {
  ------------------
  |  Branch (9643:7): [True: 97.7k, False: 247k]
  ------------------
 9644|  97.7k|    return;
 9645|  97.7k|  }
 9646|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9647|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9648|       |  // the insert could be fused with another insert.
 9649|   247k|  buffer.insert(components.protocol_end, "//");
 9650|   247k|  components.username_end += 2;
 9651|   247k|  components.host_start += 2;
 9652|   247k|  components.host_end += 2;
 9653|   247k|  components.pathname_start += 2;
 9654|   247k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9654:7): [True: 0, False: 247k]
  ------------------
 9655|      0|    components.search_start += 2;
 9656|      0|  }
 9657|   247k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9657:7): [True: 0, False: 247k]
  ------------------
 9658|      0|    components.hash_start += 2;
 9659|      0|  }
 9660|   247k|  ADA_ASSERT_TRUE(validate());
 9661|   247k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9265|  57.5k|inline void url_aggregator::append_base_username(const std::string_view input) {
 9266|  57.5k|  ada_log("url_aggregator::append_base_username ", input);
 9267|  57.5k|  ADA_ASSERT_TRUE(validate());
 9268|  57.5k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9269|       |#if ADA_DEVELOPMENT_CHECKS
 9270|       |  // computing the expected password.
 9271|       |  std::string username_expected(get_username());
 9272|       |  username_expected.append(input);
 9273|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9274|  57.5k|  add_authority_slashes_if_needed();
 9275|       |
 9276|       |  // If input is empty, do nothing.
 9277|  57.5k|  if (input.empty()) {
  ------------------
  |  Branch (9277:7): [True: 17.0k, False: 40.4k]
  ------------------
 9278|  17.0k|    return;
 9279|  17.0k|  }
 9280|       |
 9281|  40.4k|  uint32_t difference = uint32_t(input.size());
 9282|  40.4k|  buffer.insert(components.username_end, input);
 9283|  40.4k|  components.username_end += difference;
 9284|  40.4k|  components.host_start += difference;
 9285|       |
 9286|  40.4k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (9286:7): [True: 31.2k, False: 9.18k]
  ------------------
 9287|  31.2k|      components.host_start != components.host_end) {
  ------------------
  |  Branch (9287:7): [True: 31.2k, False: 0]
  ------------------
 9288|  31.2k|    buffer.insert(components.host_start, "@");
 9289|  31.2k|    difference++;
 9290|  31.2k|  }
 9291|       |
 9292|  40.4k|  components.host_end += difference;
 9293|  40.4k|  components.pathname_start += difference;
 9294|  40.4k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9294:7): [True: 0, False: 40.4k]
  ------------------
 9295|      0|    components.search_start += difference;
 9296|      0|  }
 9297|  40.4k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9297:7): [True: 0, False: 40.4k]
  ------------------
 9298|      0|    components.hash_start += difference;
 9299|      0|  }
 9300|       |#if ADA_DEVELOPMENT_CHECKS
 9301|       |  std::string username_after(get_username());
 9302|       |  ADA_ASSERT_EQUAL(
 9303|       |      username_expected, username_after,
 9304|       |      "append_base_username problem after inserting " + std::string(input));
 9305|       |#endif  // ADA_DEVELOPMENT_CHECKS
 9306|  40.4k|  ADA_ASSERT_TRUE(validate());
 9307|  40.4k|}
_ZNK3ada14url_aggregator8get_hrefEv:
 9741|  1.21M|    const noexcept ada_lifetime_bound {
 9742|  1.21M|  ada_log("url_aggregator::get_href");
 9743|  1.21M|  return buffer;
 9744|  1.21M|}
_ZN3ada14url_aggregator16update_base_portEj:
 9433|  1.68k|inline void url_aggregator::update_base_port(uint32_t input) {
 9434|  1.68k|  ada_log("url_aggregator::update_base_port");
 9435|  1.68k|  ADA_ASSERT_TRUE(validate());
 9436|  1.68k|  if (input == url_components::omitted) {
  ------------------
  |  Branch (9436:7): [True: 0, False: 1.68k]
  ------------------
 9437|      0|    clear_port();
 9438|      0|    return;
 9439|      0|  }
 9440|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 9441|       |  // value is probably already available as a string.
 9442|  1.68k|  std::string value = helpers::concat(":", std::to_string(input));
 9443|  1.68k|  uint32_t difference = uint32_t(value.size());
 9444|       |
 9445|  1.68k|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (9445:7): [True: 0, False: 1.68k]
  ------------------
 9446|      0|    difference -= components.pathname_start - components.host_end;
 9447|      0|    buffer.erase(components.host_end,
 9448|      0|                 components.pathname_start - components.host_end);
 9449|      0|  }
 9450|       |
 9451|  1.68k|  buffer.insert(components.host_end, value);
 9452|  1.68k|  components.pathname_start += difference;
 9453|  1.68k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9453:7): [True: 0, False: 1.68k]
  ------------------
 9454|      0|    components.search_start += difference;
 9455|      0|  }
 9456|  1.68k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9456:7): [True: 0, False: 1.68k]
  ------------------
 9457|      0|    components.hash_start += difference;
 9458|      0|  }
 9459|  1.68k|  components.port = input;
 9460|  1.68k|  ADA_ASSERT_TRUE(validate());
 9461|  1.68k|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 2463|  1.68k|std::string concat(Args... args) {
 2464|  1.68k|  std::string answer;
 2465|  1.68k|  inner_concat(answer, args...);
 2466|  1.68k|  return answer;
 2467|  1.68k|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 2452|  1.68k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 2453|  1.68k|  buffer.append(t);
 2454|  1.68k|  return inner_concat(buffer, args...);
 2455|  1.68k|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 2444|  1.68k|inline void inner_concat(std::string& buffer, T t) {
 2445|  1.68k|  buffer.append(t);
 2446|  1.68k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 9104|  12.3k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 9105|  12.3k|  ada_log("url_aggregator::update_base_search ", input,
 9106|  12.3k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 9107|  12.3k|  ADA_ASSERT_TRUE(validate());
 9108|  12.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9109|       |
 9110|  12.3k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (9110:7): [True: 12.3k, False: 0]
  ------------------
 9111|  12.3k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (9111:9): [True: 12.3k, False: 0]
  ------------------
 9112|  12.3k|      components.search_start = uint32_t(buffer.size());
 9113|  12.3k|      buffer += "?";
 9114|  12.3k|    } else {
 9115|      0|      buffer.resize(components.search_start + 1);
 9116|      0|    }
 9117|       |
 9118|  12.3k|    bool encoding_required =
 9119|  12.3k|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 9120|       |    // When encoding_required is false, then buffer is left unchanged, and
 9121|       |    // percent encoding was not deemed required.
 9122|  12.3k|    if (!encoding_required) {
  ------------------
  |  Branch (9122:9): [True: 12.0k, False: 376]
  ------------------
 9123|  12.0k|      buffer.append(input);
 9124|  12.0k|    }
 9125|  12.3k|  } else {
 9126|      0|    const size_t idx =
 9127|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 9128|      0|    std::string encoded;
 9129|      0|    std::string_view replacement = input;
 9130|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (9130:9): [True: 0, False: 0]
  ------------------
 9131|      0|      encoded =
 9132|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 9133|      0|      replacement = encoded;
 9134|      0|    }
 9135|       |
 9136|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9136:9): [True: 0, False: 0]
  ------------------
 9137|      0|      const uint32_t difference = replace_and_resize(
 9138|      0|          components.search_start + 1, components.hash_start, replacement);
 9139|      0|      components.hash_start += difference;
 9140|      0|    } else {
 9141|      0|      components.search_start = components.hash_start;
 9142|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 9143|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (9143:11): [True: 0, False: 0]
  ------------------
 9144|      0|        std::memmove(buffer.data() + components.search_start + 1,
 9145|      0|                     replacement.data(), replacement.size());
 9146|      0|      }
 9147|      0|      components.hash_start +=
 9148|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 9149|      0|    }
 9150|      0|  }
 9151|       |
 9152|  12.3k|  ADA_ASSERT_TRUE(validate());
 9153|  12.3k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9019|   248k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 9020|   248k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 9021|   248k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 9022|   248k|  ADA_ASSERT_TRUE(validate());
 9023|   248k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 9024|       |
 9025|       |  // This next line is required for when parsing a URL like `foo://`
 9026|   248k|  add_authority_slashes_if_needed();
 9027|       |
 9028|   248k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 9029|   248k|  uint32_t new_difference =
 9030|   248k|      replace_and_resize(components.host_start, components.host_end, input);
 9031|       |
 9032|   248k|  if (has_credentials) {
  ------------------
  |  Branch (9032:7): [True: 31.1k, False: 217k]
  ------------------
 9033|  31.1k|    buffer.insert(components.host_start, "@");
 9034|  31.1k|    new_difference++;
 9035|  31.1k|  }
 9036|   248k|  components.host_end += new_difference;
 9037|   248k|  components.pathname_start += new_difference;
 9038|   248k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9038:7): [True: 0, False: 248k]
  ------------------
 9039|      0|    components.search_start += new_difference;
 9040|      0|  }
 9041|   248k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9041:7): [True: 0, False: 248k]
  ------------------
 9042|      0|    components.hash_start += new_difference;
 9043|      0|  }
 9044|   248k|  ADA_ASSERT_TRUE(validate());
 9045|   248k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9751|  2.28k|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9752|  2.28k|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9753|  2.28k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9753:7): [True: 2.07k, False: 205]
  |  Branch (9753:24): [True: 5, False: 2.07k]
  ------------------
 9754|      5|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9755|      5|    is_valid = false;
 9756|      5|    return 0;
 9757|      5|  }
 9758|  2.27k|  uint16_t parsed_port{};
 9759|  2.27k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9760|  2.27k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9760:7): [True: 24, False: 2.25k]
  ------------------
 9761|     24|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9762|     24|    is_valid = false;
 9763|     24|    return 0;
 9764|     24|  }
 9765|  2.25k|  ada_log("parse_port: ", parsed_port);
 9766|  2.25k|  const size_t consumed = size_t(r.ptr - view.data());
 9767|  2.25k|  ada_log("parse_port: consumed ", consumed);
 9768|  2.25k|  if (check_trailing_content) {
  ------------------
  |  Branch (9768:7): [True: 2.25k, False: 0]
  ------------------
 9769|  2.25k|    is_valid &=
 9770|  2.25k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9770:10): [True: 419, False: 1.83k]
  |  Branch (9770:37): [True: 1.44k, False: 388]
  ------------------
 9771|    388|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9771:10): [True: 116, False: 272]
  |  Branch (9771:36): [True: 260, False: 12]
  |  Branch (9771:52): [True: 63, False: 197]
  ------------------
 9772|  2.25k|  }
 9773|  2.25k|  ada_log("parse_port: is_valid = ", is_valid);
 9774|  2.25k|  if (is_valid) {
  ------------------
  |  Branch (9774:7): [True: 2.04k, False: 209]
  ------------------
 9775|  2.04k|    ada_log("parse_port", r.ec == std::errc());
 9776|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9777|  2.04k|    auto default_port = scheme_default_port();
 9778|  2.04k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9778:27): [True: 190, False: 1.85k]
  |  Branch (9778:48): [True: 97, False: 93]
  ------------------
 9779|  1.94k|                         (default_port != parsed_port);
  ------------------
  |  Branch (9779:26): [True: 1.94k, False: 4]
  ------------------
 9780|  2.04k|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9780:9): [True: 1.68k, False: 358]
  |  Branch (9780:32): [True: 1.68k, False: 4]
  ------------------
 9781|  1.68k|      update_base_port(parsed_port);
 9782|  1.68k|    } else {
 9783|    362|      clear_port();
 9784|    362|    }
 9785|  2.04k|  }
 9786|  2.25k|  return consumed;
 9787|  2.27k|}
_ZN3ada14url_aggregator20set_protocol_as_fileEv:
 9789|  1.39k|constexpr void url_aggregator::set_protocol_as_file() {
 9790|  1.39k|  ada_log("url_aggregator::set_protocol_as_file ");
 9791|  1.39k|  ADA_ASSERT_TRUE(validate());
 9792|  1.39k|  type = ada::scheme::type::FILE;
 9793|       |  // next line could overflow but unsigned arithmetic has well-defined
 9794|       |  // overflows.
 9795|  1.39k|  uint32_t new_difference = 5 - components.protocol_end;
 9796|       |
 9797|  1.39k|  if (buffer.empty()) {
  ------------------
  |  Branch (9797:7): [True: 0, False: 1.39k]
  ------------------
 9798|      0|    buffer.append("file:");
 9799|  1.39k|  } else {
 9800|  1.39k|    buffer.erase(0, components.protocol_end);
 9801|  1.39k|    buffer.insert(0, "file:");
 9802|  1.39k|  }
 9803|  1.39k|  components.protocol_end = 5;
 9804|       |
 9805|       |  // Update the rest of the components.
 9806|  1.39k|  components.username_end += new_difference;
 9807|  1.39k|  components.host_start += new_difference;
 9808|  1.39k|  components.host_end += new_difference;
 9809|  1.39k|  components.pathname_start += new_difference;
 9810|  1.39k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9810:7): [True: 0, False: 1.39k]
  ------------------
 9811|      0|    components.search_start += new_difference;
 9812|      0|  }
 9813|  1.39k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9813:7): [True: 0, False: 1.39k]
  ------------------
 9814|      0|    components.hash_start += new_difference;
 9815|      0|  }
 9816|  1.39k|  ADA_ASSERT_TRUE(validate());
 9817|  1.39k|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8871|    603|                                              const uint8_t character_set[]) {
 8872|    603|  const char* data = input.data();
 8873|    603|  const size_t size = input.size();
 8874|       |
 8875|       |  // Process 8 bytes at a time using unrolled loop
 8876|    603|  size_t i = 0;
 8877|  1.31k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8877:10): [True: 744, False: 571]
  ------------------
 8878|    744|    unsigned char chunk[8];
 8879|    744|    std::memcpy(&chunk, data + i,
 8880|    744|                8);  // entices compiler to unconditionally process 8 characters
 8881|       |
 8882|       |    // Check 8 characters at once
 8883|  6.55k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8883:24): [True: 5.84k, False: 712]
  ------------------
 8884|  5.84k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8884:11): [True: 32, False: 5.80k]
  ------------------
 8885|     32|        return i + j;
 8886|     32|      }
 8887|  5.84k|    }
 8888|    744|  }
 8889|       |
 8890|       |  // Handle remaining bytes
 8891|  2.39k|  for (; i < size; i++) {
  ------------------
  |  Branch (8891:10): [True: 1.83k, False: 563]
  ------------------
 8892|  1.83k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8892:9): [True: 8, False: 1.82k]
  ------------------
 8893|      8|      return i;
 8894|      8|    }
 8895|  1.83k|  }
 8896|       |
 8897|    563|  return size;
 8898|    571|}
_ZN3ada14url_aggregator10clear_portEv:
 9463|    362|inline void url_aggregator::clear_port() {
 9464|    362|  ada_log("url_aggregator::clear_port");
 9465|    362|  ADA_ASSERT_TRUE(validate());
 9466|    362|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (9466:7): [True: 362, False: 0]
  ------------------
 9467|    362|    return;
 9468|    362|  }
 9469|      0|  uint32_t length = components.pathname_start - components.host_end;
 9470|      0|  buffer.erase(components.host_end, length);
 9471|      0|  components.pathname_start -= length;
 9472|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9472:7): [True: 0, False: 0]
  ------------------
 9473|      0|    components.search_start -= length;
 9474|      0|  }
 9475|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9475:7): [True: 0, False: 0]
  ------------------
 9476|      0|    components.hash_start -= length;
 9477|      0|  }
 9478|      0|  components.port = url_components::omitted;
 9479|      0|  ADA_ASSERT_TRUE(validate());
 9480|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9628|   346k|    const noexcept {
 9629|   346k|  ada_log("url_aggregator::has_authority");
 9630|       |  // Performance: instead of doing this potentially expensive check, we could
 9631|       |  // have a boolean in the struct.
 9632|   346k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9632:10): [True: 98.5k, False: 247k]
  ------------------
 9633|  98.5k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9633:10): [True: 98.5k, False: 0]
  ------------------
 9634|  98.5k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9634:10): [True: 98.5k, False: 0]
  ------------------
 9635|   346k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9708|  61.0k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9709|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9710|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9711|       |  // U+002F (/) followed by U+002E (.) to output.
 9712|  61.0k|  ada_log("url_aggregator::has_dash_dot");
 9713|       |#if ADA_DEVELOPMENT_CHECKS
 9714|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9715|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9716|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9717|       |  if (components.pathname_start == components.host_end + 2) {
 9718|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9719|       |                     buffer[components.host_end + 1] == '.') ||
 9720|       |                    (buffer[components.host_end] == ':' &&
 9721|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9722|       |  }
 9723|       |  if (components.pathname_start == components.host_end + 2 &&
 9724|       |      buffer[components.host_end] == '/' &&
 9725|       |      buffer[components.host_end + 1] == '.') {
 9726|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9727|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9728|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9729|       |  }
 9730|       |#endif
 9731|       |  // Performance: it should be uncommon for components.pathname_start ==
 9732|       |  // components.host_end + 2 to be true. So we put this check first in the
 9733|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9734|       |  // more expensive, but should be uncommon.
 9735|  61.0k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9735:10): [True: 1.43k, False: 59.6k]
  ------------------
 9736|  1.43k|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9736:10): [True: 1.43k, False: 0]
  |  Branch (9736:30): [True: 0, False: 1.43k]
  ------------------
 9737|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9737:10): [True: 0, False: 0]
  ------------------
 9738|  61.0k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4573|   404k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4542|  1.01M|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4543|  1.01M|    TL_ASSERT(has_value());
  ------------------
  |  | 2595|  1.01M|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4543:5): [True: 1.01M, False: 0]
  ------------------
 4544|  1.01M|    return valptr();
 4545|  1.01M|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3838|  1.01M|  T* valptr() { return std::addressof(this->m_val); }
_ZNR2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4555|  1.01M|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4556|  1.01M|    TL_ASSERT(has_value());
  ------------------
  |  | 2595|  1.01M|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4556:5): [True: 1.01M, False: 0]
  ------------------
 4557|  1.01M|    return val();
 4558|  1.01M|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3847|  1.01M|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3848|  1.01M|    return this->m_val;
 3849|  1.01M|  }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4572|  2.44M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 3170|   628k|  ~expected_storage_base() {
 3171|   628k|    if (m_has_val) {
  ------------------
  |  Branch (3171:9): [True: 606k, False: 21.9k]
  ------------------
 3172|   606k|      m_val.~T();
 3173|   606k|    }
 3174|   628k|  }
_ZNK3ada14url_aggregator22has_non_empty_usernameEv:
 9667|   202k|constexpr bool url_aggregator::has_non_empty_username() const noexcept {
 9668|   202k|  ada_log("url_aggregator::has_non_empty_username");
 9669|   202k|  return components.protocol_end + 2 < components.username_end;
 9670|   202k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 2385|   979k|                                                       size_t pos2) {
 2386|       |#if ADA_DEVELOPMENT_CHECKS
 2387|       |  if (pos2 < pos1) {
 2388|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 2389|       |              << std::endl;
 2390|       |    abort();
 2391|       |  }
 2392|       |#endif
 2393|   979k|  return input.substr(pos1, pos2 - pos1);
 2394|   979k|}
_ZNK3ada14url_aggregator22has_non_empty_passwordEv:
 9672|   202k|constexpr bool url_aggregator::has_non_empty_password() const noexcept {
 9673|   202k|  ada_log("url_aggregator::has_non_empty_password");
 9674|   202k|  return components.host_start > components.username_end;
 9675|   202k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 9060|   211k|    const noexcept {
 9061|   211k|  return buffer.size() == components.pathname_start;
 9062|   211k|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9677|  35.3k|constexpr bool url_aggregator::has_password() const noexcept {
 9678|  35.3k|  ada_log("url_aggregator::has_password");
 9679|       |  // This function does not care about the length of the password
 9680|  35.3k|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9680:10): [True: 5.35k, False: 30.0k]
  ------------------
 9681|  5.35k|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9681:10): [True: 5.35k, False: 0]
  ------------------
 9682|  35.3k|}
_ZNK3ada14url_aggregator13get_href_sizeEv:
 9746|   404k|[[nodiscard]] constexpr size_t url_aggregator::get_href_size() const noexcept {
 9747|   404k|  return buffer.size();
 9748|   404k|}
_ZNK3ada3url8get_hrefEv:
 8124|  1.41M|[[nodiscard]] ada_really_inline std::string url::get_href() const {
 8125|  1.41M|  if (is_special() && host.has_value() && username.empty() &&
  ------------------
  |  Branch (8125:7): [True: 1.41M, False: 4.20k]
  |  Branch (8125:23): [True: 1.41M, False: 0]
  |  Branch (8125:43): [True: 1.33M, False: 72.2k]
  ------------------
 8126|  1.33M|      password.empty() && !port.has_value()) [[likely]] {
  ------------------
  |  Branch (8126:7): [True: 1.33M, False: 322]
  |  Branch (8126:27): [True: 1.19M, False: 147k]
  ------------------
 8127|  1.19M|    const std::string_view scheme = ada::scheme::details::is_special_list[type];
 8128|  1.19M|    const size_t host_size = host->size();
 8129|  1.19M|    const size_t path_size = path.size();
 8130|  1.19M|    const size_t query_size = query.has_value() ? query->size() : 0;
  ------------------
  |  Branch (8130:31): [True: 226k, False: 964k]
  ------------------
 8131|  1.19M|    const size_t hash_size = hash.has_value() ? hash->size() : 0;
  ------------------
  |  Branch (8131:30): [True: 159k, False: 1.03M]
  ------------------
 8132|  1.19M|    const size_t total = scheme.size() + 3 + host_size + path_size +
 8133|  1.19M|                         (query.has_value() ? query_size + 1 : 0) +
  ------------------
  |  Branch (8133:27): [True: 226k, False: 964k]
  ------------------
 8134|  1.19M|                         (hash.has_value() ? hash_size + 1 : 0);
  ------------------
  |  Branch (8134:27): [True: 159k, False: 1.03M]
  ------------------
 8135|  1.19M|    std::string output(total, '\0');
 8136|  1.19M|    char* p = output.data();
 8137|  1.19M|    std::memcpy(p, scheme.data(), scheme.size());
 8138|  1.19M|    p += scheme.size();
 8139|  1.19M|    p[0] = ':';
 8140|  1.19M|    p[1] = '/';
 8141|  1.19M|    p[2] = '/';
 8142|  1.19M|    p += 3;
 8143|       |    // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 8144|  1.19M|    std::memcpy(p, host->data(), host_size);
 8145|  1.19M|    p += host_size;
 8146|  1.19M|    std::memcpy(p, path.data(), path_size);
 8147|  1.19M|    p += path_size;
 8148|  1.19M|    if (query.has_value()) {
  ------------------
  |  Branch (8148:9): [True: 226k, False: 964k]
  ------------------
 8149|   226k|      *p++ = '?';
 8150|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 8151|   226k|      std::memcpy(p, query->data(), query_size);
 8152|   226k|      p += query_size;
 8153|   226k|    }
 8154|  1.19M|    if (hash.has_value()) {
  ------------------
  |  Branch (8154:9): [True: 159k, False: 1.03M]
  ------------------
 8155|   159k|      *p++ = '#';
 8156|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 8157|   159k|      std::memcpy(p, hash->data(), hash_size);
 8158|   159k|    }
 8159|  1.19M|    return output;
 8160|  1.19M|  }
 8161|       |
 8162|   224k|  std::string output;
 8163|   224k|  output.reserve(get_href_size());
 8164|       |
 8165|   224k|  if (is_special()) {
  ------------------
  |  Branch (8165:7): [True: 220k, False: 4.20k]
  ------------------
 8166|   220k|    output.append(ada::scheme::details::is_special_list[type]);
 8167|   220k|    output += ':';
 8168|   220k|  } else {
 8169|  4.20k|    output.append(non_special_scheme);
 8170|  4.20k|    output += ':';
 8171|  4.20k|  }
 8172|       |
 8173|   224k|  if (host.has_value()) {
  ------------------
  |  Branch (8173:7): [True: 222k, False: 2.59k]
  ------------------
 8174|   222k|    output += '/';
 8175|   222k|    output += '/';
 8176|   222k|    if (has_credentials()) {
  ------------------
  |  Branch (8176:9): [True: 72.6k, False: 149k]
  ------------------
 8177|  72.6k|      output.append(username);
 8178|  72.6k|      if (!password.empty()) {
  ------------------
  |  Branch (8178:11): [True: 69.8k, False: 2.82k]
  ------------------
 8179|  69.8k|        output += ':';
 8180|  69.8k|        output.append(password);
 8181|  69.8k|      }
 8182|  72.6k|      output += '@';
 8183|  72.6k|    }
 8184|   222k|    output.append(*host);
 8185|   222k|    if (port.has_value()) {
  ------------------
  |  Branch (8185:9): [True: 148k, False: 73.6k]
  ------------------
 8186|   148k|      output += ':';
 8187|   148k|      char port_buf[5];
 8188|   148k|      auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, *port);
 8189|   148k|      (void)ec;
 8190|   148k|      output.append(port_buf, static_cast<size_t>(ptr - port_buf));
 8191|   148k|    }
 8192|   222k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (8192:14): [True: 784, False: 1.80k]
  |  Branch (8192:34): [True: 35, False: 749]
  ------------------
 8193|       |    // If url's host is null, url does not have an opaque path, url's path's
 8194|       |    // size is greater than 1, and url's path[0] is the empty string, then
 8195|       |    // append U+002F (/) followed by U+002E (.) to output.
 8196|     35|    output += '/';
 8197|     35|    output += '.';
 8198|     35|  }
 8199|   224k|  output.append(path);
 8200|   224k|  if (query.has_value()) {
  ------------------
  |  Branch (8200:7): [True: 14.3k, False: 210k]
  ------------------
 8201|  14.3k|    output += '?';
 8202|  14.3k|    output.append(*query);
 8203|  14.3k|  }
 8204|   224k|  if (hash.has_value()) {
  ------------------
  |  Branch (8204:7): [True: 13.9k, False: 210k]
  ------------------
 8205|  13.9k|    output += '#';
 8206|  13.9k|    output.append(*hash);
 8207|  13.9k|  }
 8208|   224k|  return output;
 8209|  1.41M|}
_ZNK3ada14url_aggregator8validateEv:
 9819|   202k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9820|   202k|  if (!is_valid) {
  ------------------
  |  Branch (9820:7): [True: 0, False: 202k]
  ------------------
 9821|      0|    return true;
 9822|      0|  }
 9823|   202k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9823:7): [True: 0, False: 202k]
  ------------------
 9824|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9825|      0|            to_diagram());
 9826|      0|    return false;
 9827|      0|  }
 9828|       |  // We have a credible components struct, but let us investivate more
 9829|       |  // carefully:
 9830|       |  /**
 9831|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9832|       |   *       |     |    |          | ^^^^|       |   |
 9833|       |   *       |     |    |          | |   |       |   `----- hash_start
 9834|       |   *       |     |    |          | |   |       `--------- search_start
 9835|       |   *       |     |    |          | |   `----------------- pathname_start
 9836|       |   *       |     |    |          | `--------------------- port
 9837|       |   *       |     |    |          `----------------------- host_end
 9838|       |   *       |     |    `---------------------------------- host_start
 9839|       |   *       |     `--------------------------------------- username_end
 9840|       |   *       `--------------------------------------------- protocol_end
 9841|       |   */
 9842|   202k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9842:7): [True: 0, False: 202k]
  ------------------
 9843|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9844|      0|    return false;
 9845|      0|  }
 9846|   202k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9846:7): [True: 0, False: 202k]
  ------------------
 9847|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9848|      0|    return false;
 9849|      0|  }
 9850|   202k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9850:7): [True: 0, False: 202k]
  ------------------
 9851|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9852|      0|    return false;
 9853|      0|  }
 9854|   202k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9854:7): [True: 0, False: 202k]
  ------------------
 9855|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9856|      0|    return false;
 9857|      0|  }
 9858|   202k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9858:7): [True: 0, False: 202k]
  ------------------
 9859|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9860|      0|    return false;
 9861|      0|  }
 9862|       |
 9863|   202k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9863:7): [True: 0, False: 202k]
  ------------------
 9864|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9865|      0|    return false;
 9866|      0|  }
 9867|   202k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9867:7): [True: 0, False: 202k]
  ------------------
 9868|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9869|      0|    return false;
 9870|      0|  }
 9871|   202k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9871:7): [True: 0, False: 202k]
  ------------------
 9872|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9873|      0|    return false;
 9874|      0|  }
 9875|   202k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9875:7): [True: 0, False: 202k]
  ------------------
 9876|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9877|      0|    return false;
 9878|      0|  }
 9879|   202k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9879:7): [True: 0, False: 202k]
  ------------------
 9880|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9881|      0|            to_diagram());
 9882|      0|    return false;
 9883|      0|  }
 9884|       |
 9885|   202k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9885:7): [True: 202k, False: 0]
  ------------------
 9886|   202k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9886:9): [True: 0, False: 202k]
  ------------------
 9887|      0|      ada_log(
 9888|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9889|      0|          to_diagram());
 9890|      0|      return false;
 9891|      0|    }
 9892|   202k|  }
 9893|       |
 9894|   202k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9894:7): [True: 202k, False: 30]
  ------------------
 9895|   202k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9895:7): [True: 10.3k, False: 191k]
  ------------------
 9896|  10.3k|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9896:9): [True: 404, False: 9.92k]
  ------------------
 9897|    404|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9897:9): [True: 0, False: 404]
  ------------------
 9898|      0|      ada_log(
 9899|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9900|      0|          "\n",
 9901|      0|          to_diagram());
 9902|      0|      return false;
 9903|      0|    }
 9904|  10.3k|  }
 9905|       |
 9906|   202k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9906:7): [True: 202k, False: 30]
  ------------------
 9907|   202k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9907:9): [True: 9.97k, False: 192k]
  ------------------
 9908|  9.97k|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9908:11): [True: 0, False: 9.97k]
  ------------------
 9909|      0|        ada_log(
 9910|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9911|      0|            to_diagram());
 9912|      0|        return false;
 9913|      0|      }
 9914|   192k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9914:16): [True: 192k, False: 0]
  ------------------
 9915|   192k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9915:16): [True: 191k, False: 499]
  ------------------
 9916|   191k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9916:11): [True: 191k, False: 404]
  ------------------
 9917|   191k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9917:13): [True: 0, False: 191k]
  ------------------
 9918|   191k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9918:13): [True: 0, False: 191k]
  ------------------
 9919|      0|          ada_log(
 9920|      0|              "url_aggregator::validate missing // between protocol and host "
 9921|      0|              "\n",
 9922|      0|              to_diagram());
 9923|      0|          return false;
 9924|      0|        }
 9925|   191k|      } else {
 9926|    404|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9926:13): [True: 404, False: 0]
  ------------------
 9927|    404|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9927:13): [True: 0, False: 404]
  ------------------
 9928|      0|          ada_log(
 9929|      0|              "url_aggregator::validate missing @ at the end of the username "
 9930|      0|              "\n",
 9931|      0|              to_diagram());
 9932|      0|          return false;
 9933|      0|        }
 9934|    404|      }
 9935|   191k|    } else {
 9936|    499|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9936:11): [True: 0, False: 499]
  ------------------
 9937|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9938|      0|                to_diagram());
 9939|      0|        return false;
 9940|      0|      }
 9941|    499|    }
 9942|   202k|  }
 9943|   202k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9943:7): [True: 202k, False: 46]
  ------------------
 9944|   202k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9944:7): [True: 21.2k, False: 181k]
  ------------------
 9945|  21.2k|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9945:9): [True: 1.04k, False: 20.1k]
  ------------------
 9946|  1.04k|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9946:9): [True: 5, False: 1.04k]
  ------------------
 9947|      5|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9947:9): [True: 5, False: 0]
  ------------------
 9948|      5|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9948:11): [True: 0, False: 5]
  ------------------
 9949|      5|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9949:11): [True: 0, False: 5]
  ------------------
 9950|      5|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9950:11): [True: 0, False: 5]
  ------------------
 9951|      0|        ada_log(
 9952|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9953|      0|            to_diagram());
 9954|      0|        return false;
 9955|      0|      }
 9956|  21.2k|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9956:16): [True: 0, False: 21.2k]
  ------------------
 9957|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9958|      0|              to_diagram());
 9959|      0|      return false;
 9960|      0|    }
 9961|  21.2k|  }
 9962|   202k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9962:7): [True: 202k, False: 50]
  ------------------
 9963|   202k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9963:7): [True: 202k, False: 56]
  ------------------
 9964|   202k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9964:7): [True: 202k, False: 47]
  |  Branch (9964:60): [True: 201k, False: 192]
  ------------------
 9965|   201k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9965:9): [True: 0, False: 201k]
  ------------------
 9966|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9967|      0|              to_diagram());
 9968|      0|      return false;
 9969|      0|    }
 9970|   201k|  }
 9971|   202k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9971:7): [True: 34.4k, False: 167k]
  ------------------
 9972|  34.4k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9972:9): [True: 0, False: 34.4k]
  ------------------
 9973|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9974|      0|              to_diagram());
 9975|      0|      return false;
 9976|      0|    }
 9977|  34.4k|  }
 9978|   202k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9978:7): [True: 24.8k, False: 177k]
  ------------------
 9979|  24.8k|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9979:9): [True: 0, False: 24.8k]
  ------------------
 9980|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9981|      0|              to_diagram());
 9982|      0|      return false;
 9983|      0|    }
 9984|  24.8k|  }
 9985|       |
 9986|   202k|  return true;
 9987|   202k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 8303|   202k|    const noexcept {
 8304|       |  /**
 8305|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 8306|       |   *       |     |    |          | ^^^^|       |   |
 8307|       |   *       |     |    |          | |   |       |   `----- hash_start
 8308|       |   *       |     |    |          | |   |       `--------- search_start
 8309|       |   *       |     |    |          | |   `----------------- pathname_start
 8310|       |   *       |     |    |          | `--------------------- port
 8311|       |   *       |     |    |          `----------------------- host_end
 8312|       |   *       |     |    `---------------------------------- host_start
 8313|       |   *       |     `--------------------------------------- username_end
 8314|       |   *       `--------------------------------------------- protocol_end
 8315|       |   */
 8316|       |  // These conditions can be made more strict.
 8317|   202k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (8317:7): [True: 0, False: 202k]
  ------------------
 8318|      0|    return false;
 8319|      0|  }
 8320|   202k|  uint32_t index = protocol_end;
 8321|       |
 8322|   202k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (8322:7): [True: 0, False: 202k]
  ------------------
 8323|      0|    return false;
 8324|      0|  }
 8325|   202k|  if (username_end < index) {
  ------------------
  |  Branch (8325:7): [True: 0, False: 202k]
  ------------------
 8326|      0|    return false;
 8327|      0|  }
 8328|   202k|  index = username_end;
 8329|       |
 8330|   202k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (8330:7): [True: 0, False: 202k]
  ------------------
 8331|      0|    return false;
 8332|      0|  }
 8333|   202k|  if (host_start < index) {
  ------------------
  |  Branch (8333:7): [True: 0, False: 202k]
  ------------------
 8334|      0|    return false;
 8335|      0|  }
 8336|   202k|  index = host_start;
 8337|       |
 8338|   202k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (8338:7): [True: 21.2k, False: 181k]
  ------------------
 8339|  21.2k|    if (port > 0xffff) {
  ------------------
  |  Branch (8339:9): [True: 0, False: 21.2k]
  ------------------
 8340|      0|      return false;
 8341|      0|    }
 8342|  21.2k|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 8343|  21.2k|    if (index + port_length < index) {
  ------------------
  |  Branch (8343:9): [True: 0, False: 21.2k]
  ------------------
 8344|      0|      return false;
 8345|      0|    }
 8346|  21.2k|    index += port_length;
 8347|  21.2k|  }
 8348|       |
 8349|   202k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (8349:7): [True: 0, False: 202k]
  ------------------
 8350|      0|    return false;
 8351|      0|  }
 8352|   202k|  if (pathname_start < index) {
  ------------------
  |  Branch (8352:7): [True: 0, False: 202k]
  ------------------
 8353|      0|    return false;
 8354|      0|  }
 8355|   202k|  index = pathname_start;
 8356|       |
 8357|   202k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (8357:7): [True: 34.4k, False: 167k]
  ------------------
 8358|  34.4k|    if (search_start < index) {
  ------------------
  |  Branch (8358:9): [True: 0, False: 34.4k]
  ------------------
 8359|      0|      return false;
 8360|      0|    }
 8361|  34.4k|    index = search_start;
 8362|  34.4k|  }
 8363|       |
 8364|   202k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (8364:7): [True: 24.8k, False: 177k]
  ------------------
 8365|  24.8k|    if (hash_start < index) {
  ------------------
  |  Branch (8365:9): [True: 0, False: 24.8k]
  ------------------
 8366|      0|      return false;
 8367|      0|    }
 8368|  24.8k|  }
 8369|       |
 8370|   202k|  return true;
 8371|   202k|}
_ZN3ada7helpers16fast_digit_countEj:
 2489|  21.2k|inline int fast_digit_count(uint32_t x) noexcept {
 2490|  21.2k|  auto int_log2 = [](uint32_t z) -> int {
 2491|  21.2k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2492|  21.2k|  };
 2493|       |  // Compiles to very few instructions. Note that the
 2494|       |  // table is static and thus effectively a constant.
 2495|       |  // We leave it inside the function because it is meaningless
 2496|       |  // outside of it (this comes at no performance cost).
 2497|  21.2k|  const static uint64_t table[] = {
 2498|  21.2k|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2499|  21.2k|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2500|  21.2k|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2501|  21.2k|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2502|  21.2k|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2503|  21.2k|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2504|  21.2k|      42949672960, 42949672960};
 2505|  21.2k|  return int((x + table[int_log2(x)]) >> 32);
 2506|  21.2k|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2490|  21.2k|  auto int_log2 = [](uint32_t z) -> int {
 2491|  21.2k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2492|  21.2k|  };
_ZN3ada7helpers6concatIJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKcEEENS2_12basic_stringIcS5_NS2_9allocatorIcEEEEDpT_:
 2463|   206k|std::string concat(Args... args) {
 2464|   206k|  std::string answer;
 2465|   206k|  inner_concat(answer, args...);
 2466|   206k|  return answer;
 2467|   206k|}
_ZN3ada7helpers12inner_concatINSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEJPKcEEEvRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEET_DpT0_:
 2452|   206k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 2453|   206k|  buffer.append(t);
 2454|   206k|  return inner_concat(buffer, args...);
 2455|   206k|}
_ZN3ada7helpers12inner_concatIPKcJEEEvRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEET_:
 2444|   207k|inline void inner_concat(std::string& buffer, T t) {
 2445|   207k|  buffer.append(t);
 2446|   207k|}
_ZN3ada7helpers6concatIJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcEEES8_DpT_:
 2463|    600|std::string concat(Args... args) {
 2464|    600|  std::string answer;
 2465|    600|  inner_concat(answer, args...);
 2466|    600|  return answer;
 2467|    600|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJPKcEEEvRS8_T_DpT0_:
 2452|    600|inline void inner_concat(std::string& buffer, T t, Args... args) {
 2453|    600|  buffer.append(t);
 2454|    600|  return inner_concat(buffer, args...);
 2455|    600|}
_ZN3ada3url10set_schemeEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8106|  4.77k|inline void url::set_scheme(std::string&& new_scheme) noexcept {
 8107|  4.77k|  type = ada::scheme::get_scheme_type(new_scheme);
 8108|       |  // We only move the 'scheme' if it is non-special.
 8109|  4.77k|  if (!is_special()) {
  ------------------
  |  Branch (8109:7): [True: 1.86k, False: 2.91k]
  ------------------
 8110|  1.86k|    non_special_scheme = std::move(new_scheme);
 8111|  1.86k|  }
 8112|  4.77k|}

LLVMFuzzerTestOneInput:
  212|  9.53k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  213|  9.53k|  FuzzedDataProvider fdp(data, size);
  214|       |
  215|  9.53k|  fuzz_one_input(make_candidate(fdp));
  216|       |
  217|  9.53k|  if (fdp.remaining_bytes() > 0) {
  ------------------
  |  Branch (217:7): [True: 4.96k, False: 4.56k]
  ------------------
  218|  4.96k|    std::string raw = fdp.ConsumeRemainingBytesAsString();
  219|  4.96k|    if (raw.size() > 512) {
  ------------------
  |  Branch (219:9): [True: 18, False: 4.95k]
  ------------------
  220|     18|      raw.resize(512);
  221|     18|    }
  222|  4.96k|    if (!raw.empty() && (static_cast<unsigned char>(raw[0]) & 1u)) {
  ------------------
  |  Branch (222:9): [True: 4.96k, False: 0]
  |  Branch (222:25): [True: 2.25k, False: 2.71k]
  ------------------
  223|  2.25k|      raw = std::string("https://") + raw;
  224|  2.71k|    } else if (!raw.empty()) {
  ------------------
  |  Branch (224:16): [True: 2.71k, False: 0]
  ------------------
  225|  2.71k|      raw = std::string("http://") + raw;
  226|  2.71k|    }
  227|  4.96k|    fuzz_one_input(raw);
  228|  4.96k|  }
  229|       |
  230|  9.53k|  static constexpr const char* kAnchors[] = {
  231|  9.53k|      "https://example.com",
  232|  9.53k|      "https://example.com/",
  233|  9.53k|      "https://example.com?q=1",
  234|  9.53k|      "https://example.com#frag",
  235|  9.53k|      "https://example.com/?q=1#frag",
  236|  9.53k|      "http://www.example.com/path/file.js",
  237|  9.53k|      "http://WWW.Example.COM/file.js",
  238|  9.53k|      "https://www.google.com/imghp?hl=en&tab=wi",
  239|  9.53k|      "http://192.168.0.1/x",
  240|  9.53k|      "http://0x7f.1/",
  241|  9.53k|      "https://user:pass@example.com/x",
  242|  9.53k|      "https://example.com:8080/x",
  243|  9.53k|      "https://example.com/a/./b/../c",
  244|  9.53k|      "https://example.com/foo/%2e%2e",
  245|  9.53k|      "https://xn--nxasmq6b.com/",
  246|  9.53k|      "https://xn--a/",
  247|  9.53k|      "http://foo.0xffffffff/",
  248|  9.53k|      "http://example.0x/",
  249|  9.53k|      "https://example.com:0080/x",
  250|  9.53k|      "http://@19%2E68.1.10.",
  251|  9.53k|      "http://19%2E68.1.10.",
  252|  9.53k|      "http://0xffffffff.",
  253|  9.53k|  };
  254|   209k|  for (const char* seed : kAnchors) {
  ------------------
  |  Branch (254:25): [True: 209k, False: 9.53k]
  ------------------
  255|   209k|    fuzz_one_input(seed);
  256|   209k|  }
  257|       |
  258|  9.53k|  return 0;
  259|  9.53k|}
simple_absolute.cc:_ZL14fuzz_one_inputNSt3__117basic_string_viewIcNS_11char_traitsIcEEEE:
  171|   224k|static void fuzz_one_input(std::string_view input) {
  172|   224k|  auto url = ada::parse<ada::url>(input);
  173|   224k|  auto agg = ada::parse<ada::url_aggregator>(input);
  174|       |
  175|   224k|  if (url.has_value() != agg.has_value()) {
  ------------------
  |  Branch (175:7): [True: 0, False: 224k]
  ------------------
  176|      0|    printf(
  177|      0|        "parse agreement failure\n"
  178|      0|        "  input: %.*s\n"
  179|      0|        "  url: %d aggregator: %d\n",
  180|      0|        static_cast<int>(input.size()), input.data(), url.has_value(),
  181|      0|        agg.has_value());
  182|      0|    abort();
  183|      0|  }
  184|       |
  185|   224k|  if (!url) {
  ------------------
  |  Branch (185:7): [True: 21.9k, False: 202k]
  ------------------
  186|  21.9k|    return;
  187|  21.9k|  }
  188|       |
  189|   202k|  check_components_agree(*url, *agg, input);
  190|   202k|  check_href_size(*url, input);
  191|   202k|  check_href_size(*agg, input);
  192|   202k|  check_reparse_idempotent(*url, input);
  193|   202k|  check_reparse_idempotent(*agg, input);
  194|       |
  195|   202k|  const std::string href = url->get_href();
  196|   202k|  url->set_href(href);
  197|   202k|  agg->set_href(href);
  198|   202k|  if (url->get_href() != std::string(agg->get_href())) {
  ------------------
  |  Branch (198:7): [True: 0, False: 202k]
  ------------------
  199|      0|    printf(
  200|      0|        "set_href agreement failure\n"
  201|      0|        "  href: %s\n",
  202|      0|        href.c_str());
  203|      0|    abort();
  204|      0|  }
  205|   202k|  check_href_size(*url, href);
  206|   202k|  check_href_size(*agg, href);
  207|       |
  208|   202k|  volatile bool valid = agg->validate();
  209|   202k|  (void)valid;
  210|   202k|}
simple_absolute.cc:_ZL22check_components_agreeRKN3ada3urlERKNS_14url_aggregatorENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  148|   202k|                                   std::string_view input) {
  149|   202k|  if (u.get_protocol() != a.get_protocol() ||
  ------------------
  |  Branch (149:7): [True: 0, False: 202k]
  |  Branch (149:7): [True: 0, False: 202k]
  ------------------
  150|   202k|      u.get_href() != std::string(a.get_href()) ||
  ------------------
  |  Branch (150:7): [True: 0, False: 202k]
  ------------------
  151|   202k|      std::string(u.get_hostname()) != std::string(a.get_hostname()) ||
  ------------------
  |  Branch (151:7): [True: 0, False: 202k]
  ------------------
  152|   202k|      std::string(u.get_pathname()) != std::string(a.get_pathname()) ||
  ------------------
  |  Branch (152:7): [True: 0, False: 202k]
  ------------------
  153|   202k|      std::string(u.get_search()) != std::string(a.get_search()) ||
  ------------------
  |  Branch (153:7): [True: 0, False: 202k]
  ------------------
  154|   202k|      std::string(u.get_hash()) != std::string(a.get_hash()) ||
  ------------------
  |  Branch (154:7): [True: 0, False: 202k]
  ------------------
  155|   202k|      std::string(u.get_port()) != std::string(a.get_port()) ||
  ------------------
  |  Branch (155:7): [True: 0, False: 202k]
  ------------------
  156|   202k|      u.get_username() != std::string(a.get_username()) ||
  ------------------
  |  Branch (156:7): [True: 0, False: 202k]
  ------------------
  157|   202k|      u.get_password() != std::string(a.get_password()) ||
  ------------------
  |  Branch (157:7): [True: 0, False: 202k]
  ------------------
  158|   202k|      std::string(u.get_host()) != std::string(a.get_host())) {
  ------------------
  |  Branch (158:7): [True: 0, False: 202k]
  ------------------
  159|      0|    printf(
  160|      0|        "url vs aggregator component mismatch\n"
  161|      0|        "  input: %.*s\n"
  162|      0|        "  url href: %s\n"
  163|      0|        "  agg href: %s\n",
  164|      0|        static_cast<int>(input.size()), input.data(), u.get_href().c_str(),
  165|      0|        std::string(a.get_href()).c_str());
  166|       |    fflush(stdout);
  167|      0|    abort();
  168|      0|  }
  169|   202k|}
simple_absolute.cc:_ZL15check_href_sizeRKN3ada3urlENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
   94|   404k|static void check_href_size(const ada::url& u, std::string_view input) {
   95|   404k|  if (u.get_href_size() != u.get_href().size()) {
  ------------------
  |  Branch (95:7): [True: 0, False: 404k]
  ------------------
   96|      0|    printf(
   97|      0|        "get_href_size mismatch (url)\n"
   98|      0|        "  input: %.*s\n"
   99|      0|        "  size:  %zu href.size: %zu\n"
  100|      0|        "  href:  %s\n",
  101|      0|        static_cast<int>(input.size()), input.data(), u.get_href_size(),
  102|      0|        u.get_href().size(), u.get_href().c_str());
  103|      0|    abort();
  104|      0|  }
  105|   404k|}
simple_absolute.cc:_ZL15check_href_sizeRKN3ada14url_aggregatorENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  108|   404k|                            std::string_view input) {
  109|   404k|  if (u.get_href_size() != u.get_href().size()) {
  ------------------
  |  Branch (109:7): [True: 0, False: 404k]
  ------------------
  110|      0|    printf(
  111|      0|        "get_href_size mismatch (aggregator)\n"
  112|      0|        "  input: %.*s\n"
  113|      0|        "  size:  %zu href.size: %zu\n"
  114|      0|        "  href:  %s\n",
  115|      0|        static_cast<int>(input.size()), input.data(), u.get_href_size(),
  116|      0|        u.get_href().size(), std::string(u.get_href()).c_str());
  117|      0|    abort();
  118|      0|  }
  119|   404k|}
simple_absolute.cc:_ZL24check_reparse_idempotentIN3ada3urlEEvRKT_NSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  123|   202k|                                     std::string_view input) {
  124|   202k|  const std::string href = std::string(parsed.get_href());
  125|   202k|  auto again = ada::parse<Result>(href);
  126|   202k|  if (!again) {
  ------------------
  |  Branch (126:7): [True: 0, False: 202k]
  ------------------
  127|      0|    printf(
  128|      0|        "re-parse of href failed\n"
  129|      0|        "  input: %.*s\n"
  130|      0|        "  href:  %s\n",
  131|      0|        static_cast<int>(input.size()), input.data(), href.c_str());
  132|      0|    abort();
  133|      0|  }
  134|   202k|  if (std::string(again->get_href()) != href) {
  ------------------
  |  Branch (134:7): [True: 0, False: 202k]
  ------------------
  135|      0|    printf(
  136|      0|        "href not idempotent\n"
  137|      0|        "  input: %.*s\n"
  138|      0|        "  href1: %s\n"
  139|      0|        "  href2: %s\n",
  140|      0|        static_cast<int>(input.size()), input.data(), href.c_str(),
  141|      0|        std::string(again->get_href()).c_str());
  142|      0|    abort();
  143|      0|  }
  144|   202k|}
simple_absolute.cc:_ZL24check_reparse_idempotentIN3ada14url_aggregatorEEvRKT_NSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  123|   202k|                                     std::string_view input) {
  124|   202k|  const std::string href = std::string(parsed.get_href());
  125|   202k|  auto again = ada::parse<Result>(href);
  126|   202k|  if (!again) {
  ------------------
  |  Branch (126:7): [True: 0, False: 202k]
  ------------------
  127|      0|    printf(
  128|      0|        "re-parse of href failed\n"
  129|      0|        "  input: %.*s\n"
  130|      0|        "  href:  %s\n",
  131|      0|        static_cast<int>(input.size()), input.data(), href.c_str());
  132|      0|    abort();
  133|      0|  }
  134|   202k|  if (std::string(again->get_href()) != href) {
  ------------------
  |  Branch (134:7): [True: 0, False: 202k]
  ------------------
  135|      0|    printf(
  136|      0|        "href not idempotent\n"
  137|      0|        "  input: %.*s\n"
  138|      0|        "  href1: %s\n"
  139|      0|        "  href2: %s\n",
  140|      0|        static_cast<int>(input.size()), input.data(), href.c_str(),
  141|      0|        std::string(again->get_href()).c_str());
  142|      0|    abort();
  143|      0|  }
  144|   202k|}
simple_absolute.cc:_ZL14make_candidateR18FuzzedDataProvider:
   74|  9.53k|static std::string make_candidate(FuzzedDataProvider& fdp) {
   75|  9.53k|  std::string out;
   76|  9.53k|  out += pick(fdp, kSchemes);
   77|  9.53k|  out += pick(fdp, kHosts);
   78|  9.53k|  out += pick(fdp, kPaths);
   79|  9.53k|  out += pick(fdp, kQueries);
   80|  9.53k|  out += pick(fdp, kFrags);
   81|       |
   82|  9.53k|  if (fdp.ConsumeBool() && !out.empty()) {
  ------------------
  |  Branch (82:7): [True: 3.59k, False: 5.93k]
  |  Branch (82:28): [True: 3.59k, False: 0]
  ------------------
   83|  3.59k|    std::string mid = fdp.ConsumeRandomLengthString(24);
   84|  3.59k|    size_t pos = fdp.ConsumeIntegralInRange<size_t>(0, out.size());
   85|  3.59k|    out.insert(pos, mid);
   86|  3.59k|  }
   87|  9.53k|  if (fdp.ConsumeBool() && !out.empty()) {
  ------------------
  |  Branch (87:7): [True: 2.26k, False: 7.27k]
  |  Branch (87:28): [True: 2.26k, False: 0]
  ------------------
   88|  2.26k|    size_t i = fdp.ConsumeIntegralInRange<size_t>(0, out.size() - 1);
   89|  2.26k|    out[i] = static_cast<char>(fdp.ConsumeIntegral<uint8_t>());
   90|  2.26k|  }
   91|  9.53k|  return out;
   92|  9.53k|}
simple_absolute.cc:_ZL4pickILm8EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.53k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.53k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.53k|}
simple_absolute.cc:_ZL4pickILm20EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.53k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.53k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.53k|}
simple_absolute.cc:_ZL4pickILm16EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.53k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.53k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.53k|}
simple_absolute.cc:_ZL4pickILm6EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.53k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.53k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.53k|}
simple_absolute.cc:_ZL4pickILm5EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.53k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.53k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.53k|}

