_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  162|  4.97k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  163|  4.97k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  164|  4.97k|  size_t pos = 0;
  165|  4.97k|  const char32_t* start{utf32_output};
  166|  96.6k|  while (pos < len) {
  ------------------
  |  Branch (166:10): [True: 92.1k, False: 4.54k]
  ------------------
  167|       |    // try to convert the next block of 16 ASCII bytes
  168|  92.1k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (168:9): [True: 64.5k, False: 27.5k]
  ------------------
  169|       |                            // bytes, check that they are ascii
  170|  64.5k|      uint64_t v1;
  171|  64.5k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  172|  64.5k|      uint64_t v2;
  173|  64.5k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  174|  64.5k|      uint64_t v{v1 | v2};
  175|  64.5k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (175:11): [True: 4.41k, False: 60.1k]
  ------------------
  176|  4.41k|        size_t final_pos = pos + 16;
  177|  75.0k|        while (pos < final_pos) {
  ------------------
  |  Branch (177:16): [True: 70.5k, False: 4.41k]
  ------------------
  178|  70.5k|          *utf32_output++ = char32_t(buf[pos]);
  179|  70.5k|          pos++;
  180|  70.5k|        }
  181|  4.41k|        continue;
  182|  4.41k|      }
  183|  64.5k|    }
  184|  87.6k|    uint8_t leading_byte = data[pos];  // leading byte
  185|  87.6k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (185:9): [True: 50.4k, False: 37.2k]
  ------------------
  186|       |      // converting one ASCII byte !!!
  187|  50.4k|      *utf32_output++ = char32_t(leading_byte);
  188|  50.4k|      pos++;
  189|  50.4k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (189:16): [True: 7.03k, False: 30.2k]
  ------------------
  190|       |      // We have a two-byte UTF-8
  191|  7.03k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (191:11): [True: 62, False: 6.97k]
  ------------------
  192|     62|        return 0;
  193|     62|      }  // minimal bound checking
  194|  6.97k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (194:11): [True: 74, False: 6.89k]
  ------------------
  195|     74|        return 0;
  196|     74|      }
  197|       |      // range check
  198|  6.89k|      uint32_t code_point =
  199|  6.89k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  200|  6.89k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (200:11): [True: 8, False: 6.89k]
  |  Branch (200:32): [True: 0, False: 6.89k]
  ------------------
  201|      8|        return 0;
  202|      8|      }
  203|  6.89k|      *utf32_output++ = char32_t(code_point);
  204|  6.89k|      pos += 2;
  205|  30.2k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (205:16): [True: 29.2k, False: 922]
  ------------------
  206|       |      // We have a three-byte UTF-8
  207|  29.2k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (207:11): [True: 10, False: 29.2k]
  ------------------
  208|     10|        return 0;
  209|     10|      }  // minimal bound checking
  210|       |
  211|  29.2k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (211:11): [True: 28, False: 29.2k]
  ------------------
  212|     28|        return 0;
  213|     28|      }
  214|  29.2k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (214:11): [True: 6, False: 29.2k]
  ------------------
  215|      6|        return 0;
  216|      6|      }
  217|       |      // range check
  218|  29.2k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  219|  29.2k|                            (data[pos + 1] & 0b00111111) << 6 |
  220|  29.2k|                            (data[pos + 2] & 0b00111111);
  221|  29.2k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (221:11): [True: 16, False: 29.2k]
  |  Branch (221:33): [True: 0, False: 29.2k]
  ------------------
  222|  29.2k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (222:12): [True: 5.75k, False: 23.4k]
  |  Branch (222:35): [True: 6, False: 5.74k]
  ------------------
  223|     22|        return 0;
  224|     22|      }
  225|  29.2k|      *utf32_output++ = char32_t(code_point);
  226|  29.2k|      pos += 3;
  227|  29.2k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (227:16): [True: 790, False: 132]
  ------------------
  228|       |      // we have a 4-byte UTF-8 word.
  229|    790|      if (pos + 3 >= len) {
  ------------------
  |  Branch (229:11): [True: 24, False: 766]
  ------------------
  230|     24|        return 0;
  231|     24|      }  // minimal bound checking
  232|    766|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (232:11): [True: 24, False: 742]
  ------------------
  233|     24|        return 0;
  234|     24|      }
  235|    742|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (235:11): [True: 14, False: 728]
  ------------------
  236|     14|        return 0;
  237|     14|      }
  238|    728|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (238:11): [True: 10, False: 718]
  ------------------
  239|     10|        return 0;
  240|     10|      }
  241|       |
  242|       |      // range check
  243|    718|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  244|    718|                            (data[pos + 1] & 0b00111111) << 12 |
  245|    718|                            (data[pos + 2] & 0b00111111) << 6 |
  246|    718|                            (data[pos + 3] & 0b00111111);
  247|    718|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (247:11): [True: 14, False: 704]
  |  Branch (247:35): [True: 6, False: 698]
  ------------------
  248|     20|        return 0;
  249|     20|      }
  250|    698|      *utf32_output++ = char32_t(code_point);
  251|    698|      pos += 4;
  252|    698|    } else {
  253|    132|      return 0;
  254|    132|    }
  255|  87.6k|  }
  256|  4.54k|  return utf32_output - start;
  257|  4.97k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  272|  5.02k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  273|  5.02k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  274|  5.02k|  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|  5.02k|    return c > -65;
  278|  5.02k|  });
  279|  5.02k|}
_ZN3ada4idna9ascii_mapEPcm:
 5338|   121k|void ascii_map(char* input, size_t length) {
 5339|   121k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5340|   121k|    return 0x101010101010101ull * v;
 5341|   121k|  };
 5342|   121k|  uint64_t broadcast_80 = broadcast(0x80);
 5343|   121k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5344|   121k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5345|   121k|  size_t i = 0;
 5346|       |
 5347|   321k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5347:10): [True: 200k, False: 121k]
  ------------------
 5348|   200k|    uint64_t word{};
 5349|   200k|    std::memcpy(&word, input + i, sizeof(word));
 5350|   200k|    word ^=
 5351|   200k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5352|   200k|    std::memcpy(input + i, &word, sizeof(word));
 5353|   200k|  }
 5354|   121k|  if (i < length) {
  ------------------
  |  Branch (5354:7): [True: 63.3k, False: 58.4k]
  ------------------
 5355|  63.3k|    uint64_t word{};
 5356|  63.3k|    std::memcpy(&word, input + i, length - i);
 5357|  63.3k|    word ^=
 5358|  63.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5359|  63.3k|    std::memcpy(input + i, &word, length - i);
 5360|  63.3k|  }
 5361|   121k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5365|  7.11k|bool map(std::u32string_view input, std::u32string& out) {
 5366|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5367|  7.11k|  out.clear();
 5368|  7.11k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5368:7): [True: 0, False: 7.11k]
  ------------------
 5369|      0|    return false;
 5370|      0|  }
 5371|       |
 5372|       |  // Pass 1: validate and compute exact output length.
 5373|  7.11k|  size_t out_size = 0;
 5374|   179k|  for (char32_t x : input) {
  ------------------
  |  Branch (5374:19): [True: 179k, False: 6.78k]
  ------------------
 5375|   179k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5376|   179k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5376:9): [True: 334, False: 179k]
  ------------------
 5377|    334|      return false;
 5378|    334|    }
 5379|   179k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5379:9): [True: 120k, False: 58.4k]
  ------------------
 5380|   120k|      ++out_size;
 5381|   120k|      continue;
 5382|   120k|    }
 5383|  58.4k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5383:9): [True: 0, False: 58.4k]
  ------------------
 5384|      0|      return false;
 5385|      0|    }
 5386|  58.4k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5387|  58.4k|  }
 5388|       |
 5389|       |  // Pass 2: write into a single allocation.
 5390|  6.78k|  out.resize(out_size);
 5391|  6.78k|  size_t w = 0;
 5392|   178k|  for (char32_t x : input) {
  ------------------
  |  Branch (5392:19): [True: 178k, False: 6.78k]
  ------------------
 5393|   178k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5394|   178k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5394:9): [True: 119k, False: 58.3k]
  ------------------
 5395|   119k|      out[w++] = x;
 5396|   119k|      continue;
 5397|   119k|    }
 5398|       |    // IGNORED or mapped (status already validated in pass 1).
 5399|  58.3k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5400|   324k|    while (*ptr != 0) {
  ------------------
  |  Branch (5400:12): [True: 266k, False: 58.3k]
  ------------------
 5401|   266k|      out[w++] = utf8_next(ptr);
 5402|   266k|    }
 5403|  58.3k|  }
 5404|  6.78k|  return true;
 5405|  7.11k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5499|  1.65k|    const std::u32string_view input) noexcept {
 5500|  1.65k|  bool decomposition_needed{false};
 5501|  1.65k|  size_t additional_elements{0};
 5502|  75.5k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5502:35): [True: 75.5k, False: 1.65k]
  ------------------
 5503|  75.5k|    size_t decomposition_length{0};
 5504|       |
 5505|  75.5k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5505:9): [True: 3.72k, False: 71.7k]
  ------------------
 5506|  3.72k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5506:9): [True: 2.40k, False: 1.31k]
  ------------------
 5507|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5508|  2.40k|      decomposition_length = 2;
 5509|  2.40k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5509:11): [True: 336, False: 2.07k]
  ------------------
 5510|    336|        decomposition_length = 3;
 5511|    336|      }
 5512|  73.1k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5512:16): [True: 73.1k, False: 0]
  ------------------
 5513|  73.1k|      const uint8_t di = decomposition_index[current_character >> 8];
 5514|  73.1k|      const uint16_t* const decomposition =
 5515|  73.1k|          decomposition_block_row(di) + (current_character % 256);
 5516|  73.1k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5517|  73.1k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5517:11): [True: 2.56k, False: 70.5k]
  |  Branch (5517:41): [True: 0, False: 2.56k]
  ------------------
 5518|      0|        decomposition_length = 0;
 5519|      0|      }
 5520|  73.1k|    }
 5521|  75.5k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5521:9): [True: 4.97k, False: 70.5k]
  ------------------
 5522|  4.97k|      decomposition_needed = true;
 5523|  4.97k|      additional_elements += decomposition_length - 1;
 5524|  4.97k|    }
 5525|  75.5k|  }
 5526|  1.65k|  return {decomposition_needed, additional_elements};
 5527|  1.65k|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5529|  1.14k|void decompose(std::u32string& input, size_t additional_elements) {
 5530|  1.14k|  input.resize(input.size() + additional_elements);
 5531|  1.14k|  for (size_t descending_idx = input.size(),
 5532|  1.14k|              input_count = descending_idx - additional_elements;
 5533|  67.8k|       input_count--;) {
  ------------------
  |  Branch (5533:8): [True: 66.7k, False: 1.14k]
  ------------------
 5534|  66.7k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5534:9): [True: 2.93k, False: 63.7k]
  ------------------
 5535|  2.93k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5535:9): [True: 2.40k, False: 522]
  ------------------
 5536|       |      // Hangul decomposition.
 5537|  2.40k|      char32_t s_index = input[input_count] - hangul_sbase;
 5538|  2.40k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5538:11): [True: 336, False: 2.07k]
  ------------------
 5539|    336|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5540|    336|      }
 5541|  2.40k|      input[--descending_idx] =
 5542|  2.40k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5543|  2.40k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5544|  64.2k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5544:16): [True: 64.2k, False: 0]
  ------------------
 5545|  64.2k|      const uint16_t* decomposition =
 5546|  64.2k|          decomposition_block_row(
 5547|  64.2k|              decomposition_index[input[input_count] >> 8]) +
 5548|  64.2k|          (input[input_count] % 256);
 5549|  64.2k|      uint16_t decomposition_length =
 5550|  64.2k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5551|  64.2k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5551:11): [True: 2.56k, False: 61.7k]
  |  Branch (5551:39): [True: 0, False: 2.56k]
  ------------------
 5552|      0|        decomposition_length = 0;
 5553|      0|      }
 5554|  64.2k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5554:11): [True: 2.56k, False: 61.7k]
  ------------------
 5555|  2.56k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5556|  2.56k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5556:13): [True: 0, False: 2.56k]
  ------------------
 5557|      0|          input[--descending_idx] = input[input_count];
 5558|  2.56k|        } else {
 5559|  7.97k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5559:18): [True: 5.41k, False: 2.56k]
  ------------------
 5560|  5.41k|            input[--descending_idx] =
 5561|  5.41k|                decomposition_data[base + decomposition_length];
 5562|  5.41k|          }
 5563|  2.56k|        }
 5564|  61.7k|      } else {
 5565|  61.7k|        input[--descending_idx] = input[input_count];
 5566|  61.7k|      }
 5567|  64.2k|    } else {
 5568|      0|      input[--descending_idx] = input[input_count];
 5569|      0|    }
 5570|  66.7k|  }
 5571|  1.14k|}
_ZN3ada4idna7get_cccEDi:
 5573|  1.21M|uint8_t get_ccc(char32_t c) noexcept {
 5574|  1.21M|  if (c >= 0x110000) {
  ------------------
  |  Branch (5574:7): [True: 0, False: 1.21M]
  ------------------
 5575|      0|    return 0;
 5576|      0|  }
 5577|  1.21M|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5578|  1.21M|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5580|  1.65k|void sort_marks(std::u32string& input) {
 5581|  81.1k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5581:24): [True: 79.4k, False: 1.65k]
  ------------------
 5582|  79.4k|    uint8_t ccc = get_ccc(input[idx]);
 5583|  79.4k|    if (ccc == 0) {
  ------------------
  |  Branch (5583:9): [True: 72.1k, False: 7.35k]
  ------------------
 5584|  72.1k|      continue;
 5585|  72.1k|    }
 5586|  7.35k|    auto current_character = input[idx];
 5587|  7.35k|    size_t back_idx = idx;
 5588|  10.2k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5588:12): [True: 10.0k, False: 132]
  |  Branch (5588:29): [True: 2.85k, False: 7.22k]
  ------------------
 5589|  2.85k|      input[back_idx] = input[back_idx - 1];
 5590|  2.85k|      back_idx--;
 5591|  2.85k|    }
 5592|  7.35k|    input[back_idx] = current_character;
 5593|  7.35k|  }
 5594|  1.65k|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5596|  1.65k|void decompose_nfc(std::u32string& input) {
 5597|       |  /**
 5598|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5599|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5600|       |   */
 5601|  1.65k|  auto [decomposition_needed, additional_elements] =
 5602|  1.65k|      compute_decomposition_length(input);
 5603|  1.65k|  if (decomposition_needed) {
  ------------------
  |  Branch (5603:7): [True: 1.14k, False: 510]
  ------------------
 5604|  1.14k|    decompose(input, additional_elements);
 5605|  1.14k|  }
 5606|  1.65k|  sort_marks(input);
 5607|  1.65k|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5742|  7.63k|bool is_already_nfc(std::u32string_view input) noexcept {
 5743|  7.63k|  if (input.empty()) {
  ------------------
  |  Branch (5743:7): [True: 0, False: 7.63k]
  ------------------
 5744|      0|    return true;
 5745|      0|  }
 5746|  7.63k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5746:7): [True: 0, False: 7.63k]
  |  Branch (5746:30): [True: 0, False: 0]
  ------------------
 5747|      0|    return false;
 5748|      0|  }
 5749|       |  // 1) A character whose canonical decomposition does not compose back to it is
 5750|       |  //    not NFC: singletons (e.g. U+212B), composition exclusions (e.g. U+0958)
 5751|       |  //    and non-starter decompositions (e.g. U+0344), or one whose
 5752|       |  //    decomposition starts with a code point that composes with the previous
 5753|       |  //    character (e.g. U+1611E U+16121).
 5754|  7.63k|  char32_t previous = 0x110000;  // none
 5755|   381k|  for (char32_t c : input) {
  ------------------
  |  Branch (5755:19): [True: 381k, False: 7.63k]
  ------------------
 5756|   381k|    if (decomposition_is_not_nfc(previous, c)) {
  ------------------
  |  Branch (5756:9): [True: 4, False: 381k]
  ------------------
 5757|      4|      return false;
 5758|      4|    }
 5759|   381k|    previous = c;
 5760|   381k|  }
 5761|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5762|       |  //    trailing class of the previous character's canonical decomposition so a
 5763|       |  //    composite starter followed by a lower-class mark is caught.
 5764|  7.63k|  uint8_t prev_ccc = 0;
 5765|   374k|  for (char32_t c : input) {
  ------------------
  |  Branch (5765:19): [True: 374k, False: 5.54k]
  ------------------
 5766|   374k|    uint8_t ccc = get_ccc(c);
 5767|   374k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5767:9): [True: 8.39k, False: 366k]
  |  Branch (5767:21): [True: 2.08k, False: 6.31k]
  ------------------
 5768|  2.08k|      return false;
 5769|  2.08k|    }
 5770|   372k|    prev_ccc = trailing_ccc(c);
 5771|   372k|  }
 5772|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5773|  5.54k|  return !would_compose(input);
 5774|  7.63k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5776|  9.26k|void compose(std::u32string& input) {
 5777|       |  /**
 5778|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5779|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5780|       |   */
 5781|  9.26k|  size_t input_count{0};
 5782|  9.26k|  size_t composition_count{0};
 5783|  87.8k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5783:10): [True: 78.5k, False: 9.26k]
  ------------------
 5784|  78.5k|    input[composition_count] = input[input_count];
 5785|  78.5k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5785:9): [True: 6.29k, False: 72.2k]
  ------------------
 5786|  6.29k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5786:9): [True: 3.20k, False: 3.09k]
  ------------------
 5787|  3.20k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5787:11): [True: 3.18k, False: 18]
  ------------------
 5788|  3.18k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5788:11): [True: 2.77k, False: 406]
  ------------------
 5789|  2.77k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5789:11): [True: 2.49k, False: 288]
  ------------------
 5790|  2.49k|        input[composition_count] =
 5791|  2.49k|            hangul_sbase +
 5792|  2.49k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5793|  2.49k|             input[input_count + 1] - hangul_vbase) *
 5794|  2.49k|                hangul_tcount;
 5795|  2.49k|        input_count++;
 5796|  2.49k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5796:13): [True: 2.44k, False: 44]
  ------------------
 5797|  2.44k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5797:13): [True: 556, False: 1.89k]
  ------------------
 5798|    556|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5798:13): [True: 354, False: 202]
  ------------------
 5799|    354|          input[composition_count] += input[++input_count] - hangul_tbase;
 5800|    354|        }
 5801|  2.49k|      }
 5802|  75.3k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5802:16): [True: 1.29k, False: 74.0k]
  ------------------
 5803|  1.29k|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5803:16): [True: 0, False: 1.29k]
  ------------------
 5804|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5804:11): [True: 0, False: 0]
  ------------------
 5805|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5805:11): [True: 0, False: 0]
  ------------------
 5806|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5806:11): [True: 0, False: 0]
  ------------------
 5807|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5807:11): [True: 0, False: 0]
  ------------------
 5808|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5809|      0|      }
 5810|  75.3k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5810:16): [True: 75.3k, False: 0]
  ------------------
 5811|  75.3k|      const uint16_t* composition =
 5812|  75.3k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5813|  75.3k|          (input[input_count] % 256);
 5814|  75.3k|      size_t initial_composition_count = composition_count;
 5815|  90.9k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5815:39): [True: 81.7k, False: 9.17k]
  ------------------
 5816|  81.7k|           input_count++) {
 5817|  81.7k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5818|       |
 5819|  81.7k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5819:13): [True: 25.9k, False: 55.8k]
  |  Branch (5819:49): [True: 25.3k, False: 580]
  ------------------
 5820|  25.3k|          int left = composition[0];
 5821|  25.3k|          int right = composition[1];
 5822|  25.3k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5822:15): [True: 0, False: 25.3k]
  |  Branch (5822:27): [True: 0, False: 25.3k]
  ------------------
 5823|  25.3k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5823:15): [True: 0, False: 25.3k]
  ------------------
 5824|      0|            break;
 5825|      0|          }
 5826|  56.1k|          while (left + 2 < right) {
  ------------------
  |  Branch (5826:18): [True: 30.8k, False: 25.3k]
  ------------------
 5827|  30.8k|            int middle = left + (((right - left) >> 1) & ~1);
 5828|  30.8k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5828:17): [True: 14.2k, False: 16.5k]
  ------------------
 5829|  30.8k|                input[input_count + 1]) {
 5830|  14.2k|              left = middle;
 5831|  14.2k|            }
 5832|  30.8k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5832:17): [True: 24.9k, False: 5.83k]
  ------------------
 5833|  30.8k|                input[input_count + 1]) {
 5834|  24.9k|              right = middle;
 5835|  24.9k|            }
 5836|  30.8k|          }
 5837|  25.3k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5837:15): [True: 25.3k, False: 0]
  ------------------
 5838|  25.3k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5838:15): [True: 11.6k, False: 13.6k]
  ------------------
 5839|  25.3k|                  input[input_count + 1]) {
 5840|  11.6k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5841|  11.6k|            input[initial_composition_count] = composed;
 5842|  11.6k|            composition =
 5843|  11.6k|                composition_block_row(composition_index[composed >> 8]) +
 5844|  11.6k|                (composed % 256);
 5845|  11.6k|            continue;
 5846|  11.6k|          }
 5847|  25.3k|        }
 5848|       |
 5849|  70.1k|        if (ccc == 0) {
  ------------------
  |  Branch (5849:13): [True: 66.1k, False: 3.94k]
  ------------------
 5850|  66.1k|          break;
 5851|  66.1k|        }
 5852|  3.94k|        previous_ccc = ccc;
 5853|  3.94k|        input[++composition_count] = input[input_count + 1];
 5854|  3.94k|      }
 5855|  75.3k|    }
 5856|  78.5k|  }
 5857|       |
 5858|  9.26k|  if (composition_count < input_count) {
  ------------------
  |  Branch (5858:7): [True: 9.13k, False: 124]
  ------------------
 5859|  9.13k|    input.resize(composition_count);
 5860|  9.13k|  }
 5861|  9.26k|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5863|  1.65k|bool normalize(std::u32string& input) {
 5864|       |  /**
 5865|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5866|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5867|       |   */
 5868|  1.65k|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5868:7): [True: 0, False: 1.65k]
  |  Branch (5868:27): [True: 0, False: 1.65k]
  ------------------
 5869|  1.65k|      composition_index == nullptr) {
  ------------------
  |  Branch (5869:7): [True: 0, False: 1.65k]
  ------------------
 5870|      0|    return false;
 5871|      0|  }
 5872|  1.65k|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5872:7): [True: 0, False: 1.65k]
  ------------------
 5873|      0|    return true;
 5874|      0|  }
 5875|  1.65k|  decompose_nfc(input);
 5876|  1.65k|  compose(input);
 5877|  1.65k|  return true;
 5878|  1.65k|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5938|  2.80k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5939|  2.80k|  int32_t written_out{0};
 5940|  2.80k|  out.reserve(out.size() + input.size());
 5941|  2.80k|  uint32_t n = initial_n;
 5942|  2.80k|  int32_t i = 0;
 5943|  2.80k|  int32_t bias = initial_bias;
 5944|       |  // grab ascii content
 5945|       |  // RFC 3492 section 6.2: copy the code points before the last delimiter,
 5946|       |  // then consume the delimiter only "if more than zero code points were
 5947|       |  // consumed". With a leading delimiter, b == 0, decoding starts at the
 5948|       |  // delimiter itself, which is not a digit, and fails. This matches the
 5949|       |  // reference implementation in appendix C (`in = b > 0 ? b + 1 : 0`).
 5950|  2.80k|  size_t end_of_ascii = input.find_last_of('-');
 5951|  2.80k|  if (end_of_ascii != std::string_view::npos && end_of_ascii > 0) {
  ------------------
  |  Branch (5951:7): [True: 562, False: 2.24k]
  |  Branch (5951:49): [True: 556, False: 6]
  ------------------
 5952|  11.6k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5952:20): [True: 11.6k, False: 556]
  ------------------
 5953|  11.6k|      if (c >= 0x80) {
  ------------------
  |  Branch (5953:11): [True: 0, False: 11.6k]
  ------------------
 5954|      0|        return false;
 5955|      0|      }
 5956|  11.6k|      out.push_back(c);
 5957|  11.6k|      written_out++;
 5958|  11.6k|    }
 5959|    556|    input.remove_prefix(end_of_ascii + 1);
 5960|    556|  }
 5961|  26.0k|  while (!input.empty()) {
  ------------------
  |  Branch (5961:10): [True: 23.4k, False: 2.66k]
  ------------------
 5962|  23.4k|    int32_t oldi = i;
 5963|  23.4k|    int32_t w = 1;
 5964|  34.3k|    for (int32_t k = base;; k += base) {
 5965|  34.3k|      if (input.empty()) {
  ------------------
  |  Branch (5965:11): [True: 32, False: 34.3k]
  ------------------
 5966|     32|        return false;
 5967|     32|      }
 5968|  34.3k|      uint8_t code_point = input.front();
 5969|  34.3k|      input.remove_prefix(1);
 5970|  34.3k|      int32_t digit = char_to_digit_value(code_point);
 5971|  34.3k|      if (digit < 0) {
  ------------------
  |  Branch (5971:11): [True: 42, False: 34.3k]
  ------------------
 5972|     42|        return false;
 5973|     42|      }
 5974|  34.3k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5974:11): [True: 6, False: 34.3k]
  ------------------
 5975|      6|        return false;
 5976|      6|      }
 5977|  34.3k|      i = i + digit * w;
 5978|  34.3k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5978:19): [True: 6.97k, False: 27.3k]
  |  Branch (5978:38): [True: 25.8k, False: 1.48k]
  ------------------
 5979|  34.3k|      if (digit < t) {
  ------------------
  |  Branch (5979:11): [True: 23.3k, False: 10.9k]
  ------------------
 5980|  23.3k|        break;
 5981|  23.3k|      }
 5982|  10.9k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5982:11): [True: 0, False: 10.9k]
  ------------------
 5983|      0|        return false;
 5984|      0|      }
 5985|  10.9k|      w = w * (base - t);
 5986|  10.9k|    }
 5987|  23.3k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5988|  23.3k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5988:9): [True: 56, False: 23.2k]
  ------------------
 5989|     56|      return false;
 5990|     56|    }
 5991|  23.2k|    n = n + i / (written_out + 1);
 5992|  23.2k|    i = i % (written_out + 1);
 5993|  23.2k|    if (n < 0x80) {
  ------------------
  |  Branch (5993:9): [True: 0, False: 23.2k]
  ------------------
 5994|      0|      return false;
 5995|      0|    }
 5996|  23.2k|    out.insert(out.begin() + i, n);
 5997|  23.2k|    written_out++;
 5998|  23.2k|    ++i;
 5999|  23.2k|  }
 6000|       |  // See https://github.com/whatwg/url/issues/803
 6001|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 6002|  2.66k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (6002:7): [True: 1.17k, False: 1.49k]
  |  Branch (6002:26): [True: 310, False: 860]
  |  Branch (6002:44): [True: 220, False: 90]
  |  Branch (6002:62): [True: 118, False: 102]
  ------------------
 6003|    118|      out[3] == U'-') {
  ------------------
  |  Branch (6003:7): [True: 6, False: 112]
  ------------------
 6004|      6|    return false;
 6005|      6|  }
 6006|  2.66k|  return true;
 6007|  2.66k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 6087|  22.4k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 6088|  22.4k|  out.reserve(input.size() + out.size());
 6089|  22.4k|  uint32_t n = initial_n;
 6090|  22.4k|  int32_t d = 0;
 6091|  22.4k|  int32_t bias = initial_bias;
 6092|  22.4k|  size_t h = 0;
 6093|       |  // first push the ascii content
 6094|   101k|  for (uint32_t c : input) {
  ------------------
  |  Branch (6094:19): [True: 101k, False: 22.4k]
  ------------------
 6095|   101k|    if (c < 0x80) {
  ------------------
  |  Branch (6095:9): [True: 52.7k, False: 48.5k]
  ------------------
 6096|  52.7k|      ++h;
 6097|  52.7k|      out.push_back(char(c));
 6098|  52.7k|    }
 6099|   101k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (6099:9): [True: 0, False: 101k]
  |  Branch (6099:26): [True: 762, False: 100k]
  |  Branch (6099:41): [True: 0, False: 762]
  ------------------
 6100|      0|      return false;
 6101|      0|    }
 6102|   101k|  }
 6103|  22.4k|  size_t b = h;
 6104|  22.4k|  if (b > 0) {
  ------------------
  |  Branch (6104:7): [True: 19.2k, False: 3.24k]
  ------------------
 6105|  19.2k|    out.push_back('-');
 6106|  19.2k|  }
 6107|  65.5k|  while (h < input.size()) {
  ------------------
  |  Branch (6107:10): [True: 43.0k, False: 22.4k]
  ------------------
 6108|  43.0k|    uint32_t m = 0x10FFFF;
 6109|   246k|    for (auto code_point : input) {
  ------------------
  |  Branch (6109:26): [True: 246k, False: 43.0k]
  ------------------
 6110|   246k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (6110:11): [True: 96.5k, False: 150k]
  |  Branch (6110:30): [True: 45.4k, False: 51.0k]
  ------------------
 6111|   246k|    }
 6112|       |
 6113|  43.0k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (6113:9): [True: 0, False: 43.0k]
  ------------------
 6114|      0|      return false;
 6115|      0|    }
 6116|  43.0k|    d = d + int32_t((m - n) * (h + 1));
 6117|  43.0k|    n = m;
 6118|   246k|    for (auto c : input) {
  ------------------
  |  Branch (6118:17): [True: 246k, False: 43.0k]
  ------------------
 6119|   246k|      if (c < n) {
  ------------------
  |  Branch (6119:11): [True: 150k, False: 96.5k]
  ------------------
 6120|   150k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (6120:13): [True: 0, False: 150k]
  ------------------
 6121|      0|          return false;
 6122|      0|        }
 6123|   150k|        ++d;
 6124|   150k|      }
 6125|   246k|      if (c == n) {
  ------------------
  |  Branch (6125:11): [True: 48.5k, False: 198k]
  ------------------
 6126|  48.5k|        int32_t q = d;
 6127|   172k|        for (int32_t k = base;; k += base) {
 6128|   172k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (6128:23): [True: 46.3k, False: 125k]
  |  Branch (6128:42): [True: 106k, False: 19.3k]
  ------------------
 6129|       |
 6130|   172k|          if (q < t) {
  ------------------
  |  Branch (6130:15): [True: 48.5k, False: 123k]
  ------------------
 6131|  48.5k|            break;
 6132|  48.5k|          }
 6133|   123k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 6134|   123k|          q = (q - t) / (base - t);
 6135|   123k|        }
 6136|  48.5k|        out.push_back(digit_to_char(q));
 6137|  48.5k|        bias = adapt(d, int32_t(h + 1), h == b);
 6138|  48.5k|        d = 0;
 6139|  48.5k|        ++h;
 6140|  48.5k|      }
 6141|   246k|    }
 6142|  43.0k|    ++d;
 6143|  43.0k|    ++n;
 6144|  43.0k|  }
 6145|  22.4k|  return true;
 6146|  22.4k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  25.1k|bool is_label_valid(const std::u32string_view label) {
 6293|  25.1k|  if (label.empty()) {
  ------------------
  |  Branch (6293:7): [True: 0, False: 25.1k]
  ------------------
 6294|      0|    return true;
 6295|      0|  }
 6296|  25.1k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (6296:7): [True: 0, False: 25.1k]
  |  Branch (6296:27): [True: 0, False: 25.1k]
  |  Branch (6296:58): [True: 0, False: 25.1k]
  ------------------
 6297|  25.1k|      dir_final == nullptr || dir_value == nullptr ||
  ------------------
  |  Branch (6297:7): [True: 0, False: 25.1k]
  |  Branch (6297:31): [True: 0, False: 25.1k]
  ------------------
 6298|  25.1k|      joining_start == nullptr || joining_final == nullptr ||
  ------------------
  |  Branch (6298:7): [True: 0, False: 25.1k]
  |  Branch (6298:35): [True: 0, False: 25.1k]
  ------------------
 6299|  25.1k|      joining_value == nullptr) {
  ------------------
  |  Branch (6299:7): [True: 0, False: 25.1k]
  ------------------
 6300|      0|    return false;
 6301|      0|  }
 6302|       |
 6303|       |  ///////////////
 6304|       |  // We have a normalization step which ensures that we are in NFC.
 6305|       |  // If we receive punycode, we normalize and check that the normalized
 6306|       |  // version matches the original.
 6307|       |  // --------------------------------------
 6308|       |  // The label must be in Unicode Normalization Form NFC.
 6309|       |
 6310|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 6311|       |  // ---------------------------------------
 6312|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 6313|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 6314|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 6315|       |
 6316|       |  // This is not necessary because we segment the
 6317|       |  // labels by '.'.
 6318|       |  // ---------------------------------------
 6319|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 6320|       |  // if (label.find('.') != std::string_view::npos) return false;
 6321|       |
 6322|       |  // The label must not begin with a combining mark.
 6323|       |  // Range membership via lower_bound on range end.
 6324|  25.1k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 6325|  25.1k|                                               combining_range_count};
 6326|  25.1k|  const auto comb_it = std::ranges::lower_bound(
 6327|  25.1k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 6328|  25.1k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (6328:7): [True: 25.1k, False: 0]
  |  Branch (6328:7): [True: 108, False: 25.0k]
  |  Branch (6328:37): [True: 108, False: 25.0k]
  ------------------
 6329|    108|    return false;
 6330|    108|  }
 6331|       |  // We verify this next step as part of the mapping:
 6332|       |  // ---------------------------------------------
 6333|       |  // Each code point in the label must only have certain status values
 6334|       |  // according to Section 5, IDNA Mapping Table:
 6335|       |  // - For Transitional Processing, each value must be valid.
 6336|       |  // - For Nontransitional Processing, each value must be either valid or
 6337|       |  // deviation.
 6338|       |
 6339|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6340|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6341|       |  // Applications (IDNA) [IDNA2008].
 6342|  25.0k|  if (!is_contextj_valid(label)) {
  ------------------
  |  Branch (6342:7): [True: 200, False: 24.8k]
  ------------------
 6343|    200|    return false;
 6344|    200|  }
 6345|       |
 6346|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6347|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6348|       |  // Section 2.
 6349|       |
 6350|       |  // The following rule, consisting of six conditions, applies to labels
 6351|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6352|       |  // described in Section 3.  All of the conditions must be satisfied for
 6353|       |  // the rule to be satisfied.
 6354|       |  //
 6355|       |  //  1.  The first character must be a character with Bidi property L, R,
 6356|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6357|       |  //     has the L property, it is an LTR label.
 6358|       |  //
 6359|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6360|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6361|       |  //
 6362|       |  //   3.  In an RTL label, the end of the label must be a character with
 6363|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6364|       |  //       characters with Bidi property NSM.
 6365|       |  //
 6366|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6367|       |  //       vice versa.
 6368|       |  //
 6369|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6370|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6371|       |  //
 6372|       |  //   6.  In an LTR label, the end of the label must be a character with
 6373|       |  //       Bidi property L or EN, followed by zero or more characters with
 6374|       |  //       Bidi property NSM.
 6375|       |
 6376|  24.8k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6377|  24.8k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6377:7): [True: 0, False: 24.8k]
  ------------------
 6378|      0|    return false;
 6379|      0|  }
 6380|       |
 6381|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6382|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6383|       |  // domain names.
 6384|  24.8k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6384:7): [True: 2.82k, False: 21.9k]
  ------------------
 6385|       |    // The first character must be a character with Bidi property L, R,
 6386|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6387|       |    // has the L property, it is an LTR label.
 6388|       |
 6389|  2.82k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6389:9): [True: 184, False: 2.63k]
  ------------------
 6390|       |      // Eval as LTR
 6391|       |
 6392|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6393|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6394|  2.44k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6394:26): [True: 2.44k, False: 0]
  ------------------
 6395|  2.44k|        const direction d = find_direction(label[i]);
 6396|  2.44k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6396:15): [True: 672, False: 1.76k]
  |  Branch (6396:36): [True: 208, False: 1.56k]
  |  Branch (6396:58): [True: 196, False: 1.36k]
  ------------------
 6397|  1.36k|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6397:15): [True: 198, False: 1.16k]
  |  Branch (6397:37): [True: 202, False: 964]
  |  Branch (6397:59): [True: 212, False: 752]
  ------------------
 6398|    752|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6398:15): [True: 376, False: 376]
  |  Branch (6398:37): [True: 192, False: 184]
  ------------------
 6399|    184|          return false;
 6400|    184|        }
 6401|  2.44k|      }
 6402|       |
 6403|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6404|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6404:13): [True: 0, False: 0]
  |  Branch (6404:41): [True: 0, False: 0]
  ------------------
 6405|      0|        return false;
 6406|      0|      }
 6407|       |
 6408|      0|      return true;
 6409|       |
 6410|  2.63k|    } else {
 6411|       |      // Eval as RTL
 6412|       |
 6413|       |      // The first character must be R or AL; a leading AN (or any other
 6414|       |      // direction) does not start a valid RTL label.
 6415|  2.63k|      const direction first_dir = find_direction(label[0]);
 6416|  2.63k|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6416:11): [True: 1.85k, False: 786]
  |  Branch (6416:40): [True: 24, False: 1.82k]
  ------------------
 6417|     24|        return false;
 6418|     24|      }
 6419|       |
 6420|  2.61k|      bool has_an = false;
 6421|  2.61k|      bool has_en = false;
 6422|  10.1k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6422:26): [True: 7.69k, False: 2.41k]
  ------------------
 6423|  7.69k|        const direction d = find_direction(label[i]);
 6424|       |
 6425|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6426|       |        // versa.
 6427|  7.69k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6427:14): [True: 540, False: 7.15k]
  |  Branch (6427:37): [True: 540, False: 0]
  |  Branch (6427:56): [True: 6, False: 534]
  ------------------
 6428|  7.69k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6428:14): [True: 390, False: 7.30k]
  |  Branch (6428:37): [True: 390, False: 0]
  |  Branch (6428:56): [True: 6, False: 384]
  ------------------
 6429|     12|          return false;
 6430|     12|        }
 6431|       |
 6432|  7.68k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6432:15): [True: 1.26k, False: 6.41k]
  |  Branch (6432:36): [True: 3.43k, False: 2.98k]
  |  Branch (6432:58): [True: 384, False: 2.59k]
  ------------------
 6433|  2.59k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6433:15): [True: 534, False: 2.06k]
  |  Branch (6433:37): [True: 190, False: 1.87k]
  |  Branch (6433:59): [True: 246, False: 1.62k]
  ------------------
 6434|  1.62k|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6434:15): [True: 192, False: 1.43k]
  |  Branch (6434:37): [True: 244, False: 1.19k]
  |  Branch (6434:59): [True: 564, False: 628]
  ------------------
 6435|    628|              d == direction::NSM)) {
  ------------------
  |  Branch (6435:15): [True: 518, False: 110]
  ------------------
 6436|    110|          return false;
 6437|    110|        }
 6438|       |
 6439|  7.57k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6439:13): [True: 2.49k, False: 5.08k]
  ------------------
 6440|  2.49k|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6440:15): [True: 388, False: 2.10k]
  |  Branch (6440:36): [True: 1.61k, False: 484]
  |  Branch (6440:58): [True: 200, False: 284]
  ------------------
 6441|    284|              d == direction::EN)) {
  ------------------
  |  Branch (6441:15): [True: 212, False: 72]
  ------------------
 6442|     72|          return false;
 6443|     72|        }
 6444|  7.57k|      }
 6445|       |
 6446|  2.41k|      return true;
 6447|  2.61k|    }
 6448|  2.82k|  }
 6449|       |
 6450|  21.9k|  return true;
 6451|  24.8k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6610|   126k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6611|   126k|  out.clear();
 6612|       |  // The ASCII path is a single same-size copy, so it needs no length bound.
 6613|       |  // Checking first would reject the (longer) ASCII output of a non-ASCII input
 6614|       |  // that was accepted, breaking to_ascii(to_ascii(x)) == to_ascii(x).
 6615|   126k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6615:7): [True: 121k, False: 5.02k]
  ------------------
 6616|   121k|    from_ascii_to_ascii(ut8_string, out);
 6617|   121k|    return true;
 6618|   121k|  }
 6619|  5.02k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6619:7): [True: 0, False: 5.02k]
  ------------------
 6620|      0|    return false;
 6621|      0|  }
 6622|       |
 6623|       |#ifdef ADA_USE_SIMDUTF
 6624|       |  size_t utf32_length =
 6625|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6626|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6627|       |    return false;
 6628|       |  }
 6629|       |  std::u32string working(utf32_length, U'\0');
 6630|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6631|       |      ut8_string.data(), ut8_string.size(), working.data());
 6632|       |#else
 6633|  5.02k|  size_t utf32_length =
 6634|  5.02k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6635|  5.02k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6635:7): [True: 48, False: 4.97k]
  |  Branch (6635:28): [True: 48, False: 0]
  ------------------
 6636|     48|    return false;
 6637|     48|  }
 6638|  4.97k|  std::u32string working(utf32_length, U'\0');
 6639|  4.97k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6640|  4.97k|      ut8_string.data(), ut8_string.size(), working.data());
 6641|  4.97k|#endif
 6642|  4.97k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6642:7): [True: 434, False: 4.54k]
  |  Branch (6642:35): [True: 0, False: 4.54k]
  ------------------
 6643|    434|    return false;
 6644|    434|  }
 6645|  4.54k|  working.resize(actual_utf32_length);
 6646|       |
 6647|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6648|  4.54k|  std::u32string mapped;
 6649|  4.54k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6649:7): [True: 74, False: 4.47k]
  ------------------
 6650|     74|    return false;
 6651|     74|  }
 6652|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6653|  4.47k|  working.clear();
 6654|       |
 6655|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6656|  4.47k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6656:7): [True: 3.78k, False: 682]
  |  Branch (6656:28): [True: 678, False: 3.11k]
  ------------------
 6657|    678|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6657:9): [True: 0, False: 678]
  ------------------
 6658|      0|      return false;
 6659|      0|    }
 6660|    678|  }
 6661|       |
 6662|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6663|  4.47k|  out.reserve(mapped.size() + 8);
 6664|       |
 6665|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6666|  4.47k|  const char32_t* p = mapped.data();
 6667|  4.47k|  const char32_t* const end = p + mapped.size();
 6668|  4.47k|  std::u32string post_map;
 6669|       |
 6670|  32.9k|  while (p < end) {
  ------------------
  |  Branch (6670:10): [True: 30.0k, False: 2.91k]
  ------------------
 6671|  30.0k|    const char32_t* label_begin = p;
 6672|   300k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6672:12): [True: 296k, False: 3.80k]
  |  Branch (6672:23): [True: 270k, False: 26.2k]
  ------------------
 6673|   270k|      ++p;
 6674|   270k|    }
 6675|  30.0k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6676|  30.0k|    std::u32string_view label_view(label_begin, label_size);
 6677|  30.0k|    const bool is_last_label = (p == end);
 6678|  30.0k|    if (p < end) {
  ------------------
  |  Branch (6678:9): [True: 26.2k, False: 3.80k]
  ------------------
 6679|  26.2k|      ++p;  // skip dot
 6680|  26.2k|    }
 6681|       |
 6682|  30.0k|    if (label_size == 0) {
  ------------------
  |  Branch (6682:9): [True: 1.89k, False: 28.1k]
  ------------------
 6683|       |      // empty label
 6684|  28.1k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6684:16): [True: 2.83k, False: 25.3k]
  ------------------
 6685|  59.5k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6685:23): [True: 59.5k, False: 2.80k]
  ------------------
 6686|  59.5k|        if (c >= 0x80) {
  ------------------
  |  Branch (6686:13): [True: 32, False: 59.5k]
  ------------------
 6687|     32|          out.clear();
 6688|     32|          return false;
 6689|     32|        }
 6690|  59.5k|      }
 6691|  2.80k|      append_ascii_label(out, label_view);
 6692|  2.80k|      std::string_view puny_segment_ascii(
 6693|  2.80k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6694|  2.80k|      working.clear();
 6695|  2.80k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6695:11): [True: 142, False: 2.66k]
  ------------------
 6696|    142|        out.clear();
 6697|    142|        return false;
 6698|    142|      }
 6699|  2.66k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6699:11): [True: 90, False: 2.57k]
  ------------------
 6700|     90|        out.clear();
 6701|     90|        return false;
 6702|     90|      }
 6703|  2.57k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6703:11): [True: 260, False: 2.31k]
  |  Branch (6703:49): [True: 122, False: 2.19k]
  ------------------
 6704|    382|        out.clear();
 6705|    382|        return false;
 6706|    382|      }
 6707|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6708|  2.19k|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6708:11): [True: 2.19k, False: 0]
  |  Branch (6708:34): [True: 980, False: 1.21k]
  ------------------
 6709|    980|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6709:13): [True: 0, False: 980]
  |  Branch (6709:37): [True: 198, False: 782]
  ------------------
 6710|    198|          out.clear();
 6711|    198|          return false;
 6712|    198|        }
 6713|    980|      }
 6714|  1.99k|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6714:11): [True: 0, False: 1.99k]
  |  Branch (6714:31): [True: 50, False: 1.94k]
  ------------------
 6715|     50|        out.clear();
 6716|     50|        return false;
 6717|     50|      }
 6718|  25.3k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6718:16): [True: 2.23k, False: 23.1k]
  ------------------
 6719|  2.23k|      append_ascii_label(out, label_view);
 6720|  23.1k|    } else {
 6721|  23.1k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6721:11): [True: 660, False: 22.4k]
  ------------------
 6722|    660|        out.clear();
 6723|    660|        return false;
 6724|    660|      }
 6725|  22.4k|      out.append("xn--");
 6726|  22.4k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6726:11): [True: 0, False: 22.4k]
  ------------------
 6727|      0|        out.clear();
 6728|      0|        return false;
 6729|      0|      }
 6730|  22.4k|    }
 6731|  28.5k|    if (!is_last_label) {
  ------------------
  |  Branch (6731:9): [True: 25.8k, False: 2.68k]
  ------------------
 6732|  25.8k|      out.push_back('.');
 6733|  25.8k|    }
 6734|  28.5k|  }
 6735|  2.91k|  return true;
 6736|  4.47k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6738|   126k|std::string to_ascii(std::string_view ut8_string) {
 6739|   126k|  std::string out;
 6740|   126k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6740:7): [True: 2.11k, False: 124k]
  ------------------
 6741|  2.11k|    return {};
 6742|  2.11k|  }
 6743|   124k|  return out;
 6744|   126k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7618|  24.5k|                    std::string& out) {
 7619|  24.5k|  ada_log("percent_encode ", input, " to output string while ",
 7620|  24.5k|          append ? "appending" : "overwriting");
 7621|  24.5k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7622|  24.5k|    return character_sets::bit_at(character_set, c);
 7623|  24.5k|  });
 7624|  24.5k|  ada_log("percent_encode done checking, moved to ",
 7625|  24.5k|          std::distance(input.begin(), pointer));
 7626|       |
 7627|       |  // Optimization: Don't iterate if percent encode is not required
 7628|  24.5k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7628:7): [True: 23.9k, False: 633]
  ------------------
 7629|  23.9k|    ada_log("percent_encode encoding not needed.");
 7630|  23.9k|    return false;
 7631|  23.9k|  }
 7632|       |  if constexpr (!append) {
 7633|       |    out.clear();
 7634|       |  }
 7635|    633|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7636|    633|          " bytes");
 7637|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7638|    633|  out.append(input.data(), std::distance(input.begin(), pointer));
 7639|    633|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7640|    633|          " bytes");
 7641|  37.2k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7641:10): [True: 36.6k, False: 633]
  ------------------
 7642|  36.6k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7642:9): [True: 23.7k, False: 12.8k]
  ------------------
 7643|  23.7k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7644|  23.7k|    } else {
 7645|  12.8k|      out += *pointer;
 7646|  12.8k|    }
 7647|  36.6k|  }
 7648|    633|  return true;
 7649|  24.5k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7618|  28.5k|                    std::string& out) {
 7619|  28.5k|  ada_log("percent_encode ", input, " to output string while ",
 7620|  28.5k|          append ? "appending" : "overwriting");
 7621|  28.5k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7622|  28.5k|    return character_sets::bit_at(character_set, c);
 7623|  28.5k|  });
 7624|  28.5k|  ada_log("percent_encode done checking, moved to ",
 7625|  28.5k|          std::distance(input.begin(), pointer));
 7626|       |
 7627|       |  // Optimization: Don't iterate if percent encode is not required
 7628|  28.5k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7628:7): [True: 20.1k, False: 8.40k]
  ------------------
 7629|  20.1k|    ada_log("percent_encode encoding not needed.");
 7630|  20.1k|    return false;
 7631|  20.1k|  }
 7632|  8.40k|  if constexpr (!append) {
 7633|  8.40k|    out.clear();
 7634|  8.40k|  }
 7635|  8.40k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7636|  8.40k|          " bytes");
 7637|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7638|  8.40k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7639|  8.40k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7640|  8.40k|          " bytes");
 7641|  99.0k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7641:10): [True: 90.6k, False: 8.40k]
  ------------------
 7642|  90.6k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7642:9): [True: 76.1k, False: 14.4k]
  ------------------
 7643|  76.1k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7644|  76.1k|    } else {
 7645|  14.4k|      out += *pointer;
 7646|  14.4k|    }
 7647|  90.6k|  }
 7648|  8.40k|  return true;
 7649|  28.5k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7449|  39.4k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7450|       |  // next line is for safety only, we expect users to avoid calling
 7451|       |  // percent_decode when first_percent is outside the range.
 7452|  39.4k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7452:7): [True: 0, False: 39.4k]
  ------------------
 7453|      0|    return std::string(input);
 7454|      0|  }
 7455|       |
 7456|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7457|  39.4k|  const char* const src = input.data();
 7458|  39.4k|  const char* const end = src + input.size();
 7459|       |
 7460|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7461|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7462|       |  // byte-at-a-time appends of the naive version.
 7463|  39.4k|  std::string out(input.size(), '\0');
 7464|  39.4k|  char* d = out.data();
 7465|  39.4k|  char* const d0 = d;
 7466|       |
 7467|  39.4k|  std::memcpy(d, src, first_percent);
 7468|  39.4k|  d += first_percent;
 7469|       |
 7470|  39.4k|  const char* p = src + first_percent;
 7471|   123k|  while (p < end) {
  ------------------
  |  Branch (7471:10): [True: 84.4k, False: 39.4k]
  ------------------
 7472|  84.4k|    if (*p == '%') {
  ------------------
  |  Branch (7472:9): [True: 43.6k, False: 40.7k]
  ------------------
 7473|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7474|  85.6k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7474:14): [True: 84.4k, False: 1.26k]
  |  Branch (7474:29): [True: 45.3k, False: 39.0k]
  ------------------
 7475|  45.3k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7475:13): [True: 2.20k, False: 43.1k]
  |  Branch (7475:42): [True: 1.12k, False: 42.0k]
  ------------------
 7476|  3.32k|          break;
 7477|  3.32k|        }
 7478|  42.0k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7479|  42.0k|                                 convert_hex_to_binary(p[2]));
 7480|  42.0k|        p += 3;
 7481|  42.0k|      }
 7482|  43.6k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7482:11): [True: 42.8k, False: 776]
  |  Branch (7482:22): [True: 3.60k, False: 39.2k]
  ------------------
 7483|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7484|       |        // literally and keep scanning after it.
 7485|  3.60k|        *d++ = *p++;
 7486|  3.60k|      }
 7487|  43.6k|    } else {
 7488|  40.7k|      const char* q = static_cast<const char*>(
 7489|  40.7k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7490|  40.7k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7490:29): [True: 2.27k, False: 38.4k]
  ------------------
 7491|  40.7k|      const size_t n = static_cast<size_t>(run_end - p);
 7492|  40.7k|      std::memcpy(d, p, n);
 7493|  40.7k|      d += n;
 7494|  40.7k|      p = run_end;
 7495|  40.7k|    }
 7496|  84.4k|  }
 7497|       |
 7498|  39.4k|  out.resize(static_cast<size_t>(d - d0));
 7499|  39.4k|  return out;
 7500|  39.4k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7588|   192k|                           const uint8_t character_set[]) {
 7589|   192k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7590|   192k|    return character_sets::bit_at(character_set, c);
 7591|   192k|  });
 7592|       |  // Optimization: Don't iterate if percent encode is not required
 7593|   192k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7593:7): [True: 189k, False: 3.05k]
  ------------------
 7594|   189k|    return std::string(input);
 7595|   189k|  }
 7596|       |
 7597|  3.05k|  std::string result;
 7598|  3.05k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7599|       |                                   // produce 3 characters.
 7600|  3.05k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7601|  3.05k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7601:7): [True: 801, False: 2.25k]
  ------------------
 7602|    801|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7603|    801|                          result);
 7604|  2.25k|  } else {
 7605|  18.8k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7605:12): [True: 16.6k, False: 2.25k]
  ------------------
 7606|  16.6k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7606:11): [True: 11.3k, False: 5.31k]
  ------------------
 7607|  11.3k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7608|  11.3k|      } else {
 7609|  5.31k|        result += *pointer;
 7610|  5.31k|      }
 7611|  16.6k|    }
 7612|  2.25k|  }
 7613|  3.05k|  return result;
 7614|   192k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7659|   126k|              size_t first_percent) {
 7660|   126k|  std::string percent_decoded_buffer;
 7661|   126k|  std::string_view input = plain;
 7662|   126k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7662:7): [True: 654, False: 126k]
  ------------------
 7663|    654|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7664|    654|    input = percent_decoded_buffer;
 7665|    654|  }
 7666|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7667|   126k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7668|   126k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7668:7): [True: 2.13k, False: 124k]
  |  Branch (7668:29): [True: 764, False: 123k]
  ------------------
 7669|   124k|                                idna_ascii.data(), idna_ascii.size())) {
 7670|  2.89k|    return false;
 7671|  2.89k|  }
 7672|   123k|  out = std::move(idna_ascii);
 7673|   123k|  return true;
 7674|   126k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7677|     40|                           const uint8_t character_set[], size_t index) {
 7678|     40|  std::string out;
 7679|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7680|     40|  out.append(input.data(), index);
 7681|     40|  auto pointer = input.begin() + index;
 7682|     40|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7682:7): [True: 2, False: 38]
  ------------------
 7683|      2|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7684|      2|                          out);
 7685|     38|  } else {
 7686|    582|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7686:12): [True: 544, False: 38]
  ------------------
 7687|    544|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7687:11): [True: 160, False: 384]
  ------------------
 7688|    160|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7689|    384|      } else {
 7690|    384|        out += *pointer;
 7691|    384|      }
 7692|    544|    }
 7693|     38|  }
 7694|     40|  return out;
 7695|     40|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7993|    803|                           const uint8_t character_set[], std::string& out) {
 7994|    803|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7995|    803|#ifdef ADA_UNICODE_NEED_SSSE3_TARGET
 7996|    803|  static const bool ssse3_supported = __builtin_cpu_supports("ssse3") != 0;
 7997|    803|  const bool use_wide = ssse3_supported;
 7998|       |#else
 7999|       |  const bool use_wide = true;
 8000|       |#endif
 8001|    803|  if (use_wide && static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (8001:7): [True: 803, False: 0]
  |  Branch (8001:19): [True: 803, False: 0]
  ------------------
 8002|    803|    percent_encode_to_wide(p, end, character_set, out);
 8003|    803|    return;
 8004|    803|  }
 8005|      0|#endif
 8006|      0|  percent_encode_to_scalar(p, end, character_set, out);
 8007|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 8072|    882|    size_t& compress_length) noexcept {
 8073|    882|  compress = 0;
 8074|    882|  compress_length = 0;
 8075|    882|  size_t i = 0;
 8076|  3.34k|  while (i < 8) {
  ------------------
  |  Branch (8076:10): [True: 2.46k, False: 882]
  ------------------
 8077|  2.46k|    if (address[i] != 0) {
  ------------------
  |  Branch (8077:9): [True: 1.36k, False: 1.09k]
  ------------------
 8078|  1.36k|      ++i;
 8079|  1.36k|      continue;
 8080|  1.36k|    }
 8081|  1.09k|    size_t next = i + 1;
 8082|  5.69k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (8082:12): [True: 5.16k, False: 528]
  |  Branch (8082:24): [True: 4.59k, False: 570]
  ------------------
 8083|  4.59k|      ++next;
 8084|  4.59k|    }
 8085|  1.09k|    const size_t count = next - i;
 8086|  1.09k|    if (count > compress_length) {
  ------------------
  |  Branch (8086:9): [True: 954, False: 144]
  ------------------
 8087|    954|      compress_length = count;
 8088|    954|      compress = i;
 8089|    954|    }
 8090|  1.09k|    i = next;
 8091|  1.09k|  }
 8092|    882|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 8094|    882|std::string ipv6(const std::array<uint16_t, 8>& address) {
 8095|    882|  size_t compress = 0;
 8096|    882|  size_t compress_length = 0;
 8097|    882|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 8098|       |
 8099|       |  // Skip compression when the longest zero run is a single piece.
 8100|    882|  if (compress_length <= 1) {
  ------------------
  |  Branch (8100:7): [True: 38, False: 844]
  ------------------
 8101|     38|    compress = compress_length = 8;
 8102|     38|  }
 8103|       |
 8104|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 8105|    882|  std::string output(4 * 8 + 7 + 2, '\0');
 8106|    882|  char* point = output.data();
 8107|    882|  *point++ = '[';
 8108|    882|  size_t piece_index = 0;
 8109|  2.13k|  while (true) {
  ------------------
  |  Branch (8109:10): [True: 2.13k, Folded]
  ------------------
 8110|  2.13k|    if (piece_index == compress) {
  ------------------
  |  Branch (8110:9): [True: 844, False: 1.28k]
  ------------------
 8111|    844|      *point++ = ':';
 8112|       |      // If we skip a value initially, we need to write '::'.
 8113|    844|      if (piece_index == 0) {
  ------------------
  |  Branch (8113:11): [True: 550, False: 294]
  ------------------
 8114|    550|        *point++ = ':';
 8115|    550|      }
 8116|    844|      piece_index += compress_length;
 8117|    844|      if (piece_index == 8) {
  ------------------
  |  Branch (8117:11): [True: 466, False: 378]
  ------------------
 8118|    466|        break;
 8119|    466|      }
 8120|    844|    }
 8121|  1.66k|    point = write_hex_u16(point, address[piece_index]);
 8122|  1.66k|    ++piece_index;
 8123|  1.66k|    if (piece_index == 8) {
  ------------------
  |  Branch (8123:9): [True: 416, False: 1.25k]
  ------------------
 8124|    416|      break;
 8125|    416|    }
 8126|  1.25k|    *point++ = ':';
 8127|  1.25k|  }
 8128|    882|  *point++ = ']';
 8129|    882|  output.resize(static_cast<size_t>(point - output.data()));
 8130|    882|  return output;
 8131|    882|}
_ZN3ada11serializers4ipv4Em:
 8133|  40.6k|std::string ipv4(const uint64_t address) {
 8134|  40.6k|  std::string output(15, '\0');
 8135|  40.6k|  char* point = output.data();
 8136|  40.6k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 8137|  40.6k|  *point++ = '.';
 8138|  40.6k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 8139|  40.6k|  *point++ = '.';
 8140|  40.6k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 8141|  40.6k|  *point++ = '.';
 8142|  40.6k|  point = write_u8(point, static_cast<uint8_t>(address));
 8143|  40.6k|  output.resize(static_cast<size_t>(point - output.data()));
 8144|  40.6k|  return output;
 8145|  40.6k|}
_ZN3ada5parseINS_3urlEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8549|   618k|    std::string_view input, const result_type* base_url) {
 8550|   618k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8551|   618k|  if (!u.is_valid) {
  ------------------
  |  Branch (8551:7): [True: 21.6k, False: 596k]
  ------------------
 8552|  21.6k|    return tl::unexpected(errors::type_error);
 8553|  21.6k|  }
 8554|   596k|  return u;
 8555|   618k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8549|   618k|    std::string_view input, const result_type* base_url) {
 8550|   618k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8551|   618k|  if (!u.is_valid) {
  ------------------
  |  Branch (8551:7): [True: 21.6k, False: 596k]
  ------------------
 8552|  21.6k|    return tl::unexpected(errors::type_error);
 8553|  21.6k|  }
 8554|   596k|  return u;
 8555|   618k|}
_ZN3ada20get_max_input_lengthEv:
 8170|  1.63M|uint32_t get_max_input_length() {
 8171|  1.63M|  return max_input_length_.load(std::memory_order_relaxed);
 8172|  1.63M|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9539|   532k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9540|   533k|  while (!input.empty() &&
  ------------------
  |  Branch (9540:10): [True: 533k, False: 0]
  ------------------
 9541|   533k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9541:10): [True: 474, False: 532k]
  ------------------
 9542|    474|    input.remove_prefix(1);
 9543|    474|  }
 9544|   536k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9544:10): [True: 536k, False: 0]
  |  Branch (9544:28): [True: 3.63k, False: 532k]
  ------------------
 9545|  3.63k|    input.remove_suffix(1);
 9546|  3.63k|  }
 9547|   532k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9714|  18.7k|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9715|  18.7k|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9716|  18.7k|          input1.size(), " bytes] is part of string '", input2, "' [",
 9717|  18.7k|          input2.size(), " bytes]");
 9718|  18.7k|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9718:10): [True: 18.7k, False: 0]
  |  Branch (9718:29): [True: 18.7k, False: 0]
  |  Branch (9718:48): [True: 18.7k, False: 3]
  ------------------
 9719|  18.7k|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9719:10): [True: 0, False: 18.7k]
  ------------------
 9720|  18.7k|}
_ZN3ada3url17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10099|    621|bool url::parse_opaque_host(std::string_view input) {
10100|    621|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
10101|    621|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (10101:7): [True: 38, False: 583]
  ------------------
10102|     38|    return is_valid = false;
10103|     38|  }
10104|       |
10105|       |  // Return the result of running UTF-8 percent-encode on input using the C0
10106|       |  // control percent-encode set.
10107|    583|  host = ada::unicode::percent_encode(
10108|    583|      input, ada::character_sets::C0_CONTROL_PERCENT_ENCODE);
10109|    583|  return true;
10110|    621|}
_ZN3ada3url10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10112|  58.1k|bool url::parse_ipv4(std::string_view input) {
10113|  58.1k|  ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
10114|  58.1k|  if (input.empty()) {
  ------------------
  |  Branch (10114:7): [True: 0, False: 58.1k]
  ------------------
10115|      0|    return is_valid = false;
10116|      0|  }
10117|  58.1k|  std::string_view original_input = input;
10118|  58.1k|  if (original_input.back() == '.') {
  ------------------
  |  Branch (10118:7): [True: 28.1k, False: 30.0k]
  ------------------
10119|  28.1k|    original_input.remove_suffix(1);
10120|  28.1k|  }
10121|  58.1k|  if (input.back() == '.') {
  ------------------
  |  Branch (10121:7): [True: 28.1k, False: 30.0k]
  ------------------
10122|  28.1k|    input.remove_suffix(1);
10123|  28.1k|    if (input.empty()) {
  ------------------
  |  Branch (10123:9): [True: 0, False: 28.1k]
  ------------------
10124|      0|      return is_valid = false;
10125|      0|    }
10126|  28.1k|  }
10127|       |
10128|  58.1k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
10129|  58.1k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (10129:7): [True: 18.7k, False: 39.4k]
  ------------------
10130|  18.7k|    host = original_input;
10131|  18.7k|    host_type = IPV4;
10132|  18.7k|    return true;
10133|  18.7k|  }
10134|       |
10135|  39.4k|  const char* p = input.data();
10136|  39.4k|  const char* end = p + input.size();
10137|  39.4k|  uint64_t ipv4 = 0;
10138|  39.4k|  int digit_count = 0;
10139|  39.4k|  int pure_decimal_count = 0;
10140|       |
10141|  49.6k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (10141:10): [True: 49.6k, False: 15]
  |  Branch (10141:29): [True: 49.6k, False: 0]
  ------------------
10142|  49.6k|    uint64_t segment = 0;
10143|  49.6k|    bool pure = false;
10144|  49.6k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (10144:9): [True: 19.0k, False: 30.5k]
  ------------------
10145|  19.0k|      return is_valid = false;
10146|  19.0k|    }
10147|  30.5k|    if (pure) {
  ------------------
  |  Branch (10147:9): [True: 11.3k, False: 19.2k]
  ------------------
10148|  11.3k|      ++pure_decimal_count;
10149|  11.3k|    }
10150|  30.5k|    if (p >= end) {
  ------------------
  |  Branch (10150:9): [True: 20.3k, False: 10.2k]
  ------------------
10151|  20.3k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
10152|  20.3k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (10152:11): [True: 22, False: 20.3k]
  ------------------
10153|     22|        return is_valid = false;
10154|     22|      }
10155|  20.3k|      ipv4 = (ipv4 << shift) | segment;
10156|  20.3k|      host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (10156:14): [True: 0, False: 20.3k]
  ------------------
10157|  20.3k|                                       : ada::serializers::ipv4(ipv4);
10158|  20.3k|      host_type = IPV4;
10159|  20.3k|      return true;
10160|  20.3k|    }
10161|  10.2k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (10161:9): [True: 30, False: 10.1k]
  |  Branch (10161:26): [True: 0, False: 10.1k]
  ------------------
10162|     30|      return is_valid = false;
10163|     30|    }
10164|  10.1k|    ipv4 = (ipv4 << 8) | segment;
10165|  10.1k|    ++p;
10166|  10.1k|  }
10167|     15|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (10167:7): [True: 0, False: 15]
  |  Branch (10167:27): [True: 15, False: 0]
  ------------------
10168|     15|    return is_valid = false;
10169|     15|  }
10170|      0|  host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (10170:10): [True: 0, False: 0]
  ------------------
10171|      0|                                   : ada::serializers::ipv4(ipv4);
10172|      0|  host_type = IPV4;
10173|      0|  return true;
10174|     15|}
_ZN3ada3url10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10176|    598|bool url::parse_ipv6(std::string_view input) {
10177|    598|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
10178|    598|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (10178:7): [True: 22, False: 576]
  |  Branch (10178:24): [True: 9, False: 567]
  ------------------
10179|     31|    return is_valid = false;
10180|     31|  }
10181|    567|  std::array<uint16_t, 8> address{};
10182|       |#if defined(ADA_AVX512_IPV6)
10183|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
10184|       |                                                     address, simd_valid)) {
10185|       |    if (!simd_valid) [[unlikely]] {
10186|       |      return is_valid = false;
10187|       |    }
10188|       |    host = ada::serializers::ipv6(address);
10189|       |    host_type = IPV6;
10190|       |    return true;
10191|       |  }
10192|       |  address = {};
10193|       |#endif
10194|    567|  const char* pointer = input.data();
10195|    567|  const char* const end = pointer + input.size();
10196|    567|  int piece_index = 0;
10197|    567|  int compress = -1;
10198|       |
10199|    567|  if (*pointer == ':') {
  ------------------
  |  Branch (10199:7): [True: 284, False: 283]
  ------------------
10200|    284|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (10200:9): [True: 3, False: 281]
  |  Branch (10200:30): [True: 3, False: 278]
  ------------------
10201|      6|      return is_valid = false;
10202|      6|    }
10203|    278|    pointer += 2;
10204|    278|    compress = ++piece_index;
10205|    278|  }
10206|       |
10207|  1.61k|  while (pointer != end) {
  ------------------
  |  Branch (10207:10): [True: 1.16k, False: 454]
  ------------------
10208|  1.16k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (10208:9): [True: 3, False: 1.16k]
  ------------------
10209|      3|      return is_valid = false;
10210|      3|    }
10211|  1.16k|    if (*pointer == ':') {
  ------------------
  |  Branch (10211:9): [True: 162, False: 998]
  ------------------
10212|    162|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (10212:11): [True: 3, False: 159]
  ------------------
10213|      3|        return is_valid = false;
10214|      3|      }
10215|    159|      ++pointer;
10216|    159|      compress = ++piece_index;
10217|    159|      continue;
10218|    162|    }
10219|       |
10220|    998|    uint16_t value = 0;
10221|    998|    const int length = detail::parse_hex_piece(pointer, end, value);
10222|       |
10223|    998|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (10223:9): [True: 770, False: 228]
  |  Branch (10223:27): [True: 81, False: 689]
  ------------------
10224|     81|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (10224:11): [True: 5, False: 76]
  ------------------
10225|      5|        return is_valid = false;
10226|      5|      }
10227|     76|      pointer -= length;
10228|     76|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (10228:11): [True: 3, False: 73]
  ------------------
10229|      3|        return is_valid = false;
10230|      3|      }
10231|       |
10232|     73|      int numbers_seen = 0;
10233|    220|      while (pointer != end) {
  ------------------
  |  Branch (10233:14): [True: 198, False: 22]
  ------------------
10234|    198|        int ipv4_piece = -1;
10235|    198|        if (numbers_seen > 0) {
  ------------------
  |  Branch (10235:13): [True: 125, False: 73]
  ------------------
10236|    125|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (10236:15): [True: 107, False: 18]
  |  Branch (10236:34): [True: 101, False: 6]
  ------------------
10237|    101|            ++pointer;
10238|    101|          } else {
10239|     24|            return is_valid = false;
10240|     24|          }
10241|    125|        }
10242|    174|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (10242:13): [True: 12, False: 162]
  |  Branch (10242:31): [True: 3, False: 159]
  |  Branch (10242:49): [True: 3, False: 156]
  ------------------
10243|     18|          return is_valid = false;
10244|     18|        }
10245|    156|        ipv4_piece = *pointer - '0';
10246|    156|        ++pointer;
10247|    156|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (10247:13): [True: 143, False: 13]
  |  Branch (10247:31): [True: 67, False: 76]
  |  Branch (10247:50): [True: 64, False: 3]
  ------------------
10248|     64|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (10248:15): [True: 3, False: 61]
  ------------------
10249|      3|            return is_valid = false;
10250|      3|          }
10251|     61|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
10252|     61|          ++pointer;
10253|     61|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (10253:15): [True: 58, False: 3]
  |  Branch (10253:33): [True: 34, False: 24]
  |  Branch (10253:52): [True: 31, False: 3]
  ------------------
10254|     31|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
10255|     31|            ++pointer;
10256|     31|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (10256:17): [True: 6, False: 25]
  ------------------
10257|      6|              return is_valid = false;
10258|      6|            }
10259|     31|          }
10260|     61|        }
10261|    147|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
10262|    147|            address[static_cast<size_t>(piece_index)] * 0x100 +
10263|    147|            static_cast<uint16_t>(ipv4_piece));
10264|    147|        ++numbers_seen;
10265|    147|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (10265:13): [True: 47, False: 100]
  |  Branch (10265:34): [True: 15, False: 85]
  ------------------
10266|     62|          ++piece_index;
10267|     62|        }
10268|    147|      }
10269|     22|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (10269:11): [True: 13, False: 9]
  ------------------
10270|     13|        return is_valid = false;
10271|     13|      }
10272|      9|      break;
10273|     22|    }
10274|       |
10275|    917|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (10275:9): [True: 13, False: 904]
  ------------------
10276|     13|      return is_valid = false;
10277|     13|    }
10278|       |
10279|    904|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (10279:9): [True: 676, False: 228]
  |  Branch (10279:27): [True: 672, False: 4]
  ------------------
10280|    672|      ++pointer;
10281|    672|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (10281:11): [True: 3, False: 669]
  ------------------
10282|      3|        return is_valid = false;
10283|      3|      }
10284|    672|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (10284:16): [True: 4, False: 228]
  ------------------
10285|      4|      return is_valid = false;
10286|      4|    }
10287|       |
10288|    897|    address[static_cast<size_t>(piece_index)] = value;
10289|    897|    ++piece_index;
10290|    897|  }
10291|       |
10292|    463|  if (compress != -1) {
  ------------------
  |  Branch (10292:7): [True: 427, False: 36]
  ------------------
10293|    427|    const int right = piece_index - compress;
10294|    427|    if (right > 0) {
  ------------------
  |  Branch (10294:9): [True: 201, False: 226]
  ------------------
10295|    201|      const size_t dest = static_cast<size_t>(8 - right);
10296|    201|      const size_t src = static_cast<size_t>(compress);
10297|    201|      if (dest != src) {
  ------------------
  |  Branch (10297:11): [True: 193, False: 8]
  ------------------
10298|    537|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (10298:53): [True: 344, False: 193]
  ------------------
10299|    344|          address[dest + i] = address[src + i];
10300|    344|          address[src + i] = 0;
10301|    344|        }
10302|    193|      }
10303|    201|    }
10304|    427|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (10304:14): [True: 22, False: 14]
  ------------------
10305|     22|    return is_valid = false;
10306|     22|  }
10307|       |
10308|    441|  host = ada::serializers::ipv6(address);
10309|    441|  ada_log("parse_ipv6 ", *host);
10310|    441|  host_type = IPV6;
10311|    441|  return true;
10312|    463|}
_ZNK3ada3url12get_protocolEv:
10641|   198k|[[nodiscard]] std::string url::get_protocol() const {
10642|   198k|  if (is_special()) {
  ------------------
  |  Branch (10642:7): [True: 198k, False: 580]
  ------------------
10643|   198k|    return helpers::concat(ada::scheme::details::is_special_list[type], ":");
10644|   198k|  }
10645|       |  // We only move the 'scheme' if it is non-special.
10646|    580|  return helpers::concat(non_special_scheme, ":");
10647|   198k|}
_ZNK3ada3url8get_hostEv:
10649|   198k|[[nodiscard]] std::string url::get_host() const {
10650|       |  // If url's host is null, then return the empty string.
10651|       |  // If url's port is null, return url's host, serialized.
10652|       |  // Return url's host, serialized, followed by U+003A (:) and url's port,
10653|       |  // serialized.
10654|   198k|  if (!host.has_value()) {
  ------------------
  |  Branch (10654:7): [True: 357, False: 198k]
  ------------------
10655|    357|    return "";
10656|    357|  }
10657|   198k|  if (port.has_value()) {
  ------------------
  |  Branch (10657:7): [True: 20.7k, False: 177k]
  ------------------
10658|  20.7k|    return host.value() + ":" + get_port();
10659|  20.7k|  }
10660|   177k|  return host.value();
10661|   198k|}
_ZNK3ada3url12get_hostnameEv:
10663|   198k|[[nodiscard]] std::string url::get_hostname() const {
10664|   198k|  return host.value_or("");
10665|   198k|}
_ZNK3ada3url10get_searchEv:
10667|   198k|[[nodiscard]] std::string url::get_search() const {
10668|       |  // If this's URL's query is either null or the empty string, then return the
10669|       |  // empty string. Return U+003F (?), followed by this's URL's query.
10670|   198k|  return (!query.has_value() || (query->empty())) ? "" : "?" + query.value();
  ------------------
  |  Branch (10670:11): [True: 165k, False: 33.8k]
  |  Branch (10670:33): [True: 1.15k, False: 32.6k]
  ------------------
10671|   198k|}
_ZNK3ada3url12get_usernameEv:
10673|   198k|[[nodiscard]] const std::string& url::get_username() const noexcept {
10674|   198k|  return username;
10675|   198k|}
_ZNK3ada3url12get_passwordEv:
10677|   198k|[[nodiscard]] const std::string& url::get_password() const noexcept {
10678|   198k|  return password;
10679|   198k|}
_ZNK3ada3url8get_portEv:
10681|   219k|[[nodiscard]] std::string url::get_port() const {
10682|   219k|  return port.has_value() ? std::to_string(port.value()) : "";
  ------------------
  |  Branch (10682:10): [True: 41.5k, False: 178k]
  ------------------
10683|   219k|}
_ZNK3ada3url8get_hashEv:
10685|   198k|[[nodiscard]] std::string url::get_hash() const {
10686|       |  // If this's URL's fragment is either null or the empty string, then return
10687|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
10688|   198k|  return (!hash.has_value() || (hash->empty())) ? "" : "#" + hash.value();
  ------------------
  |  Branch (10688:11): [True: 174k, False: 24.4k]
  |  Branch (10688:32): [True: 1.51k, False: 22.8k]
  ------------------
10689|   198k|}
_ZN3ada3url8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10979|   198k|bool url::set_href(const std::string_view input) {
10980|   198k|  ada::result<ada::url> out = ada::parse<ada::url>(input);
10981|       |
10982|   198k|  if (out) {
  ------------------
  |  Branch (10982:7): [True: 198k, False: 0]
  ------------------
10983|       |    // The parser enforces get_max_input_length() on both the input and the
10984|       |    // normalized result. This is a defense-in-depth check.
10985|   198k|    if (out->get_href_size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (10985:9): [True: 0, False: 198k]
  ------------------
10986|      0|      return false;
10987|      0|    }
10988|   198k|    *this = std::move(*out);
10989|   198k|  }
10990|       |
10991|   198k|  return out.has_value();
10992|   198k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12269|   440k|                                                result_type& out) {
12270|   440k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12271|   440k|  constexpr bool is_aggregator =
12272|   440k|      std::is_same_v<result_type, ada::url_aggregator>;
12273|   440k|  static_assert(is_ada_url || is_aggregator);
12274|       |
12275|   440k|  const size_t len = input.size();
12276|       |  // Shortest accepted form is "ws://x" (6).
12277|   440k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12277:7): [True: 9, False: 440k]
  ------------------
12278|      9|    return false;
12279|      9|  }
12280|   440k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12281|       |
12282|   440k|  size_t pos = 0;
12283|   440k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12284|   440k|  uint32_t protocol_end = 0;
12285|   440k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12286|   440k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12287|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12288|       |  // Masked compares cover the shorter special schemes without extra loads.
12289|   440k|  if (len >= 8) {
  ------------------
  |  Branch (12289:7): [True: 440k, False: 207]
  ------------------
12290|   440k|    uint64_t first8 = 0;
12291|   440k|    std::memcpy(&first8, b, 8);
12292|   440k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12292:9): [True: 346k, False: 94.1k]
  ------------------
12293|   346k|      pos = 8;
12294|   346k|      scheme_type = ada::scheme::type::HTTPS;
12295|   346k|      protocol_end = 6;
12296|   346k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12296:16): [True: 87.8k, False: 6.33k]
  ------------------
12297|  94.1k|               0x002f2f3a70747468ull) {  // "http://"
12298|  87.8k|      pos = 7;
12299|  87.8k|      scheme_type = ada::scheme::type::HTTP;
12300|  87.8k|      protocol_end = 5;
12301|  87.8k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12301:16): [True: 8, False: 6.32k]
  ------------------
12302|  6.33k|               0x00002f2f3a737377ull) {  // "wss://"
12303|      8|      pos = 6;
12304|      8|      scheme_type = ada::scheme::type::WSS;
12305|      8|      protocol_end = 4;
12306|  6.32k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12306:16): [True: 68, False: 6.25k]
  ------------------
12307|  6.32k|               0x00002f2f3a707466ull) {  // "ftp://"
12308|     68|      pos = 6;
12309|     68|      scheme_type = ada::scheme::type::FTP;
12310|     68|      protocol_end = 4;
12311|  6.25k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12311:16): [True: 227, False: 6.02k]
  ------------------
12312|  6.25k|               0x0000002f2f3a7377ull) {  // "ws://"
12313|    227|      pos = 5;
12314|    227|      scheme_type = ada::scheme::type::WS;
12315|    227|      protocol_end = 3;
12316|  6.02k|    } else {
12317|  6.02k|      return false;
12318|  6.02k|    }
12319|   440k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12319:14): [True: 43, False: 164]
  |  Branch (12319:29): [True: 25, False: 18]
  ------------------
12320|     25|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12320:9): [True: 3, False: 22]
  |  Branch (12320:24): [True: 2, False: 1]
  |  Branch (12320:39): [True: 2, False: 0]
  ------------------
12321|      2|      pos = 5;
12322|      2|      scheme_type = ada::scheme::type::WS;
12323|      2|      protocol_end = 3;
12324|     23|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12324:16): [True: 5, False: 18]
  |  Branch (12324:31): [True: 0, False: 5]
  |  Branch (12324:46): [True: 0, False: 0]
  |  Branch (12324:61): [True: 0, False: 0]
  ------------------
12325|      0|      pos = 6;
12326|      0|      scheme_type = ada::scheme::type::WSS;
12327|      0|      protocol_end = 4;
12328|     23|    } else {
12329|     23|      return false;
12330|     23|    }
12331|    182|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12331:14): [True: 28, False: 154]
  |  Branch (12331:29): [True: 18, False: 10]
  |  Branch (12331:44): [True: 5, False: 13]
  |  Branch (12331:59): [True: 0, False: 5]
  ------------------
12332|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12332:14): [True: 0, False: 0]
  |  Branch (12332:29): [True: 0, False: 0]
  ------------------
12333|      0|    pos = 6;
12334|      0|    scheme_type = ada::scheme::type::FTP;
12335|      0|    protocol_end = 4;
12336|    182|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12336:14): [True: 151, False: 31]
  |  Branch (12336:26): [True: 91, False: 60]
  |  Branch (12336:41): [True: 67, False: 24]
  |  Branch (12336:56): [True: 52, False: 15]
  ------------------
12337|     52|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12337:14): [True: 42, False: 10]
  |  Branch (12337:29): [True: 24, False: 18]
  |  Branch (12337:44): [True: 12, False: 12]
  |  Branch (12337:59): [True: 5, False: 7]
  ------------------
12338|      5|    pos = 7;
12339|      5|    scheme_type = ada::scheme::type::HTTP;
12340|      5|    protocol_end = 5;
12341|    177|  } else {
12342|    177|    return false;
12343|    177|  }
12344|       |#else
12345|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12346|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12347|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12348|       |    pos = 8;
12349|       |    scheme_type = ada::scheme::type::HTTPS;
12350|       |    protocol_end = 6;
12351|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12352|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12353|       |    pos = 7;
12354|       |    scheme_type = ada::scheme::type::HTTP;
12355|       |    protocol_end = 5;
12356|       |  } else if (b[0] == 'w' && b[1] == 's') {
12357|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12358|       |      pos = 5;
12359|       |      scheme_type = ada::scheme::type::WS;
12360|       |      protocol_end = 3;
12361|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12362|       |               b[5] == '/') {
12363|       |      pos = 6;
12364|       |      scheme_type = ada::scheme::type::WSS;
12365|       |      protocol_end = 4;
12366|       |    } else {
12367|       |      return false;
12368|       |    }
12369|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12370|       |             b[4] == '/' && b[5] == '/') {
12371|       |    pos = 6;
12372|       |    scheme_type = ada::scheme::type::FTP;
12373|       |    protocol_end = 4;
12374|       |  } else {
12375|       |    return false;
12376|       |  }
12377|       |#endif
12378|   434k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12378:7): [True: 434k, False: 5]
  |  Branch (12378:21): [True: 101, False: 434k]
  |  Branch (12378:38): [True: 21, False: 434k]
  ------------------
12379|    122|    return false;
12380|    122|  }
12381|       |
12382|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12383|   434k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12383:7): [True: 434k, False: 5]
  |  Branch (12383:22): [True: 431k, False: 2.22k]
  |  Branch (12383:39): [True: 34, False: 431k]
  |  Branch (12383:57): [True: 6, False: 434k]
  ------------------
12384|     40|    return false;
12385|     40|  }
12386|       |
12387|   434k|  const size_t host_start = pos;
12388|   434k|  bool has_upper = false;
12389|   434k|  bool has_x = false;
12390|   434k|  size_t host_end = pos;
12391|   434k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12391:7): [True: 2.75k, False: 431k]
  ------------------
12392|  2.75k|    return false;
12393|  2.75k|  }
12394|   431k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12394:7): [True: 92, False: 431k]
  ------------------
12395|     92|    return false;
12396|     92|  }
12397|   431k|  const size_t host_len = host_end - host_start;
12398|   431k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12398:7): [True: 293, False: 431k]
  ------------------
12399|    293|    return false;
12400|    293|  }
12401|   431k|  {
12402|   431k|    std::string_view hv(input.data() + host_start, host_len);
12403|   431k|    char host_buf[256];
12404|   431k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12404:9): [True: 10.0k, False: 420k]
  ------------------
12405|  10.0k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12406|  10.0k|      unicode::to_lower_ascii(host_buf, host_len);
12407|  10.0k|      hv = std::string_view(host_buf, host_len);
12408|  10.0k|    }
12409|   431k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12409:9): [True: 18.9k, False: 412k]
  ------------------
12410|  18.9k|      return false;
12411|  18.9k|    }
12412|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12413|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12414|   412k|    static constexpr std::string_view xn{"xn-", 3};
12415|   412k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12415:10): [True: 375k, False: 36.1k]
  |  Branch (12415:19): [True: 481, False: 35.6k]
  |  Branch (12415:33): [True: 59.5k, False: 316k]
  ------------------
12416|  59.5k|        [[unlikely]] {
12417|  59.5k|      return false;
12418|  59.5k|    }
12419|   412k|  }
12420|       |
12421|   352k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12421:7): [True: 343k, False: 9.55k]
  |  Branch (12421:25): [True: 61.3k, False: 281k]
  ------------------
12422|  61.3k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12423|  61.3k|                                            protocol_end, host_start, host_end,
12424|  61.3k|                                            host_len, has_upper);
12425|  61.3k|  }
12426|       |
12427|   291k|  size_t i = host_end;
12428|   291k|  size_t path_start = host_end;
12429|   291k|  size_t path_end = host_end;
12430|   291k|  size_t query_start = std::string_view::npos;
12431|   291k|  size_t hash_start = std::string_view::npos;
12432|   291k|  bool has_path = false;
12433|   291k|  bool maybe_dot_segment = false;
12434|   291k|  bool rest_simple = true;
12435|       |
12436|   291k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12436:7): [True: 281k, False: 9.55k]
  |  Branch (12436:18): [True: 262k, False: 19.1k]
  ------------------
12437|   262k|    has_path = true;
12438|   262k|    path_start = i;
12439|   262k|    ++i;
12440|   262k|    scan_path_run(b, i, len, maybe_dot_segment);
12441|   262k|    if (i < len) {
  ------------------
  |  Branch (12441:9): [True: 110k, False: 152k]
  ------------------
12442|   110k|      const uint8_t cls = k_path[b[i]];
12443|   110k|      if (cls == 1) {
  ------------------
  |  Branch (12443:11): [True: 97.9k, False: 12.1k]
  ------------------
12444|  97.9k|        path_end = i;
12445|  97.9k|        if (b[i] == '?') {
  ------------------
  |  Branch (12445:13): [True: 78.2k, False: 19.6k]
  ------------------
12446|  78.2k|          query_start = i;
12447|  78.2k|          ++i;
12448|  78.2k|          goto scan_query;
12449|  78.2k|        }
12450|  19.6k|        hash_start = i;
12451|  19.6k|        ++i;
12452|  19.6k|        goto scan_hash;
12453|  97.9k|      }
12454|  12.1k|      rest_simple = false;
12455|   254k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12455:14): [True: 243k, False: 10.8k]
  ------------------
12456|   243k|        if (b[i] == '?') {
  ------------------
  |  Branch (12456:13): [True: 1.06k, False: 242k]
  ------------------
12457|  1.06k|          path_end = i;
12458|  1.06k|          query_start = i;
12459|  1.06k|          ++i;
12460|  1.06k|          goto scan_query_boundary;
12461|  1.06k|        }
12462|   242k|        if (b[i] == '#') {
  ------------------
  |  Branch (12462:13): [True: 262, False: 242k]
  ------------------
12463|    262|          path_end = i;
12464|    262|          hash_start = i;
12465|    262|          ++i;
12466|    262|          goto after_rest;
12467|    262|        }
12468|   242k|      }
12469|  10.8k|      path_end = i;
12470|  10.8k|      goto after_rest;
12471|  12.1k|    }
12472|   152k|    path_end = i;
12473|   152k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12473:14): [True: 19.1k, False: 9.55k]
  |  Branch (12473:25): [True: 9.64k, False: 9.51k]
  ------------------
12474|  9.64k|    query_start = i;
12475|  9.64k|    ++i;
12476|  9.64k|    goto scan_query;
12477|  19.0k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12477:14): [True: 9.51k, False: 9.55k]
  |  Branch (12477:25): [True: 9.51k, False: 0]
  ------------------
12478|  9.51k|    hash_start = i;
12479|  9.51k|    ++i;
12480|  9.51k|    goto scan_hash;
12481|  9.51k|  }
12482|   161k|  goto after_rest;
12483|       |
12484|   161k|scan_query:
12485|  87.9k|  scan_query_run(b, i, len);
12486|  87.9k|  if (i < len) {
  ------------------
  |  Branch (12486:7): [True: 30.6k, False: 57.2k]
  ------------------
12487|  30.6k|    if (b[i] == '#') {
  ------------------
  |  Branch (12487:9): [True: 30.5k, False: 135]
  ------------------
12488|  30.5k|      hash_start = i;
12489|  30.5k|      ++i;
12490|  30.5k|      goto scan_hash;
12491|  30.5k|    }
12492|    135|    rest_simple = false;
12493|    135|    goto scan_query_boundary;
12494|  30.6k|  }
12495|  57.2k|  goto after_rest;
12496|       |
12497|  57.2k|scan_query_boundary:
12498|  24.4k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12498:10): [True: 23.9k, False: 469]
  ------------------
12499|  23.9k|    if (b[i] == '#') {
  ------------------
  |  Branch (12499:9): [True: 730, False: 23.2k]
  ------------------
12500|    730|      hash_start = i;
12501|    730|      ++i;
12502|    730|      goto after_rest;
12503|    730|    }
12504|  23.9k|  }
12505|    469|  goto after_rest;
12506|       |
12507|  59.7k|scan_hash:
12508|  59.7k|  scan_hash_run(b, i, len);
12509|  59.7k|  if (i < len) {
  ------------------
  |  Branch (12509:7): [True: 115, False: 59.5k]
  ------------------
12510|    115|    rest_simple = false;
12511|    115|  }
12512|       |
12513|   291k|after_rest:
12514|   291k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12514:7): [True: 278k, False: 12.4k]
  |  Branch (12514:22): [True: 10.1k, False: 268k]
  ------------------
12515|  10.1k|    const std::string_view path_body(input.data() + path_start,
12516|  10.1k|                                     path_end - path_start);
12517|  10.1k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12517:9): [True: 9.75k, False: 373]
  ------------------
12518|  9.75k|      rest_simple = false;
12519|  9.75k|    }
12520|  10.1k|  }
12521|       |
12522|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12523|       |  // trailing C0 control or space; this fast path does neither. A query or
12524|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12525|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12526|       |  // inputs back to the slow path.
12527|   291k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12527:7): [True: 22.1k, False: 269k]
  |  Branch (12527:24): [True: 34, False: 22.1k]
  ------------------
12528|  22.1k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12528:24): [True: 66, False: 22.0k]
  ------------------
12529|    100|    return false;
12530|    100|  }
12531|       |
12532|   291k|  out.type = scheme_type;
12533|   291k|  out.is_valid = true;
12534|   291k|  out.has_opaque_path = false;
12535|   291k|  out.host_type = DEFAULT;
12536|       |
12537|   291k|  if (!rest_simple) {
  ------------------
  |  Branch (12537:7): [True: 22.0k, False: 269k]
  ------------------
12538|       |    // Host is a plain domain. Finish path/query/hash with
12539|       |    // the regular helpers
12540|       |    // so percent-encoding and dot segments do not re-parse the authority.
12541|  22.0k|    const std::string_view path_view =
12542|  22.0k|        has_path
  ------------------
  |  Branch (12542:9): [True: 21.9k, False: 159]
  ------------------
12543|  22.0k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12544|  22.0k|            : std::string_view{};
12545|  22.0k|    auto apply_query_and_hash = [&]() {
12546|  22.0k|      if (query_start != std::string_view::npos) {
12547|  22.0k|        const size_t q_end =
12548|  22.0k|            (hash_start != std::string_view::npos) ? hash_start : len;
12549|  22.0k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12550|  22.0k|                                                q_end - query_start - 1),
12551|  22.0k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12552|  22.0k|      }
12553|  22.0k|      if (hash_start != std::string_view::npos) {
12554|  22.0k|        out.update_unencoded_base_hash(std::string_view(
12555|  22.0k|            input.data() + hash_start + 1, len - hash_start - 1));
12556|  22.0k|      }
12557|  22.0k|    };
12558|       |    if constexpr (is_aggregator) {
12559|       |      out.buffer.assign(input.substr(0, host_end));
12560|       |      if (has_upper) {
12561|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12562|       |      }
12563|       |      out.components.protocol_end = protocol_end;
12564|       |      out.components.username_end = protocol_end + 2;
12565|       |      out.components.host_start = protocol_end + 2;
12566|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12567|       |      out.components.port = url_components::omitted;
12568|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12569|       |      out.components.search_start = url_components::omitted;
12570|       |      out.components.hash_start = url_components::omitted;
12571|       |      out.parse_path(path_view);
12572|       |      apply_query_and_hash();
12573|  22.0k|    } else {
12574|  22.0k|      std::string host_str(input.substr(host_start, host_len));
12575|  22.0k|      if (has_upper) {
  ------------------
  |  Branch (12575:11): [True: 143, False: 21.9k]
  ------------------
12576|    143|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12577|    143|      }
12578|  22.0k|      out.host = std::move(host_str);
12579|  22.0k|      out.parse_path(path_view);
12580|  22.0k|      apply_query_and_hash();
12581|  22.0k|    }
12582|  22.0k|    return true;
12583|  22.0k|  }
12584|       |
12585|   269k|  const bool need_slash = !has_path;
12586|       |  if constexpr (is_aggregator) {
12587|       |    if (!need_slash) {
12588|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12589|       |      out.buffer.assign(input);
12590|       |      if (has_upper) {
12591|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12592|       |      }
12593|       |      out.components.protocol_end = protocol_end;
12594|       |      out.components.username_end = protocol_end + 2;
12595|       |      out.components.host_start = protocol_end + 2;
12596|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12597|       |      out.components.port = url_components::omitted;
12598|       |      out.components.pathname_start = static_cast<uint32_t>(path_start);
12599|       |      out.components.search_start = (query_start != std::string_view::npos)
12600|       |                                        ? static_cast<uint32_t>(query_start)
12601|       |                                        : url_components::omitted;
12602|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12603|       |                                      ? static_cast<uint32_t>(hash_start)
12604|       |                                      : url_components::omitted;
12605|       |    } else {
12606|       |      out.buffer.clear();
12607|       |      out.buffer.reserve(len + 1);
12608|       |      out.buffer.append(input.substr(0, host_end));
12609|       |      out.buffer.push_back('/');
12610|       |      if (host_end < len) {
12611|       |        out.buffer.append(input.substr(host_end));
12612|       |      }
12613|       |      if (has_upper) {
12614|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12615|       |      }
12616|       |      out.components.protocol_end = protocol_end;
12617|       |      out.components.username_end = protocol_end + 2;
12618|       |      out.components.host_start = protocol_end + 2;
12619|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12620|       |      out.components.port = url_components::omitted;
12621|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12622|       |      out.components.search_start = (query_start != std::string_view::npos)
12623|       |                                        ? static_cast<uint32_t>(query_start + 1)
12624|       |                                        : url_components::omitted;
12625|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12626|       |                                      ? static_cast<uint32_t>(hash_start + 1)
12627|       |                                      : url_components::omitted;
12628|       |    }
12629|   269k|  } else {
12630|   269k|    std::string host_str(input.substr(host_start, host_len));
12631|   269k|    if (has_upper) {
  ------------------
  |  Branch (12631:9): [True: 9.50k, False: 259k]
  ------------------
12632|  9.50k|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12633|  9.50k|    }
12634|   269k|    out.host = std::move(host_str);
12635|   269k|    if (need_slash) {
  ------------------
  |  Branch (12635:9): [True: 28.5k, False: 240k]
  ------------------
12636|  28.5k|      out.path = "/";
12637|   240k|    } else {
12638|   240k|      out.path.assign(input.data() + path_start, path_end - path_start);
12639|   240k|    }
12640|   269k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12640:9): [True: 87.5k, False: 181k]
  ------------------
12641|  87.5k|      const size_t q_end =
12642|  87.5k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12642:11): [True: 30.3k, False: 57.2k]
  ------------------
12643|  87.5k|      out.query.emplace(input.data() + query_start + 1,
12644|  87.5k|                        q_end - query_start - 1);
12645|  87.5k|    }
12646|   269k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12646:9): [True: 59.4k, False: 209k]
  ------------------
12647|  59.4k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12648|  59.4k|    }
12649|   269k|  }
12650|   269k|  return true;
12651|   291k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
12269|   440k|                                                result_type& out) {
12270|   440k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
12271|   440k|  constexpr bool is_aggregator =
12272|   440k|      std::is_same_v<result_type, ada::url_aggregator>;
12273|   440k|  static_assert(is_ada_url || is_aggregator);
12274|       |
12275|   440k|  const size_t len = input.size();
12276|       |  // Shortest accepted form is "ws://x" (6).
12277|   440k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (12277:7): [True: 9, False: 440k]
  ------------------
12278|      9|    return false;
12279|      9|  }
12280|   440k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12281|       |
12282|   440k|  size_t pos = 0;
12283|   440k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
12284|   440k|  uint32_t protocol_end = 0;
12285|   440k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
12286|   440k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
12287|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
12288|       |  // Masked compares cover the shorter special schemes without extra loads.
12289|   440k|  if (len >= 8) {
  ------------------
  |  Branch (12289:7): [True: 440k, False: 207]
  ------------------
12290|   440k|    uint64_t first8 = 0;
12291|   440k|    std::memcpy(&first8, b, 8);
12292|   440k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (12292:9): [True: 346k, False: 94.1k]
  ------------------
12293|   346k|      pos = 8;
12294|   346k|      scheme_type = ada::scheme::type::HTTPS;
12295|   346k|      protocol_end = 6;
12296|   346k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (12296:16): [True: 87.8k, False: 6.33k]
  ------------------
12297|  94.1k|               0x002f2f3a70747468ull) {  // "http://"
12298|  87.8k|      pos = 7;
12299|  87.8k|      scheme_type = ada::scheme::type::HTTP;
12300|  87.8k|      protocol_end = 5;
12301|  87.8k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12301:16): [True: 8, False: 6.32k]
  ------------------
12302|  6.33k|               0x00002f2f3a737377ull) {  // "wss://"
12303|      8|      pos = 6;
12304|      8|      scheme_type = ada::scheme::type::WSS;
12305|      8|      protocol_end = 4;
12306|  6.32k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (12306:16): [True: 68, False: 6.25k]
  ------------------
12307|  6.32k|               0x00002f2f3a707466ull) {  // "ftp://"
12308|     68|      pos = 6;
12309|     68|      scheme_type = ada::scheme::type::FTP;
12310|     68|      protocol_end = 4;
12311|  6.25k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (12311:16): [True: 227, False: 6.02k]
  ------------------
12312|  6.25k|               0x0000002f2f3a7377ull) {  // "ws://"
12313|    227|      pos = 5;
12314|    227|      scheme_type = ada::scheme::type::WS;
12315|    227|      protocol_end = 3;
12316|  6.02k|    } else {
12317|  6.02k|      return false;
12318|  6.02k|    }
12319|   440k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12319:14): [True: 43, False: 164]
  |  Branch (12319:29): [True: 25, False: 18]
  ------------------
12320|     25|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12320:9): [True: 3, False: 22]
  |  Branch (12320:24): [True: 2, False: 1]
  |  Branch (12320:39): [True: 2, False: 0]
  ------------------
12321|      2|      pos = 5;
12322|      2|      scheme_type = ada::scheme::type::WS;
12323|      2|      protocol_end = 3;
12324|     23|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12324:16): [True: 5, False: 18]
  |  Branch (12324:31): [True: 0, False: 5]
  |  Branch (12324:46): [True: 0, False: 0]
  |  Branch (12324:61): [True: 0, False: 0]
  ------------------
12325|      0|      pos = 6;
12326|      0|      scheme_type = ada::scheme::type::WSS;
12327|      0|      protocol_end = 4;
12328|     23|    } else {
12329|     23|      return false;
12330|     23|    }
12331|    182|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12331:14): [True: 28, False: 154]
  |  Branch (12331:29): [True: 18, False: 10]
  |  Branch (12331:44): [True: 5, False: 13]
  |  Branch (12331:59): [True: 0, False: 5]
  ------------------
12332|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12332:14): [True: 0, False: 0]
  |  Branch (12332:29): [True: 0, False: 0]
  ------------------
12333|      0|    pos = 6;
12334|      0|    scheme_type = ada::scheme::type::FTP;
12335|      0|    protocol_end = 4;
12336|    182|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12336:14): [True: 151, False: 31]
  |  Branch (12336:26): [True: 91, False: 60]
  |  Branch (12336:41): [True: 67, False: 24]
  |  Branch (12336:56): [True: 52, False: 15]
  ------------------
12337|     52|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12337:14): [True: 42, False: 10]
  |  Branch (12337:29): [True: 24, False: 18]
  |  Branch (12337:44): [True: 12, False: 12]
  |  Branch (12337:59): [True: 5, False: 7]
  ------------------
12338|      5|    pos = 7;
12339|      5|    scheme_type = ada::scheme::type::HTTP;
12340|      5|    protocol_end = 5;
12341|    177|  } else {
12342|    177|    return false;
12343|    177|  }
12344|       |#else
12345|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12346|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12347|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12348|       |    pos = 8;
12349|       |    scheme_type = ada::scheme::type::HTTPS;
12350|       |    protocol_end = 6;
12351|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12352|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12353|       |    pos = 7;
12354|       |    scheme_type = ada::scheme::type::HTTP;
12355|       |    protocol_end = 5;
12356|       |  } else if (b[0] == 'w' && b[1] == 's') {
12357|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12358|       |      pos = 5;
12359|       |      scheme_type = ada::scheme::type::WS;
12360|       |      protocol_end = 3;
12361|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12362|       |               b[5] == '/') {
12363|       |      pos = 6;
12364|       |      scheme_type = ada::scheme::type::WSS;
12365|       |      protocol_end = 4;
12366|       |    } else {
12367|       |      return false;
12368|       |    }
12369|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12370|       |             b[4] == '/' && b[5] == '/') {
12371|       |    pos = 6;
12372|       |    scheme_type = ada::scheme::type::FTP;
12373|       |    protocol_end = 4;
12374|       |  } else {
12375|       |    return false;
12376|       |  }
12377|       |#endif
12378|   434k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12378:7): [True: 434k, False: 5]
  |  Branch (12378:21): [True: 101, False: 434k]
  |  Branch (12378:38): [True: 21, False: 434k]
  ------------------
12379|    122|    return false;
12380|    122|  }
12381|       |
12382|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12383|   434k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12383:7): [True: 434k, False: 5]
  |  Branch (12383:22): [True: 431k, False: 2.22k]
  |  Branch (12383:39): [True: 34, False: 431k]
  |  Branch (12383:57): [True: 6, False: 434k]
  ------------------
12384|     40|    return false;
12385|     40|  }
12386|       |
12387|   434k|  const size_t host_start = pos;
12388|   434k|  bool has_upper = false;
12389|   434k|  bool has_x = false;
12390|   434k|  size_t host_end = pos;
12391|   434k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12391:7): [True: 2.75k, False: 431k]
  ------------------
12392|  2.75k|    return false;
12393|  2.75k|  }
12394|   431k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12394:7): [True: 92, False: 431k]
  ------------------
12395|     92|    return false;
12396|     92|  }
12397|   431k|  const size_t host_len = host_end - host_start;
12398|   431k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12398:7): [True: 293, False: 431k]
  ------------------
12399|    293|    return false;
12400|    293|  }
12401|   431k|  {
12402|   431k|    std::string_view hv(input.data() + host_start, host_len);
12403|   431k|    char host_buf[256];
12404|   431k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12404:9): [True: 10.0k, False: 420k]
  ------------------
12405|  10.0k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12406|  10.0k|      unicode::to_lower_ascii(host_buf, host_len);
12407|  10.0k|      hv = std::string_view(host_buf, host_len);
12408|  10.0k|    }
12409|   431k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12409:9): [True: 18.9k, False: 412k]
  ------------------
12410|  18.9k|      return false;
12411|  18.9k|    }
12412|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12413|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12414|   412k|    static constexpr std::string_view xn{"xn-", 3};
12415|   412k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12415:10): [True: 375k, False: 36.1k]
  |  Branch (12415:19): [True: 481, False: 35.6k]
  |  Branch (12415:33): [True: 59.5k, False: 316k]
  ------------------
12416|  59.5k|        [[unlikely]] {
12417|  59.5k|      return false;
12418|  59.5k|    }
12419|   412k|  }
12420|       |
12421|   352k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12421:7): [True: 343k, False: 9.55k]
  |  Branch (12421:25): [True: 61.3k, False: 281k]
  ------------------
12422|  61.3k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12423|  61.3k|                                            protocol_end, host_start, host_end,
12424|  61.3k|                                            host_len, has_upper);
12425|  61.3k|  }
12426|       |
12427|   291k|  size_t i = host_end;
12428|   291k|  size_t path_start = host_end;
12429|   291k|  size_t path_end = host_end;
12430|   291k|  size_t query_start = std::string_view::npos;
12431|   291k|  size_t hash_start = std::string_view::npos;
12432|   291k|  bool has_path = false;
12433|   291k|  bool maybe_dot_segment = false;
12434|   291k|  bool rest_simple = true;
12435|       |
12436|   291k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12436:7): [True: 281k, False: 9.55k]
  |  Branch (12436:18): [True: 262k, False: 19.1k]
  ------------------
12437|   262k|    has_path = true;
12438|   262k|    path_start = i;
12439|   262k|    ++i;
12440|   262k|    scan_path_run(b, i, len, maybe_dot_segment);
12441|   262k|    if (i < len) {
  ------------------
  |  Branch (12441:9): [True: 110k, False: 152k]
  ------------------
12442|   110k|      const uint8_t cls = k_path[b[i]];
12443|   110k|      if (cls == 1) {
  ------------------
  |  Branch (12443:11): [True: 97.9k, False: 12.1k]
  ------------------
12444|  97.9k|        path_end = i;
12445|  97.9k|        if (b[i] == '?') {
  ------------------
  |  Branch (12445:13): [True: 78.2k, False: 19.6k]
  ------------------
12446|  78.2k|          query_start = i;
12447|  78.2k|          ++i;
12448|  78.2k|          goto scan_query;
12449|  78.2k|        }
12450|  19.6k|        hash_start = i;
12451|  19.6k|        ++i;
12452|  19.6k|        goto scan_hash;
12453|  97.9k|      }
12454|  12.1k|      rest_simple = false;
12455|   254k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12455:14): [True: 243k, False: 10.8k]
  ------------------
12456|   243k|        if (b[i] == '?') {
  ------------------
  |  Branch (12456:13): [True: 1.06k, False: 242k]
  ------------------
12457|  1.06k|          path_end = i;
12458|  1.06k|          query_start = i;
12459|  1.06k|          ++i;
12460|  1.06k|          goto scan_query_boundary;
12461|  1.06k|        }
12462|   242k|        if (b[i] == '#') {
  ------------------
  |  Branch (12462:13): [True: 262, False: 242k]
  ------------------
12463|    262|          path_end = i;
12464|    262|          hash_start = i;
12465|    262|          ++i;
12466|    262|          goto after_rest;
12467|    262|        }
12468|   242k|      }
12469|  10.8k|      path_end = i;
12470|  10.8k|      goto after_rest;
12471|  12.1k|    }
12472|   152k|    path_end = i;
12473|   152k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12473:14): [True: 19.1k, False: 9.55k]
  |  Branch (12473:25): [True: 9.64k, False: 9.51k]
  ------------------
12474|  9.64k|    query_start = i;
12475|  9.64k|    ++i;
12476|  9.64k|    goto scan_query;
12477|  19.0k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12477:14): [True: 9.51k, False: 9.55k]
  |  Branch (12477:25): [True: 9.51k, False: 0]
  ------------------
12478|  9.51k|    hash_start = i;
12479|  9.51k|    ++i;
12480|  9.51k|    goto scan_hash;
12481|  9.51k|  }
12482|   161k|  goto after_rest;
12483|       |
12484|   161k|scan_query:
12485|  87.9k|  scan_query_run(b, i, len);
12486|  87.9k|  if (i < len) {
  ------------------
  |  Branch (12486:7): [True: 30.6k, False: 57.2k]
  ------------------
12487|  30.6k|    if (b[i] == '#') {
  ------------------
  |  Branch (12487:9): [True: 30.5k, False: 135]
  ------------------
12488|  30.5k|      hash_start = i;
12489|  30.5k|      ++i;
12490|  30.5k|      goto scan_hash;
12491|  30.5k|    }
12492|    135|    rest_simple = false;
12493|    135|    goto scan_query_boundary;
12494|  30.6k|  }
12495|  57.2k|  goto after_rest;
12496|       |
12497|  57.2k|scan_query_boundary:
12498|  24.4k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12498:10): [True: 23.9k, False: 469]
  ------------------
12499|  23.9k|    if (b[i] == '#') {
  ------------------
  |  Branch (12499:9): [True: 730, False: 23.2k]
  ------------------
12500|    730|      hash_start = i;
12501|    730|      ++i;
12502|    730|      goto after_rest;
12503|    730|    }
12504|  23.9k|  }
12505|    469|  goto after_rest;
12506|       |
12507|  59.7k|scan_hash:
12508|  59.7k|  scan_hash_run(b, i, len);
12509|  59.7k|  if (i < len) {
  ------------------
  |  Branch (12509:7): [True: 115, False: 59.5k]
  ------------------
12510|    115|    rest_simple = false;
12511|    115|  }
12512|       |
12513|   291k|after_rest:
12514|   291k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12514:7): [True: 278k, False: 12.4k]
  |  Branch (12514:22): [True: 10.1k, False: 268k]
  ------------------
12515|  10.1k|    const std::string_view path_body(input.data() + path_start,
12516|  10.1k|                                     path_end - path_start);
12517|  10.1k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12517:9): [True: 9.75k, False: 373]
  ------------------
12518|  9.75k|      rest_simple = false;
12519|  9.75k|    }
12520|  10.1k|  }
12521|       |
12522|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12523|       |  // trailing C0 control or space; this fast path does neither. A query or
12524|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12525|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12526|       |  // inputs back to the slow path.
12527|   291k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12527:7): [True: 22.1k, False: 269k]
  |  Branch (12527:24): [True: 34, False: 22.1k]
  ------------------
12528|  22.1k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12528:24): [True: 66, False: 22.0k]
  ------------------
12529|    100|    return false;
12530|    100|  }
12531|       |
12532|   291k|  out.type = scheme_type;
12533|   291k|  out.is_valid = true;
12534|   291k|  out.has_opaque_path = false;
12535|   291k|  out.host_type = DEFAULT;
12536|       |
12537|   291k|  if (!rest_simple) {
  ------------------
  |  Branch (12537:7): [True: 22.0k, False: 269k]
  ------------------
12538|       |    // Host is a plain domain. Finish path/query/hash with
12539|       |    // the regular helpers
12540|       |    // so percent-encoding and dot segments do not re-parse the authority.
12541|  22.0k|    const std::string_view path_view =
12542|  22.0k|        has_path
  ------------------
  |  Branch (12542:9): [True: 21.9k, False: 159]
  ------------------
12543|  22.0k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12544|  22.0k|            : std::string_view{};
12545|  22.0k|    auto apply_query_and_hash = [&]() {
12546|  22.0k|      if (query_start != std::string_view::npos) {
12547|  22.0k|        const size_t q_end =
12548|  22.0k|            (hash_start != std::string_view::npos) ? hash_start : len;
12549|  22.0k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12550|  22.0k|                                                q_end - query_start - 1),
12551|  22.0k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12552|  22.0k|      }
12553|  22.0k|      if (hash_start != std::string_view::npos) {
12554|  22.0k|        out.update_unencoded_base_hash(std::string_view(
12555|  22.0k|            input.data() + hash_start + 1, len - hash_start - 1));
12556|  22.0k|      }
12557|  22.0k|    };
12558|  22.0k|    if constexpr (is_aggregator) {
12559|  22.0k|      out.buffer.assign(input.substr(0, host_end));
12560|  22.0k|      if (has_upper) {
  ------------------
  |  Branch (12560:11): [True: 143, False: 21.9k]
  ------------------
12561|    143|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12562|    143|      }
12563|  22.0k|      out.components.protocol_end = protocol_end;
12564|  22.0k|      out.components.username_end = protocol_end + 2;
12565|  22.0k|      out.components.host_start = protocol_end + 2;
12566|  22.0k|      out.components.host_end = static_cast<uint32_t>(host_end);
12567|  22.0k|      out.components.port = url_components::omitted;
12568|  22.0k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12569|  22.0k|      out.components.search_start = url_components::omitted;
12570|  22.0k|      out.components.hash_start = url_components::omitted;
12571|  22.0k|      out.parse_path(path_view);
12572|  22.0k|      apply_query_and_hash();
12573|       |    } else {
12574|       |      std::string host_str(input.substr(host_start, host_len));
12575|       |      if (has_upper) {
12576|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12577|       |      }
12578|       |      out.host = std::move(host_str);
12579|       |      out.parse_path(path_view);
12580|       |      apply_query_and_hash();
12581|       |    }
12582|  22.0k|    return true;
12583|  22.0k|  }
12584|       |
12585|   269k|  const bool need_slash = !has_path;
12586|   269k|  if constexpr (is_aggregator) {
12587|   269k|    if (!need_slash) {
  ------------------
  |  Branch (12587:9): [True: 240k, False: 28.5k]
  ------------------
12588|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12589|   240k|      out.buffer.assign(input);
12590|   240k|      if (has_upper) {
  ------------------
  |  Branch (12590:11): [True: 9.41k, False: 231k]
  ------------------
12591|  9.41k|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12592|  9.41k|      }
12593|   240k|      out.components.protocol_end = protocol_end;
12594|   240k|      out.components.username_end = protocol_end + 2;
12595|   240k|      out.components.host_start = protocol_end + 2;
12596|   240k|      out.components.host_end = static_cast<uint32_t>(host_end);
12597|   240k|      out.components.port = url_components::omitted;
12598|   240k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12599|   240k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12599:37): [True: 78.0k, False: 162k]
  ------------------
12600|   240k|                                        ? static_cast<uint32_t>(query_start)
12601|   240k|                                        : url_components::omitted;
12602|   240k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12602:35): [True: 49.8k, False: 190k]
  ------------------
12603|   240k|                                      ? static_cast<uint32_t>(hash_start)
12604|   240k|                                      : url_components::omitted;
12605|   240k|    } else {
12606|  28.5k|      out.buffer.clear();
12607|  28.5k|      out.buffer.reserve(len + 1);
12608|  28.5k|      out.buffer.append(input.substr(0, host_end));
12609|  28.5k|      out.buffer.push_back('/');
12610|  28.5k|      if (host_end < len) {
  ------------------
  |  Branch (12610:11): [True: 18.9k, False: 9.55k]
  ------------------
12611|  18.9k|        out.buffer.append(input.substr(host_end));
12612|  18.9k|      }
12613|  28.5k|      if (has_upper) {
  ------------------
  |  Branch (12613:11): [True: 87, False: 28.4k]
  ------------------
12614|     87|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12615|     87|      }
12616|  28.5k|      out.components.protocol_end = protocol_end;
12617|  28.5k|      out.components.username_end = protocol_end + 2;
12618|  28.5k|      out.components.host_start = protocol_end + 2;
12619|  28.5k|      out.components.host_end = static_cast<uint32_t>(host_end);
12620|  28.5k|      out.components.port = url_components::omitted;
12621|  28.5k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12622|  28.5k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12622:37): [True: 9.53k, False: 18.9k]
  ------------------
12623|  28.5k|                                        ? static_cast<uint32_t>(query_start + 1)
12624|  28.5k|                                        : url_components::omitted;
12625|  28.5k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12625:35): [True: 9.54k, False: 18.9k]
  ------------------
12626|  28.5k|                                      ? static_cast<uint32_t>(hash_start + 1)
12627|  28.5k|                                      : url_components::omitted;
12628|  28.5k|    }
12629|       |  } else {
12630|       |    std::string host_str(input.substr(host_start, host_len));
12631|       |    if (has_upper) {
12632|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12633|       |    }
12634|       |    out.host = std::move(host_str);
12635|       |    if (need_slash) {
12636|       |      out.path = "/";
12637|       |    } else {
12638|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12639|       |    }
12640|       |    if (query_start != std::string_view::npos) {
12641|       |      const size_t q_end =
12642|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12643|       |      out.query.emplace(input.data() + query_start + 1,
12644|       |                        q_end - query_start - 1);
12645|       |    }
12646|       |    if (hash_start != std::string_view::npos) {
12647|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12648|       |    }
12649|       |  }
12650|   269k|  return true;
12651|   291k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11997|  61.3k|    bool has_upper) {
11998|  61.3k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11999|  61.3k|  constexpr bool is_aggregator =
12000|  61.3k|      std::is_same_v<result_type, ada::url_aggregator>;
12001|  61.3k|  static_assert(is_ada_url || is_aggregator);
12002|       |
12003|  61.3k|  const size_t len = input.size();
12004|  61.3k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12005|  61.3k|  size_t p = host_end + 1;
12006|  61.3k|  uint32_t port_value = 0;
12007|  61.3k|  bool any_digit = false;
12008|   264k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12008:10): [True: 264k, False: 48]
  |  Branch (12008:21): [True: 203k, False: 61.0k]
  |  Branch (12008:36): [True: 202k, False: 320]
  ------------------
12009|   202k|    any_digit = true;
12010|   202k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12011|   202k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12011:9): [True: 17, False: 202k]
  ------------------
12012|     17|      return false;
12013|     17|    }
12014|   202k|    ++p;
12015|   202k|  }
12016|  61.3k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12016:7): [True: 61.3k, False: 48]
  |  Branch (12016:18): [True: 444, False: 60.8k]
  |  Branch (12016:33): [True: 315, False: 129]
  |  Branch (12016:48): [True: 233, False: 82]
  ------------------
12017|    233|    return false;
12018|    233|  }
12019|  61.1k|  uint32_t parsed_port = url_components::omitted;
12020|  61.1k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12021|  61.1k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12021:7): [True: 60.6k, False: 471]
  |  Branch (12021:20): [True: 60.6k, False: 4]
  ------------------
12022|  60.6k|    parsed_port = port_value;
12023|  60.6k|  }
12024|  61.1k|  const size_t authority_end = p;
12025|       |
12026|  61.1k|  size_t i = authority_end;
12027|  61.1k|  size_t path_start = host_end;
12028|  61.1k|  size_t path_end = host_end;
12029|  61.1k|  size_t query_start = std::string_view::npos;
12030|  61.1k|  size_t hash_start = std::string_view::npos;
12031|  61.1k|  bool has_path = false;
12032|  61.1k|  bool maybe_dot_segment = false;
12033|  61.1k|  bool rest_simple = true;
12034|       |
12035|  61.1k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12035:7): [True: 61.0k, False: 48]
  |  Branch (12035:18): [True: 60.8k, False: 211]
  ------------------
12036|  60.8k|    has_path = true;
12037|  60.8k|    path_start = i;
12038|  60.8k|    ++i;
12039|  60.8k|    scan_path_run(b, i, len, maybe_dot_segment);
12040|  60.8k|    if (i < len) {
  ------------------
  |  Branch (12040:9): [True: 4.07k, False: 56.8k]
  ------------------
12041|  4.07k|      const uint8_t cls = k_path[b[i]];
12042|  4.07k|      if (cls == 1) {
  ------------------
  |  Branch (12042:11): [True: 2.31k, False: 1.75k]
  ------------------
12043|  2.31k|        path_end = i;
12044|  2.31k|        if (b[i] == '?') {
  ------------------
  |  Branch (12044:13): [True: 1.81k, False: 504]
  ------------------
12045|  1.81k|          query_start = i;
12046|  1.81k|          ++i;
12047|  1.81k|          goto scan_query;
12048|  1.81k|        }
12049|    504|        hash_start = i;
12050|    504|        ++i;
12051|    504|        goto scan_hash;
12052|  2.31k|      }
12053|  1.75k|      rest_simple = false;
12054|  82.2k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12054:14): [True: 81.5k, False: 687]
  ------------------
12055|  81.5k|        if (b[i] == '?') {
  ------------------
  |  Branch (12055:13): [True: 852, False: 80.6k]
  ------------------
12056|    852|          path_end = i;
12057|    852|          query_start = i;
12058|    852|          ++i;
12059|    852|          goto scan_query_boundary;
12060|    852|        }
12061|  80.6k|        if (b[i] == '#') {
  ------------------
  |  Branch (12061:13): [True: 220, False: 80.4k]
  ------------------
12062|    220|          path_end = i;
12063|    220|          hash_start = i;
12064|    220|          ++i;
12065|    220|          goto after_rest;
12066|    220|        }
12067|  80.6k|      }
12068|    687|      path_end = i;
12069|    687|      goto after_rest;
12070|  1.75k|    }
12071|  56.8k|    path_end = i;
12072|  56.8k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12072:14): [True: 211, False: 48]
  |  Branch (12072:25): [True: 129, False: 82]
  ------------------
12073|    129|    query_start = i;
12074|    129|    ++i;
12075|    129|    goto scan_query;
12076|    130|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12076:14): [True: 82, False: 48]
  |  Branch (12076:25): [True: 82, False: 0]
  ------------------
12077|     82|    hash_start = i;
12078|     82|    ++i;
12079|     82|    goto scan_hash;
12080|     82|  }
12081|  56.8k|  goto after_rest;
12082|       |
12083|  56.8k|scan_query:
12084|  1.94k|  scan_query_run(b, i, len);
12085|  1.94k|  if (i < len) {
  ------------------
  |  Branch (12085:7): [True: 1.30k, False: 639]
  ------------------
12086|  1.30k|    if (b[i] == '#') {
  ------------------
  |  Branch (12086:9): [True: 1.19k, False: 109]
  ------------------
12087|  1.19k|      hash_start = i;
12088|  1.19k|      ++i;
12089|  1.19k|      goto scan_hash;
12090|  1.19k|    }
12091|    109|    rest_simple = false;
12092|    109|    goto scan_query_boundary;
12093|  1.30k|  }
12094|    639|  goto after_rest;
12095|       |
12096|    961|scan_query_boundary:
12097|  24.8k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12097:10): [True: 24.5k, False: 335]
  ------------------
12098|  24.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12098:9): [True: 626, False: 23.9k]
  ------------------
12099|    626|      hash_start = i;
12100|    626|      ++i;
12101|    626|      goto after_rest;
12102|    626|    }
12103|  24.5k|  }
12104|    335|  goto after_rest;
12105|       |
12106|  1.78k|scan_hash:
12107|  1.78k|  scan_hash_run(b, i, len);
12108|  1.78k|  if (i < len) {
  ------------------
  |  Branch (12108:7): [True: 95, False: 1.68k]
  ------------------
12109|     95|    rest_simple = false;
12110|     95|  }
12111|       |
12112|  61.1k|after_rest:
12113|  61.1k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12113:7): [True: 59.1k, False: 1.96k]
  |  Branch (12113:22): [True: 595, False: 58.5k]
  ------------------
12114|    595|    const std::string_view path_body(input.data() + path_start,
12115|    595|                                     path_end - path_start);
12116|    595|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12116:9): [True: 360, False: 235]
  ------------------
12117|    360|      rest_simple = false;
12118|    360|    }
12119|    595|  }
12120|       |
12121|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12122|       |  // trailing C0 control or space; this fast path does neither. A query or
12123|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12124|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12125|       |  // inputs back to the slow path.
12126|  61.1k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12126:7): [True: 2.32k, False: 58.8k]
  |  Branch (12126:24): [True: 34, False: 2.28k]
  ------------------
12127|  2.28k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12127:24): [True: 68, False: 2.22k]
  ------------------
12128|    102|    return false;
12129|    102|  }
12130|       |
12131|  61.0k|  out.type = scheme_type;
12132|  61.0k|  out.is_valid = true;
12133|  61.0k|  out.has_opaque_path = false;
12134|  61.0k|  out.host_type = DEFAULT;
12135|       |
12136|  61.0k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12136:31): [True: 60.6k, False: 428]
  ------------------
12137|  61.0k|                                  ? (1 + port_decimal_digit_count(parsed_port))
12138|  61.0k|                                  : 0;
12139|       |
12140|  61.0k|  if (!rest_simple) {
  ------------------
  |  Branch (12140:7): [True: 2.22k, False: 58.8k]
  ------------------
12141|  2.22k|    const std::string_view path_view =
12142|  2.22k|        has_path
  ------------------
  |  Branch (12142:9): [True: 2.12k, False: 94]
  ------------------
12143|  2.22k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12144|  2.22k|            : std::string_view{};
12145|  2.22k|    auto apply_query_and_hash = [&]() {
12146|  2.22k|      if (query_start != std::string_view::npos) {
12147|  2.22k|        const size_t q_end =
12148|  2.22k|            (hash_start != std::string_view::npos) ? hash_start : len;
12149|  2.22k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12150|  2.22k|                                                q_end - query_start - 1),
12151|  2.22k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12152|  2.22k|      }
12153|  2.22k|      if (hash_start != std::string_view::npos) {
12154|  2.22k|        out.update_unencoded_base_hash(std::string_view(
12155|  2.22k|            input.data() + hash_start + 1, len - hash_start - 1));
12156|  2.22k|      }
12157|  2.22k|    };
12158|       |    if constexpr (is_aggregator) {
12159|       |      out.buffer.assign(input.substr(0, host_end));
12160|       |      if (parsed_port != url_components::omitted) {
12161|       |        append_canonical_port(out.buffer, parsed_port);
12162|       |      }
12163|       |      if (has_upper) {
12164|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12165|       |      }
12166|       |      out.components.protocol_end = protocol_end;
12167|       |      out.components.username_end = protocol_end + 2;
12168|       |      out.components.host_start = protocol_end + 2;
12169|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12170|       |      out.components.port = parsed_port;
12171|       |      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12172|       |      out.components.search_start = url_components::omitted;
12173|       |      out.components.hash_start = url_components::omitted;
12174|       |      out.parse_path(path_view);
12175|       |      apply_query_and_hash();
12176|  2.22k|    } else {
12177|  2.22k|      std::string host_str(input.substr(host_start, host_len));
12178|  2.22k|      if (has_upper) {
  ------------------
  |  Branch (12178:11): [True: 145, False: 2.07k]
  ------------------
12179|    145|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12180|    145|      }
12181|  2.22k|      out.host = std::move(host_str);
12182|  2.22k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12182:11): [True: 1.87k, False: 349]
  ------------------
12183|  1.87k|        out.port = static_cast<uint16_t>(parsed_port);
12184|  1.87k|      }
12185|  2.22k|      out.parse_path(path_view);
12186|  2.22k|      apply_query_and_hash();
12187|  2.22k|    }
12188|  2.22k|    return true;
12189|  2.22k|  }
12190|       |
12191|  58.8k|  const bool insert_slash = !has_path;
12192|       |  if constexpr (is_aggregator) {
12193|       |    const size_t out_len =
12194|       |        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
12195|       |    const bool omit_port_bytes = parsed_port == url_components::omitted;
12196|       |    if (out_len == len && !insert_slash && !omit_port_bytes) {
12197|       |      out.buffer.assign(input);
12198|       |    } else {
12199|       |      out.buffer.clear();
12200|       |      out.buffer.reserve(out_len);
12201|       |      out.buffer.append(input.substr(0, host_end));
12202|       |      if (parsed_port != url_components::omitted) {
12203|       |        append_canonical_port(out.buffer, parsed_port);
12204|       |      }
12205|       |      if (insert_slash) {
12206|       |        out.buffer.push_back('/');
12207|       |      }
12208|       |      if (authority_end < len) {
12209|       |        out.buffer.append(input.substr(authority_end));
12210|       |      }
12211|       |    }
12212|       |    if (has_upper) {
12213|       |      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12214|       |    }
12215|       |    const uint32_t pathname_start =
12216|       |        static_cast<uint32_t>(host_end) + port_bytes;
12217|       |    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12218|       |                               (insert_slash ? 1 : 0) -
12219|       |                               static_cast<int32_t>(authority_end);
12220|       |    out.components.protocol_end = protocol_end;
12221|       |    out.components.username_end = protocol_end + 2;
12222|       |    out.components.host_start = protocol_end + 2;
12223|       |    out.components.host_end = static_cast<uint32_t>(host_end);
12224|       |    out.components.port = parsed_port;
12225|       |    out.components.pathname_start = pathname_start;
12226|       |    out.components.search_start =
12227|       |        (query_start != std::string_view::npos)
12228|       |            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12229|       |                                    tail_delta)
12230|       |            : url_components::omitted;
12231|       |    out.components.hash_start =
12232|       |        (hash_start != std::string_view::npos)
12233|       |            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12234|       |                                    tail_delta)
12235|       |            : url_components::omitted;
12236|  58.8k|  } else {
12237|  58.8k|    std::string host_str(input.substr(host_start, host_len));
12238|  58.8k|    if (has_upper) {
  ------------------
  |  Branch (12238:9): [True: 53, False: 58.7k]
  ------------------
12239|     53|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12240|     53|    }
12241|  58.8k|    out.host = std::move(host_str);
12242|  58.8k|    if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12242:9): [True: 58.7k, False: 79]
  ------------------
12243|  58.7k|      out.port = static_cast<uint16_t>(parsed_port);
12244|  58.7k|    }
12245|  58.8k|    if (insert_slash) {
  ------------------
  |  Branch (12245:9): [True: 146, False: 58.6k]
  ------------------
12246|    146|      out.path = "/";
12247|  58.6k|    } else {
12248|  58.6k|      out.path.assign(input.data() + path_start, path_end - path_start);
12249|  58.6k|    }
12250|  58.8k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12250:9): [True: 1.64k, False: 57.1k]
  ------------------
12251|  1.64k|      const size_t q_end =
12252|  1.64k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12252:11): [True: 1.07k, False: 570]
  ------------------
12253|  1.64k|      out.query.emplace(input.data() + query_start + 1,
12254|  1.64k|                        q_end - query_start - 1);
12255|  1.64k|    }
12256|  58.8k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12256:9): [True: 1.53k, False: 57.2k]
  ------------------
12257|  1.53k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12258|  1.53k|    }
12259|  58.8k|  }
12260|  58.8k|  return true;
12261|  61.0k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11997|  61.3k|    bool has_upper) {
11998|  61.3k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11999|  61.3k|  constexpr bool is_aggregator =
12000|  61.3k|      std::is_same_v<result_type, ada::url_aggregator>;
12001|  61.3k|  static_assert(is_ada_url || is_aggregator);
12002|       |
12003|  61.3k|  const size_t len = input.size();
12004|  61.3k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
12005|  61.3k|  size_t p = host_end + 1;
12006|  61.3k|  uint32_t port_value = 0;
12007|  61.3k|  bool any_digit = false;
12008|   264k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (12008:10): [True: 264k, False: 48]
  |  Branch (12008:21): [True: 203k, False: 61.0k]
  |  Branch (12008:36): [True: 202k, False: 320]
  ------------------
12009|   202k|    any_digit = true;
12010|   202k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
12011|   202k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (12011:9): [True: 17, False: 202k]
  ------------------
12012|     17|      return false;
12013|     17|    }
12014|   202k|    ++p;
12015|   202k|  }
12016|  61.3k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (12016:7): [True: 61.3k, False: 48]
  |  Branch (12016:18): [True: 444, False: 60.8k]
  |  Branch (12016:33): [True: 315, False: 129]
  |  Branch (12016:48): [True: 233, False: 82]
  ------------------
12017|    233|    return false;
12018|    233|  }
12019|  61.1k|  uint32_t parsed_port = url_components::omitted;
12020|  61.1k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
12021|  61.1k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (12021:7): [True: 60.6k, False: 471]
  |  Branch (12021:20): [True: 60.6k, False: 4]
  ------------------
12022|  60.6k|    parsed_port = port_value;
12023|  60.6k|  }
12024|  61.1k|  const size_t authority_end = p;
12025|       |
12026|  61.1k|  size_t i = authority_end;
12027|  61.1k|  size_t path_start = host_end;
12028|  61.1k|  size_t path_end = host_end;
12029|  61.1k|  size_t query_start = std::string_view::npos;
12030|  61.1k|  size_t hash_start = std::string_view::npos;
12031|  61.1k|  bool has_path = false;
12032|  61.1k|  bool maybe_dot_segment = false;
12033|  61.1k|  bool rest_simple = true;
12034|       |
12035|  61.1k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12035:7): [True: 61.0k, False: 48]
  |  Branch (12035:18): [True: 60.8k, False: 211]
  ------------------
12036|  60.8k|    has_path = true;
12037|  60.8k|    path_start = i;
12038|  60.8k|    ++i;
12039|  60.8k|    scan_path_run(b, i, len, maybe_dot_segment);
12040|  60.8k|    if (i < len) {
  ------------------
  |  Branch (12040:9): [True: 4.07k, False: 56.8k]
  ------------------
12041|  4.07k|      const uint8_t cls = k_path[b[i]];
12042|  4.07k|      if (cls == 1) {
  ------------------
  |  Branch (12042:11): [True: 2.31k, False: 1.75k]
  ------------------
12043|  2.31k|        path_end = i;
12044|  2.31k|        if (b[i] == '?') {
  ------------------
  |  Branch (12044:13): [True: 1.81k, False: 504]
  ------------------
12045|  1.81k|          query_start = i;
12046|  1.81k|          ++i;
12047|  1.81k|          goto scan_query;
12048|  1.81k|        }
12049|    504|        hash_start = i;
12050|    504|        ++i;
12051|    504|        goto scan_hash;
12052|  2.31k|      }
12053|  1.75k|      rest_simple = false;
12054|  82.2k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12054:14): [True: 81.5k, False: 687]
  ------------------
12055|  81.5k|        if (b[i] == '?') {
  ------------------
  |  Branch (12055:13): [True: 852, False: 80.6k]
  ------------------
12056|    852|          path_end = i;
12057|    852|          query_start = i;
12058|    852|          ++i;
12059|    852|          goto scan_query_boundary;
12060|    852|        }
12061|  80.6k|        if (b[i] == '#') {
  ------------------
  |  Branch (12061:13): [True: 220, False: 80.4k]
  ------------------
12062|    220|          path_end = i;
12063|    220|          hash_start = i;
12064|    220|          ++i;
12065|    220|          goto after_rest;
12066|    220|        }
12067|  80.6k|      }
12068|    687|      path_end = i;
12069|    687|      goto after_rest;
12070|  1.75k|    }
12071|  56.8k|    path_end = i;
12072|  56.8k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12072:14): [True: 211, False: 48]
  |  Branch (12072:25): [True: 129, False: 82]
  ------------------
12073|    129|    query_start = i;
12074|    129|    ++i;
12075|    129|    goto scan_query;
12076|    130|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12076:14): [True: 82, False: 48]
  |  Branch (12076:25): [True: 82, False: 0]
  ------------------
12077|     82|    hash_start = i;
12078|     82|    ++i;
12079|     82|    goto scan_hash;
12080|     82|  }
12081|  56.8k|  goto after_rest;
12082|       |
12083|  56.8k|scan_query:
12084|  1.94k|  scan_query_run(b, i, len);
12085|  1.94k|  if (i < len) {
  ------------------
  |  Branch (12085:7): [True: 1.30k, False: 639]
  ------------------
12086|  1.30k|    if (b[i] == '#') {
  ------------------
  |  Branch (12086:9): [True: 1.19k, False: 109]
  ------------------
12087|  1.19k|      hash_start = i;
12088|  1.19k|      ++i;
12089|  1.19k|      goto scan_hash;
12090|  1.19k|    }
12091|    109|    rest_simple = false;
12092|    109|    goto scan_query_boundary;
12093|  1.30k|  }
12094|    639|  goto after_rest;
12095|       |
12096|    961|scan_query_boundary:
12097|  24.8k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12097:10): [True: 24.5k, False: 335]
  ------------------
12098|  24.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12098:9): [True: 626, False: 23.9k]
  ------------------
12099|    626|      hash_start = i;
12100|    626|      ++i;
12101|    626|      goto after_rest;
12102|    626|    }
12103|  24.5k|  }
12104|    335|  goto after_rest;
12105|       |
12106|  1.78k|scan_hash:
12107|  1.78k|  scan_hash_run(b, i, len);
12108|  1.78k|  if (i < len) {
  ------------------
  |  Branch (12108:7): [True: 95, False: 1.68k]
  ------------------
12109|     95|    rest_simple = false;
12110|     95|  }
12111|       |
12112|  61.1k|after_rest:
12113|  61.1k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12113:7): [True: 59.1k, False: 1.96k]
  |  Branch (12113:22): [True: 595, False: 58.5k]
  ------------------
12114|    595|    const std::string_view path_body(input.data() + path_start,
12115|    595|                                     path_end - path_start);
12116|    595|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12116:9): [True: 360, False: 235]
  ------------------
12117|    360|      rest_simple = false;
12118|    360|    }
12119|    595|  }
12120|       |
12121|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12122|       |  // trailing C0 control or space; this fast path does neither. A query or
12123|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12124|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12125|       |  // inputs back to the slow path.
12126|  61.1k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12126:7): [True: 2.32k, False: 58.8k]
  |  Branch (12126:24): [True: 34, False: 2.28k]
  ------------------
12127|  2.28k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12127:24): [True: 68, False: 2.22k]
  ------------------
12128|    102|    return false;
12129|    102|  }
12130|       |
12131|  61.0k|  out.type = scheme_type;
12132|  61.0k|  out.is_valid = true;
12133|  61.0k|  out.has_opaque_path = false;
12134|  61.0k|  out.host_type = DEFAULT;
12135|       |
12136|  61.0k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (12136:31): [True: 60.6k, False: 428]
  ------------------
12137|  61.0k|                                  ? (1 + port_decimal_digit_count(parsed_port))
12138|  61.0k|                                  : 0;
12139|       |
12140|  61.0k|  if (!rest_simple) {
  ------------------
  |  Branch (12140:7): [True: 2.22k, False: 58.8k]
  ------------------
12141|  2.22k|    const std::string_view path_view =
12142|  2.22k|        has_path
  ------------------
  |  Branch (12142:9): [True: 2.12k, False: 94]
  ------------------
12143|  2.22k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12144|  2.22k|            : std::string_view{};
12145|  2.22k|    auto apply_query_and_hash = [&]() {
12146|  2.22k|      if (query_start != std::string_view::npos) {
12147|  2.22k|        const size_t q_end =
12148|  2.22k|            (hash_start != std::string_view::npos) ? hash_start : len;
12149|  2.22k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12150|  2.22k|                                                q_end - query_start - 1),
12151|  2.22k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12152|  2.22k|      }
12153|  2.22k|      if (hash_start != std::string_view::npos) {
12154|  2.22k|        out.update_unencoded_base_hash(std::string_view(
12155|  2.22k|            input.data() + hash_start + 1, len - hash_start - 1));
12156|  2.22k|      }
12157|  2.22k|    };
12158|  2.22k|    if constexpr (is_aggregator) {
12159|  2.22k|      out.buffer.assign(input.substr(0, host_end));
12160|  2.22k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12160:11): [True: 1.87k, False: 349]
  ------------------
12161|  1.87k|        append_canonical_port(out.buffer, parsed_port);
12162|  1.87k|      }
12163|  2.22k|      if (has_upper) {
  ------------------
  |  Branch (12163:11): [True: 145, False: 2.07k]
  ------------------
12164|    145|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12165|    145|      }
12166|  2.22k|      out.components.protocol_end = protocol_end;
12167|  2.22k|      out.components.username_end = protocol_end + 2;
12168|  2.22k|      out.components.host_start = protocol_end + 2;
12169|  2.22k|      out.components.host_end = static_cast<uint32_t>(host_end);
12170|  2.22k|      out.components.port = parsed_port;
12171|  2.22k|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
12172|  2.22k|      out.components.search_start = url_components::omitted;
12173|  2.22k|      out.components.hash_start = url_components::omitted;
12174|  2.22k|      out.parse_path(path_view);
12175|  2.22k|      apply_query_and_hash();
12176|       |    } else {
12177|       |      std::string host_str(input.substr(host_start, host_len));
12178|       |      if (has_upper) {
12179|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12180|       |      }
12181|       |      out.host = std::move(host_str);
12182|       |      if (parsed_port != url_components::omitted) {
12183|       |        out.port = static_cast<uint16_t>(parsed_port);
12184|       |      }
12185|       |      out.parse_path(path_view);
12186|       |      apply_query_and_hash();
12187|       |    }
12188|  2.22k|    return true;
12189|  2.22k|  }
12190|       |
12191|  58.8k|  const bool insert_slash = !has_path;
12192|  58.8k|  if constexpr (is_aggregator) {
12193|  58.8k|    const size_t out_len =
12194|  58.8k|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (12194:34): [True: 146, False: 58.6k]
  ------------------
12195|  58.8k|    const bool omit_port_bytes = parsed_port == url_components::omitted;
12196|  58.8k|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (12196:9): [True: 49.2k, False: 9.52k]
  |  Branch (12196:27): [True: 49.2k, False: 36]
  |  Branch (12196:44): [True: 49.2k, False: 0]
  ------------------
12197|  49.2k|      out.buffer.assign(input);
12198|  49.2k|    } else {
12199|  9.55k|      out.buffer.clear();
12200|  9.55k|      out.buffer.reserve(out_len);
12201|  9.55k|      out.buffer.append(input.substr(0, host_end));
12202|  9.55k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (12202:11): [True: 9.47k, False: 79]
  ------------------
12203|  9.47k|        append_canonical_port(out.buffer, parsed_port);
12204|  9.47k|      }
12205|  9.55k|      if (insert_slash) {
  ------------------
  |  Branch (12205:11): [True: 146, False: 9.41k]
  ------------------
12206|    146|        out.buffer.push_back('/');
12207|    146|      }
12208|  9.55k|      if (authority_end < len) {
  ------------------
  |  Branch (12208:11): [True: 9.50k, False: 48]
  ------------------
12209|  9.50k|        out.buffer.append(input.substr(authority_end));
12210|  9.50k|      }
12211|  9.55k|    }
12212|  58.8k|    if (has_upper) {
  ------------------
  |  Branch (12212:9): [True: 53, False: 58.7k]
  ------------------
12213|     53|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12214|     53|    }
12215|  58.8k|    const uint32_t pathname_start =
12216|  58.8k|        static_cast<uint32_t>(host_end) + port_bytes;
12217|  58.8k|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
12218|  58.8k|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (12218:33): [True: 146, False: 58.6k]
  ------------------
12219|  58.8k|                               static_cast<int32_t>(authority_end);
12220|  58.8k|    out.components.protocol_end = protocol_end;
12221|  58.8k|    out.components.username_end = protocol_end + 2;
12222|  58.8k|    out.components.host_start = protocol_end + 2;
12223|  58.8k|    out.components.host_end = static_cast<uint32_t>(host_end);
12224|  58.8k|    out.components.port = parsed_port;
12225|  58.8k|    out.components.pathname_start = pathname_start;
12226|  58.8k|    out.components.search_start =
12227|  58.8k|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (12227:9): [True: 1.64k, False: 57.1k]
  ------------------
12228|  58.8k|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
12229|  1.64k|                                    tail_delta)
12230|  58.8k|            : url_components::omitted;
12231|  58.8k|    out.components.hash_start =
12232|  58.8k|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12232:9): [True: 1.53k, False: 57.2k]
  ------------------
12233|  58.8k|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
12234|  1.53k|                                    tail_delta)
12235|  58.8k|            : url_components::omitted;
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|       |    if (insert_slash) {
12246|       |      out.path = "/";
12247|       |    } else {
12248|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12249|       |    }
12250|       |    if (query_start != std::string_view::npos) {
12251|       |      const size_t q_end =
12252|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12253|       |      out.query.emplace(input.data() + query_start + 1,
12254|       |                        q_end - query_start - 1);
12255|       |    }
12256|       |    if (hash_start != std::string_view::npos) {
12257|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12258|       |    }
12259|       |  }
12260|  58.8k|  return true;
12261|  61.0k|}
_ZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12840|   618k|                           const result_type* base_url) {
12841|       |  // We can specialize the implementation per type.
12842|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12843|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12844|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12845|       |  // and ada::url **do not have to support the exact same API**.
12846|   618k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12847|   618k|  constexpr bool result_type_is_ada_url_aggregator =
12848|   618k|      std::is_same_v<url_aggregator, result_type>;
12849|   618k|  static_assert(result_type_is_ada_url ||
12850|   618k|                result_type_is_ada_url_aggregator);  // We don't support
12851|       |                                                     // anything else for now.
12852|       |
12853|   618k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12854|   618k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12855|   618k|          ")");
12856|       |
12857|   618k|  result_type url{};
12858|       |
12859|   618k|  const uint32_t max_input_length = ada::get_max_input_length();
12860|       |
12861|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12862|       |  // max_input_length even when the input fit under it. The check at the end of
12863|       |  // the state machine covers URLs that run to completion, but several states
12864|       |  // return early after appending a query or fragment, so run the same check on
12865|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12866|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12867|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12868|   618k|  const auto enforce_max_input_length = [&]() {
12869|   618k|    if constexpr (store_values) {
12870|   618k|      if (url.is_valid) {
12871|   618k|        if constexpr (result_type_is_ada_url_aggregator) {
12872|   618k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12873|   618k|            url.is_valid = false;
12874|   618k|          }
12875|   618k|        } else {
12876|   618k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12877|   618k|            url.is_valid = false;
12878|   618k|          }
12879|   618k|        }
12880|   618k|      }
12881|   618k|    }
12882|   618k|  };
12883|       |
12884|       |  // We refuse to parse URL strings that exceed the maximum input length.
12885|       |  // By default, this is 4GB but can be configured via
12886|       |  // ada::set_max_input_length().
12887|   618k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12887:7): [True: 0, False: 618k]
  ------------------
12888|      0|    url.is_valid = false;
12889|      0|  }
12890|       |  // Going forward, user_input.size() is in [0,
12891|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12892|       |  // base, or the optional_url was invalid, we must return.
12893|   618k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12893:7): [True: 0, False: 618k]
  ------------------
12894|      0|    url.is_valid &= base_url->is_valid;
12895|      0|  }
12896|   618k|  if (!url.is_valid) {
  ------------------
  |  Branch (12896:7): [True: 0, False: 618k]
  ------------------
12897|      0|    return url;
12898|      0|  }
12899|       |
12900|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12901|   618k|  if constexpr (store_values) {
12902|   618k|    bool hit_fast_path = false;
12903|   618k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12903:9): [True: 618k, False: 0]
  ------------------
12904|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12905|       |      // call so those URLs (including SetHref) do not pay for a miss.
12906|   618k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12907|   618k|      const size_t n = user_input.size();
12908|   618k|      size_t host_start = 0;
12909|   618k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12909:11): [True: 618k, False: 216]
  |  Branch (12909:21): [True: 237k, False: 381k]
  |  Branch (12909:36): [True: 236k, False: 896]
  |  Branch (12909:51): [True: 235k, False: 168]
  ------------------
12910|   235k|        host_start = 7;
12911|   382k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12911:18): [True: 382k, False: 237]
  |  Branch (12911:28): [True: 379k, False: 2.58k]
  |  Branch (12911:43): [True: 378k, False: 801]
  |  Branch (12911:58): [True: 378k, False: 92]
  ------------------
12912|   378k|        host_start = 8;
12913|   378k|      }
12914|   618k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12914:34): [True: 614k, False: 3.71k]
  ------------------
12915|   618k|      const bool skip_ip =
12916|   618k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12916:11): [True: 533, False: 617k]
  |  Branch (12916:33): [True: 611k, False: 6.67k]
  |  Branch (12916:54): [True: 138k, False: 473k]
  ------------------
12917|   618k|      const bool skip_userinfo =
12918|   618k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12918:11): [True: 614k, False: 3.71k]
  |  Branch (12918:30): [True: 39.3k, False: 575k]
  ------------------
12919|   618k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12919:23): [True: 479k, False: 138k]
  |  Branch (12919:35): [True: 440k, False: 39.3k]
  ------------------
12920|   440k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12920:23): [True: 352k, False: 88.4k]
  ------------------
12921|   618k|    } else {
12922|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12923|      0|    }
12924|   618k|    if (hit_fast_path) {
  ------------------
  |  Branch (12924:9): [True: 352k, False: 266k]
  ------------------
12925|       |      if constexpr (result_type_is_ada_url_aggregator) {
12926|       |        if (url.buffer.size() > max_input_length) [[unlikely]] {
12927|       |          url.is_valid = false;
12928|       |        }
12929|   352k|      } else {
12930|       |        // For a small absolute input, even worst-case normalization cannot
12931|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12932|       |        // most 4.5x. Avoid traversing every stored component on the common
12933|       |        // default-limit path.
12934|   352k|        if ((base_url != nullptr ||
  ------------------
  |  Branch (12934:14): [True: 0, False: 352k]
  ------------------
12935|   352k|             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
  ------------------
  |  Branch (12935:14): [True: 0, False: 352k]
  ------------------
12936|      0|            url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12936:13): [True: 0, False: 0]
  ------------------
12937|      0|          url.is_valid = false;
12938|      0|        }
12939|   352k|      }
12940|   352k|      return url;
12941|   352k|    }
12942|   618k|  }
12943|       |
12944|   266k|  state state = state::SCHEME_START;
12945|       |
12946|   618k|  std::string tmp_buffer;
12947|   618k|  std::string_view url_data;
12948|   618k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12948:7): [True: 478, False: 618k]
  ------------------
12949|    478|    tmp_buffer = user_input;
12950|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12951|       |    // just directly build the string from user_input.
12952|    478|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12953|    478|    url_data = tmp_buffer;
12954|   618k|  } else [[likely]] {
12955|   618k|    url_data = user_input;
12956|   618k|  }
12957|       |
12958|       |  // Leading and trailing control characters are uncommon and easy to deal with
12959|       |  // (no performance concern).
12960|   618k|  helpers::trim_c0_whitespace(url_data);
12961|       |
12962|       |  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12963|       |    // Most of the time, we just need user_input.size().
12964|       |    // In some instances, we may need a bit more.
12965|       |    ///////////////////////////
12966|       |    // This is *very* important. This line should *not* be removed
12967|       |    // hastily. There are principled reasons why reserve is important
12968|       |    // for performance. If you have a benchmark with small inputs,
12969|       |    // it may not matter, but in other instances, it could.
12970|       |    ////
12971|       |    // This rounds up to the next power of two.
12972|       |    // We know that user_input.size() is in [0,
12973|       |    // std::numeric_limits<uint32_t>::max).
12974|       |    uint32_t reserve_capacity =
12975|       |        (0xFFFFFFFF >>
12976|       |         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12977|       |        1;
12978|       |    url.reserve(reserve_capacity);
12979|       |  }
12980|       |
12981|       |  // Optimization opportunity. Most websites do not have fragment.
12982|   618k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12983|       |  // We add it last so that an implementation like ada::url_aggregator
12984|       |  // can append it last to its internal buffer, thus improving performance.
12985|       |
12986|       |  // Here url_data no longer has its fragment.
12987|       |  // We are going to access the data from url_data (it is immutable).
12988|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12989|       |  // The input_position variable should range from 0 to input_size.
12990|       |  // It is illegal to access url_data at input_size.
12991|   618k|  size_t input_position = 0;
12992|   618k|  const size_t input_size = url_data.size();
12993|       |  // Keep running the following state machine by switching on state.
12994|       |  // If after a run pointer points to the EOF code point, go to the next step.
12995|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12996|       |  // We never decrement input_position.
12997|  2.35M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12997:10): [True: 1.79M, False: 556k]
  ------------------
12998|  1.79M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12999|  1.79M|            " in state ", ada::to_string(state));
13000|  1.79M|    switch (state) {
13001|   266k|      case state::SCHEME_START: {
  ------------------
  |  Branch (13001:7): [True: 266k, False: 1.52M]
  ------------------
13002|   266k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
13003|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
13004|       |        // state to scheme state.
13005|   266k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13005:13): [True: 266k, False: 1]
  ------------------
13006|   266k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (13006:13): [True: 266k, False: 127]
  ------------------
13007|   266k|          state = state::SCHEME;
13008|   266k|          input_position++;
13009|   266k|        } else {
13010|       |          // Otherwise, if state override is not given, set state to no scheme
13011|       |          // state and decrease pointer by 1.
13012|    128|          state = state::NO_SCHEME;
13013|    128|        }
13014|   266k|        break;
13015|      0|      }
13016|   266k|      case state::SCHEME: {
  ------------------
  |  Branch (13016:7): [True: 266k, False: 1.52M]
  ------------------
13017|   266k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
13018|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
13019|       |        // append c, lowercased, to buffer.
13020|  1.15M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13020:16): [True: 1.15M, False: 2]
  ------------------
13021|  1.15M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13021:16): [True: 890k, False: 266k]
  ------------------
13022|   890k|          input_position++;
13023|   890k|        }
13024|       |        // Otherwise, if c is U+003A (:), then:
13025|   266k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13025:13): [True: 266k, False: 2]
  ------------------
13026|   266k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13026:13): [True: 266k, False: 80]
  ------------------
13027|   266k|          ada_log("SCHEME the scheme should be ",
13028|   266k|                  url_data.substr(0, input_position));
13029|   266k|          if constexpr (result_type_is_ada_url) {
13030|   266k|            if (!url.parse_scheme(url_data.substr(0, input_position))) {
  ------------------
  |  Branch (13030:17): [True: 0, False: 266k]
  ------------------
13031|      0|              return url;
13032|      0|            }
13033|       |          } else {
13034|       |            // we pass the colon along instead of painfully adding it back.
13035|       |            if (!url.parse_scheme_with_colon(
13036|       |                    url_data.substr(0, input_position + 1))) {
13037|       |              return url;
13038|       |            }
13039|       |          }
13040|   266k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13041|       |
13042|       |          // If url's scheme is "file", then:
13043|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13044|   266k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13044:15): [True: 1.44k, False: 264k]
  ------------------
13045|       |            // Set state to file state.
13046|  1.44k|            state = state::FILE;
13047|  1.44k|          }
13048|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13049|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13050|       |          // != nullptr is false.
13051|   264k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13051:20): [True: 262k, False: 1.81k]
  |  Branch (13051:40): [True: 0, False: 262k]
  ------------------
13052|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13052:20): [True: 0, False: 0]
  ------------------
13053|       |            // Set state to special relative or authority state.
13054|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13055|      0|          }
13056|       |          // Otherwise, if url is special, set state to special authority
13057|       |          // slashes state.
13058|   264k|          else if (url.is_special()) {
  ------------------
  |  Branch (13058:20): [True: 262k, False: 1.81k]
  ------------------
13059|   262k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13060|   262k|          }
13061|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13062|       |          // path or authority state and increase pointer by 1.
13063|  1.81k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13063:20): [True: 1.65k, False: 153]
  ------------------
13064|  1.65k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13064:20): [True: 1.08k, False: 579]
  ------------------
13065|  1.08k|            state = state::PATH_OR_AUTHORITY;
13066|  1.08k|            input_position++;
13067|  1.08k|          }
13068|       |          // Otherwise, set url's path to the empty string and set state to
13069|       |          // opaque path state.
13070|    732|          else {
13071|    732|            state = state::OPAQUE_PATH;
13072|    732|          }
13073|   266k|        }
13074|       |        // Otherwise, if state override is not given, set buffer to the empty
13075|       |        // string, state to no scheme state, and start over (from the first code
13076|       |        // point in input).
13077|     82|        else {
13078|     82|          state = state::NO_SCHEME;
13079|     82|          input_position = 0;
13080|     82|          break;
13081|     82|        }
13082|   266k|        input_position++;
13083|   266k|        break;
13084|   266k|      }
13085|    210|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13085:7): [True: 210, False: 1.79M]
  ------------------
13086|    210|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13087|       |        // The fragment was pruned from url_data before the state machine ran,
13088|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13089|       |        // nothing else remains in front of it.
13090|    210|        const bool c_is_hash =
13091|    210|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13091:13): [True: 121, False: 89]
  |  Branch (13091:37): [True: 1, False: 120]
  ------------------
13092|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13093|       |        // validation error, return failure.
13094|    210|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13094:13): [True: 210, False: 0]
  |  Branch (13094:37): [True: 0, False: 0]
  |  Branch (13094:66): [True: 0, False: 0]
  ------------------
13095|    210|          ada_log("NO_SCHEME validation error");
13096|    210|          url.is_valid = false;
13097|    210|          return url;
13098|    210|        }
13099|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13100|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13101|       |        // query to base's query, and set state to fragment state.
13102|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13102:18): [True: 0, False: 0]
  |  Branch (13102:47): [True: 0, False: 0]
  ------------------
13103|      0|          ada_log("NO_SCHEME opaque base with fragment");
13104|      0|          url.copy_scheme(*base_url);
13105|      0|          url.has_opaque_path = base_url->has_opaque_path;
13106|       |
13107|      0|          if constexpr (result_type_is_ada_url) {
13108|      0|            url.path = base_url->path;
13109|      0|            url.query = base_url->query;
13110|       |          } else {
13111|       |            url.update_base_pathname(base_url->get_pathname());
13112|       |            if (base_url->has_search()) {
13113|       |              // get_search() returns "" for an empty query string (URL ends
13114|       |              // with '?'). update_base_search("") would incorrectly clear the
13115|       |              // query, so pass "?" to preserve the empty query distinction.
13116|       |              auto s = base_url->get_search();
13117|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13118|       |            }
13119|       |          }
13120|      0|          url.update_unencoded_base_hash(*fragment);
13121|      0|          enforce_max_input_length();
13122|      0|          return url;
13123|      0|        }
13124|       |        // Otherwise, if base's scheme is not "file", set state to relative
13125|       |        // state and decrease pointer by 1.
13126|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13127|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13127:18): [True: 0, False: 0]
  ------------------
13128|      0|          ada_log("NO_SCHEME non-file relative path");
13129|      0|          state = state::RELATIVE_SCHEME;
13130|      0|        }
13131|       |        // Otherwise, set state to file state and decrease pointer by 1.
13132|      0|        else {
13133|      0|          ada_log("NO_SCHEME file base type");
13134|      0|          state = state::FILE;
13135|      0|        }
13136|      0|        break;
13137|    210|      }
13138|   263k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13138:7): [True: 263k, False: 1.53M]
  ------------------
13139|   263k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13140|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13141|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13142|       |        // worry about AUTHORITY.
13143|       |        // TODO: Instead of just collecting a bool, collect the location of the
13144|       |        // '@' and do something useful with it.
13145|       |        // TODO: We could do various processing early on, using a single pass
13146|       |        // over the string to collect information about it, e.g., telling us
13147|       |        // whether there is a @ and if so, where (or how many).
13148|       |
13149|       |        // Check if url data contains an @.
13150|   263k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13150:13): [True: 223k, False: 40.5k]
  ------------------
13151|   223k|          state = state::HOST;
13152|   223k|          break;
13153|   223k|        }
13154|  40.5k|        bool at_sign_seen{false};
13155|  40.5k|        bool password_token_seen{false};
13156|       |        /**
13157|       |         * We expect something of the sort...
13158|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13159|       |         * --------^
13160|       |         */
13161|  93.9k|        do {
13162|  93.9k|          std::string_view view = url_data.substr(input_position);
13163|       |          // The delimiters are @, /, ? \\.
13164|  93.9k|          size_t location =
13165|  93.9k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13165:15): [True: 93.8k, False: 143]
  ------------------
13166|  93.9k|                               : helpers::find_authority_delimiter(view);
13167|  93.9k|          std::string_view authority_view = view.substr(0, location);
13168|  93.9k|          size_t end_of_authority = input_position + authority_view.size();
13169|       |          // If c is U+0040 (@), then:
13170|  93.9k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13170:15): [True: 84.1k, False: 9.86k]
  ------------------
13171|  84.1k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13171:15): [True: 53.4k, False: 30.6k]
  ------------------
13172|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13173|  53.4k|            if (at_sign_seen) {
  ------------------
  |  Branch (13173:17): [True: 13.2k, False: 40.2k]
  ------------------
13174|  13.2k|              if (password_token_seen) {
  ------------------
  |  Branch (13174:19): [True: 4.07k, False: 9.14k]
  ------------------
13175|  4.07k|                if constexpr (result_type_is_ada_url) {
13176|  4.07k|                  url.password += "%40";
13177|       |                } else {
13178|       |                  url.append_base_password("%40");
13179|       |                }
13180|  9.14k|              } else {
13181|  9.14k|                if constexpr (result_type_is_ada_url) {
13182|  9.14k|                  url.username += "%40";
13183|       |                } else {
13184|       |                  url.append_base_username("%40");
13185|       |                }
13186|  9.14k|              }
13187|  13.2k|            }
13188|       |
13189|  53.4k|            at_sign_seen = true;
13190|       |
13191|  53.4k|            if (!password_token_seen) {
  ------------------
  |  Branch (13191:17): [True: 49.3k, False: 4.07k]
  ------------------
13192|  49.3k|              size_t password_token_location = authority_view.find(':');
13193|  49.3k|              password_token_seen =
13194|  49.3k|                  password_token_location != std::string_view::npos;
13195|       |
13196|  49.3k|              if constexpr (store_values) {
13197|  49.3k|                if (!password_token_seen) {
  ------------------
  |  Branch (13197:21): [True: 19.8k, False: 29.5k]
  ------------------
13198|  19.8k|                  if constexpr (result_type_is_ada_url) {
13199|  19.8k|                    url.username += unicode::percent_encode(
13200|  19.8k|                        authority_view,
13201|  19.8k|                        character_sets::USERINFO_PERCENT_ENCODE);
13202|       |                  } else {
13203|       |                    url.append_base_username(unicode::percent_encode(
13204|       |                        authority_view,
13205|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13206|       |                  }
13207|  29.5k|                } else {
13208|  29.5k|                  if constexpr (result_type_is_ada_url) {
13209|  29.5k|                    url.username += unicode::percent_encode(
13210|  29.5k|                        authority_view.substr(0, password_token_location),
13211|  29.5k|                        character_sets::USERINFO_PERCENT_ENCODE);
13212|  29.5k|                    url.password += unicode::percent_encode(
13213|  29.5k|                        authority_view.substr(password_token_location + 1),
13214|  29.5k|                        character_sets::USERINFO_PERCENT_ENCODE);
13215|       |                  } else {
13216|       |                    url.append_base_username(unicode::percent_encode(
13217|       |                        authority_view.substr(0, password_token_location),
13218|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13219|       |                    url.append_base_password(unicode::percent_encode(
13220|       |                        authority_view.substr(password_token_location + 1),
13221|       |                        character_sets::USERINFO_PERCENT_ENCODE));
13222|       |                  }
13223|  29.5k|                }
13224|  49.3k|              }
13225|  49.3k|            } else if constexpr (store_values) {
13226|  4.07k|              if constexpr (result_type_is_ada_url) {
13227|  4.07k|                url.password += unicode::percent_encode(
13228|  4.07k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13229|       |              } else {
13230|       |                url.append_base_password(unicode::percent_encode(
13231|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13232|       |              }
13233|  4.07k|            }
13234|  53.4k|          }
13235|       |          // Otherwise, if one of the following is true:
13236|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13237|       |          // - url is special and c is U+005C (\)
13238|  40.5k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13238:20): [True: 9.86k, False: 30.6k]
  ------------------
13239|  30.6k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13239:20): [True: 30.4k, False: 161]
  ------------------
13240|    161|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13240:20): [True: 122, False: 39]
  ------------------
13241|  40.5k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13241:21): [True: 39, False: 0]
  |  Branch (13241:41): [True: 39, False: 0]
  ------------------
13242|       |            // If atSignSeen is true and authority_view is the empty string,
13243|       |            // validation error, return failure.
13244|  40.5k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13244:17): [True: 40.2k, False: 265]
  |  Branch (13244:33): [True: 243, False: 40.0k]
  ------------------
13245|    243|              url.is_valid = false;
13246|    243|              return url;
13247|    243|            }
13248|  40.2k|            state = state::HOST;
13249|  40.2k|            break;
13250|  40.5k|          }
13251|  53.4k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13251:15): [True: 0, False: 53.4k]
  ------------------
13252|      0|            if constexpr (store_values) {
13253|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13253:19): [True: 0, False: 0]
  ------------------
13254|      0|                url.update_unencoded_base_hash(*fragment);
13255|      0|              }
13256|      0|            }
13257|      0|            enforce_max_input_length();
13258|      0|            return url;
13259|      0|          }
13260|  53.4k|          input_position = end_of_authority + 1;
13261|  53.4k|        } while (true);
  ------------------
  |  Branch (13261:18): [True: 53.4k, Folded]
  ------------------
13262|       |
13263|  40.2k|        break;
13264|  40.5k|      }
13265|  40.2k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13265:7): [True: 0, False: 1.79M]
  ------------------
13266|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13267|      0|                helpers::substring(url_data, input_position));
13268|       |
13269|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13270|       |        // then set state to special authority ignore slashes state and increase
13271|       |        // pointer by 1.
13272|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13272:13): [True: 0, False: 0]
  ------------------
13273|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13274|      0|          input_position += 2;
13275|      0|        } else {
13276|       |          // Otherwise, validation error, set state to relative state and
13277|       |          // decrease pointer by 1.
13278|      0|          state = state::RELATIVE_SCHEME;
13279|      0|        }
13280|       |
13281|      0|        break;
13282|  40.5k|      }
13283|  1.08k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13283:7): [True: 1.08k, False: 1.79M]
  ------------------
13284|  1.08k|        ada_log("PATH_OR_AUTHORITY ",
13285|  1.08k|                helpers::substring(url_data, input_position));
13286|       |
13287|       |        // If c is U+002F (/), then set state to authority state.
13288|  1.08k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13288:13): [True: 1.04k, False: 34]
  ------------------
13289|  1.04k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13289:13): [True: 741, False: 305]
  ------------------
13290|    741|          state = state::AUTHORITY;
13291|    741|          input_position++;
13292|    741|        } else {
13293|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13294|    339|          state = state::PATH;
13295|    339|        }
13296|       |
13297|  1.08k|        break;
13298|  40.5k|      }
13299|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13299:7): [True: 0, False: 1.79M]
  ------------------
13300|      0|        ada_log("RELATIVE_SCHEME ",
13301|      0|                helpers::substring(url_data, input_position));
13302|       |
13303|       |        // Set url's scheme to base's scheme.
13304|      0|        url.copy_scheme(*base_url);
13305|       |
13306|       |        // If c is U+002F (/), then set state to relative slash state.
13307|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13307:13): [True: 0, False: 0]
  ------------------
13308|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13309|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13309:13): [True: 0, False: 0]
  ------------------
13310|      0|          ada_log(
13311|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13312|      0|              "slash state");
13313|      0|          state = state::RELATIVE_SLASH;
13314|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13314:20): [True: 0, False: 0]
  |  Branch (13314:40): [True: 0, False: 0]
  ------------------
13315|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13315:20): [True: 0, False: 0]
  ------------------
13316|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13317|       |          // set state to relative slash state.
13318|      0|          ada_log(
13319|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13320|      0|              "error, set state to relative slash state");
13321|      0|          state = state::RELATIVE_SLASH;
13322|      0|        } else {
13323|      0|          ada_log("RELATIVE_SCHEME otherwise");
13324|       |          // Set url's username to base's username, url's password to base's
13325|       |          // password, url's host to base's host, url's port to base's port,
13326|       |          // url's path to a clone of base's path, and url's query to base's
13327|       |          // query.
13328|      0|          if constexpr (result_type_is_ada_url) {
13329|      0|            url.username = base_url->username;
13330|      0|            url.password = base_url->password;
13331|      0|            url.host = base_url->host;
13332|      0|            url.port = base_url->port;
13333|       |            // cloning the base path includes cloning the has_opaque_path flag
13334|      0|            url.has_opaque_path = base_url->has_opaque_path;
13335|      0|            url.path = base_url->path;
13336|      0|            url.query = base_url->query;
13337|       |          } else {
13338|       |            url.update_base_authority(base_url->get_href(),
13339|       |                                      base_url->get_components());
13340|       |            url.update_host_to_base_host(base_url->get_hostname());
13341|       |            url.update_base_port(base_url->retrieve_base_port());
13342|       |            // cloning the base path includes cloning the has_opaque_path flag
13343|       |            url.has_opaque_path = base_url->has_opaque_path;
13344|       |            url.update_base_pathname(base_url->get_pathname());
13345|       |            if (base_url->has_search()) {
13346|       |              // get_search() returns "" for an empty query string (URL ends
13347|       |              // with '?'). update_base_search("") would incorrectly clear the
13348|       |              // query, so pass "?" to preserve the empty query distinction.
13349|       |              auto s = base_url->get_search();
13350|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13351|       |            }
13352|       |          }
13353|       |
13354|      0|          url.has_opaque_path = base_url->has_opaque_path;
13355|       |
13356|       |          // If c is U+003F (?), then set url's query to the empty string, and
13357|       |          // state to query state.
13358|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13358:15): [True: 0, False: 0]
  ------------------
13359|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13359:15): [True: 0, False: 0]
  ------------------
13360|      0|            state = state::QUERY;
13361|      0|          }
13362|       |          // Otherwise, if c is not the EOF code point:
13363|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13363:20): [True: 0, False: 0]
  ------------------
13364|       |            // Set url's query to null.
13365|      0|            url.clear_search();
13366|      0|            if constexpr (result_type_is_ada_url) {
13367|       |              // Shorten url's path.
13368|      0|              helpers::shorten_path(url.path, url.type);
13369|       |            } else {
13370|       |              std::string_view path = url.get_pathname();
13371|       |              if (helpers::shorten_path(path, url.type)) {
13372|       |                url.update_base_pathname(std::move(std::string(path)));
13373|       |              }
13374|       |            }
13375|       |            // Set state to path state and decrease pointer by 1.
13376|      0|            state = state::PATH;
13377|      0|            break;
13378|      0|          }
13379|      0|        }
13380|      0|        input_position++;
13381|      0|        break;
13382|      0|      }
13383|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13383:7): [True: 0, False: 1.79M]
  ------------------
13384|      0|        ada_log("RELATIVE_SLASH ",
13385|      0|                helpers::substring(url_data, input_position));
13386|       |
13387|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13388|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13389|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13389:13): [True: 0, False: 0]
  |  Branch (13389:33): [True: 0, False: 0]
  ------------------
13390|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13390:14): [True: 0, False: 0]
  ------------------
13391|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13391:14): [True: 0, False: 0]
  ------------------
13392|       |          // Set state to special authority ignore slashes state.
13393|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13394|      0|        }
13395|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13396|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13396:18): [True: 0, False: 0]
  ------------------
13397|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13397:18): [True: 0, False: 0]
  ------------------
13398|      0|          state = state::AUTHORITY;
13399|      0|        }
13400|       |        // Otherwise, set
13401|       |        // - url's username to base's username,
13402|       |        // - url's password to base's password,
13403|       |        // - url's host to base's host,
13404|       |        // - url's port to base's port,
13405|       |        // - state to path state, and then, decrease pointer by 1.
13406|      0|        else {
13407|      0|          if constexpr (result_type_is_ada_url) {
13408|      0|            url.username = base_url->username;
13409|      0|            url.password = base_url->password;
13410|      0|            url.host = base_url->host;
13411|      0|            url.port = base_url->port;
13412|       |          } else {
13413|       |            url.update_base_authority(base_url->get_href(),
13414|       |                                      base_url->get_components());
13415|       |            url.update_host_to_base_host(base_url->get_hostname());
13416|       |            url.update_base_port(base_url->retrieve_base_port());
13417|       |          }
13418|      0|          state = state::PATH;
13419|      0|          break;
13420|      0|        }
13421|       |
13422|      0|        input_position++;
13423|      0|        break;
13424|      0|      }
13425|   262k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13425:7): [True: 262k, False: 1.53M]
  ------------------
13426|   262k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13427|   262k|                helpers::substring(url_data, input_position));
13428|       |
13429|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13430|       |        // then set state to special authority ignore slashes state and increase
13431|       |        // pointer by 1.
13432|   262k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13432:13): [True: 261k, False: 1.68k]
  ------------------
13433|   261k|          input_position += 2;
13434|   261k|        }
13435|       |
13436|   262k|        [[fallthrough]];
13437|   262k|      }
13438|   262k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13438:7): [True: 0, False: 1.79M]
  ------------------
13439|   262k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13440|   262k|                helpers::substring(url_data, input_position));
13441|       |
13442|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13443|       |        // authority state and decrease pointer by 1.
13444|   264k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13444:16): [True: 264k, False: 72]
  ------------------
13445|   264k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13445:17): [True: 645, False: 264k]
  ------------------
13446|   264k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13446:17): [True: 1.25k, False: 262k]
  ------------------
13447|  1.89k|          input_position++;
13448|  1.89k|        }
13449|   262k|        state = state::AUTHORITY;
13450|       |
13451|   262k|        break;
13452|   262k|      }
13453|  9.82k|      case state::QUERY: {
  ------------------
  |  Branch (13453:7): [True: 9.82k, False: 1.78M]
  ------------------
13454|  9.82k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13455|  9.82k|        if constexpr (store_values) {
13456|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13457|       |          // if url is special; otherwise the query percent-encode set.
13458|  9.82k|          const uint8_t* query_percent_encode_set =
13459|  9.82k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13459:15): [True: 8.64k, False: 1.17k]
  ------------------
13460|  9.82k|                               : character_sets::QUERY_PERCENT_ENCODE;
13461|       |
13462|       |          // Percent-encode after encoding, with encoding, buffer, and
13463|       |          // queryPercentEncodeSet, and append the result to url's query.
13464|  9.82k|          url.update_base_search(url_data.substr(input_position),
13465|  9.82k|                                 query_percent_encode_set);
13466|  9.82k|          ada_log("QUERY update_base_search completed ");
13467|  9.82k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13467:15): [True: 7.39k, False: 2.42k]
  ------------------
13468|  7.39k|            url.update_unencoded_base_hash(*fragment);
13469|  7.39k|          }
13470|  9.82k|        }
13471|  9.82k|        enforce_max_input_length();
13472|  9.82k|        return url;
13473|   262k|      }
13474|   263k|      case state::HOST: {
  ------------------
  |  Branch (13474:7): [True: 263k, False: 1.53M]
  ------------------
13475|   263k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13476|       |
13477|   263k|        std::string_view host_view = url_data.substr(input_position);
13478|   263k|        auto [location, found_colon] =
13479|   263k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13480|   263k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13480:26): [True: 263k, False: 0]
  ------------------
13481|   263k|                             ? input_position + location
13482|   263k|                             : input_size;
13483|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13484|       |        // Note: the 'found_colon' value is true if and only if a colon was
13485|       |        // encountered while not inside brackets.
13486|   263k|        if (found_colon) {
  ------------------
  |  Branch (13486:13): [True: 2.43k, False: 260k]
  ------------------
13487|       |          // If buffer is the empty string, validation error, return failure.
13488|       |          // Let host be the result of host parsing buffer with url is not
13489|       |          // special.
13490|  2.43k|          ada_log("HOST parsing ", host_view);
13491|  2.43k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13491:15): [True: 166, False: 2.26k]
  ------------------
13492|    166|            return url;
13493|    166|          }
13494|  2.26k|          ada_log("HOST parsing results in ", url.get_hostname());
13495|       |          // Set url's host to host, buffer to the empty string, and state to
13496|       |          // port state.
13497|  2.26k|          state = state::PORT;
13498|  2.26k|          input_position++;
13499|  2.26k|        }
13500|       |        // Otherwise, if one of the following is true:
13501|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13502|       |        // - url is special and c is U+005C (\)
13503|       |        // The get_host_delimiter_location function either brings us to
13504|       |        // the colon outside of the bracket, or to one of those characters.
13505|   260k|        else {
13506|       |          // If url is special and host_view is the empty string, validation
13507|       |          // error, return failure.
13508|   260k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13508:15): [True: 194, False: 260k]
  |  Branch (13508:36): [True: 107, False: 87]
  ------------------
13509|    107|            url.is_valid = false;
13510|    107|            return url;
13511|    107|          }
13512|   260k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13513|       |          // Let host be the result of host parsing host_view with url is not
13514|       |          // special.
13515|   260k|          if (host_view.empty()) {
  ------------------
  |  Branch (13515:15): [True: 87, False: 260k]
  ------------------
13516|     87|            url.update_base_hostname("");
13517|   260k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13517:22): [True: 20.5k, False: 240k]
  ------------------
13518|  20.5k|            return url;
13519|  20.5k|          }
13520|   240k|          ada_log("HOST parsing results in ", url.get_hostname(),
13521|   240k|                  " href=", url.get_href());
13522|       |
13523|       |          // Set url's host to host, and state to path start state.
13524|   240k|          state = state::PATH_START;
13525|   240k|        }
13526|       |
13527|   242k|        break;
13528|   263k|      }
13529|   242k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13529:7): [True: 732, False: 1.79M]
  ------------------
13530|    732|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13531|       |        // Opaque path, query, and fragment are structurally always valid:
13532|       |        // the parser would just percent-encode whatever is there. When we
13533|       |        // are not storing values (can_parse), we can return immediately.
13534|       |        // We must set has_opaque_path = true before returning so that when
13535|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13536|       |        // correctly rejects relative inputs against an opaque-path base
13537|       |        // (e.g. can_parse("", &"W:") must return false).
13538|       |        if constexpr (!store_values) {
13539|       |          url.has_opaque_path = true;
13540|       |          return url;
13541|       |        }
13542|    732|        std::string_view view = url_data.substr(input_position);
13543|       |        // If c is U+003F (?), then set url's query to the empty string and
13544|       |        // state to query state.
13545|    732|        size_t location = view.find('?');
13546|    732|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13546:13): [True: 462, False: 270]
  ------------------
13547|    462|          view.remove_suffix(view.size() - location);
13548|    462|          state = state::QUERY;
13549|    462|          input_position += location + 1;
13550|    462|        } else {
13551|    270|          input_position = input_size + 1;
13552|    270|        }
13553|    732|        url.has_opaque_path = true;
13554|       |
13555|       |        // This is a really unlikely scenario in real world. We should not seek
13556|       |        // to optimize it.
13557|    732|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13557:13): [True: 12, False: 720]
  ------------------
13558|     12|          std::string modified_view =
13559|     12|              std::string(view.substr(0, view.size() - 1)) + "%20";
13560|     12|          url.update_base_pathname(unicode::percent_encode(
13561|     12|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13562|    720|        } else {
13563|    720|          url.update_base_pathname(unicode::percent_encode(
13564|    720|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13565|    720|        }
13566|    732|        break;
13567|   263k|      }
13568|  2.26k|      case state::PORT: {
  ------------------
  |  Branch (13568:7): [True: 2.26k, False: 1.79M]
  ------------------
13569|  2.26k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13570|  2.26k|        std::string_view port_view = url_data.substr(input_position);
13571|  2.26k|        input_position += url.parse_port(port_view, true);
13572|  2.26k|        if (!url.is_valid) {
  ------------------
  |  Branch (13572:13): [True: 227, False: 2.04k]
  ------------------
13573|    227|          return url;
13574|    227|        }
13575|  2.04k|        state = state::PATH_START;
13576|  2.04k|        [[fallthrough]];
13577|  2.04k|      }
13578|   243k|      case state::PATH_START: {
  ------------------
  |  Branch (13578:7): [True: 241k, False: 1.55M]
  ------------------
13579|   243k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13580|       |        // Path, query, and fragment are structurally always valid: the
13581|       |        // parser would just percent-encode whatever is there. When we are
13582|       |        // not storing values (can_parse), we can return immediately since
13583|       |        // no subsequent state can invalidate the URL.
13584|       |        if constexpr (!store_values) {
13585|       |          return url;
13586|       |        }
13587|       |
13588|       |        // If url is special, then:
13589|   243k|        if (url.is_special()) {
  ------------------
  |  Branch (13589:13): [True: 242k, False: 669]
  ------------------
13590|       |          // Set state to path state.
13591|   242k|          state = state::PATH;
13592|       |
13593|       |          // Optimization: Avoiding going into PATH state improves the
13594|       |          // performance of urls ending with /.
13595|   242k|          if (input_position == input_size) {
  ------------------
  |  Branch (13595:15): [True: 30.3k, False: 212k]
  ------------------
13596|  30.3k|            if constexpr (store_values) {
13597|  30.3k|              url.update_base_pathname("/");
13598|  30.3k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13598:19): [True: 275, False: 30.0k]
  ------------------
13599|    275|                url.update_unencoded_base_hash(*fragment);
13600|    275|              }
13601|  30.3k|            }
13602|  30.3k|            enforce_max_input_length();
13603|  30.3k|            return url;
13604|  30.3k|          }
13605|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13606|       |          // by 1. We know that (input_position == input_size) is impossible
13607|       |          // here, because of the previous if-check.
13608|   212k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13608:15): [True: 1.01k, False: 211k]
  ------------------
13609|  1.01k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13609:15): [True: 611, False: 405]
  ------------------
13610|    611|            break;
13611|    611|          }
13612|   212k|        }
13613|       |        // Otherwise, if state override is not given and c is U+003F (?),
13614|       |        // set url's query to the empty string and state to query state.
13615|    669|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13615:18): [True: 543, False: 126]
  ------------------
13616|    543|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13616:18): [True: 111, False: 432]
  ------------------
13617|    111|          state = state::QUERY;
13618|    111|        }
13619|       |        // Otherwise, if c is not the EOF code point:
13620|    558|        else if (input_position != input_size) {
  ------------------
  |  Branch (13620:18): [True: 432, False: 126]
  ------------------
13621|       |          // Set state to path state.
13622|    432|          state = state::PATH;
13623|       |
13624|       |          // If c is not U+002F (/), then decrease pointer by 1.
13625|    432|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13625:15): [True: 0, False: 432]
  ------------------
13626|      0|            break;
13627|      0|          }
13628|    432|        }
13629|       |
13630|   212k|        input_position++;
13631|   212k|        break;
13632|   243k|      }
13633|   213k|      case state::PATH: {
  ------------------
  |  Branch (13633:7): [True: 213k, False: 1.58M]
  ------------------
13634|   213k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13635|       |        // Path, query, and fragment are structurally always valid: the
13636|       |        // parser would just percent-encode whatever is there. When we are
13637|       |        // not storing values (can_parse), we can return immediately since
13638|       |        // no subsequent state can invalidate the URL.
13639|       |        if constexpr (!store_values) {
13640|       |          return url;
13641|       |        }
13642|   213k|        std::string_view view = url_data.substr(input_position);
13643|       |
13644|       |        // Most time, we do not need percent encoding.
13645|       |        // Furthermore, we can immediately locate the '?'.
13646|   213k|        size_t locofquestionmark = view.find('?');
13647|   213k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13647:13): [True: 9.24k, False: 204k]
  ------------------
13648|  9.24k|          state = state::QUERY;
13649|  9.24k|          view.remove_suffix(view.size() - locofquestionmark);
13650|  9.24k|          input_position += locofquestionmark + 1;
13651|   204k|        } else {
13652|   204k|          input_position = input_size + 1;
13653|   204k|        }
13654|   213k|        if constexpr (store_values) {
13655|   213k|          if constexpr (result_type_is_ada_url) {
13656|   213k|            helpers::parse_prepared_path(view, url.type, url.path);
13657|       |          } else {
13658|       |            url.consume_prepared_path(view);
13659|       |            ADA_ASSERT_TRUE(url.validate());
13660|       |          }
13661|   213k|        }
13662|   213k|        break;
13663|   243k|      }
13664|  1.33k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13664:7): [True: 1.33k, False: 1.79M]
  ------------------
13665|  1.33k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13666|       |
13667|       |        // If c is U+002F (/) or U+005C (\), then:
13668|  1.33k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13668:13): [True: 1.33k, False: 1]
  ------------------
13669|  1.33k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13669:14): [True: 1.32k, False: 8]
  ------------------
13670|  1.32k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13670:14): [True: 2, False: 6]
  ------------------
13671|  1.32k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13672|       |          // Set state to file host state.
13673|  1.32k|          state = state::FILE_HOST;
13674|  1.32k|          input_position++;
13675|  1.32k|        } else {
13676|      7|          ada_log("FILE_SLASH otherwise");
13677|       |          // If base is non-null and base's scheme is "file", then:
13678|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13679|       |          // base_url_has_value() is true.
13680|      7|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13680:15): [True: 0, False: 7]
  |  Branch (13680:38): [True: 0, False: 0]
  ------------------
13681|       |            // Set url's host to base's host.
13682|      0|            if constexpr (result_type_is_ada_url) {
13683|      0|              url.host = base_url->host;
13684|       |            } else {
13685|       |              url.update_host_to_base_host(base_url->get_host());
13686|       |            }
13687|       |            // If the code point substring from pointer to the end of input does
13688|       |            // not start with a Windows drive letter and base's path[0] is a
13689|       |            // normalized Windows drive letter, then append base's path[0] to
13690|       |            // url's path.
13691|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13691:17): [True: 0, False: 0]
  ------------------
13692|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13692:19): [True: 0, False: 0]
  ------------------
13693|      0|                      url_data.substr(input_position))) {
13694|      0|                std::string_view first_base_url_path =
13695|      0|                    base_url->get_pathname().substr(1);
13696|      0|                size_t loc = first_base_url_path.find('/');
13697|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13697:21): [True: 0, False: 0]
  ------------------
13698|      0|                  helpers::resize(first_base_url_path, loc);
13699|      0|                }
13700|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13700:21): [True: 0, False: 0]
  ------------------
13701|      0|                        first_base_url_path)) {
13702|      0|                  if constexpr (result_type_is_ada_url) {
13703|      0|                    url.path += '/';
13704|      0|                    url.path += first_base_url_path;
13705|       |                  } else {
13706|       |                    url.append_base_pathname(
13707|       |                        helpers::concat("/", first_base_url_path));
13708|       |                  }
13709|      0|                }
13710|      0|              }
13711|      0|            }
13712|      0|          }
13713|       |
13714|       |          // Set state to path state, and decrease pointer by 1.
13715|      7|          state = state::PATH;
13716|      7|        }
13717|       |
13718|  1.33k|        break;
13719|   243k|      }
13720|  1.32k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13720:7): [True: 1.32k, False: 1.79M]
  ------------------
13721|  1.32k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13722|  1.32k|        std::string_view view = url_data.substr(input_position);
13723|       |
13724|  1.32k|        size_t location = view.find_first_of("/\\?");
13725|  1.32k|        std::string_view file_host_buffer = view.substr(
13726|  1.32k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13726:16): [True: 1.29k, False: 37]
  ------------------
13727|       |
13728|  1.32k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13728:13): [True: 1, False: 1.32k]
  ------------------
13729|      1|          state = state::PATH;
13730|  1.32k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13730:20): [True: 247, False: 1.07k]
  ------------------
13731|       |          // Set url's host to the empty string.
13732|    247|          if constexpr (result_type_is_ada_url) {
13733|    247|            url.host = "";
13734|       |          } else {
13735|       |            url.update_base_hostname("");
13736|       |          }
13737|       |          // Set state to path start state.
13738|    247|          state = state::PATH_START;
13739|  1.07k|        } else {
13740|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13741|  1.07k|          input_position += consumed_bytes;
13742|       |          // Let host be the result of host parsing buffer with url is not
13743|       |          // special.
13744|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13744:15): [True: 92, False: 987]
  ------------------
13745|     92|            return url;
13746|     92|          }
13747|       |
13748|    987|          if constexpr (result_type_is_ada_url) {
13749|       |            // If host is "localhost", then set host to the empty string.
13750|    987|            if (url.host.has_value() && url.host.value() == "localhost") {
  ------------------
  |  Branch (13750:17): [True: 987, False: 0]
  |  Branch (13750:41): [True: 3, False: 984]
  ------------------
13751|      3|              url.host = "";
13752|      3|            }
13753|       |          } else {
13754|       |            if (url.get_hostname() == "localhost") {
13755|       |              url.update_base_hostname("");
13756|       |            }
13757|       |          }
13758|       |
13759|       |          // Set buffer to the empty string and state to path start state.
13760|    987|          state = state::PATH_START;
13761|    987|        }
13762|       |
13763|  1.23k|        break;
13764|  1.32k|      }
13765|  1.44k|      case state::FILE: {
  ------------------
  |  Branch (13765:7): [True: 1.44k, False: 1.79M]
  ------------------
13766|  1.44k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13767|  1.44k|        std::string_view file_view = url_data.substr(input_position);
13768|       |
13769|  1.44k|        url.set_protocol_as_file();
13770|  1.44k|        if constexpr (result_type_is_ada_url) {
13771|       |          // Set url's host to the empty string.
13772|  1.44k|          url.host = "";
13773|       |        } else {
13774|       |          url.update_base_hostname("");
13775|       |        }
13776|       |        // If c is U+002F (/) or U+005C (\), then:
13777|  1.44k|        if (input_position != input_size &&
  ------------------
  |  Branch (13777:13): [True: 1.44k, False: 1]
  ------------------
13778|  1.44k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13778:14): [True: 1.33k, False: 108]
  ------------------
13779|  1.33k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13779:14): [True: 1, False: 107]
  ------------------
13780|  1.33k|          ada_log("FILE c is U+002F or U+005C");
13781|       |          // Set state to file slash state.
13782|  1.33k|          state = state::FILE_SLASH;
13783|  1.33k|        }
13784|       |        // Otherwise, if base is non-null and base's scheme is "file":
13785|    108|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13785:18): [True: 0, False: 108]
  |  Branch (13785:41): [True: 0, False: 0]
  ------------------
13786|       |          // Set url's host to base's host, url's path to a clone of base's
13787|       |          // path, and url's query to base's query.
13788|      0|          ada_log("FILE base non-null");
13789|      0|          if constexpr (result_type_is_ada_url) {
13790|      0|            url.host = base_url->host;
13791|      0|            url.path = base_url->path;
13792|      0|            url.query = base_url->query;
13793|       |          } else {
13794|       |            url.update_host_to_base_host(base_url->get_hostname());
13795|       |            url.update_base_pathname(base_url->get_pathname());
13796|       |            if (base_url->has_search()) {
13797|       |              // get_search() returns "" for an empty query string (URL ends
13798|       |              // with '?'). update_base_search("") would incorrectly clear the
13799|       |              // query, so pass "?" to preserve the empty query distinction.
13800|       |              auto s = base_url->get_search();
13801|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13802|       |            }
13803|       |          }
13804|      0|          url.has_opaque_path = base_url->has_opaque_path;
13805|       |
13806|       |          // If c is U+003F (?), then set url's query to the empty string and
13807|       |          // state to query state.
13808|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13808:15): [True: 0, False: 0]
  |  Branch (13808:47): [True: 0, False: 0]
  ------------------
13809|      0|            state = state::QUERY;
13810|      0|          }
13811|       |          // Otherwise, if c is not the EOF code point:
13812|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13812:20): [True: 0, False: 0]
  ------------------
13813|       |            // Set url's query to null.
13814|      0|            url.clear_search();
13815|       |            // If the code point substring from pointer to the end of input does
13816|       |            // not start with a Windows drive letter, then shorten url's path.
13817|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13817:17): [True: 0, False: 0]
  ------------------
13818|      0|              if constexpr (result_type_is_ada_url) {
13819|      0|                helpers::shorten_path(url.path, url.type);
13820|       |              } else {
13821|       |                std::string_view path = url.get_pathname();
13822|       |                if (helpers::shorten_path(path, url.type)) {
13823|       |                  url.update_base_pathname(std::move(std::string(path)));
13824|       |                }
13825|       |              }
13826|      0|            }
13827|       |            // Otherwise:
13828|      0|            else {
13829|       |              // Set url's path to an empty list.
13830|      0|              url.clear_pathname();
13831|      0|              url.has_opaque_path = true;
13832|      0|            }
13833|       |
13834|       |            // Set state to path state and decrease pointer by 1.
13835|      0|            state = state::PATH;
13836|      0|            break;
13837|      0|          }
13838|      0|        }
13839|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13840|    108|        else {
13841|    108|          ada_log("FILE go to path");
13842|    108|          state = state::PATH;
13843|    108|          break;
13844|    108|        }
13845|       |
13846|  1.33k|        input_position++;
13847|  1.33k|        break;
13848|  1.44k|      }
13849|      0|      default:
  ------------------
  |  Branch (13849:7): [True: 0, False: 1.79M]
  ------------------
13850|      0|        unreachable();
13851|  1.79M|    }
13852|  1.79M|  }
13853|   556k|  if constexpr (store_values) {
13854|   556k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13854:9): [True: 2.30k, False: 554k]
  ------------------
13855|  2.30k|      url.update_unencoded_base_hash(*fragment);
13856|  2.30k|    }
13857|   556k|  }
13858|   556k|  enforce_max_input_length();
13859|   556k|  return url;
13860|   618k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12840|   618k|                           const result_type* base_url) {
12841|       |  // We can specialize the implementation per type.
12842|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12843|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12844|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12845|       |  // and ada::url **do not have to support the exact same API**.
12846|   618k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12847|   618k|  constexpr bool result_type_is_ada_url_aggregator =
12848|   618k|      std::is_same_v<url_aggregator, result_type>;
12849|   618k|  static_assert(result_type_is_ada_url ||
12850|   618k|                result_type_is_ada_url_aggregator);  // We don't support
12851|       |                                                     // anything else for now.
12852|       |
12853|   618k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12854|   618k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12855|   618k|          ")");
12856|       |
12857|   618k|  result_type url{};
12858|       |
12859|   618k|  const uint32_t max_input_length = ada::get_max_input_length();
12860|       |
12861|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12862|       |  // max_input_length even when the input fit under it. The check at the end of
12863|       |  // the state machine covers URLs that run to completion, but several states
12864|       |  // return early after appending a query or fragment, so run the same check on
12865|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12866|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12867|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12868|   618k|  const auto enforce_max_input_length = [&]() {
12869|   618k|    if constexpr (store_values) {
12870|   618k|      if (url.is_valid) {
12871|   618k|        if constexpr (result_type_is_ada_url_aggregator) {
12872|   618k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12873|   618k|            url.is_valid = false;
12874|   618k|          }
12875|   618k|        } else {
12876|   618k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12877|   618k|            url.is_valid = false;
12878|   618k|          }
12879|   618k|        }
12880|   618k|      }
12881|   618k|    }
12882|   618k|  };
12883|       |
12884|       |  // We refuse to parse URL strings that exceed the maximum input length.
12885|       |  // By default, this is 4GB but can be configured via
12886|       |  // ada::set_max_input_length().
12887|   618k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12887:7): [True: 0, False: 618k]
  ------------------
12888|      0|    url.is_valid = false;
12889|      0|  }
12890|       |  // Going forward, user_input.size() is in [0,
12891|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12892|       |  // base, or the optional_url was invalid, we must return.
12893|   618k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12893:7): [True: 0, False: 618k]
  ------------------
12894|      0|    url.is_valid &= base_url->is_valid;
12895|      0|  }
12896|   618k|  if (!url.is_valid) {
  ------------------
  |  Branch (12896:7): [True: 0, False: 618k]
  ------------------
12897|      0|    return url;
12898|      0|  }
12899|       |
12900|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12901|   618k|  if constexpr (store_values) {
12902|   618k|    bool hit_fast_path = false;
12903|   618k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12903:9): [True: 618k, False: 0]
  ------------------
12904|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12905|       |      // call so those URLs (including SetHref) do not pay for a miss.
12906|   618k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12907|   618k|      const size_t n = user_input.size();
12908|   618k|      size_t host_start = 0;
12909|   618k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12909:11): [True: 618k, False: 216]
  |  Branch (12909:21): [True: 237k, False: 381k]
  |  Branch (12909:36): [True: 236k, False: 896]
  |  Branch (12909:51): [True: 235k, False: 168]
  ------------------
12910|   235k|        host_start = 7;
12911|   382k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12911:18): [True: 382k, False: 237]
  |  Branch (12911:28): [True: 379k, False: 2.58k]
  |  Branch (12911:43): [True: 378k, False: 801]
  |  Branch (12911:58): [True: 378k, False: 92]
  ------------------
12912|   378k|        host_start = 8;
12913|   378k|      }
12914|   618k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12914:34): [True: 614k, False: 3.71k]
  ------------------
12915|   618k|      const bool skip_ip =
12916|   618k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12916:11): [True: 533, False: 617k]
  |  Branch (12916:33): [True: 611k, False: 6.67k]
  |  Branch (12916:54): [True: 138k, False: 473k]
  ------------------
12917|   618k|      const bool skip_userinfo =
12918|   618k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12918:11): [True: 614k, False: 3.71k]
  |  Branch (12918:30): [True: 39.3k, False: 575k]
  ------------------
12919|   618k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12919:23): [True: 479k, False: 138k]
  |  Branch (12919:35): [True: 440k, False: 39.3k]
  ------------------
12920|   440k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12920:23): [True: 352k, False: 88.4k]
  ------------------
12921|   618k|    } else {
12922|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12923|      0|    }
12924|   618k|    if (hit_fast_path) {
  ------------------
  |  Branch (12924:9): [True: 352k, False: 266k]
  ------------------
12925|   352k|      if constexpr (result_type_is_ada_url_aggregator) {
12926|   352k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12926:13): [True: 0, False: 352k]
  ------------------
12927|      0|          url.is_valid = false;
12928|      0|        }
12929|       |      } else {
12930|       |        // For a small absolute input, even worst-case normalization cannot
12931|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12932|       |        // most 4.5x. Avoid traversing every stored component on the common
12933|       |        // default-limit path.
12934|       |        if ((base_url != nullptr ||
12935|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12936|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12937|       |          url.is_valid = false;
12938|       |        }
12939|       |      }
12940|   352k|      return url;
12941|   352k|    }
12942|   618k|  }
12943|       |
12944|   266k|  state state = state::SCHEME_START;
12945|       |
12946|   618k|  std::string tmp_buffer;
12947|   618k|  std::string_view url_data;
12948|   618k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12948:7): [True: 478, False: 618k]
  ------------------
12949|    478|    tmp_buffer = user_input;
12950|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12951|       |    // just directly build the string from user_input.
12952|    478|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12953|    478|    url_data = tmp_buffer;
12954|   618k|  } else [[likely]] {
12955|   618k|    url_data = user_input;
12956|   618k|  }
12957|       |
12958|       |  // Leading and trailing control characters are uncommon and easy to deal with
12959|       |  // (no performance concern).
12960|   618k|  helpers::trim_c0_whitespace(url_data);
12961|       |
12962|   618k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12963|       |    // Most of the time, we just need user_input.size().
12964|       |    // In some instances, we may need a bit more.
12965|       |    ///////////////////////////
12966|       |    // This is *very* important. This line should *not* be removed
12967|       |    // hastily. There are principled reasons why reserve is important
12968|       |    // for performance. If you have a benchmark with small inputs,
12969|       |    // it may not matter, but in other instances, it could.
12970|       |    ////
12971|       |    // This rounds up to the next power of two.
12972|       |    // We know that user_input.size() is in [0,
12973|       |    // std::numeric_limits<uint32_t>::max).
12974|   618k|    uint32_t reserve_capacity =
12975|   618k|        (0xFFFFFFFF >>
12976|   618k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12977|   618k|        1;
12978|   618k|    url.reserve(reserve_capacity);
12979|   618k|  }
12980|       |
12981|       |  // Optimization opportunity. Most websites do not have fragment.
12982|   618k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12983|       |  // We add it last so that an implementation like ada::url_aggregator
12984|       |  // can append it last to its internal buffer, thus improving performance.
12985|       |
12986|       |  // Here url_data no longer has its fragment.
12987|       |  // We are going to access the data from url_data (it is immutable).
12988|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12989|       |  // The input_position variable should range from 0 to input_size.
12990|       |  // It is illegal to access url_data at input_size.
12991|   618k|  size_t input_position = 0;
12992|   618k|  const size_t input_size = url_data.size();
12993|       |  // Keep running the following state machine by switching on state.
12994|       |  // If after a run pointer points to the EOF code point, go to the next step.
12995|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12996|       |  // We never decrement input_position.
12997|  2.35M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12997:10): [True: 1.79M, False: 556k]
  ------------------
12998|  1.79M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12999|  1.79M|            " in state ", ada::to_string(state));
13000|  1.79M|    switch (state) {
13001|   266k|      case state::SCHEME_START: {
  ------------------
  |  Branch (13001:7): [True: 266k, False: 1.52M]
  ------------------
13002|   266k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
13003|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
13004|       |        // state to scheme state.
13005|   266k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13005:13): [True: 266k, False: 1]
  ------------------
13006|   266k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (13006:13): [True: 266k, False: 127]
  ------------------
13007|   266k|          state = state::SCHEME;
13008|   266k|          input_position++;
13009|   266k|        } else {
13010|       |          // Otherwise, if state override is not given, set state to no scheme
13011|       |          // state and decrease pointer by 1.
13012|    128|          state = state::NO_SCHEME;
13013|    128|        }
13014|   266k|        break;
13015|      0|      }
13016|   266k|      case state::SCHEME: {
  ------------------
  |  Branch (13016:7): [True: 266k, False: 1.52M]
  ------------------
13017|   266k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
13018|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
13019|       |        // append c, lowercased, to buffer.
13020|  1.15M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13020:16): [True: 1.15M, False: 2]
  ------------------
13021|  1.15M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (13021:16): [True: 890k, False: 266k]
  ------------------
13022|   890k|          input_position++;
13023|   890k|        }
13024|       |        // Otherwise, if c is U+003A (:), then:
13025|   266k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13025:13): [True: 266k, False: 2]
  ------------------
13026|   266k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (13026:13): [True: 266k, False: 80]
  ------------------
13027|   266k|          ada_log("SCHEME the scheme should be ",
13028|   266k|                  url_data.substr(0, input_position));
13029|       |          if constexpr (result_type_is_ada_url) {
13030|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
13031|       |              return url;
13032|       |            }
13033|   266k|          } else {
13034|       |            // we pass the colon along instead of painfully adding it back.
13035|   266k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (13035:17): [True: 0, False: 266k]
  ------------------
13036|   266k|                    url_data.substr(0, input_position + 1))) {
13037|      0|              return url;
13038|      0|            }
13039|   266k|          }
13040|   266k|          ada_log("SCHEME the scheme is ", url.get_protocol());
13041|       |
13042|       |          // If url's scheme is "file", then:
13043|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
13044|   266k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (13044:15): [True: 1.44k, False: 264k]
  ------------------
13045|       |            // Set state to file state.
13046|  1.44k|            state = state::FILE;
13047|  1.44k|          }
13048|       |          // Otherwise, if url is special, base is non-null, and base's scheme
13049|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
13050|       |          // != nullptr is false.
13051|   264k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (13051:20): [True: 262k, False: 1.81k]
  |  Branch (13051:40): [True: 0, False: 262k]
  ------------------
13052|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (13052:20): [True: 0, False: 0]
  ------------------
13053|       |            // Set state to special relative or authority state.
13054|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
13055|      0|          }
13056|       |          // Otherwise, if url is special, set state to special authority
13057|       |          // slashes state.
13058|   264k|          else if (url.is_special()) {
  ------------------
  |  Branch (13058:20): [True: 262k, False: 1.81k]
  ------------------
13059|   262k|            state = state::SPECIAL_AUTHORITY_SLASHES;
13060|   262k|          }
13061|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
13062|       |          // path or authority state and increase pointer by 1.
13063|  1.81k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (13063:20): [True: 1.65k, False: 153]
  ------------------
13064|  1.65k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (13064:20): [True: 1.08k, False: 579]
  ------------------
13065|  1.08k|            state = state::PATH_OR_AUTHORITY;
13066|  1.08k|            input_position++;
13067|  1.08k|          }
13068|       |          // Otherwise, set url's path to the empty string and set state to
13069|       |          // opaque path state.
13070|    732|          else {
13071|    732|            state = state::OPAQUE_PATH;
13072|    732|          }
13073|   266k|        }
13074|       |        // Otherwise, if state override is not given, set buffer to the empty
13075|       |        // string, state to no scheme state, and start over (from the first code
13076|       |        // point in input).
13077|     82|        else {
13078|     82|          state = state::NO_SCHEME;
13079|     82|          input_position = 0;
13080|     82|          break;
13081|     82|        }
13082|   266k|        input_position++;
13083|   266k|        break;
13084|   266k|      }
13085|    210|      case state::NO_SCHEME: {
  ------------------
  |  Branch (13085:7): [True: 210, False: 1.79M]
  ------------------
13086|    210|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
13087|       |        // The fragment was pruned from url_data before the state machine ran,
13088|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
13089|       |        // nothing else remains in front of it.
13090|    210|        const bool c_is_hash =
13091|    210|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (13091:13): [True: 121, False: 89]
  |  Branch (13091:37): [True: 1, False: 120]
  ------------------
13092|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
13093|       |        // validation error, return failure.
13094|    210|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (13094:13): [True: 210, False: 0]
  |  Branch (13094:37): [True: 0, False: 0]
  |  Branch (13094:66): [True: 0, False: 0]
  ------------------
13095|    210|          ada_log("NO_SCHEME validation error");
13096|    210|          url.is_valid = false;
13097|    210|          return url;
13098|    210|        }
13099|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
13100|       |        // set url's scheme to base's scheme, url's path to base's path, url's
13101|       |        // query to base's query, and set state to fragment state.
13102|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (13102:18): [True: 0, False: 0]
  |  Branch (13102:47): [True: 0, False: 0]
  ------------------
13103|      0|          ada_log("NO_SCHEME opaque base with fragment");
13104|      0|          url.copy_scheme(*base_url);
13105|      0|          url.has_opaque_path = base_url->has_opaque_path;
13106|       |
13107|       |          if constexpr (result_type_is_ada_url) {
13108|       |            url.path = base_url->path;
13109|       |            url.query = base_url->query;
13110|      0|          } else {
13111|      0|            url.update_base_pathname(base_url->get_pathname());
13112|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13112:17): [True: 0, False: 0]
  ------------------
13113|       |              // get_search() returns "" for an empty query string (URL ends
13114|       |              // with '?'). update_base_search("") would incorrectly clear the
13115|       |              // query, so pass "?" to preserve the empty query distinction.
13116|      0|              auto s = base_url->get_search();
13117|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13117:38): [True: 0, False: 0]
  ------------------
13118|      0|            }
13119|      0|          }
13120|      0|          url.update_unencoded_base_hash(*fragment);
13121|      0|          enforce_max_input_length();
13122|      0|          return url;
13123|      0|        }
13124|       |        // Otherwise, if base's scheme is not "file", set state to relative
13125|       |        // state and decrease pointer by 1.
13126|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13127|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (13127:18): [True: 0, False: 0]
  ------------------
13128|      0|          ada_log("NO_SCHEME non-file relative path");
13129|      0|          state = state::RELATIVE_SCHEME;
13130|      0|        }
13131|       |        // Otherwise, set state to file state and decrease pointer by 1.
13132|      0|        else {
13133|      0|          ada_log("NO_SCHEME file base type");
13134|      0|          state = state::FILE;
13135|      0|        }
13136|      0|        break;
13137|    210|      }
13138|   263k|      case state::AUTHORITY: {
  ------------------
  |  Branch (13138:7): [True: 263k, False: 1.53M]
  ------------------
13139|   263k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
13140|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
13141|       |        // about AUTHORITY. Of course, we could have @ and still not have to
13142|       |        // worry about AUTHORITY.
13143|       |        // TODO: Instead of just collecting a bool, collect the location of the
13144|       |        // '@' and do something useful with it.
13145|       |        // TODO: We could do various processing early on, using a single pass
13146|       |        // over the string to collect information about it, e.g., telling us
13147|       |        // whether there is a @ and if so, where (or how many).
13148|       |
13149|       |        // Check if url data contains an @.
13150|   263k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (13150:13): [True: 223k, False: 40.5k]
  ------------------
13151|   223k|          state = state::HOST;
13152|   223k|          break;
13153|   223k|        }
13154|  40.5k|        bool at_sign_seen{false};
13155|  40.5k|        bool password_token_seen{false};
13156|       |        /**
13157|       |         * We expect something of the sort...
13158|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
13159|       |         * --------^
13160|       |         */
13161|  93.9k|        do {
13162|  93.9k|          std::string_view view = url_data.substr(input_position);
13163|       |          // The delimiters are @, /, ? \\.
13164|  93.9k|          size_t location =
13165|  93.9k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (13165:15): [True: 93.8k, False: 143]
  ------------------
13166|  93.9k|                               : helpers::find_authority_delimiter(view);
13167|  93.9k|          std::string_view authority_view = view.substr(0, location);
13168|  93.9k|          size_t end_of_authority = input_position + authority_view.size();
13169|       |          // If c is U+0040 (@), then:
13170|  93.9k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (13170:15): [True: 84.1k, False: 9.86k]
  ------------------
13171|  84.1k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (13171:15): [True: 53.4k, False: 30.6k]
  ------------------
13172|       |            // If atSignSeen is true, then prepend "%40" to buffer.
13173|  53.4k|            if (at_sign_seen) {
  ------------------
  |  Branch (13173:17): [True: 13.2k, False: 40.2k]
  ------------------
13174|  13.2k|              if (password_token_seen) {
  ------------------
  |  Branch (13174:19): [True: 4.07k, False: 9.14k]
  ------------------
13175|       |                if constexpr (result_type_is_ada_url) {
13176|       |                  url.password += "%40";
13177|  4.07k|                } else {
13178|  4.07k|                  url.append_base_password("%40");
13179|  4.07k|                }
13180|  9.14k|              } else {
13181|       |                if constexpr (result_type_is_ada_url) {
13182|       |                  url.username += "%40";
13183|  9.14k|                } else {
13184|  9.14k|                  url.append_base_username("%40");
13185|  9.14k|                }
13186|  9.14k|              }
13187|  13.2k|            }
13188|       |
13189|  53.4k|            at_sign_seen = true;
13190|       |
13191|  53.4k|            if (!password_token_seen) {
  ------------------
  |  Branch (13191:17): [True: 49.3k, False: 4.07k]
  ------------------
13192|  49.3k|              size_t password_token_location = authority_view.find(':');
13193|  49.3k|              password_token_seen =
13194|  49.3k|                  password_token_location != std::string_view::npos;
13195|       |
13196|  49.3k|              if constexpr (store_values) {
13197|  49.3k|                if (!password_token_seen) {
  ------------------
  |  Branch (13197:21): [True: 19.8k, False: 29.5k]
  ------------------
13198|       |                  if constexpr (result_type_is_ada_url) {
13199|       |                    url.username += unicode::percent_encode(
13200|       |                        authority_view,
13201|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13202|  19.8k|                  } else {
13203|  19.8k|                    url.append_base_username(unicode::percent_encode(
13204|  19.8k|                        authority_view,
13205|  19.8k|                        character_sets::USERINFO_PERCENT_ENCODE));
13206|  19.8k|                  }
13207|  29.5k|                } else {
13208|       |                  if constexpr (result_type_is_ada_url) {
13209|       |                    url.username += unicode::percent_encode(
13210|       |                        authority_view.substr(0, password_token_location),
13211|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13212|       |                    url.password += unicode::percent_encode(
13213|       |                        authority_view.substr(password_token_location + 1),
13214|       |                        character_sets::USERINFO_PERCENT_ENCODE);
13215|  29.5k|                  } else {
13216|  29.5k|                    url.append_base_username(unicode::percent_encode(
13217|  29.5k|                        authority_view.substr(0, password_token_location),
13218|  29.5k|                        character_sets::USERINFO_PERCENT_ENCODE));
13219|  29.5k|                    url.append_base_password(unicode::percent_encode(
13220|  29.5k|                        authority_view.substr(password_token_location + 1),
13221|  29.5k|                        character_sets::USERINFO_PERCENT_ENCODE));
13222|  29.5k|                  }
13223|  29.5k|                }
13224|  49.3k|              }
13225|  49.3k|            } else if constexpr (store_values) {
13226|       |              if constexpr (result_type_is_ada_url) {
13227|       |                url.password += unicode::percent_encode(
13228|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
13229|  4.07k|              } else {
13230|  4.07k|                url.append_base_password(unicode::percent_encode(
13231|  4.07k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
13232|  4.07k|              }
13233|  4.07k|            }
13234|  53.4k|          }
13235|       |          // Otherwise, if one of the following is true:
13236|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13237|       |          // - url is special and c is U+005C (\)
13238|  40.5k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (13238:20): [True: 9.86k, False: 30.6k]
  ------------------
13239|  30.6k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (13239:20): [True: 30.4k, False: 161]
  ------------------
13240|    161|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (13240:20): [True: 122, False: 39]
  ------------------
13241|  40.5k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (13241:21): [True: 39, False: 0]
  |  Branch (13241:41): [True: 39, False: 0]
  ------------------
13242|       |            // If atSignSeen is true and authority_view is the empty string,
13243|       |            // validation error, return failure.
13244|  40.5k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (13244:17): [True: 40.2k, False: 265]
  |  Branch (13244:33): [True: 243, False: 40.0k]
  ------------------
13245|    243|              url.is_valid = false;
13246|    243|              return url;
13247|    243|            }
13248|  40.2k|            state = state::HOST;
13249|  40.2k|            break;
13250|  40.5k|          }
13251|  53.4k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (13251:15): [True: 0, False: 53.4k]
  ------------------
13252|      0|            if constexpr (store_values) {
13253|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (13253:19): [True: 0, False: 0]
  ------------------
13254|      0|                url.update_unencoded_base_hash(*fragment);
13255|      0|              }
13256|      0|            }
13257|      0|            enforce_max_input_length();
13258|      0|            return url;
13259|      0|          }
13260|  53.4k|          input_position = end_of_authority + 1;
13261|  53.4k|        } while (true);
  ------------------
  |  Branch (13261:18): [True: 53.4k, Folded]
  ------------------
13262|       |
13263|  40.2k|        break;
13264|  40.5k|      }
13265|  40.2k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (13265:7): [True: 0, False: 1.79M]
  ------------------
13266|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
13267|      0|                helpers::substring(url_data, input_position));
13268|       |
13269|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13270|       |        // then set state to special authority ignore slashes state and increase
13271|       |        // pointer by 1.
13272|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13272:13): [True: 0, False: 0]
  ------------------
13273|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13274|      0|          input_position += 2;
13275|      0|        } else {
13276|       |          // Otherwise, validation error, set state to relative state and
13277|       |          // decrease pointer by 1.
13278|      0|          state = state::RELATIVE_SCHEME;
13279|      0|        }
13280|       |
13281|      0|        break;
13282|  40.5k|      }
13283|  1.08k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (13283:7): [True: 1.08k, False: 1.79M]
  ------------------
13284|  1.08k|        ada_log("PATH_OR_AUTHORITY ",
13285|  1.08k|                helpers::substring(url_data, input_position));
13286|       |
13287|       |        // If c is U+002F (/), then set state to authority state.
13288|  1.08k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13288:13): [True: 1.04k, False: 34]
  ------------------
13289|  1.04k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13289:13): [True: 741, False: 305]
  ------------------
13290|    741|          state = state::AUTHORITY;
13291|    741|          input_position++;
13292|    741|        } else {
13293|       |          // Otherwise, set state to path state, and decrease pointer by 1.
13294|    339|          state = state::PATH;
13295|    339|        }
13296|       |
13297|  1.08k|        break;
13298|  40.5k|      }
13299|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (13299:7): [True: 0, False: 1.79M]
  ------------------
13300|      0|        ada_log("RELATIVE_SCHEME ",
13301|      0|                helpers::substring(url_data, input_position));
13302|       |
13303|       |        // Set url's scheme to base's scheme.
13304|      0|        url.copy_scheme(*base_url);
13305|       |
13306|       |        // If c is U+002F (/), then set state to relative slash state.
13307|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13307:13): [True: 0, False: 0]
  ------------------
13308|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
13309|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13309:13): [True: 0, False: 0]
  ------------------
13310|      0|          ada_log(
13311|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13312|      0|              "slash state");
13313|      0|          state = state::RELATIVE_SLASH;
13314|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13314:20): [True: 0, False: 0]
  |  Branch (13314:40): [True: 0, False: 0]
  ------------------
13315|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13315:20): [True: 0, False: 0]
  ------------------
13316|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13317|       |          // set state to relative slash state.
13318|      0|          ada_log(
13319|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13320|      0|              "error, set state to relative slash state");
13321|      0|          state = state::RELATIVE_SLASH;
13322|      0|        } else {
13323|      0|          ada_log("RELATIVE_SCHEME otherwise");
13324|       |          // Set url's username to base's username, url's password to base's
13325|       |          // password, url's host to base's host, url's port to base's port,
13326|       |          // url's path to a clone of base's path, and url's query to base's
13327|       |          // query.
13328|       |          if constexpr (result_type_is_ada_url) {
13329|       |            url.username = base_url->username;
13330|       |            url.password = base_url->password;
13331|       |            url.host = base_url->host;
13332|       |            url.port = base_url->port;
13333|       |            // cloning the base path includes cloning the has_opaque_path flag
13334|       |            url.has_opaque_path = base_url->has_opaque_path;
13335|       |            url.path = base_url->path;
13336|       |            url.query = base_url->query;
13337|      0|          } else {
13338|      0|            url.update_base_authority(base_url->get_href(),
13339|      0|                                      base_url->get_components());
13340|      0|            url.update_host_to_base_host(base_url->get_hostname());
13341|      0|            url.update_base_port(base_url->retrieve_base_port());
13342|       |            // cloning the base path includes cloning the has_opaque_path flag
13343|      0|            url.has_opaque_path = base_url->has_opaque_path;
13344|      0|            url.update_base_pathname(base_url->get_pathname());
13345|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13345:17): [True: 0, False: 0]
  ------------------
13346|       |              // get_search() returns "" for an empty query string (URL ends
13347|       |              // with '?'). update_base_search("") would incorrectly clear the
13348|       |              // query, so pass "?" to preserve the empty query distinction.
13349|      0|              auto s = base_url->get_search();
13350|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13350:38): [True: 0, False: 0]
  ------------------
13351|      0|            }
13352|      0|          }
13353|       |
13354|      0|          url.has_opaque_path = base_url->has_opaque_path;
13355|       |
13356|       |          // If c is U+003F (?), then set url's query to the empty string, and
13357|       |          // state to query state.
13358|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13358:15): [True: 0, False: 0]
  ------------------
13359|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13359:15): [True: 0, False: 0]
  ------------------
13360|      0|            state = state::QUERY;
13361|      0|          }
13362|       |          // Otherwise, if c is not the EOF code point:
13363|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13363:20): [True: 0, False: 0]
  ------------------
13364|       |            // Set url's query to null.
13365|      0|            url.clear_search();
13366|       |            if constexpr (result_type_is_ada_url) {
13367|       |              // Shorten url's path.
13368|       |              helpers::shorten_path(url.path, url.type);
13369|      0|            } else {
13370|      0|              std::string_view path = url.get_pathname();
13371|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13371:19): [True: 0, False: 0]
  ------------------
13372|      0|                url.update_base_pathname(std::move(std::string(path)));
13373|      0|              }
13374|      0|            }
13375|       |            // Set state to path state and decrease pointer by 1.
13376|      0|            state = state::PATH;
13377|      0|            break;
13378|      0|          }
13379|      0|        }
13380|      0|        input_position++;
13381|      0|        break;
13382|      0|      }
13383|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13383:7): [True: 0, False: 1.79M]
  ------------------
13384|      0|        ada_log("RELATIVE_SLASH ",
13385|      0|                helpers::substring(url_data, input_position));
13386|       |
13387|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13388|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13389|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13389:13): [True: 0, False: 0]
  |  Branch (13389:33): [True: 0, False: 0]
  ------------------
13390|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13390:14): [True: 0, False: 0]
  ------------------
13391|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13391:14): [True: 0, False: 0]
  ------------------
13392|       |          // Set state to special authority ignore slashes state.
13393|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13394|      0|        }
13395|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13396|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13396:18): [True: 0, False: 0]
  ------------------
13397|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13397:18): [True: 0, False: 0]
  ------------------
13398|      0|          state = state::AUTHORITY;
13399|      0|        }
13400|       |        // Otherwise, set
13401|       |        // - url's username to base's username,
13402|       |        // - url's password to base's password,
13403|       |        // - url's host to base's host,
13404|       |        // - url's port to base's port,
13405|       |        // - state to path state, and then, decrease pointer by 1.
13406|      0|        else {
13407|       |          if constexpr (result_type_is_ada_url) {
13408|       |            url.username = base_url->username;
13409|       |            url.password = base_url->password;
13410|       |            url.host = base_url->host;
13411|       |            url.port = base_url->port;
13412|      0|          } else {
13413|      0|            url.update_base_authority(base_url->get_href(),
13414|      0|                                      base_url->get_components());
13415|      0|            url.update_host_to_base_host(base_url->get_hostname());
13416|      0|            url.update_base_port(base_url->retrieve_base_port());
13417|      0|          }
13418|      0|          state = state::PATH;
13419|      0|          break;
13420|      0|        }
13421|       |
13422|      0|        input_position++;
13423|      0|        break;
13424|      0|      }
13425|   262k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13425:7): [True: 262k, False: 1.53M]
  ------------------
13426|   262k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13427|   262k|                helpers::substring(url_data, input_position));
13428|       |
13429|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13430|       |        // then set state to special authority ignore slashes state and increase
13431|       |        // pointer by 1.
13432|   262k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13432:13): [True: 261k, False: 1.68k]
  ------------------
13433|   261k|          input_position += 2;
13434|   261k|        }
13435|       |
13436|   262k|        [[fallthrough]];
13437|   262k|      }
13438|   262k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13438:7): [True: 0, False: 1.79M]
  ------------------
13439|   262k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13440|   262k|                helpers::substring(url_data, input_position));
13441|       |
13442|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13443|       |        // authority state and decrease pointer by 1.
13444|   264k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13444:16): [True: 264k, False: 72]
  ------------------
13445|   264k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13445:17): [True: 645, False: 264k]
  ------------------
13446|   264k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13446:17): [True: 1.25k, False: 262k]
  ------------------
13447|  1.89k|          input_position++;
13448|  1.89k|        }
13449|   262k|        state = state::AUTHORITY;
13450|       |
13451|   262k|        break;
13452|   262k|      }
13453|  9.82k|      case state::QUERY: {
  ------------------
  |  Branch (13453:7): [True: 9.82k, False: 1.78M]
  ------------------
13454|  9.82k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13455|  9.82k|        if constexpr (store_values) {
13456|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13457|       |          // if url is special; otherwise the query percent-encode set.
13458|  9.82k|          const uint8_t* query_percent_encode_set =
13459|  9.82k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13459:15): [True: 8.64k, False: 1.17k]
  ------------------
13460|  9.82k|                               : character_sets::QUERY_PERCENT_ENCODE;
13461|       |
13462|       |          // Percent-encode after encoding, with encoding, buffer, and
13463|       |          // queryPercentEncodeSet, and append the result to url's query.
13464|  9.82k|          url.update_base_search(url_data.substr(input_position),
13465|  9.82k|                                 query_percent_encode_set);
13466|  9.82k|          ada_log("QUERY update_base_search completed ");
13467|  9.82k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13467:15): [True: 7.39k, False: 2.42k]
  ------------------
13468|  7.39k|            url.update_unencoded_base_hash(*fragment);
13469|  7.39k|          }
13470|  9.82k|        }
13471|  9.82k|        enforce_max_input_length();
13472|  9.82k|        return url;
13473|   262k|      }
13474|   263k|      case state::HOST: {
  ------------------
  |  Branch (13474:7): [True: 263k, False: 1.53M]
  ------------------
13475|   263k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13476|       |
13477|   263k|        std::string_view host_view = url_data.substr(input_position);
13478|   263k|        auto [location, found_colon] =
13479|   263k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13480|   263k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13480:26): [True: 263k, False: 0]
  ------------------
13481|   263k|                             ? input_position + location
13482|   263k|                             : input_size;
13483|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13484|       |        // Note: the 'found_colon' value is true if and only if a colon was
13485|       |        // encountered while not inside brackets.
13486|   263k|        if (found_colon) {
  ------------------
  |  Branch (13486:13): [True: 2.43k, False: 260k]
  ------------------
13487|       |          // If buffer is the empty string, validation error, return failure.
13488|       |          // Let host be the result of host parsing buffer with url is not
13489|       |          // special.
13490|  2.43k|          ada_log("HOST parsing ", host_view);
13491|  2.43k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13491:15): [True: 166, False: 2.26k]
  ------------------
13492|    166|            return url;
13493|    166|          }
13494|  2.26k|          ada_log("HOST parsing results in ", url.get_hostname());
13495|       |          // Set url's host to host, buffer to the empty string, and state to
13496|       |          // port state.
13497|  2.26k|          state = state::PORT;
13498|  2.26k|          input_position++;
13499|  2.26k|        }
13500|       |        // Otherwise, if one of the following is true:
13501|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13502|       |        // - url is special and c is U+005C (\)
13503|       |        // The get_host_delimiter_location function either brings us to
13504|       |        // the colon outside of the bracket, or to one of those characters.
13505|   260k|        else {
13506|       |          // If url is special and host_view is the empty string, validation
13507|       |          // error, return failure.
13508|   260k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13508:15): [True: 194, False: 260k]
  |  Branch (13508:36): [True: 107, False: 87]
  ------------------
13509|    107|            url.is_valid = false;
13510|    107|            return url;
13511|    107|          }
13512|   260k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13513|       |          // Let host be the result of host parsing host_view with url is not
13514|       |          // special.
13515|   260k|          if (host_view.empty()) {
  ------------------
  |  Branch (13515:15): [True: 87, False: 260k]
  ------------------
13516|     87|            url.update_base_hostname("");
13517|   260k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13517:22): [True: 20.5k, False: 240k]
  ------------------
13518|  20.5k|            return url;
13519|  20.5k|          }
13520|   240k|          ada_log("HOST parsing results in ", url.get_hostname(),
13521|   240k|                  " href=", url.get_href());
13522|       |
13523|       |          // Set url's host to host, and state to path start state.
13524|   240k|          state = state::PATH_START;
13525|   240k|        }
13526|       |
13527|   242k|        break;
13528|   263k|      }
13529|   242k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13529:7): [True: 732, False: 1.79M]
  ------------------
13530|    732|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13531|       |        // Opaque path, query, and fragment are structurally always valid:
13532|       |        // the parser would just percent-encode whatever is there. When we
13533|       |        // are not storing values (can_parse), we can return immediately.
13534|       |        // We must set has_opaque_path = true before returning so that when
13535|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13536|       |        // correctly rejects relative inputs against an opaque-path base
13537|       |        // (e.g. can_parse("", &"W:") must return false).
13538|       |        if constexpr (!store_values) {
13539|       |          url.has_opaque_path = true;
13540|       |          return url;
13541|       |        }
13542|    732|        std::string_view view = url_data.substr(input_position);
13543|       |        // If c is U+003F (?), then set url's query to the empty string and
13544|       |        // state to query state.
13545|    732|        size_t location = view.find('?');
13546|    732|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13546:13): [True: 462, False: 270]
  ------------------
13547|    462|          view.remove_suffix(view.size() - location);
13548|    462|          state = state::QUERY;
13549|    462|          input_position += location + 1;
13550|    462|        } else {
13551|    270|          input_position = input_size + 1;
13552|    270|        }
13553|    732|        url.has_opaque_path = true;
13554|       |
13555|       |        // This is a really unlikely scenario in real world. We should not seek
13556|       |        // to optimize it.
13557|    732|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13557:13): [True: 12, False: 720]
  ------------------
13558|     12|          std::string modified_view =
13559|     12|              std::string(view.substr(0, view.size() - 1)) + "%20";
13560|     12|          url.update_base_pathname(unicode::percent_encode(
13561|     12|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13562|    720|        } else {
13563|    720|          url.update_base_pathname(unicode::percent_encode(
13564|    720|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13565|    720|        }
13566|    732|        break;
13567|   263k|      }
13568|  2.26k|      case state::PORT: {
  ------------------
  |  Branch (13568:7): [True: 2.26k, False: 1.79M]
  ------------------
13569|  2.26k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13570|  2.26k|        std::string_view port_view = url_data.substr(input_position);
13571|  2.26k|        input_position += url.parse_port(port_view, true);
13572|  2.26k|        if (!url.is_valid) {
  ------------------
  |  Branch (13572:13): [True: 227, False: 2.04k]
  ------------------
13573|    227|          return url;
13574|    227|        }
13575|  2.04k|        state = state::PATH_START;
13576|  2.04k|        [[fallthrough]];
13577|  2.04k|      }
13578|   243k|      case state::PATH_START: {
  ------------------
  |  Branch (13578:7): [True: 241k, False: 1.55M]
  ------------------
13579|   243k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13580|       |        // Path, query, and fragment are structurally always valid: the
13581|       |        // parser would just percent-encode whatever is there. When we are
13582|       |        // not storing values (can_parse), we can return immediately since
13583|       |        // no subsequent state can invalidate the URL.
13584|       |        if constexpr (!store_values) {
13585|       |          return url;
13586|       |        }
13587|       |
13588|       |        // If url is special, then:
13589|   243k|        if (url.is_special()) {
  ------------------
  |  Branch (13589:13): [True: 242k, False: 669]
  ------------------
13590|       |          // Set state to path state.
13591|   242k|          state = state::PATH;
13592|       |
13593|       |          // Optimization: Avoiding going into PATH state improves the
13594|       |          // performance of urls ending with /.
13595|   242k|          if (input_position == input_size) {
  ------------------
  |  Branch (13595:15): [True: 30.3k, False: 212k]
  ------------------
13596|  30.3k|            if constexpr (store_values) {
13597|  30.3k|              url.update_base_pathname("/");
13598|  30.3k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13598:19): [True: 275, False: 30.0k]
  ------------------
13599|    275|                url.update_unencoded_base_hash(*fragment);
13600|    275|              }
13601|  30.3k|            }
13602|  30.3k|            enforce_max_input_length();
13603|  30.3k|            return url;
13604|  30.3k|          }
13605|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13606|       |          // by 1. We know that (input_position == input_size) is impossible
13607|       |          // here, because of the previous if-check.
13608|   212k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13608:15): [True: 1.01k, False: 211k]
  ------------------
13609|  1.01k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13609:15): [True: 611, False: 405]
  ------------------
13610|    611|            break;
13611|    611|          }
13612|   212k|        }
13613|       |        // Otherwise, if state override is not given and c is U+003F (?),
13614|       |        // set url's query to the empty string and state to query state.
13615|    669|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13615:18): [True: 543, False: 126]
  ------------------
13616|    543|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13616:18): [True: 111, False: 432]
  ------------------
13617|    111|          state = state::QUERY;
13618|    111|        }
13619|       |        // Otherwise, if c is not the EOF code point:
13620|    558|        else if (input_position != input_size) {
  ------------------
  |  Branch (13620:18): [True: 432, False: 126]
  ------------------
13621|       |          // Set state to path state.
13622|    432|          state = state::PATH;
13623|       |
13624|       |          // If c is not U+002F (/), then decrease pointer by 1.
13625|    432|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13625:15): [True: 0, False: 432]
  ------------------
13626|      0|            break;
13627|      0|          }
13628|    432|        }
13629|       |
13630|   212k|        input_position++;
13631|   212k|        break;
13632|   243k|      }
13633|   213k|      case state::PATH: {
  ------------------
  |  Branch (13633:7): [True: 213k, False: 1.58M]
  ------------------
13634|   213k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13635|       |        // Path, query, and fragment are structurally always valid: the
13636|       |        // parser would just percent-encode whatever is there. When we are
13637|       |        // not storing values (can_parse), we can return immediately since
13638|       |        // no subsequent state can invalidate the URL.
13639|       |        if constexpr (!store_values) {
13640|       |          return url;
13641|       |        }
13642|   213k|        std::string_view view = url_data.substr(input_position);
13643|       |
13644|       |        // Most time, we do not need percent encoding.
13645|       |        // Furthermore, we can immediately locate the '?'.
13646|   213k|        size_t locofquestionmark = view.find('?');
13647|   213k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13647:13): [True: 9.24k, False: 204k]
  ------------------
13648|  9.24k|          state = state::QUERY;
13649|  9.24k|          view.remove_suffix(view.size() - locofquestionmark);
13650|  9.24k|          input_position += locofquestionmark + 1;
13651|   204k|        } else {
13652|   204k|          input_position = input_size + 1;
13653|   204k|        }
13654|   213k|        if constexpr (store_values) {
13655|       |          if constexpr (result_type_is_ada_url) {
13656|       |            helpers::parse_prepared_path(view, url.type, url.path);
13657|   213k|          } else {
13658|   213k|            url.consume_prepared_path(view);
13659|   213k|            ADA_ASSERT_TRUE(url.validate());
13660|   213k|          }
13661|   213k|        }
13662|   213k|        break;
13663|   243k|      }
13664|  1.33k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13664:7): [True: 1.33k, False: 1.79M]
  ------------------
13665|  1.33k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13666|       |
13667|       |        // If c is U+002F (/) or U+005C (\), then:
13668|  1.33k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13668:13): [True: 1.33k, False: 1]
  ------------------
13669|  1.33k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13669:14): [True: 1.32k, False: 8]
  ------------------
13670|  1.32k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13670:14): [True: 2, False: 6]
  ------------------
13671|  1.32k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13672|       |          // Set state to file host state.
13673|  1.32k|          state = state::FILE_HOST;
13674|  1.32k|          input_position++;
13675|  1.32k|        } else {
13676|      7|          ada_log("FILE_SLASH otherwise");
13677|       |          // If base is non-null and base's scheme is "file", then:
13678|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13679|       |          // base_url_has_value() is true.
13680|      7|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13680:15): [True: 0, False: 7]
  |  Branch (13680:38): [True: 0, False: 0]
  ------------------
13681|       |            // Set url's host to base's host.
13682|       |            if constexpr (result_type_is_ada_url) {
13683|       |              url.host = base_url->host;
13684|      0|            } else {
13685|      0|              url.update_host_to_base_host(base_url->get_host());
13686|      0|            }
13687|       |            // If the code point substring from pointer to the end of input does
13688|       |            // not start with a Windows drive letter and base's path[0] is a
13689|       |            // normalized Windows drive letter, then append base's path[0] to
13690|       |            // url's path.
13691|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13691:17): [True: 0, False: 0]
  ------------------
13692|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13692:19): [True: 0, False: 0]
  ------------------
13693|      0|                      url_data.substr(input_position))) {
13694|      0|                std::string_view first_base_url_path =
13695|      0|                    base_url->get_pathname().substr(1);
13696|      0|                size_t loc = first_base_url_path.find('/');
13697|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13697:21): [True: 0, False: 0]
  ------------------
13698|      0|                  helpers::resize(first_base_url_path, loc);
13699|      0|                }
13700|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13700:21): [True: 0, False: 0]
  ------------------
13701|      0|                        first_base_url_path)) {
13702|       |                  if constexpr (result_type_is_ada_url) {
13703|       |                    url.path += '/';
13704|       |                    url.path += first_base_url_path;
13705|      0|                  } else {
13706|      0|                    url.append_base_pathname(
13707|      0|                        helpers::concat("/", first_base_url_path));
13708|      0|                  }
13709|      0|                }
13710|      0|              }
13711|      0|            }
13712|      0|          }
13713|       |
13714|       |          // Set state to path state, and decrease pointer by 1.
13715|      7|          state = state::PATH;
13716|      7|        }
13717|       |
13718|  1.33k|        break;
13719|   243k|      }
13720|  1.32k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13720:7): [True: 1.32k, False: 1.79M]
  ------------------
13721|  1.32k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13722|  1.32k|        std::string_view view = url_data.substr(input_position);
13723|       |
13724|  1.32k|        size_t location = view.find_first_of("/\\?");
13725|  1.32k|        std::string_view file_host_buffer = view.substr(
13726|  1.32k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13726:16): [True: 1.29k, False: 37]
  ------------------
13727|       |
13728|  1.32k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13728:13): [True: 1, False: 1.32k]
  ------------------
13729|      1|          state = state::PATH;
13730|  1.32k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13730:20): [True: 247, False: 1.07k]
  ------------------
13731|       |          // Set url's host to the empty string.
13732|       |          if constexpr (result_type_is_ada_url) {
13733|       |            url.host = "";
13734|    247|          } else {
13735|    247|            url.update_base_hostname("");
13736|    247|          }
13737|       |          // Set state to path start state.
13738|    247|          state = state::PATH_START;
13739|  1.07k|        } else {
13740|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13741|  1.07k|          input_position += consumed_bytes;
13742|       |          // Let host be the result of host parsing buffer with url is not
13743|       |          // special.
13744|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13744:15): [True: 92, False: 987]
  ------------------
13745|     92|            return url;
13746|     92|          }
13747|       |
13748|       |          if constexpr (result_type_is_ada_url) {
13749|       |            // If host is "localhost", then set host to the empty string.
13750|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13751|       |              url.host = "";
13752|       |            }
13753|    987|          } else {
13754|    987|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13754:17): [True: 3, False: 984]
  ------------------
13755|      3|              url.update_base_hostname("");
13756|      3|            }
13757|    987|          }
13758|       |
13759|       |          // Set buffer to the empty string and state to path start state.
13760|    987|          state = state::PATH_START;
13761|    987|        }
13762|       |
13763|  1.23k|        break;
13764|  1.32k|      }
13765|  1.44k|      case state::FILE: {
  ------------------
  |  Branch (13765:7): [True: 1.44k, False: 1.79M]
  ------------------
13766|  1.44k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13767|  1.44k|        std::string_view file_view = url_data.substr(input_position);
13768|       |
13769|  1.44k|        url.set_protocol_as_file();
13770|       |        if constexpr (result_type_is_ada_url) {
13771|       |          // Set url's host to the empty string.
13772|       |          url.host = "";
13773|  1.44k|        } else {
13774|  1.44k|          url.update_base_hostname("");
13775|  1.44k|        }
13776|       |        // If c is U+002F (/) or U+005C (\), then:
13777|  1.44k|        if (input_position != input_size &&
  ------------------
  |  Branch (13777:13): [True: 1.44k, False: 1]
  ------------------
13778|  1.44k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13778:14): [True: 1.33k, False: 108]
  ------------------
13779|  1.33k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13779:14): [True: 1, False: 107]
  ------------------
13780|  1.33k|          ada_log("FILE c is U+002F or U+005C");
13781|       |          // Set state to file slash state.
13782|  1.33k|          state = state::FILE_SLASH;
13783|  1.33k|        }
13784|       |        // Otherwise, if base is non-null and base's scheme is "file":
13785|    108|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13785:18): [True: 0, False: 108]
  |  Branch (13785:41): [True: 0, False: 0]
  ------------------
13786|       |          // Set url's host to base's host, url's path to a clone of base's
13787|       |          // path, and url's query to base's query.
13788|      0|          ada_log("FILE base non-null");
13789|       |          if constexpr (result_type_is_ada_url) {
13790|       |            url.host = base_url->host;
13791|       |            url.path = base_url->path;
13792|       |            url.query = base_url->query;
13793|      0|          } else {
13794|      0|            url.update_host_to_base_host(base_url->get_hostname());
13795|      0|            url.update_base_pathname(base_url->get_pathname());
13796|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13796:17): [True: 0, False: 0]
  ------------------
13797|       |              // get_search() returns "" for an empty query string (URL ends
13798|       |              // with '?'). update_base_search("") would incorrectly clear the
13799|       |              // query, so pass "?" to preserve the empty query distinction.
13800|      0|              auto s = base_url->get_search();
13801|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13801:38): [True: 0, False: 0]
  ------------------
13802|      0|            }
13803|      0|          }
13804|      0|          url.has_opaque_path = base_url->has_opaque_path;
13805|       |
13806|       |          // If c is U+003F (?), then set url's query to the empty string and
13807|       |          // state to query state.
13808|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13808:15): [True: 0, False: 0]
  |  Branch (13808:47): [True: 0, False: 0]
  ------------------
13809|      0|            state = state::QUERY;
13810|      0|          }
13811|       |          // Otherwise, if c is not the EOF code point:
13812|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13812:20): [True: 0, False: 0]
  ------------------
13813|       |            // Set url's query to null.
13814|      0|            url.clear_search();
13815|       |            // If the code point substring from pointer to the end of input does
13816|       |            // not start with a Windows drive letter, then shorten url's path.
13817|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13817:17): [True: 0, False: 0]
  ------------------
13818|       |              if constexpr (result_type_is_ada_url) {
13819|       |                helpers::shorten_path(url.path, url.type);
13820|      0|              } else {
13821|      0|                std::string_view path = url.get_pathname();
13822|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13822:21): [True: 0, False: 0]
  ------------------
13823|      0|                  url.update_base_pathname(std::move(std::string(path)));
13824|      0|                }
13825|      0|              }
13826|      0|            }
13827|       |            // Otherwise:
13828|      0|            else {
13829|       |              // Set url's path to an empty list.
13830|      0|              url.clear_pathname();
13831|      0|              url.has_opaque_path = true;
13832|      0|            }
13833|       |
13834|       |            // Set state to path state and decrease pointer by 1.
13835|      0|            state = state::PATH;
13836|      0|            break;
13837|      0|          }
13838|      0|        }
13839|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13840|    108|        else {
13841|    108|          ada_log("FILE go to path");
13842|    108|          state = state::PATH;
13843|    108|          break;
13844|    108|        }
13845|       |
13846|  1.33k|        input_position++;
13847|  1.33k|        break;
13848|  1.44k|      }
13849|      0|      default:
  ------------------
  |  Branch (13849:7): [True: 0, False: 1.79M]
  ------------------
13850|      0|        unreachable();
13851|  1.79M|    }
13852|  1.79M|  }
13853|   556k|  if constexpr (store_values) {
13854|   556k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13854:9): [True: 2.30k, False: 554k]
  ------------------
13855|  2.30k|      url.update_unencoded_base_hash(*fragment);
13856|  2.30k|    }
13857|   556k|  }
13858|   556k|  enforce_max_input_length();
13859|   556k|  return url;
13860|   618k|}
_ZN3ada14url_aggregator8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14446|   198k|bool url_aggregator::set_href(const std::string_view input) {
14447|   198k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14448|   198k|  ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
14449|   198k|  ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
14450|   198k|  ada_log("url_aggregator::set_href, success :", out.has_value());
14451|       |
14452|   198k|  if (out) {
  ------------------
  |  Branch (14452:7): [True: 198k, False: 0]
  ------------------
14453|       |    // The parser enforces get_max_input_length() on both the input and the
14454|       |    // normalized result. This is a defense-in-depth check.
14455|   198k|    if (out->buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (14455:9): [True: 0, False: 198k]
  ------------------
14456|      0|      return false;
14457|      0|    }
14458|   198k|    ada_log("url_aggregator::set_href, parsed ", out->to_string());
14459|       |    // TODO: Figure out why the following line puts test to never finish.
14460|   198k|    *this = std::move(*out);
14461|   198k|  }
14462|       |
14463|   198k|  return out.has_value();
14464|   198k|}
_ZNK3ada14url_aggregator12get_usernameEv:
14813|   198k|    ada_lifetime_bound {
14814|   198k|  ada_log("url_aggregator::get_username");
14815|   198k|  if (has_non_empty_username()) {
  ------------------
  |  Branch (14815:7): [True: 10.1k, False: 188k]
  ------------------
14816|  10.1k|    return helpers::substring(buffer, components.protocol_end + 2,
14817|  10.1k|                              components.username_end);
14818|  10.1k|  }
14819|   188k|  return "";
14820|   198k|}
_ZNK3ada14url_aggregator12get_passwordEv:
14823|   198k|    ada_lifetime_bound {
14824|   198k|  ada_log("url_aggregator::get_password");
14825|   198k|  if (has_non_empty_password()) {
  ------------------
  |  Branch (14825:7): [True: 9.81k, False: 189k]
  ------------------
14826|  9.81k|    return helpers::substring(buffer, components.username_end + 1,
14827|  9.81k|                              components.host_start);
14828|  9.81k|  }
14829|   189k|  return "";
14830|   198k|}
_ZNK3ada14url_aggregator8get_portEv:
14833|   198k|    ada_lifetime_bound {
14834|   198k|  ada_log("url_aggregator::get_port");
14835|   198k|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (14835:7): [True: 178k, False: 20.7k]
  ------------------
14836|   178k|    return "";
14837|   178k|  }
14838|  20.7k|  return helpers::substring(buffer, components.host_end + 1,
14839|  20.7k|                            components.pathname_start);
14840|   198k|}
_ZNK3ada14url_aggregator8get_hashEv:
14843|   198k|    ada_lifetime_bound {
14844|   198k|  ada_log("url_aggregator::get_hash");
14845|       |  // If this's URL's fragment is either null or the empty string, then return
14846|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
14847|   198k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (14847:7): [True: 174k, False: 24.4k]
  ------------------
14848|   174k|    return "";
14849|   174k|  }
14850|  24.4k|  if (buffer.size() - components.hash_start <= 1) {
  ------------------
  |  Branch (14850:7): [True: 1.51k, False: 22.8k]
  ------------------
14851|  1.51k|    return "";
14852|  1.51k|  }
14853|  22.8k|  return helpers::substring(buffer, components.hash_start);
14854|  24.4k|}
_ZNK3ada14url_aggregator8get_hostEv:
14857|   198k|    ada_lifetime_bound {
14858|   198k|  ada_log("url_aggregator::get_host");
14859|       |  // Technically, we should check if there is a hostname, but
14860|       |  // the code below works even if there isn't.
14861|       |  // if(!has_hostname()) { return ""; }
14862|   198k|  size_t start = components.host_start;
14863|   198k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14863:7): [True: 198k, False: 508]
  ------------------
14864|   198k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14864:7): [True: 10.1k, False: 188k]
  ------------------
14865|  10.1k|    start++;
14866|  10.1k|  }
14867|       |  // if we have an empty host, then the space between components.host_end and
14868|       |  // components.pathname_start may be occupied by /.
14869|   198k|  if (start == components.host_end) {
  ------------------
  |  Branch (14869:7): [True: 508, False: 198k]
  ------------------
14870|    508|    return {};
14871|    508|  }
14872|   198k|  return helpers::substring(buffer, start, components.pathname_start);
14873|   198k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14876|   263k|    ada_lifetime_bound {
14877|   263k|  ada_log("url_aggregator::get_hostname");
14878|       |  // Technically, we should check if there is a hostname, but
14879|       |  // the code below works even if there isn't.
14880|       |  // if(!has_hostname()) { return ""; }
14881|   263k|  size_t start = components.host_start;
14882|       |  // So host_start is not where the host begins.
14883|   263k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14883:7): [True: 199k, False: 64.1k]
  ------------------
14884|   199k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14884:7): [True: 10.3k, False: 189k]
  ------------------
14885|  10.3k|    start++;
14886|  10.3k|  }
14887|   263k|  return helpers::substring(buffer, start, components.host_end);
14888|   263k|}
_ZNK3ada14url_aggregator10get_searchEv:
14891|   198k|    ada_lifetime_bound {
14892|   198k|  ada_log("url_aggregator::get_search");
14893|       |  // If this's URL's query is either null or the empty string, then return the
14894|       |  // empty string. Return U+003F (?), followed by this's URL's query.
14895|   198k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (14895:7): [True: 165k, False: 33.8k]
  ------------------
14896|   165k|    return "";
14897|   165k|  }
14898|  33.8k|  auto ending_index = uint32_t(buffer.size());
14899|  33.8k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (14899:7): [True: 13.4k, False: 20.3k]
  ------------------
14900|  13.4k|    ending_index = components.hash_start;
14901|  13.4k|  }
14902|  33.8k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (14902:7): [True: 1.15k, False: 32.6k]
  ------------------
14903|  1.15k|    return "";
14904|  1.15k|  }
14905|  32.6k|  return helpers::substring(buffer, components.search_start, ending_index);
14906|  33.8k|}
_ZNK3ada14url_aggregator12get_protocolEv:
14909|   198k|    ada_lifetime_bound {
14910|   198k|  ada_log("url_aggregator::get_protocol");
14911|   198k|  return helpers::substring(buffer, 0, components.protocol_end);
14912|   198k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
15021|  58.1k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
15022|  58.1k|  ada_log("parse_ipv4 ", input, " [", input.size(),
15023|  58.1k|          " bytes], overlaps with buffer: ",
15024|  58.1k|          helpers::overlaps(input, buffer) ? "yes" : "no");
15025|  58.1k|  ADA_ASSERT_TRUE(validate());
15026|  58.1k|  if (input.empty()) {
  ------------------
  |  Branch (15026:7): [True: 0, False: 58.1k]
  ------------------
15027|      0|    return is_valid = false;
15028|      0|  }
15029|  58.1k|  const bool trailing_dot = (input.back() == '.');
15030|  58.1k|  if (trailing_dot) {
  ------------------
  |  Branch (15030:7): [True: 28.1k, False: 30.0k]
  ------------------
15031|  28.1k|    input.remove_suffix(1);
15032|  28.1k|    if (input.empty()) {
  ------------------
  |  Branch (15032:9): [True: 0, False: 28.1k]
  ------------------
15033|      0|      return is_valid = false;
15034|      0|    }
15035|  28.1k|  }
15036|       |
15037|  58.1k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
15038|  58.1k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (15038:7): [True: 18.7k, False: 39.4k]
  ------------------
15039|       |    // Pure decimal: keep the buffer when it already holds the address.
15040|       |    // Otherwise write the (trailing-dot-stripped) input.
15041|  18.7k|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (15041:11): [True: 0, False: 18.7k]
  |  Branch (15041:23): [True: 0, False: 0]
  ------------------
15042|  18.7k|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (15042:11): [True: 0, False: 18.7k]
  ------------------
15043|      0|        update_base_hostname(std::string(input));
15044|  18.7k|      } else {
15045|  18.7k|        update_base_hostname(input);
15046|  18.7k|      }
15047|  18.7k|    }
15048|  18.7k|    host_type = IPV4;
15049|  18.7k|    ADA_ASSERT_TRUE(validate());
15050|  18.7k|    return true;
15051|  18.7k|  }
15052|       |
15053|  39.4k|  const char* p = input.data();
15054|  39.4k|  const char* end = p + input.size();
15055|  39.4k|  uint64_t ipv4 = 0;
15056|  39.4k|  int digit_count = 0;
15057|  39.4k|  int pure_decimal_count = 0;
15058|       |
15059|  49.6k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (15059:10): [True: 49.6k, False: 15]
  |  Branch (15059:29): [True: 49.6k, False: 0]
  ------------------
15060|  49.6k|    uint64_t segment = 0;
15061|  49.6k|    bool pure = false;
15062|  49.6k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (15062:9): [True: 19.0k, False: 30.5k]
  ------------------
15063|  19.0k|      return is_valid = false;
15064|  19.0k|    }
15065|  30.5k|    if (pure) {
  ------------------
  |  Branch (15065:9): [True: 11.3k, False: 19.2k]
  ------------------
15066|  11.3k|      ++pure_decimal_count;
15067|  11.3k|    }
15068|  30.5k|    if (p >= end) {
  ------------------
  |  Branch (15068:9): [True: 20.3k, False: 10.2k]
  ------------------
15069|  20.3k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
15070|  20.3k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (15070:11): [True: 22, False: 20.3k]
  ------------------
15071|     22|        return is_valid = false;
15072|     22|      }
15073|  20.3k|      ipv4 = (ipv4 << shift) | segment;
15074|  20.3k|      goto ipv4_done;
15075|  20.3k|    }
15076|  10.2k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (15076:9): [True: 30, False: 10.1k]
  |  Branch (15076:26): [True: 0, False: 10.1k]
  ------------------
15077|     30|      return is_valid = false;
15078|     30|    }
15079|  10.1k|    ipv4 = (ipv4 << 8) | segment;
15080|  10.1k|    ++p;
15081|  10.1k|  }
15082|     15|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (15082:7): [True: 0, False: 15]
  |  Branch (15082:27): [True: 15, False: 0]
  ------------------
15083|     15|    return is_valid = false;
15084|     15|  }
15085|  20.3k|ipv4_done:
15086|  20.3k|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
15087|  20.3k|          " host: ", get_host());
15088|  20.3k|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (15088:7): [True: 0, False: 20.3k]
  |  Branch (15088:19): [True: 0, False: 0]
  |  Branch (15088:46): [True: 0, False: 0]
  ------------------
15089|      0|    ada_log(
15090|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
15091|      0|        "buffer");
15092|  20.3k|  } else {
15093|  20.3k|    update_base_hostname(ada::serializers::ipv4(ipv4));
15094|  20.3k|  }
15095|  20.3k|  host_type = IPV4;
15096|  20.3k|  ADA_ASSERT_TRUE(validate());
15097|  20.3k|  return true;
15098|     15|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15100|    598|bool url_aggregator::parse_ipv6(std::string_view input) {
15101|    598|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
15102|    598|  ADA_ASSERT_TRUE(validate());
15103|    598|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15104|    598|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (15104:7): [True: 22, False: 576]
  |  Branch (15104:24): [True: 9, False: 567]
  ------------------
15105|     31|    return is_valid = false;
15106|     31|  }
15107|    567|  std::array<uint16_t, 8> address{};
15108|       |#if defined(ADA_AVX512_IPV6)
15109|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
15110|       |                                                     address, simd_valid)) {
15111|       |    if (!simd_valid) [[unlikely]] {
15112|       |      return is_valid = false;
15113|       |    }
15114|       |    const std::string serialized = ada::serializers::ipv6(address);
15115|       |    if (get_hostname() != serialized) {
15116|       |      update_base_hostname(serialized);
15117|       |    }
15118|       |    host_type = IPV6;
15119|       |    return true;
15120|       |  }
15121|       |  address = {};
15122|       |#endif
15123|    567|  const char* pointer = input.data();
15124|    567|  const char* const end = pointer + input.size();
15125|    567|  int piece_index = 0;
15126|    567|  int compress = -1;
15127|       |
15128|    567|  if (*pointer == ':') {
  ------------------
  |  Branch (15128:7): [True: 284, False: 283]
  ------------------
15129|    284|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (15129:9): [True: 3, False: 281]
  |  Branch (15129:30): [True: 3, False: 278]
  ------------------
15130|      6|      return is_valid = false;
15131|      6|    }
15132|    278|    pointer += 2;
15133|    278|    compress = ++piece_index;
15134|    278|  }
15135|       |
15136|  1.61k|  while (pointer != end) {
  ------------------
  |  Branch (15136:10): [True: 1.16k, False: 454]
  ------------------
15137|  1.16k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (15137:9): [True: 3, False: 1.16k]
  ------------------
15138|      3|      return is_valid = false;
15139|      3|    }
15140|  1.16k|    if (*pointer == ':') {
  ------------------
  |  Branch (15140:9): [True: 162, False: 998]
  ------------------
15141|    162|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (15141:11): [True: 3, False: 159]
  ------------------
15142|      3|        return is_valid = false;
15143|      3|      }
15144|    159|      ++pointer;
15145|    159|      compress = ++piece_index;
15146|    159|      continue;
15147|    162|    }
15148|       |
15149|    998|    uint16_t value = 0;
15150|    998|    const int length = detail::parse_hex_piece(pointer, end, value);
15151|       |
15152|    998|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (15152:9): [True: 770, False: 228]
  |  Branch (15152:27): [True: 81, False: 689]
  ------------------
15153|     81|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15153:11): [True: 5, False: 76]
  ------------------
15154|      5|        return is_valid = false;
15155|      5|      }
15156|     76|      pointer -= length;
15157|     76|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (15157:11): [True: 3, False: 73]
  ------------------
15158|      3|        return is_valid = false;
15159|      3|      }
15160|       |
15161|     73|      int numbers_seen = 0;
15162|    220|      while (pointer != end) {
  ------------------
  |  Branch (15162:14): [True: 198, False: 22]
  ------------------
15163|    198|        int ipv4_piece = -1;
15164|    198|        if (numbers_seen > 0) {
  ------------------
  |  Branch (15164:13): [True: 125, False: 73]
  ------------------
15165|    125|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (15165:15): [True: 107, False: 18]
  |  Branch (15165:34): [True: 101, False: 6]
  ------------------
15166|    101|            ++pointer;
15167|    101|          } else {
15168|     24|            return is_valid = false;
15169|     24|          }
15170|    125|        }
15171|    174|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (15171:13): [True: 12, False: 162]
  |  Branch (15171:31): [True: 3, False: 159]
  |  Branch (15171:49): [True: 3, False: 156]
  ------------------
15172|     18|          return is_valid = false;
15173|     18|        }
15174|    156|        ipv4_piece = *pointer - '0';
15175|    156|        ++pointer;
15176|    156|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15176:13): [True: 143, False: 13]
  |  Branch (15176:31): [True: 67, False: 76]
  |  Branch (15176:50): [True: 64, False: 3]
  ------------------
15177|     64|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (15177:15): [True: 3, False: 61]
  ------------------
15178|      3|            return is_valid = false;
15179|      3|          }
15180|     61|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15181|     61|          ++pointer;
15182|     61|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (15182:15): [True: 58, False: 3]
  |  Branch (15182:33): [True: 34, False: 24]
  |  Branch (15182:52): [True: 31, False: 3]
  ------------------
15183|     31|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
15184|     31|            ++pointer;
15185|     31|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (15185:17): [True: 6, False: 25]
  ------------------
15186|      6|              return is_valid = false;
15187|      6|            }
15188|     31|          }
15189|     61|        }
15190|    147|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
15191|    147|            address[static_cast<size_t>(piece_index)] * 0x100 +
15192|    147|            static_cast<uint16_t>(ipv4_piece));
15193|    147|        ++numbers_seen;
15194|    147|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (15194:13): [True: 47, False: 100]
  |  Branch (15194:34): [True: 15, False: 85]
  ------------------
15195|     62|          ++piece_index;
15196|     62|        }
15197|    147|      }
15198|     22|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (15198:11): [True: 13, False: 9]
  ------------------
15199|     13|        return is_valid = false;
15200|     13|      }
15201|      9|      break;
15202|     22|    }
15203|       |
15204|    917|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (15204:9): [True: 13, False: 904]
  ------------------
15205|     13|      return is_valid = false;
15206|     13|    }
15207|       |
15208|    904|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (15208:9): [True: 676, False: 228]
  |  Branch (15208:27): [True: 672, False: 4]
  ------------------
15209|    672|      ++pointer;
15210|    672|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (15210:11): [True: 3, False: 669]
  ------------------
15211|      3|        return is_valid = false;
15212|      3|      }
15213|    672|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (15213:16): [True: 4, False: 228]
  ------------------
15214|      4|      return is_valid = false;
15215|      4|    }
15216|       |
15217|    897|    address[static_cast<size_t>(piece_index)] = value;
15218|    897|    ++piece_index;
15219|    897|  }
15220|       |
15221|    463|  if (compress != -1) {
  ------------------
  |  Branch (15221:7): [True: 427, False: 36]
  ------------------
15222|    427|    const int right = piece_index - compress;
15223|    427|    if (right > 0) {
  ------------------
  |  Branch (15223:9): [True: 201, False: 226]
  ------------------
15224|    201|      const size_t dest = static_cast<size_t>(8 - right);
15225|    201|      const size_t src = static_cast<size_t>(compress);
15226|    201|      if (dest != src) {
  ------------------
  |  Branch (15226:11): [True: 193, False: 8]
  ------------------
15227|    537|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (15227:53): [True: 344, False: 193]
  ------------------
15228|    344|          address[dest + i] = address[src + i];
15229|    344|          address[src + i] = 0;
15230|    344|        }
15231|    193|      }
15232|    201|    }
15233|    427|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (15233:14): [True: 22, False: 14]
  ------------------
15234|     22|    return is_valid = false;
15235|     22|  }
15236|       |
15237|       |  // Serialize once; skip rewrite when hostname is already canonical.
15238|    441|  const std::string serialized = ada::serializers::ipv6(address);
15239|    441|  const std::string_view current = get_hostname();
15240|    441|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (15240:7): [True: 0, False: 441]
  ------------------
15241|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (15241:7): [True: 0, False: 0]
  ------------------
15242|      0|    ada_log("parse_ipv6 in-place canonical match");
15243|    441|  } else {
15244|    441|    update_base_hostname(serialized);
15245|    441|  }
15246|    441|  ada_log("parse_ipv6 ", get_hostname());
15247|    441|  ADA_ASSERT_TRUE(validate());
15248|    441|  host_type = IPV6;
15249|    441|  return true;
15250|    463|}
_ZN3ada14url_aggregator17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15252|    621|bool url_aggregator::parse_opaque_host(std::string_view input) {
15253|    621|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
15254|    621|  ADA_ASSERT_TRUE(validate());
15255|    621|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
15256|    621|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (15256:7): [True: 38, False: 583]
  ------------------
15257|     38|    return is_valid = false;
15258|     38|  }
15259|       |
15260|       |  // Return the result of running UTF-8 percent-encode on input using the C0
15261|       |  // control percent-encode set.
15262|    583|  size_t idx = ada::unicode::percent_encode_index(
15263|    583|      input, character_sets::C0_CONTROL_PERCENT_ENCODE);
15264|    583|  if (idx == input.size()) {
  ------------------
  |  Branch (15264:7): [True: 543, False: 40]
  ------------------
15265|    543|    update_base_hostname(input);
15266|    543|  } else {
15267|       |    // We only create a temporary string if we need to.
15268|     40|    update_base_hostname(ada::unicode::percent_encode(
15269|     40|        input, character_sets::C0_CONTROL_PERCENT_ENCODE, idx));
15270|     40|  }
15271|    583|  ADA_ASSERT_TRUE(validate());
15272|    583|  return true;
15273|    621|}
simple_absolute.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  274|   236k|  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|   236k|    return c > -65;
  278|   236k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  480|      2|inline Huff make_fixed_litlen_huff() {
  481|      2|  Huff h;
  482|      2|  uint8_t lens[288];
  483|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  484|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (484:19): [True: 288, False: 2]
  ------------------
  485|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (485:21): [True: 224, False: 2]
  ------------------
  486|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (486:21): [True: 48, False: 2]
  ------------------
  487|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (487:21): [True: 16, False: 2]
  ------------------
  488|      2|  h.build(lens, 288);
  489|      2|  return h;
  490|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  429|     16|  bool build(const uint8_t* lens, int n) {
  430|     16|    std::memset(counts, 0, sizeof(counts));
  431|     16|    std::memset(first_code, 0, sizeof(first_code));
  432|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  433|     16|    nsymbols = n;
  434|     16|    max_bits = 0;
  435|  1.99k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (435:21): [True: 1.97k, False: 16]
  ------------------
  436|  1.97k|      lengths[i] = lens[i];
  437|  1.97k|      if (lens[i]) {
  ------------------
  |  Branch (437:11): [True: 1.93k, False: 42]
  ------------------
  438|  1.93k|        counts[lens[i]]++;
  439|  1.93k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (439:13): [True: 45, False: 1.88k]
  ------------------
  440|  1.93k|      }
  441|  1.97k|    }
  442|       |    // Canonical first code for each bit length (RFC 1951).
  443|     16|    int code = 0;
  444|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (444:24): [True: 240, False: 16]
  ------------------
  445|    240|      code = (code + counts[bits - 1]) << 1;
  446|    240|      first_code[bits] = code;
  447|    240|    }
  448|     16|    int idx = 0;
  449|    159|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (449:24): [True: 143, False: 16]
  ------------------
  450|    143|      base_idx[bits] = idx;
  451|       |      // assign symbols in symbol order for codes of this length
  452|  21.8k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (452:25): [True: 21.6k, False: 143]
  ------------------
  453|  21.6k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (453:13): [True: 1.93k, False: 19.7k]
  ------------------
  454|  1.93k|          symbols[idx++] = static_cast<int16_t>(sym);
  455|  1.93k|        }
  456|  21.6k|      }
  457|    143|    }
  458|     16|    return true;
  459|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  492|      2|inline Huff make_fixed_dist_huff() {
  493|      2|  Huff h;
  494|      2|  uint8_t lens[32];
  495|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (495:19): [True: 64, False: 2]
  ------------------
  496|      2|  h.build(lens, 32);
  497|      2|  return h;
  498|      2|}
simple_absolute.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5339|   365k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5340|   365k|    return 0x101010101010101ull * v;
 5341|   365k|  };
_ZN3ada4idna13ensure_tablesEv:
 5085|  33.8k|[[nodiscard]] inline bool ensure_tables() noexcept {
 5086|  33.8k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 5087|  33.8k|  if (state == kTablesReady) {
  ------------------
  |  Branch (5087:7): [True: 33.8k, False: 1]
  ------------------
 5088|  33.8k|    return true;
 5089|  33.8k|  }
 5090|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (5090:7): [True: 0, False: 1]
  ------------------
 5091|      0|    return false;
 5092|      0|  }
 5093|       |
 5094|      1|  uint8_t expected = kTablesUninit;
 5095|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (5095:7): [True: 1, False: 0]
  ------------------
 5096|      1|                                                std::memory_order_acq_rel,
 5097|      1|                                                std::memory_order_acquire)) {
 5098|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 5099|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (5099:9): [True: 0, False: 1]
  ------------------
 5100|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5101|      0|      return false;
 5102|      0|    }
 5103|       |
 5104|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 5105|      1|                                          table_blob::compressed_size, buffer,
 5106|      1|                                          table_blob::uncompressed_size);
 5107|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (5107:9): [True: 0, False: 1]
  ------------------
 5108|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (5108:9): [True: 0, False: 1]
  ------------------
 5109|      0|      delete[] buffer;
 5110|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 5111|      0|      return false;
 5112|      0|    }
 5113|       |
 5114|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 5115|      1|    detail::convert_table_blob_to_host_endian(buffer);
 5116|       |
 5117|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5118|      1|      return buffer + off;
 5119|      1|    };
 5120|       |
 5121|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 5122|       |    // acquire on tables_init_state and then observe these writes.
 5123|      1|    idna_stage1 =
 5124|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 5125|      1|    idna_stage2 =
 5126|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 5127|      1|    idna_bool_blocks =
 5128|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 5129|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 5130|       |
 5131|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 5132|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 5133|      1|        at(table_blob::off_decomposition_block));
 5134|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 5135|      1|        at(table_blob::off_decomposition_data));
 5136|      1|    ccc_index = at(table_blob::off_ccc_index);
 5137|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 5138|      1|    composition_index = at(table_blob::off_composition_index);
 5139|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 5140|      1|        at(table_blob::off_composition_block));
 5141|      1|    composition_data =
 5142|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 5143|       |
 5144|      1|    id_continue =
 5145|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 5146|      1|    id_start =
 5147|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 5148|       |
 5149|      1|    dir_start =
 5150|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 5151|      1|    dir_final =
 5152|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 5153|      1|    dir_value = at(table_blob::off_dir_value);
 5154|      1|    combining_ranges =
 5155|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 5156|      1|    joining_start =
 5157|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_start));
 5158|      1|    joining_final =
 5159|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_joining_final));
 5160|      1|    joining_value = at(table_blob::off_joining_value);
 5161|       |
 5162|      1|    tables_buffer = buffer;
 5163|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 5164|      1|    return true;
 5165|      1|  }
 5166|       |
 5167|       |  // Another thread owns init (or finished between our loads).
 5168|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (5168:28): [True: 0, False: 0]
  ------------------
 5169|      0|    state = tables_init_state.load(std::memory_order_acquire);
 5170|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (5170:9): [True: 0, False: 0]
  ------------------
 5171|      0|      return true;
 5172|      0|    }
 5173|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (5173:9): [True: 0, False: 0]
  ------------------
 5174|      0|      return false;
 5175|      0|    }
 5176|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 5177|      0|    defined(_M_IX86)
 5178|      0|#if defined(__GNUC__) || defined(__clang__)
 5179|      0|    __builtin_ia32_pause();
 5180|      0|#endif
 5181|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 5182|       |#if defined(__GNUC__) || defined(__clang__)
 5183|       |    asm volatile("yield" ::: "memory");
 5184|       |#endif
 5185|       |#endif
 5186|      0|  }
 5187|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 5188|      0|  return false;
 5189|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  525|      1|                          size_t dst_cap) {
  526|      1|  BitReader br(src, src_len);
  527|      1|  size_t out = 0;
  528|      4|  for (;;) {
  529|      4|    uint32_t bfinal = br.get(1);
  530|      4|    uint32_t btype = br.get(2);
  531|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (531:9): [True: 0, False: 4]
  |  Branch (531:33): [True: 0, False: 4]
  ------------------
  532|      4|    if (btype == 0) {
  ------------------
  |  Branch (532:9): [True: 0, False: 4]
  ------------------
  533|       |      // stored
  534|      0|      br.align_byte();
  535|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (535:11): [True: 0, False: 0]
  ------------------
  536|       |      // read 16+16 from bit buffer awkwardly - use byte path
  537|       |      // Align: bits is multiple of 8
  538|       |      // Get len from remaining bits then bytes
  539|      0|      uint32_t len = br.get(16);
  540|      0|      uint32_t nlen = br.get(16);
  541|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (541:11): [True: 0, False: 0]
  |  Branch (541:32): [True: 0, False: 0]
  ------------------
  542|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  ------------------
  543|       |      // After get, may have bits in acc from previous - for stored, should be
  544|       |      // byte aligned Copy len bytes from p
  545|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |        // leftover bits should be 0 if aligned
  547|      0|      }
  548|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (548:11): [True: 0, False: 0]
  ------------------
  549|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|      std::memcpy(dst + out, br.p, len);
  551|      0|      br.p += len;
  552|      0|      out += len;
  553|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (553:16): [True: 0, False: 4]
  |  Branch (553:30): [True: 4, False: 0]
  ------------------
  554|      4|      Huff lit, dist;
  555|      4|      if (btype == 1) {
  ------------------
  |  Branch (555:11): [True: 0, False: 4]
  ------------------
  556|       |        // use fixed via functions
  557|      4|      } else {
  558|       |        // dynamic
  559|      4|        uint32_t hlit = br.get(5);
  560|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (560:13): [True: 0, False: 4]
  ------------------
  561|      4|        hlit += 257;
  562|      4|        uint32_t hdist = br.get(5);
  563|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (563:13): [True: 0, False: 4]
  ------------------
  564|      4|        hdist += 1;
  565|      4|        uint32_t hclen = br.get(4);
  566|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (566:13): [True: 0, False: 4]
  ------------------
  567|      4|        hclen += 4;
  568|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  569|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  570|      4|        uint8_t clen[19]{};
  571|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (571:30): [True: 65, False: 4]
  ------------------
  572|     65|          uint32_t v = br.get(3);
  573|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (573:15): [True: 0, False: 65]
  ------------------
  574|     65|          clen[order[i]] = uint8_t(v);
  575|     65|        }
  576|      4|        Huff cl;
  577|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (577:13): [True: 0, False: 4]
  ------------------
  578|      4|        uint8_t lens[288 + 32]{};
  579|      4|        uint32_t n = hlit + hdist;
  580|  1.04k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (580:30): [True: 1.03k, False: 4]
  ------------------
  581|  1.03k|          int sym = cl.decode(br);
  582|  1.03k|          if (sym < 0) return 0;
  ------------------
  |  Branch (582:15): [True: 0, False: 1.03k]
  ------------------
  583|  1.03k|          if (sym < 16) {
  ------------------
  |  Branch (583:15): [True: 973, False: 63]
  ------------------
  584|    973|            lens[i++] = uint8_t(sym);
  585|    973|          } else if (sym == 16) {
  ------------------
  |  Branch (585:22): [True: 63, False: 0]
  ------------------
  586|     63|            uint32_t rep = br.get(2);
  587|     63|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (587:17): [True: 0, False: 63]
  ------------------
  588|     63|            rep += 3;
  589|     63|            if (i == 0) return 0;
  ------------------
  |  Branch (589:17): [True: 0, False: 63]
  ------------------
  590|     63|            uint8_t v = lens[i - 1];
  591|    350|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (591:20): [True: 287, False: 63]
  ------------------
  592|     63|          } else if (sym == 17) {
  ------------------
  |  Branch (592:22): [True: 0, False: 0]
  ------------------
  593|      0|            uint32_t rep = br.get(3);
  594|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (594:17): [True: 0, False: 0]
  ------------------
  595|      0|            rep += 3;
  596|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (596:20): [True: 0, False: 0]
  ------------------
  597|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (597:22): [True: 0, False: 0]
  ------------------
  598|      0|            uint32_t rep = br.get(7);
  599|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|            rep += 11;
  601|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (601:20): [True: 0, False: 0]
  ------------------
  602|      0|          } else
  603|      0|            return 0;
  604|  1.03k|        }
  605|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (605:13): [True: 0, False: 4]
  ------------------
  606|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (606:13): [True: 0, False: 4]
  ------------------
  607|      4|      }
  608|  54.4k|      for (;;) {
  609|  54.4k|        int sym;
  610|  54.4k|        if (btype == 1)
  ------------------
  |  Branch (610:13): [True: 0, False: 54.4k]
  ------------------
  611|      0|          sym = fixed_litlen(br);
  612|  54.4k|        else
  613|  54.4k|          sym = lit.decode(br);
  614|  54.4k|        if (sym < 0) return 0;
  ------------------
  |  Branch (614:13): [True: 0, False: 54.4k]
  ------------------
  615|  54.4k|        if (sym < 256) {
  ------------------
  |  Branch (615:13): [True: 38.5k, False: 15.9k]
  ------------------
  616|  38.5k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (616:15): [True: 0, False: 38.5k]
  ------------------
  617|  38.5k|          dst[out++] = uint8_t(sym);
  618|  38.5k|        } else if (sym == 256) {
  ------------------
  |  Branch (618:20): [True: 4, False: 15.9k]
  ------------------
  619|      4|          break;
  620|  15.9k|        } else {
  621|  15.9k|          int len_code = sym - 257;
  622|  15.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (622:15): [True: 0, False: 15.9k]
  |  Branch (622:31): [True: 0, False: 15.9k]
  ------------------
  623|  15.9k|          uint32_t extra = br.get(len_extra[len_code]);
  624|  15.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (624:15): [True: 2.24k, False: 13.6k]
  |  Branch (624:38): [True: 0, False: 2.24k]
  ------------------
  625|  15.9k|          uint32_t length =
  626|  15.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (626:37): [True: 2.24k, False: 13.6k]
  ------------------
  627|  15.9k|          int dsym;
  628|  15.9k|          if (btype == 1)
  ------------------
  |  Branch (628:15): [True: 0, False: 15.9k]
  ------------------
  629|      0|            dsym = fixed_dist(br);
  630|  15.9k|          else
  631|  15.9k|            dsym = dist.decode(br);
  632|  15.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (632:15): [True: 0, False: 15.9k]
  |  Branch (632:27): [True: 0, False: 15.9k]
  ------------------
  633|  15.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  634|  15.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (634:15): [True: 10.7k, False: 5.16k]
  |  Branch (634:35): [True: 0, False: 10.7k]
  ------------------
  635|  15.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (635:50): [True: 10.7k, False: 5.16k]
  ------------------
  636|  15.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (636:15): [True: 0, False: 15.9k]
  |  Branch (636:33): [True: 0, False: 15.9k]
  ------------------
  637|   193k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (637:32): [True: 177k, False: 15.9k]
  ------------------
  638|   177k|            dst[out] = dst[out - distance];
  639|   177k|            out++;
  640|   177k|          }
  641|  15.9k|        }
  642|  54.4k|      }
  643|      4|    } else {
  644|      0|      return 0;  // reserved
  645|      0|    }
  646|      4|    if (bfinal) break;
  ------------------
  |  Branch (646:9): [True: 1, False: 3]
  ------------------
  647|      4|  }
  648|      1|  return out;
  649|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  392|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  402|   475k|  uint32_t get(int n) {
  403|   475k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (403:9): [True: 0, False: 475k]
  ------------------
  404|   475k|    uint32_t v = acc & ((1u << n) - 1);
  405|   475k|    acc >>= n;
  406|   475k|    bits -= n;
  407|   475k|    return v;
  408|   475k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  394|   475k|  bool ensure(int n) {
  395|   540k|    while (bits < n) {
  ------------------
  |  Branch (395:12): [True: 65.3k, False: 475k]
  ------------------
  396|  65.3k|      if (p >= end) return false;
  ------------------
  |  Branch (396:11): [True: 0, False: 65.3k]
  ------------------
  397|  65.3k|      acc |= uint32_t(*p++) << bits;
  398|  65.3k|      bits += 8;
  399|  65.3k|    }
  400|   475k|    return true;
  401|   475k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  461|  71.4k|  int decode(BitReader& br) const {
  462|  71.4k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (462:9): [True: 0, False: 71.4k]
  ------------------
  463|  71.4k|    int code = 0;
  464|   442k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (464:23): [True: 442k, False: 0]
  ------------------
  465|   442k|      uint32_t b = br.get(1);
  466|   442k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (466:11): [True: 0, False: 442k]
  ------------------
  467|   442k|      code = (code << 1) | int(b);
  468|   442k|      int first = first_code[len];
  469|   442k|      int cnt = counts[len];
  470|   442k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (470:11): [True: 276k, False: 166k]
  |  Branch (470:18): [True: 71.4k, False: 205k]
  ------------------
  471|  71.4k|        return symbols[base_idx[len] + (code - first)];
  472|  71.4k|      }
  473|   442k|    }
  474|      0|    return -1;
  475|  71.4k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 5068|      1|                                         size_t len) noexcept {
 5069|      1|  uint32_t c = 0xFFFFFFFFu;
 5070|   216k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (5070:22): [True: 216k, False: 1]
  ------------------
 5071|   216k|    c ^= data[i];
 5072|  1.94M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (5072:21): [True: 1.72M, False: 216k]
  ------------------
 5073|  1.72M|      const uint32_t mask = 0u - (c & 1u);
 5074|  1.72M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 5075|  1.72M|    }
 5076|   216k|  }
 5077|      1|  return ~c;
 5078|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4873|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4874|      1|  if constexpr (std::endian::native == std::endian::little) {
 4875|      1|    (void)buffer;
 4876|      1|    return;
 4877|      1|  }
 4878|      0|  auto u16 = [&](size_t off, size_t count) {
 4879|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4880|      1|  };
 4881|      1|  auto u32 = [&](size_t off, size_t count) {
 4882|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4883|      1|  };
 4884|      1|  auto u64 = [&](size_t off, size_t count) {
 4885|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4886|      1|  };
 4887|       |
 4888|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4889|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4890|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4891|      1|  u16(table_blob::off_decomposition_block,
 4892|      1|      table_blob::count_decomposition_block);
 4893|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4894|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4895|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4896|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4897|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4898|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4899|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4900|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4901|      1|  u32(table_blob::off_joining_start, table_blob::count_joining_start);
 4902|      1|  u32(table_blob::off_joining_final, table_blob::count_joining_final);
 4903|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 5117|     21|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 5118|     21|      return buffer + off;
 5119|     21|    };
simple_absolute.cc:_ZN3ada4idnaL11idna_lookupEj:
 5277|   357k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5278|   357k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5278:7): [True: 357k, False: 688]
  ------------------
 5279|   357k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5280|   357k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5280:9): [True: 146k, False: 210k]
  ------------------
 5281|   146k|      uint32_t bit_idx =
 5282|   146k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5283|   146k|          (cp & IDNA_BLOCK_MASK);
 5284|   146k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5285|   146k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5285:14): [True: 146k, False: 24]
  ------------------
 5286|   146k|    }
 5287|   210k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5288|   357k|  }
 5289|       |
 5290|    688|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5290:7): [True: 636, False: 52]
  |  Branch (5290:40): [True: 416, False: 220]
  ------------------
 5291|    416|    return IDNA_IGNORED;
 5292|    416|  }
 5293|       |
 5294|    272|  return IDNA_DISALLOWED;
 5295|    688|}
simple_absolute.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5320|  58.4k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5321|  58.4k|  size_t n = 0;
 5322|   326k|  while (*ptr != 0) {
  ------------------
  |  Branch (5322:10): [True: 267k, False: 58.4k]
  ------------------
 5323|   267k|    ++n;
 5324|   267k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5324:9): [True: 91.3k, False: 176k]
  ------------------
 5325|  91.3k|      ++ptr;
 5326|   176k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5326:16): [True: 134k, False: 42.0k]
  ------------------
 5327|   134k|      ptr += 2;
 5328|   134k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5328:16): [True: 41.1k, False: 868]
  ------------------
 5329|  41.1k|      ptr += 3;
 5330|  41.1k|    } else {
 5331|    868|      ptr += 4;
 5332|    868|    }
 5333|   267k|  }
 5334|  58.4k|  return n;
 5335|  58.4k|}
simple_absolute.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5298|   266k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5299|   266k|  uint8_t b0 = *ptr++;
 5300|   266k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5300:7): [True: 91.2k, False: 175k]
  ------------------
 5301|   175k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5301:7): [True: 133k, False: 41.7k]
  ------------------
 5302|   133k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5303|   133k|    cp |= (*ptr++ & 0x3Fu);
 5304|   133k|    return static_cast<char32_t>(cp);
 5305|   133k|  }
 5306|  41.7k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5306:7): [True: 41.1k, False: 610]
  ------------------
 5307|  41.1k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5308|  41.1k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5309|  41.1k|    cp |= (*ptr++ & 0x3Fu);
 5310|  41.1k|    return static_cast<char32_t>(cp);
 5311|  41.1k|  }
 5312|    610|  uint32_t cp = (b0 & 0x07u) << 18;
 5313|    610|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5314|    610|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5315|    610|  cp |= (*ptr++ & 0x3Fu);
 5316|    610|  return static_cast<char32_t>(cp);
 5317|  41.7k|}
_ZN3ada4idna23decomposition_block_rowEh:
 5194|   819k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 5195|   819k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (5195:7): [True: 0, False: 819k]
  ------------------
 5196|      0|    bi = 0;
 5197|      0|  }
 5198|   819k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 5199|   819k|}
_ZN3ada4idna13ccc_block_rowEh:
 5201|  1.21M|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 5202|  1.21M|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (5202:7): [True: 0, False: 1.21M]
  ------------------
 5203|      0|    bi = 0;
 5204|      0|  }
 5205|  1.21M|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5206|  1.21M|}
_ZN3ada4idna16tables_are_readyEv:
 5080|  7.63k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 5081|  7.63k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 5082|  7.63k|}
simple_absolute.cc:_ZN3ada4idnaL24decomposition_is_not_nfcEDiDi:
 5707|   381k|static bool decomposition_is_not_nfc(char32_t previous, char32_t c) noexcept {
 5708|   381k|  if (c >= hangul_sbase && c < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5708:7): [True: 43.6k, False: 337k]
  |  Branch (5708:28): [True: 39.8k, False: 3.80k]
  ------------------
 5709|  39.8k|    return false;
 5710|  39.8k|  }
 5711|   341k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5711:7): [True: 0, False: 341k]
  ------------------
 5712|      0|    return false;
 5713|      0|  }
 5714|   341k|  const uint16_t* const decomposition =
 5715|   341k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5716|   341k|  const size_t length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5717|   341k|  if (length == 0 || (decomposition[0] & 1)) {
  ------------------
  |  Branch (5717:7): [True: 333k, False: 7.60k]
  |  Branch (5717:22): [True: 0, False: 7.60k]
  ------------------
 5718|   333k|    return false;  // no canonical decomposition (or compatibility-only)
 5719|   333k|  }
 5720|  7.60k|  if (length == 1) {
  ------------------
  |  Branch (5720:7): [True: 0, False: 7.60k]
  ------------------
 5721|      0|    return true;  // singleton
 5722|      0|  }
 5723|  7.60k|  const size_t base = decomposition[0] >> 2;
 5724|  7.60k|  if (base + length > decomposition_data_size) {
  ------------------
  |  Branch (5724:7): [True: 0, False: 7.60k]
  ------------------
 5725|      0|    return false;
 5726|      0|  }
 5727|       |  // Recompose the canonical decomposition; if it does not collapse back to c,
 5728|       |  // then c is an exclusion / non-starter decomposition and is not NFC.
 5729|  7.60k|  std::u32string decomposed(decomposition_data + base,
 5730|  7.60k|                            decomposition_data + base + length);
 5731|  7.60k|  compose(decomposed);
 5732|  7.60k|  if (!(decomposed.size() == 1 && decomposed[0] == c)) {
  ------------------
  |  Branch (5732:9): [True: 7.60k, False: 0]
  |  Branch (5732:35): [True: 7.60k, False: 0]
  ------------------
 5733|      0|    return true;
 5734|      0|  }
 5735|  7.60k|  return previous < 0x110000 &&
  ------------------
  |  Branch (5735:10): [True: 5.73k, False: 1.86k]
  ------------------
 5736|  5.73k|         has_composition(
  ------------------
  |  Branch (5736:10): [True: 4, False: 5.73k]
  ------------------
 5737|  5.73k|             composition_block_row(composition_index[previous >> 8]) +
 5738|  5.73k|                 (previous % 256),
 5739|  5.73k|             decomposition_data[base]);
 5740|  7.60k|}
simple_absolute.cc:_ZN3ada4idnaL15has_compositionEPKtDi:
 5611|  84.0k|                            char32_t second) noexcept {
 5612|  84.0k|  int left = composition[0];
 5613|  84.0k|  int right = composition[1];
 5614|  84.0k|  if (left < 0 || right <= left ||
  ------------------
  |  Branch (5614:7): [True: 0, False: 84.0k]
  |  Branch (5614:19): [True: 4.27k, False: 79.7k]
  ------------------
 5615|  79.7k|      static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5615:7): [True: 0, False: 79.7k]
  ------------------
 5616|  4.27k|    return false;
 5617|  4.27k|  }
 5618|   207k|  while (left + 2 < right) {
  ------------------
  |  Branch (5618:10): [True: 127k, False: 79.7k]
  ------------------
 5619|   127k|    int middle = left + (((right - left) >> 1) & ~1);
 5620|   127k|    if (composition_data[static_cast<size_t>(middle)] <= second) {
  ------------------
  |  Branch (5620:9): [True: 4.56k, False: 122k]
  ------------------
 5621|  4.56k|      left = middle;
 5622|  4.56k|    }
 5623|   127k|    if (composition_data[static_cast<size_t>(middle)] >= second) {
  ------------------
  |  Branch (5623:9): [True: 123k, False: 3.90k]
  ------------------
 5624|   123k|      right = middle;
 5625|   123k|    }
 5626|   127k|  }
 5627|  79.7k|  return static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5627:10): [True: 79.7k, False: 0]
  ------------------
 5628|  79.7k|         composition_data[static_cast<size_t>(left)] == second;
  ------------------
  |  Branch (5628:10): [True: 1.04k, False: 78.7k]
  ------------------
 5629|  84.0k|}
simple_absolute.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5684|   372k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5685|   372k|  const size_t length = canonical_decomp_length(c);
 5686|   372k|  if (length == 0) {
  ------------------
  |  Branch (5686:7): [True: 365k, False: 6.83k]
  ------------------
 5687|   365k|    return get_ccc(c);
 5688|   365k|  }
 5689|  6.83k|  const uint16_t* const decomposition =
 5690|  6.83k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5691|  6.83k|  const size_t base = decomposition[0] >> 2;
 5692|  6.83k|  return get_ccc(decomposition_data[base + length - 1]);
 5693|   372k|}
simple_absolute.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5478|   372k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5479|   372k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5479:7): [True: 42.0k, False: 330k]
  ------------------
 5480|  42.0k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5480:7): [True: 39.1k, False: 2.90k]
  ------------------
 5481|       |    // Hangul precomposed syllables are NFC.
 5482|  39.1k|    return 0;
 5483|  39.1k|  }
 5484|   333k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5484:7): [True: 0, False: 333k]
  ------------------
 5485|      0|    return 0;
 5486|      0|  }
 5487|   333k|  const uint8_t di = decomposition_index[current_character >> 8];
 5488|   333k|  const uint16_t* const decomposition =
 5489|   333k|      decomposition_block_row(di) + (current_character % 256);
 5490|   333k|  size_t decomposition_length =
 5491|   333k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5492|   333k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5492:7): [True: 6.83k, False: 326k]
  |  Branch (5492:37): [True: 0, False: 6.83k]
  ------------------
 5493|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5494|      0|  }
 5495|   333k|  return decomposition_length;
 5496|   333k|}
simple_absolute.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5632|  5.54k|static bool would_compose(std::u32string_view input) noexcept {
 5633|   341k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5633:32): [True: 336k, False: 4.32k]
  ------------------
 5634|   336k|    const char32_t current = input[input_count];
 5635|   336k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5635:9): [True: 49.6k, False: 287k]
  |  Branch (5635:36): [True: 1.58k, False: 48.0k]
  ------------------
 5636|  1.58k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5636:11): [True: 1.48k, False: 96]
  ------------------
 5637|  1.48k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5637:11): [True: 664, False: 822]
  ------------------
 5638|    664|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5638:11): [True: 152, False: 512]
  ------------------
 5639|    152|        return true;
 5640|    152|      }
 5641|  1.43k|      ++input_count;
 5642|  1.43k|      continue;
 5643|  1.58k|    }
 5644|   335k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5644:9): [True: 39.9k, False: 295k]
  |  Branch (5644:36): [True: 38.4k, False: 1.55k]
  ------------------
 5645|  38.4k|      if ((current - hangul_sbase) % hangul_tcount == 0 &&
  ------------------
  |  Branch (5645:11): [True: 37.5k, False: 852]
  ------------------
 5646|  37.5k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5646:11): [True: 37.4k, False: 78]
  ------------------
 5647|  37.4k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5647:11): [True: 18.8k, False: 18.6k]
  ------------------
 5648|  18.8k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5648:11): [True: 36, False: 18.7k]
  ------------------
 5649|     36|        return true;
 5650|     36|      }
 5651|  38.3k|      ++input_count;
 5652|  38.3k|      continue;
 5653|  38.4k|    }
 5654|   296k|    if (current < 0x110000) {
  ------------------
  |  Branch (5654:9): [True: 296k, False: 0]
  ------------------
 5655|   296k|      const uint16_t* composition =
 5656|   296k|          composition_block_row(composition_index[current >> 8]) +
 5657|   296k|          (current % 256);
 5658|   296k|      int32_t previous_ccc = -1;
 5659|   296k|      size_t j = input_count;
 5660|   299k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5660:14): [True: 295k, False: 4.09k]
  ------------------
 5661|   295k|        uint8_t ccc = get_ccc(input[j + 1]);
 5662|   295k|        if (composition[1] != composition[0] && previous_ccc < ccc &&
  ------------------
  |  Branch (5662:13): [True: 79.7k, False: 215k]
  |  Branch (5662:49): [True: 78.2k, False: 1.43k]
  ------------------
 5663|  78.2k|            has_composition(composition, input[j + 1])) {
  ------------------
  |  Branch (5663:13): [True: 1.04k, False: 77.2k]
  ------------------
 5664|  1.04k|          return true;
 5665|  1.04k|        }
 5666|   294k|        if (ccc == 0) {
  ------------------
  |  Branch (5666:13): [True: 291k, False: 2.88k]
  ------------------
 5667|   291k|          break;
 5668|   291k|        }
 5669|  2.88k|        previous_ccc = ccc;
 5670|  2.88k|      }
 5671|   295k|      input_count = j + 1;
 5672|   295k|      continue;
 5673|   296k|    }
 5674|      0|    ++input_count;
 5675|      0|  }
 5676|  4.32k|  return false;
 5677|  5.54k|}
_ZN3ada4idna21composition_block_rowEh:
 5208|   389k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5209|   389k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5209:7): [True: 0, False: 389k]
  ------------------
 5210|      0|    bi = 0;
 5211|      0|  }
 5212|   389k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5213|   389k|}
simple_absolute.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5913|  34.3k|static constexpr int32_t char_to_digit_value(char value) {
 5914|  34.3k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5914:7): [True: 29.2k, False: 5.14k]
  |  Branch (5914:23): [True: 29.2k, False: 6]
  ------------------
 5915|  5.15k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5915:7): [True: 5.12k, False: 28]
  |  Branch (5915:23): [True: 5.11k, False: 14]
  ------------------
 5916|     42|  return -1;
 5917|  5.15k|}
simple_absolute.cc:_ZN3ada4idnaL5adaptEiib:
 5923|  71.8k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5924|  71.8k|  if (firsttime) {
  ------------------
  |  Branch (5924:7): [True: 25.1k, False: 46.7k]
  ------------------
 5925|  25.1k|    d = d / damp;
 5926|  46.7k|  } else {
 5927|  46.7k|    d = d / 2;
 5928|  46.7k|  }
 5929|  71.8k|  d += d / n;
 5930|  71.8k|  int32_t k = 0;
 5931|  95.2k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5931:10): [True: 23.3k, False: 71.8k]
  ------------------
 5932|  23.3k|    d /= base - tmin;
 5933|  23.3k|    k += base;
 5934|  23.3k|  }
 5935|  71.8k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5936|  71.8k|}
simple_absolute.cc:_ZN3ada4idnaL13digit_to_charEi:
 5919|   172k|static constexpr char digit_to_char(int32_t digit) {
 5920|   172k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5920:10): [True: 75.2k, False: 96.8k]
  ------------------
 5921|   172k|}
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 6327|   222k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
simple_absolute.cc:_ZN3ada4idnaL17is_contextj_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6232|  25.0k|inline static bool is_contextj_valid(std::u32string_view label) noexcept {
 6233|  25.0k|  constexpr uint8_t virama_ccc = 9;
 6234|   204k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6234:22): [True: 179k, False: 24.8k]
  ------------------
 6235|   179k|    if (label[i] != 0x200C && label[i] != 0x200D) {
  ------------------
  |  Branch (6235:9): [True: 178k, False: 738]
  |  Branch (6235:31): [True: 178k, False: 190]
  ------------------
 6236|   178k|      continue;
 6237|   178k|    }
 6238|       |    // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
 6239|    928|    if (i > 0 && get_ccc(label[i - 1]) == virama_ccc) {
  ------------------
  |  Branch (6239:9): [True: 916, False: 12]
  |  Branch (6239:18): [True: 338, False: 578]
  ------------------
 6240|    338|      continue;
 6241|    338|    }
 6242|    590|    if (label[i] == 0x200D) {
  ------------------
  |  Branch (6242:9): [True: 10, False: 580]
  ------------------
 6243|     10|      return false;
 6244|     10|    }
 6245|       |    // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
 6246|       |    //    (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
 6247|    580|    joining_type before = joining_type::U;
 6248|    968|    for (size_t j = i; j > 0;) {
  ------------------
  |  Branch (6248:24): [True: 962, False: 6]
  ------------------
 6249|    962|      before = find_joining_type(label[--j]);
 6250|    962|      if (before != joining_type::T) {
  ------------------
  |  Branch (6250:11): [True: 574, False: 388]
  ------------------
 6251|    574|        break;
 6252|    574|      }
 6253|    962|    }
 6254|    580|    if (before != joining_type::L && before != joining_type::D) {
  ------------------
  |  Branch (6254:9): [True: 574, False: 6]
  |  Branch (6254:38): [True: 82, False: 492]
  ------------------
 6255|     82|      return false;
 6256|     82|    }
 6257|    498|    joining_type after = joining_type::U;
 6258|    820|    for (size_t j = i + 1; j < label.size(); j++) {
  ------------------
  |  Branch (6258:28): [True: 784, False: 36]
  ------------------
 6259|    784|      after = find_joining_type(label[j]);
 6260|    784|      if (after != joining_type::T) {
  ------------------
  |  Branch (6260:11): [True: 462, False: 322]
  ------------------
 6261|    462|        break;
 6262|    462|      }
 6263|    784|    }
 6264|    498|    if (after != joining_type::R && after != joining_type::D) {
  ------------------
  |  Branch (6264:9): [True: 324, False: 174]
  |  Branch (6264:37): [True: 108, False: 216]
  ------------------
 6265|    108|      return false;
 6266|    108|    }
 6267|    498|  }
 6268|  24.8k|  return true;
 6269|  25.0k|}
simple_absolute.cc:_ZN3ada4idnaL17find_joining_typeEj:
 6224|  1.74k|inline static joining_type find_joining_type(uint32_t code_point) noexcept {
 6225|  1.74k|  size_t i =
 6226|  1.74k|      find_range(joining_start, joining_final, joining_table_count, code_point);
 6227|  1.74k|  return i == joining_table_count ? joining_type::U
  ------------------
  |  Branch (6227:10): [True: 144, False: 1.60k]
  ------------------
 6228|  1.74k|                                  : static_cast<joining_type>(joining_value[i]);
 6229|  1.74k|}
simple_absolute.cc:_ZN3ada4idnaL10find_rangeEPKjS2_mj:
 6203|   211k|                                size_t count, uint32_t code_point) noexcept {
 6204|   211k|  size_t lo = 0, hi = count;
 6205|  2.40M|  while (lo < hi) {
  ------------------
  |  Branch (6205:10): [True: 2.19M, False: 211k]
  ------------------
 6206|  2.19M|    size_t mid = lo + (hi - lo) / 2;
 6207|  2.19M|    if (last[mid] < code_point) {
  ------------------
  |  Branch (6207:9): [True: 613k, False: 1.57M]
  ------------------
 6208|   613k|      lo = mid + 1;
 6209|  1.57M|    } else {
 6210|  1.57M|      hi = mid;
 6211|  1.57M|    }
 6212|  2.19M|  }
 6213|   211k|  return lo < count && code_point >= start[lo] ? lo : count;
  ------------------
  |  Branch (6213:10): [True: 211k, False: 0]
  |  Branch (6213:24): [True: 210k, False: 144]
  ------------------
 6214|   211k|}
simple_absolute.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6272|  24.8k|    const std::u32string_view label) noexcept {
 6273|  27.0k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (6273:52): [True: 27.0k, False: 0]
  ------------------
 6274|  27.0k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (6274:9): [True: 24.8k, False: 2.26k]
  ------------------
 6275|       |
 6276|      0|  return std::u32string_view::npos;
 6277|  24.8k|}
simple_absolute.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6281|  24.8k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 6282|  24.8k|  const size_t mask =
 6283|  24.8k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 6284|       |
 6285|  24.8k|  size_t directions = 0;
 6286|   191k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6286:22): [True: 166k, False: 24.8k]
  ------------------
 6287|   166k|    directions |= 1u << find_direction(label[i]);
 6288|   166k|  }
 6289|  24.8k|  return (directions & mask) != 0;
 6290|  24.8k|}
simple_absolute.cc:_ZN3ada4idnaL14find_directionEj:
 6217|   209k|inline static direction find_direction(uint32_t code_point) noexcept {
 6218|   209k|  size_t i = find_range(dir_start, dir_final, dir_table_count, code_point);
 6219|   209k|  return i == dir_table_count ? direction::NONE
  ------------------
  |  Branch (6219:10): [True: 0, False: 209k]
  ------------------
 6220|   209k|                              : static_cast<direction>(dir_value[i]);
 6221|   209k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6552|   126k|bool constexpr is_ascii(std::string_view view) {
 6553|  1.94M|  for (uint8_t c : view) {
  ------------------
  |  Branch (6553:18): [True: 1.94M, False: 121k]
  ------------------
 6554|  1.94M|    if (c >= 0x80) {
  ------------------
  |  Branch (6554:9): [True: 5.02k, False: 1.93M]
  ------------------
 6555|  5.02k|      return false;
 6556|  5.02k|    }
 6557|  1.94M|  }
 6558|   121k|  return true;
 6559|   126k|}
simple_absolute.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6589|   121k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6590|   121k|  out.assign(ut8_string);
 6591|   121k|  ascii_map(out.data(), out.size());
 6592|   121k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6543|  34.6k|bool constexpr is_ascii(std::u32string_view view) {
 6544|   118k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6544:19): [True: 118k, False: 3.00k]
  ------------------
 6545|   118k|    if (c >= 0x80) {
  ------------------
  |  Branch (6545:9): [True: 31.6k, False: 86.3k]
  ------------------
 6546|  31.6k|      return false;
 6547|  31.6k|    }
 6548|   118k|  }
 6549|  3.00k|  return true;
 6550|  34.6k|}
simple_absolute.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6605|  28.1k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6606|  28.1k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6606:10): [True: 22.8k, False: 5.35k]
  |  Branch (6606:31): [True: 3.54k, False: 19.2k]
  |  Branch (6606:51): [True: 3.27k, False: 272]
  ------------------
 6607|  3.27k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6607:10): [True: 3.05k, False: 214]
  |  Branch (6607:30): [True: 2.83k, False: 220]
  ------------------
 6608|  28.1k|}
simple_absolute.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6595|  5.03k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6596|  5.03k|  const size_t old = out.size();
 6597|  5.03k|  out.resize(old + label.size());
 6598|  5.03k|  char* dest = out.data() + old;
 6599|  76.1k|  for (char32_t c : label) {
  ------------------
  |  Branch (6599:19): [True: 76.1k, False: 5.03k]
  ------------------
 6600|  76.1k|    *dest++ = static_cast<char>(c);
 6601|  76.1k|  }
 6602|  5.03k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7621|   236k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7622|   236k|    return character_sets::bit_at(character_set, c);
 7623|   236k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7621|  58.0k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7622|  58.0k|    return character_sets::bit_at(character_set, c);
 7623|  58.0k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7355|  88.5k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7356|  88.5k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7356:11): [True: 85.3k, False: 3.17k]
  |  Branch (7356:23): [True: 43.3k, False: 42.0k]
  |  Branch (7356:37): [True: 42.0k, False: 3.18k]
  |  Branch (7356:49): [True: 40.4k, False: 1.57k]
  ------------------
 7357|  4.75k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7357:11): [True: 1.54k, False: 3.20k]
  |  Branch (7357:23): [True: 1.42k, False: 120]
  ------------------
 7358|  88.5k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7445|  84.0k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7446|  84.0k|  return hex_to_binary_table[c - '0'];
 7447|  84.0k|}
simple_absolute.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7589|   987k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7590|   987k|    return character_sets::bit_at(character_set, c);
 7591|   987k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7282|   124k|    const char* input, size_t length) noexcept {
 7283|   124k|  size_t i = 0;
 7284|   124k|  uint8_t accumulator{};
 7285|   682k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7285:10): [True: 557k, False: 124k]
  ------------------
 7286|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7287|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7288|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7289|   557k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7290|   557k|  }
 7291|   197k|  for (; i < length; i++) {
  ------------------
  |  Branch (7291:10): [True: 72.9k, False: 124k]
  ------------------
 7292|  72.9k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7293|  72.9k|  }
 7294|   124k|  return accumulator;
 7295|   124k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7975|    803|                            const uint8_t character_set[], std::string& out) {
 7976|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7977|    803|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7978|    803|#if ADA_UNICODE_SSSE3
 7979|    803|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7980|    803|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7981|       |#elif ADA_NEON
 7982|       |  percent_encode_to_neon(p, end, character_set,
 7983|       |                         load_neon_percent_table(character_set), out);
 7984|       |#elif ADA_RVV
 7985|       |  percent_encode_to_rvv(p, end, character_set, out);
 7986|       |#endif
 7987|    803|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7802|    803|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7803|    803|  ssse3_percent_tables t{};
 7804|    803|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7805|    803|  t.cs_hi =
 7806|    803|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7807|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7808|    803|  t.pow2 =
 7809|    803|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7810|    803|  t.mask_0f = _mm_set1_epi8(0x0F);
 7811|    803|  t.mask_07 = _mm_set1_epi8(0x07);
 7812|    803|  t.zero = _mm_setzero_si128();
 7813|    803|  return t;
 7814|    803|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7833|    803|    const ssse3_percent_tables& tables, std::string& out) {
 7834|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7835|  3.16k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7835:10): [True: 2.36k, False: 803]
  ------------------
 7836|  2.36k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7837|  2.36k|    const __m128i word1 =
 7838|  2.36k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7839|  2.36k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7840|  2.36k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7841|  2.36k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7841:9): [True: 248, False: 2.11k]
  ------------------
 7842|    248|      out.append(p, 32);
 7843|  2.11k|    } else {
 7844|  2.11k|      if (mask0 == 0) {
  ------------------
  |  Branch (7844:11): [True: 63, False: 2.05k]
  ------------------
 7845|     63|        out.append(p, 16);
 7846|  2.05k|      } else {
 7847|  2.05k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7848|  2.05k|      }
 7849|  2.11k|      if (mask1 == 0) {
  ------------------
  |  Branch (7849:11): [True: 270, False: 1.84k]
  ------------------
 7850|    270|        out.append(p + 16, 16);
 7851|  1.84k|      } else {
 7852|  1.84k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7853|  1.84k|      }
 7854|  2.11k|    }
 7855|  2.36k|    p += 32;
 7856|  2.36k|  }
 7857|    803|  if (p + 16 <= end) {
  ------------------
  |  Branch (7857:7): [True: 522, False: 281]
  ------------------
 7858|    522|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7859|    522|    const int mask = ssse3_percent_mask(word, tables);
 7860|    522|    if (mask == 0) {
  ------------------
  |  Branch (7860:9): [True: 162, False: 360]
  ------------------
 7861|    162|      out.append(p, 16);
 7862|    360|    } else {
 7863|    360|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7864|    360|    }
 7865|    522|    p += 16;
 7866|    522|  }
 7867|    803|  percent_encode_to_scalar(p, end, character_set, out);
 7868|    803|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7817|  5.24k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7818|  5.24k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7819|  5.24k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7820|  5.24k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7821|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7822|  5.24k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7823|  5.24k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7824|  5.24k|                                       _mm_andnot_si128(high_byte, lo));
 7825|  5.24k|  const __m128i bits =
 7826|  5.24k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7827|  5.24k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7828|  5.24k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7829|  5.24k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7757|  4.25k|                                          size_t width, std::string& out) {
 7758|  4.25k|  uint64_t bits = mask;
 7759|  4.25k|  size_t off = 0;
 7760|  60.1k|  while (bits != 0) {
  ------------------
  |  Branch (7760:10): [True: 55.9k, False: 4.25k]
  ------------------
 7761|  55.9k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7762|  55.9k|    if (zero_run != 0) {
  ------------------
  |  Branch (7762:9): [True: 2.63k, False: 53.3k]
  ------------------
 7763|  2.63k|      out.append(p + off, static_cast<size_t>(zero_run));
 7764|  2.63k|    }
 7765|  55.9k|    off += static_cast<size_t>(zero_run);
 7766|  55.9k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7767|  55.9k|    ++off;
 7768|  55.9k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7769|  55.9k|  }
 7770|  4.25k|  if (off < width) {
  ------------------
  |  Branch (7770:7): [True: 951, False: 3.30k]
  ------------------
 7771|    951|    out.append(p + off, width - off);
 7772|    951|  }
 7773|  4.25k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7745|  55.9k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7746|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7747|       |  unsigned long ret;
 7748|       |  _BitScanForward(&ret, input_num);
 7749|       |  return static_cast<int>(ret);
 7750|       |#else
 7751|  55.9k|  return __builtin_ctz(input_num);
 7752|  55.9k|#endif
 7753|  55.9k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7778|    803|                                                std::string& out) {
 7779|  4.12k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7779:10): [True: 3.31k, False: 803]
  ------------------
 7780|  3.31k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7780:9): [True: 1.57k, False: 1.74k]
  ------------------
 7781|  1.57k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7782|  1.74k|    } else {
 7783|  1.74k|      out += *p;
 7784|  1.74k|    }
 7785|  3.31k|  }
 7786|    803|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 8048|  1.66k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 8049|  1.66k|  static constexpr char kHex[] = "0123456789abcdef";
 8050|  1.66k|  if (v >= 0x1000) {
  ------------------
  |  Branch (8050:7): [True: 176, False: 1.49k]
  ------------------
 8051|    176|    *p++ = kHex[(v >> 12) & 0xf];
 8052|    176|    *p++ = kHex[(v >> 8) & 0xf];
 8053|    176|    *p++ = kHex[(v >> 4) & 0xf];
 8054|    176|    *p++ = kHex[v & 0xf];
 8055|  1.49k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (8055:14): [True: 218, False: 1.27k]
  ------------------
 8056|    218|    *p++ = kHex[(v >> 8) & 0xf];
 8057|    218|    *p++ = kHex[(v >> 4) & 0xf];
 8058|    218|    *p++ = kHex[v & 0xf];
 8059|  1.27k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (8059:14): [True: 278, False: 994]
  ------------------
 8060|    278|    *p++ = kHex[(v >> 4) & 0xf];
 8061|    278|    *p++ = kHex[v & 0xf];
 8062|    994|  } else {
 8063|    994|    *p++ = kHex[v & 0xf];
 8064|    994|  }
 8065|  1.66k|  return p;
 8066|  1.66k|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 8034|   162k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 8035|   162k|  if (v < 10) {
  ------------------
  |  Branch (8035:7): [True: 66.1k, False: 96.5k]
  ------------------
 8036|  66.1k|    *p++ = static_cast<char>('0' + v);
 8037|  96.5k|  } else if (v < 100) {
  ------------------
  |  Branch (8037:14): [True: 360, False: 96.2k]
  ------------------
 8038|    360|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 8039|    360|    p += 2;
 8040|  96.2k|  } else {
 8041|  96.2k|    *p++ = static_cast<char>('0' + v / 100);
 8042|  96.2k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 8043|  96.2k|    p += 2;
 8044|  96.2k|  }
 8045|   162k|  return p;
 8046|   162k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7131|   631k|    std::string_view user_input) noexcept {
 7132|       |  // first check for short strings in which case we do it naively.
 7133|   631k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (7133:7): [True: 123k, False: 507k]
  ------------------
 7134|   123k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 7135|   123k|  }
 7136|       |  // fast path for long strings (expected to be common)
 7137|   507k|  size_t i = 0;
 7138|   507k|  const __m128i mask1 = _mm_set1_epi8('\r');
 7139|   507k|  const __m128i mask2 = _mm_set1_epi8('\n');
 7140|   507k|  const __m128i mask3 = _mm_set1_epi8('\t');
 7141|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 7142|   507k|  __m128i running{0};
 7143|  1.22M|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (7143:10): [True: 717k, False: 507k]
  ------------------
 7144|   717k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 7145|   717k|    running = _mm_or_si128(
 7146|   717k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7147|   717k|                                           _mm_cmpeq_epi8(word, mask2))),
 7148|   717k|        _mm_cmpeq_epi8(word, mask3));
 7149|   717k|  }
 7150|   507k|  if (i < user_input.size()) {
  ------------------
  |  Branch (7150:7): [True: 502k, False: 4.62k]
  ------------------
 7151|   502k|    __m128i word = _mm_loadu_si128(
 7152|   502k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 7153|   502k|    running = _mm_or_si128(
 7154|   502k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 7155|   502k|                                           _mm_cmpeq_epi8(word, mask2))),
 7156|   502k|        _mm_cmpeq_epi8(word, mask3));
 7157|   502k|  }
 7158|   507k|  return _mm_movemask_epi8(running) != 0;
 7159|   631k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 7016|  1.57M|constexpr bool is_tabs_or_newline(char c) noexcept {
 7017|  1.57M|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (7017:10): [True: 76, False: 1.57M]
  |  Branch (7017:23): [True: 60, False: 1.57M]
  |  Branch (7017:36): [True: 52, False: 1.57M]
  ------------------
 7018|  1.57M|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8844|    956|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8845|       |  // Fast path: inputs with no tab/newline (the common case) avoid the
 8846|       |  // per-character erase_if scan. has_tabs_or_newline uses SIMD for inputs
 8847|       |  // >= 16 bytes, making this check much cheaper than erase_if's scalar
 8848|       |  // predicate walk when there is nothing to remove.
 8849|    956|  if (!ada::unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (8849:7): [True: 0, False: 956]
  ------------------
 8850|      0|    return;
 8851|      0|  }
 8852|    956|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8853|    956|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7376|  74.7k|    const char c) noexcept {
 7377|  74.7k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7377:10): [True: 2.93k, False: 71.8k]
  |  Branch (7377:23): [True: 1.27k, False: 70.5k]
  |  Branch (7377:36): [True: 198, False: 70.3k]
  ------------------
 7378|  74.7k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7371|  1.11M|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7372|  1.11M|  return (unsigned char)c <= ' ';
 7373|  1.11M|}
_ZN3ada7helpers19parse_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS_6scheme4typeERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9551|   237k|                                           std::string& path) {
 9552|   237k|  ada_log("parse_prepared_path ", input);
 9553|   237k|  uint8_t accumulator = checkers::path_signature(input);
 9554|       |  // Let us first detect a trivial case.
 9555|       |  // If it is special, we check that we have no dot, no %,  no \ and no
 9556|       |  // character needing percent encoding. Otherwise, we check that we have no %,
 9557|       |  // no dot, and no character needing percent encoding.
 9558|   237k|  constexpr uint8_t need_encoding = 1;
 9559|   237k|  constexpr uint8_t backslash_char = 2;
 9560|   237k|  constexpr uint8_t dot_char = 4;
 9561|   237k|  constexpr uint8_t percent_char = 8;
 9562|   237k|  bool special = type != ada::scheme::NOT_SPECIAL;
 9563|   237k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (9563:39): [True: 1.32k, False: 236k]
  ------------------
 9564|  1.32k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (9564:39): [True: 34, False: 1.28k]
  ------------------
 9565|   237k|  bool trivial_path =
 9566|   237k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (9566:7): [True: 206k, False: 30.4k]
  |  Branch (9566:8): [True: 236k, False: 771]
  ------------------
 9567|   237k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
 9568|    771|                  0)) &&
 9569|   206k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (9569:7): [True: 206k, False: 11]
  ------------------
 9570|   237k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (9570:7): [True: 12.8k, False: 224k]
  |  Branch (9570:34): [True: 12.8k, False: 14]
  ------------------
 9571|       |    // '4' means that we have at least one dot, but nothing that requires
 9572|       |    // percent encoding or decoding. The only part that is not trivial is
 9573|       |    // that we may have single dots and double dots path segments.
 9574|       |    // If we have such segments, then we either have a path that begins
 9575|       |    // with '.' (easy to check), or we have the sequence './'.
 9576|       |    // Note: input cannot be empty, it must at least contain one character ('.')
 9577|       |    // Note: we know that '\' is not present.
 9578|  12.8k|    if (input[0] != '.') {
  ------------------
  |  Branch (9578:9): [True: 11.6k, False: 1.25k]
  ------------------
 9579|  11.6k|      size_t slashdot = 0;
 9580|  11.6k|      bool dot_is_file = true;
 9581|  37.8k|      for (;;) {
 9582|  37.8k|        slashdot = input.find("/.", slashdot);
 9583|  37.8k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (9583:13): [True: 11.6k, False: 26.2k]
  ------------------
 9584|  11.6k|          break;
 9585|  26.2k|        } else {  // uncommon
 9586|       |          // only three cases matter: /./, /.. or a final /
 9587|  26.2k|          slashdot += 2;
 9588|  26.2k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (9588:28): [True: 73, False: 26.1k]
  |  Branch (9588:56): [True: 12.3k, False: 13.8k]
  ------------------
 9589|  13.8k|                           input[slashdot] == '/');
  ------------------
  |  Branch (9589:28): [True: 12.4k, False: 1.40k]
  ------------------
 9590|  26.2k|        }
 9591|  37.8k|      }
 9592|  11.6k|      trivial_path = dot_is_file;
 9593|  11.6k|    }
 9594|  12.8k|  }
 9595|   237k|  if (trivial_path) {
  ------------------
  |  Branch (9595:7): [True: 208k, False: 29.3k]
  ------------------
 9596|   208k|    ada_log("parse_path trivial");
 9597|   208k|    path += '/';
 9598|   208k|    path += input;
 9599|   208k|    return;
 9600|   208k|  }
 9601|       |  // We are going to need to look a bit at the path, but let us see if we can
 9602|       |  // ignore percent encoding *and* backslashes *and* percent characters.
 9603|       |  // Except for the trivial case, this is likely to capture 99% of paths out
 9604|       |  // there.
 9605|  29.3k|  bool fast_path =
 9606|  29.3k|      (special &&
  ------------------
  |  Branch (9606:8): [True: 28.9k, False: 407]
  ------------------
 9607|  28.9k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (9607:8): [True: 11.6k, False: 17.2k]
  ------------------
 9608|  11.6k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (9608:7): [True: 11.5k, False: 106]
  ------------------
 9609|  29.3k|  if (fast_path) {
  ------------------
  |  Branch (9609:7): [True: 11.5k, False: 17.8k]
  ------------------
 9610|  11.5k|    ada_log("parse_prepared_path fast");
 9611|       |    // Here we don't need to worry about \ or percent encoding.
 9612|       |    // We also do not have a file protocol. We might have dots, however,
 9613|       |    // but dots must as appear as '.', and they cannot be encoded because
 9614|       |    // the symbol '%' is not present.
 9615|  11.5k|    size_t previous_location = 0;  // We start at 0.
 9616|  71.0k|    do {
 9617|  71.0k|      size_t new_location = input.find('/', previous_location);
 9618|       |      // std::string_view path_view = input;
 9619|       |      //  We process the last segment separately:
 9620|  71.0k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (9620:11): [True: 11.5k, False: 59.4k]
  ------------------
 9621|  11.5k|        std::string_view path_view = input.substr(previous_location);
 9622|  11.5k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (9622:13): [True: 76, False: 11.5k]
  ------------------
 9623|       |          // e.g., if you receive ".." with an empty path, you go to "/".
 9624|     76|          if (path.empty()) {
  ------------------
  |  Branch (9624:15): [True: 19, False: 57]
  ------------------
 9625|     19|            path = '/';
 9626|     19|            return;
 9627|     19|          }
 9628|       |          // Fast case where we have nothing to do:
 9629|     57|          if (path.back() == '/') {
  ------------------
  |  Branch (9629:15): [True: 16, False: 41]
  ------------------
 9630|     16|            return;
 9631|     16|          }
 9632|       |          // If you have the path "/joe/myfriend",
 9633|       |          // then you delete 'myfriend'.
 9634|     41|          path.resize(path.rfind('/') + 1);
 9635|     41|          return;
 9636|     57|        }
 9637|  11.5k|        path += '/';
 9638|  11.5k|        if (path_view != ".") {
  ------------------
  |  Branch (9638:13): [True: 11.4k, False: 102]
  ------------------
 9639|  11.4k|          path.append(path_view);
 9640|  11.4k|        }
 9641|  11.5k|        return;
 9642|  59.4k|      } else {
 9643|       |        // This is a non-final segment.
 9644|  59.4k|        std::string_view path_view =
 9645|  59.4k|            input.substr(previous_location, new_location - previous_location);
 9646|  59.4k|        previous_location = new_location + 1;
 9647|  59.4k|        if (path_view == "..") {
  ------------------
  |  Branch (9647:13): [True: 12.8k, False: 46.6k]
  ------------------
 9648|  12.8k|          size_t last_delimiter = path.rfind('/');
 9649|  12.8k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (9649:15): [True: 10.8k, False: 1.92k]
  ------------------
 9650|  10.8k|            path.erase(last_delimiter);
 9651|  10.8k|          }
 9652|  46.6k|        } else if (path_view != ".") {
  ------------------
  |  Branch (9652:20): [True: 33.5k, False: 13.0k]
  ------------------
 9653|  33.5k|          path += '/';
 9654|  33.5k|          path.append(path_view);
 9655|  33.5k|        }
 9656|  59.4k|      }
 9657|  71.0k|    } while (true);
  ------------------
  |  Branch (9657:14): [True: 59.4k, Folded]
  ------------------
 9658|  17.8k|  } else {
 9659|  17.8k|    ada_log("parse_path slow");
 9660|       |    // we have reached the general case
 9661|  17.8k|    bool needs_percent_encoding = (accumulator & 1);
 9662|  17.8k|    std::string path_buffer_tmp;
 9663|  65.4k|    do {
 9664|  65.4k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (9664:26): [True: 63.7k, False: 1.72k]
  |  Branch (9664:37): [True: 5.53k, False: 58.1k]
  ------------------
 9665|  65.4k|                            ? input.find_first_of("/\\")
 9666|  65.4k|                            : input.find('/');
 9667|  65.4k|      std::string_view path_view = input;
 9668|  65.4k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (9668:11): [True: 47.6k, False: 17.8k]
  ------------------
 9669|  47.6k|        path_view.remove_suffix(path_view.size() - location);
 9670|  47.6k|        input.remove_prefix(location + 1);
 9671|  47.6k|      }
 9672|       |      // path_buffer is either path_view or it might point at a percent encoded
 9673|       |      // temporary file.
 9674|  65.4k|      std::string_view path_buffer =
 9675|  65.4k|          (needs_percent_encoding &&
  ------------------
  |  Branch (9675:12): [True: 14.2k, False: 51.1k]
  ------------------
 9676|  14.2k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (9676:12): [True: 4.20k, False: 10.0k]
  ------------------
 9677|  14.2k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
 9678|  65.4k|              ? path_buffer_tmp
 9679|  65.4k|              : path_view;
 9680|  65.4k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9680:11): [True: 13.0k, False: 52.3k]
  ------------------
 9681|  13.0k|        helpers::shorten_path(path, type);
 9682|  13.0k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9682:13): [True: 9.76k, False: 3.28k]
  ------------------
 9683|  9.76k|          path += '/';
 9684|  9.76k|        }
 9685|  52.3k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (9685:18): [True: 2.41k, False: 49.9k]
  ------------------
 9686|  2.41k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (9686:18): [True: 441, False: 1.97k]
  ------------------
 9687|    441|        path += '/';
 9688|    441|      }
 9689|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
 9690|  51.9k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9690:16): [True: 49.9k, False: 1.97k]
  ------------------
 9691|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
 9692|       |        // Windows drive letter, then replace the second code point in
 9693|       |        // path_buffer with U+003A (:).
 9694|  49.9k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (9694:13): [True: 1.74k, False: 48.2k]
  |  Branch (9694:48): [True: 500, False: 1.24k]
  ------------------
 9695|    500|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (9695:13): [True: 36, False: 464]
  ------------------
 9696|     36|          path += '/';
 9697|     36|          path += path_buffer[0];
 9698|     36|          path += ':';
 9699|     36|          path_buffer.remove_prefix(2);
 9700|     36|          path.append(path_buffer);
 9701|  49.9k|        } else {
 9702|       |          // Append path_buffer to url's path.
 9703|  49.9k|          path += '/';
 9704|  49.9k|          path.append(path_buffer);
 9705|  49.9k|        }
 9706|  49.9k|      }
 9707|  65.4k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (9707:11): [True: 17.8k, False: 47.6k]
  ------------------
 9708|  17.8k|        return;
 9709|  17.8k|      }
 9710|  65.4k|    } while (true);
  ------------------
  |  Branch (9710:14): [True: 47.6k, Folded]
  ------------------
 9711|  17.8k|  }
 9712|  29.3k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   77|   474k|    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|   474k|  size_t i = 0;
   84|   474k|  uint8_t accumulator{};
   85|   638k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (85:10): [True: 163k, False: 474k]
  ------------------
   86|   163k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   87|   163k|                           path_signature_table[uint8_t(input[i + 1])] |
   88|   163k|                           path_signature_table[uint8_t(input[i + 2])] |
   89|   163k|                           path_signature_table[uint8_t(input[i + 3])] |
   90|   163k|                           path_signature_table[uint8_t(input[i + 4])] |
   91|   163k|                           path_signature_table[uint8_t(input[i + 5])] |
   92|   163k|                           path_signature_table[uint8_t(input[i + 6])] |
   93|   163k|                           path_signature_table[uint8_t(input[i + 7])]);
   94|   163k|  }
   95|   762k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (95:10): [True: 287k, False: 474k]
  ------------------
   96|   287k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   97|   287k|  }
   98|   474k|  return accumulator;
   99|   474k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7384|   130k|    std::string_view input) noexcept {
 7385|       |  // This will catch most cases:
 7386|       |  // The length must be 2,4 or 6.
 7387|       |  // We divide by two and require
 7388|       |  // that the result be between 1 and 3 inclusively.
 7389|   130k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7390|   130k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7390:7): [True: 54.7k, False: 76.1k]
  ------------------
 7391|  54.7k|    return false;
 7392|  54.7k|  }
 7393|       |  // We have a string of length 2, 4 or 6.
 7394|       |  // We now check the first character:
 7395|  76.1k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7395:7): [True: 64.4k, False: 11.6k]
  |  Branch (7395:28): [True: 26.4k, False: 37.9k]
  ------------------
 7396|  26.4k|    return false;
 7397|  26.4k|  }
 7398|       |  // We are unlikely the get beyond this point.
 7399|  49.6k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7400|  49.6k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7401|  49.6k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7401:7): [True: 14.9k, False: 34.6k]
  ------------------
 7402|  14.9k|    return false;
 7403|  14.9k|  }
 7404|       |  // We almost never get here.
 7405|       |  // Optimizing the rest is relatively unimportant.
 7406|  34.6k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7407|  34.6k|    uint16_t A, B;
 7408|  34.6k|    memcpy(&A, a.data(), sizeof(A));
 7409|  34.6k|    memcpy(&B, b.data(), sizeof(B));
 7410|  34.6k|    return A == B;
 7411|  34.6k|  };
 7412|  34.6k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7412:7): [True: 2.07k, False: 32.5k]
  ------------------
 7413|  2.07k|    return false;
 7414|  2.07k|  }
 7415|   117k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7415:22): [True: 91.4k, False: 26.0k]
  ------------------
 7416|  91.4k|    char c = input[i];
 7417|  91.4k|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7417:9): [True: 6.49k, False: 84.9k]
  |  Branch (7417:10): [True: 43.8k, False: 47.5k]
  ------------------
 7418|  6.49k|      return false;
 7419|  6.49k|    }
 7420|  91.4k|  }
 7421|  26.0k|  return true;
 7422|       |  // The above code might be a bit better than the code below. Compilers
 7423|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7424|       |  // 6 and other tricks.
 7425|       |  // return input == ".." ||
 7426|       |  //  input == ".%2e" || input == ".%2E" ||
 7427|       |  //  input == "%2e." || input == "%2E." ||
 7428|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7429|       |  //  "%2e%2E";
 7430|  32.5k|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7406|  34.6k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7407|  34.6k|    uint16_t A, B;
 7408|  34.6k|    memcpy(&A, a.data(), sizeof(A));
 7409|  34.6k|    memcpy(&B, b.data(), sizeof(B));
 7410|  34.6k|    return A == B;
 7411|  34.6k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7433|   208k|    std::string_view input) noexcept {
 7434|   208k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7434:10): [True: 4.44k, False: 204k]
  |  Branch (7434:26): [True: 4.32k, False: 199k]
  |  Branch (7434:44): [True: 24, False: 199k]
  ------------------
 7435|   208k|}
_ZN3ada7unicode28is_forbidden_host_code_pointEc:
 7254|  16.6k|    const char c) noexcept {
 7255|  16.6k|  return is_forbidden_host_code_point_table[uint8_t(c)];
 7256|  16.6k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9836|  99.2k|                              bool& is_pure_decimal) noexcept {
 9837|  99.2k|  is_pure_decimal = false;
 9838|  99.2k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9838:7): [True: 0, False: 99.2k]
  ------------------
 9839|      0|    return false;
 9840|      0|  }
 9841|  99.2k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9841:7): [True: 78.2k, False: 20.9k]
  |  Branch (9841:23): [True: 38.8k, False: 39.4k]
  |  Branch (9841:38): [True: 38.5k, False: 324]
  ------------------
 9842|  38.5k|    p += 2;
 9843|  38.5k|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9843:9): [True: 64, False: 38.5k]
  |  Branch (9843:21): [True: 30, False: 38.4k]
  ------------------
 9844|     94|      value = 0;
 9845|     94|      return true;
 9846|     94|    }
 9847|  38.4k|    uint64_t v = 0;
 9848|  38.4k|    int digits = 0;
 9849|   232k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9849:12): [True: 213k, False: 19.0k]
  |  Branch (9849:23): [True: 193k, False: 19.3k]
  ------------------
 9850|   193k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9851|   193k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9851:11): [True: 10, False: 193k]
  ------------------
 9852|     10|        return false;
 9853|     10|      }
 9854|   193k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9854:11): [True: 92, False: 193k]
  ------------------
 9855|     92|        return false;
 9856|     92|      }
 9857|   193k|      v = (v << 4) | nib;
 9858|   193k|      ++p;
 9859|   193k|      ++digits;
 9860|   193k|    }
 9861|  38.3k|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9861:9): [True: 0, False: 38.3k]
  ------------------
 9862|      0|      return false;
 9863|      0|    }
 9864|  38.3k|    value = v;
 9865|  38.3k|    return true;
 9866|  38.3k|  }
 9867|  60.6k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9867:7): [True: 39.7k, False: 20.9k]
  |  Branch (9867:23): [True: 324, False: 39.4k]
  |  Branch (9867:38): [True: 188, False: 136]
  |  Branch (9867:53): [True: 174, False: 14]
  ------------------
 9868|    174|    ++p;
 9869|    174|    uint64_t v = 0;
 9870|  1.28k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9870:12): [True: 1.22k, False: 60]
  |  Branch (9870:23): [True: 1.18k, False: 32]
  ------------------
 9871|  1.18k|      const char c = *p;
 9872|  1.18k|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9872:11): [True: 8, False: 1.18k]
  |  Branch (9872:22): [True: 18, False: 1.16k]
  ------------------
 9873|     26|        return false;
 9874|     26|      }
 9875|  1.16k|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9875:11): [True: 56, False: 1.10k]
  ------------------
 9876|     56|        return false;
 9877|     56|      }
 9878|  1.10k|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9879|  1.10k|      ++p;
 9880|  1.10k|    }
 9881|     92|    value = v;
 9882|     92|    return true;
 9883|    174|  }
 9884|  60.5k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9884:7): [True: 66, False: 60.4k]
  |  Branch (9884:19): [True: 37.6k, False: 22.7k]
  ------------------
 9885|  37.7k|    return false;
 9886|  37.7k|  }
 9887|  22.7k|  is_pure_decimal = true;
 9888|  22.7k|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9889|  22.7k|  ++p;
 9890|  29.9k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9890:10): [True: 8.36k, False: 21.5k]
  |  Branch (9890:21): [True: 7.30k, False: 1.05k]
  ------------------
 9891|  7.30k|    const char c = *p;
 9892|  7.30k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9892:9): [True: 16, False: 7.29k]
  |  Branch (9892:20): [True: 50, False: 7.24k]
  ------------------
 9893|     66|      return false;
 9894|     66|    }
 9895|  7.24k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9895:9): [True: 90, False: 7.15k]
  ------------------
 9896|     90|      return false;
 9897|     90|    }
 9898|  7.15k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9899|  7.15k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9899:9): [True: 8, False: 7.14k]
  ------------------
 9900|      8|      return false;
 9901|      8|    }
 9902|  7.14k|    ++p;
 9903|  7.14k|  }
 9904|  22.6k|  value = v;
 9905|  22.6k|  return true;
 9906|  22.7k|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9910|  1.99k|                           uint16_t& value) noexcept {
 9911|  1.99k|  if (pointer == end) {
  ------------------
  |  Branch (9911:7): [True: 0, False: 1.99k]
  ------------------
 9912|      0|    return 0;
 9913|      0|  }
 9914|  1.99k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9915|  1.99k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9915:7): [True: 36, False: 1.96k]
  ------------------
 9916|     36|    return 0;
 9917|     36|  }
 9918|  1.96k|  uint32_t v = n0;
 9919|  1.96k|  ++pointer;
 9920|  1.96k|  int length = 1;
 9921|  1.96k|  if (pointer != end) {
  ------------------
  |  Branch (9921:7): [True: 1.75k, False: 208]
  ------------------
 9922|  1.75k|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9923|  1.75k|    if (n1 != 0xff) {
  ------------------
  |  Branch (9923:9): [True: 738, False: 1.01k]
  ------------------
 9924|    738|      v = (v << 4) | n1;
 9925|    738|      ++pointer;
 9926|    738|      ++length;
 9927|    738|      if (pointer != end) {
  ------------------
  |  Branch (9927:11): [True: 664, False: 74]
  ------------------
 9928|    664|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9929|    664|        if (n2 != 0xff) {
  ------------------
  |  Branch (9929:13): [True: 438, False: 226]
  ------------------
 9930|    438|          v = (v << 4) | n2;
 9931|    438|          ++pointer;
 9932|    438|          ++length;
 9933|    438|          if (pointer != end) {
  ------------------
  |  Branch (9933:15): [True: 338, False: 100]
  ------------------
 9934|    338|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9935|    338|            if (n3 != 0xff) {
  ------------------
  |  Branch (9935:17): [True: 180, False: 158]
  ------------------
 9936|    180|              v = (v << 4) | n3;
 9937|    180|              ++pointer;
 9938|    180|              ++length;
 9939|    180|            }
 9940|    338|          }
 9941|    438|        }
 9942|    664|      }
 9943|    738|    }
 9944|  1.75k|  }
 9945|  1.96k|  value = static_cast<uint16_t>(v);
 9946|  1.96k|  return length;
 9947|  1.99k|}
_ZN3ada3url10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10522|  24.2k|ada_really_inline void url::parse_path(std::string_view input) {
10523|  24.2k|  ada_log("parse_path ", input);
10524|  24.2k|  std::string tmp_buffer;
10525|  24.2k|  std::string_view internal_input;
10526|  24.2k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (10526:7): [True: 0, False: 24.2k]
  ------------------
10527|      0|    tmp_buffer = input;
10528|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10529|       |    // just directly build the string from user_input.
10530|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10531|      0|    internal_input = tmp_buffer;
10532|  24.2k|  } else {
10533|  24.2k|    internal_input = input;
10534|  24.2k|  }
10535|       |
10536|       |  // If url is special, then:
10537|  24.2k|  if (is_special()) {
  ------------------
  |  Branch (10537:7): [True: 24.2k, False: 0]
  ------------------
10538|  24.2k|    if (internal_input.empty()) {
  ------------------
  |  Branch (10538:9): [True: 253, False: 24.0k]
  ------------------
10539|    253|      path = "/";
10540|  24.0k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (10540:16): [True: 24.0k, False: 0]
  |  Branch (10540:46): [True: 0, False: 0]
  ------------------
10541|  24.0k|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10542|  24.0k|    } else {
10543|      0|      helpers::parse_prepared_path(internal_input, type, path);
10544|      0|    }
10545|  24.2k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (10545:14): [True: 0, False: 0]
  ------------------
10546|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (10546:9): [True: 0, False: 0]
  ------------------
10547|      0|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10548|      0|    } else {
10549|      0|      helpers::parse_prepared_path(internal_input, type, path);
10550|      0|    }
10551|      0|  } else {
10552|      0|    if (!host.has_value()) {
  ------------------
  |  Branch (10552:9): [True: 0, False: 0]
  ------------------
10553|      0|      path = "/";
10554|      0|    }
10555|      0|  }
10556|  24.2k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7348|  2.31M|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7349|  2.31M|  return is_alnum_plus_table[uint8_t(c)];
 7350|       |  // A table is almost surely much faster than the
 7351|       |  // following under most compilers: return
 7352|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7353|  2.31M|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 7024|  51.2k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 7025|  51.2k|  uint64_t broadcast_80 = broadcast(0x80);
 7026|  51.2k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 7027|  51.2k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 7028|  51.2k|  uint64_t non_ascii = 0;
 7029|  51.2k|  size_t i = 0;
 7030|       |
 7031|  97.9k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (7031:10): [True: 46.6k, False: 51.2k]
  ------------------
 7032|  46.6k|    uint64_t word{};
 7033|  46.6k|    memcpy(&word, input + i, sizeof(word));
 7034|  46.6k|    non_ascii |= (word & broadcast_80);
 7035|  46.6k|    word ^=
 7036|  46.6k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7037|  46.6k|    memcpy(input + i, &word, sizeof(word));
 7038|  46.6k|  }
 7039|  51.2k|  if (i < length) {
  ------------------
  |  Branch (7039:7): [True: 50.8k, False: 450]
  ------------------
 7040|  50.8k|    uint64_t word{};
 7041|  50.8k|    memcpy(&word, input + i, length - i);
 7042|  50.8k|    non_ascii |= (word & broadcast_80);
 7043|  50.8k|    word ^=
 7044|  50.8k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 7045|  50.8k|    memcpy(input + i, &word, length - i);
 7046|  50.8k|  }
 7047|  51.2k|  return non_ascii == 0;
 7048|  51.2k|}
_ZN3ada7unicode9broadcastEh:
 7020|   153k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 7021|   153k|  return 0x101010101010101ull * v;
 7022|   153k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12545|  22.0k|    auto apply_query_and_hash = [&]() {
12546|  22.0k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12546:11): [True: 1.37k, False: 20.7k]
  ------------------
12547|  1.37k|        const size_t q_end =
12548|  1.37k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12548:13): [True: 850, False: 520]
  ------------------
12549|  1.37k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12550|  1.37k|                                                q_end - query_start - 1),
12551|  1.37k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12552|  1.37k|      }
12553|  22.0k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12553:11): [True: 1.22k, False: 20.8k]
  ------------------
12554|  1.22k|        out.update_unencoded_base_hash(std::string_view(
12555|  1.22k|            input.data() + hash_start + 1, len - hash_start - 1));
12556|  1.22k|      }
12557|  22.0k|    };
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12545|  22.0k|    auto apply_query_and_hash = [&]() {
12546|  22.0k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12546:11): [True: 1.37k, False: 20.7k]
  ------------------
12547|  1.37k|        const size_t q_end =
12548|  1.37k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12548:13): [True: 850, False: 520]
  ------------------
12549|  1.37k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12550|  1.37k|                                                q_end - query_start - 1),
12551|  1.37k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12552|  1.37k|      }
12553|  22.0k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12553:11): [True: 1.22k, False: 20.8k]
  ------------------
12554|  1.22k|        out.update_unencoded_base_hash(std::string_view(
12555|  1.22k|            input.data() + hash_start + 1, len - hash_start - 1));
12556|  1.22k|      }
12557|  22.0k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12145|  2.22k|    auto apply_query_and_hash = [&]() {
12146|  2.22k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12146:11): [True: 1.12k, False: 1.09k]
  ------------------
12147|  1.12k|        const size_t q_end =
12148|  1.12k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12148:13): [True: 730, False: 393]
  ------------------
12149|  1.12k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12150|  1.12k|                                                q_end - query_start - 1),
12151|  1.12k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12152|  1.12k|      }
12153|  2.22k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12153:11): [True: 1.04k, False: 1.17k]
  ------------------
12154|  1.04k|        out.update_unencoded_base_hash(std::string_view(
12155|  1.04k|            input.data() + hash_start + 1, len - hash_start - 1));
12156|  1.04k|      }
12157|  2.22k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
12145|  2.22k|    auto apply_query_and_hash = [&]() {
12146|  2.22k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12146:11): [True: 1.12k, False: 1.09k]
  ------------------
12147|  1.12k|        const size_t q_end =
12148|  1.12k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12148:13): [True: 730, False: 393]
  ------------------
12149|  1.12k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12150|  1.12k|                                                q_end - query_start - 1),
12151|  1.12k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12152|  1.12k|      }
12153|  2.22k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12153:11): [True: 1.04k, False: 1.17k]
  ------------------
12154|  1.04k|        out.update_unencoded_base_hash(std::string_view(
12155|  1.04k|            input.data() + hash_start + 1, len - hash_start - 1));
12156|  1.04k|      }
12157|  2.22k|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8784|   532k|    std::string_view& input) noexcept {
 8785|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8786|       |  // function). this function should be quite fast.
 8787|   532k|  size_t location_of_first = input.find('#');
 8788|   532k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8788:7): [True: 510k, False: 21.9k]
  ------------------
 8789|   510k|    return std::nullopt;
 8790|   510k|  }
 8791|  21.9k|  std::string_view hash = input;
 8792|  21.9k|  hash.remove_prefix(location_of_first + 1);
 8793|  21.9k|  input.remove_suffix(input.size() - location_of_first);
 8794|  21.9k|  return hash;
 8795|   532k|}
_ZZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12868|   244k|  const auto enforce_max_input_length = [&]() {
12869|   244k|    if constexpr (store_values) {
12870|   244k|      if (url.is_valid) {
  ------------------
  |  Branch (12870:11): [True: 244k, False: 0]
  ------------------
12871|       |        if constexpr (result_type_is_ada_url_aggregator) {
12872|       |          if (url.buffer.size() > max_input_length) [[unlikely]] {
12873|       |            url.is_valid = false;
12874|       |          }
12875|   244k|        } else {
12876|   244k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12876:15): [True: 0, False: 244k]
  ------------------
12877|      0|            url.is_valid = false;
12878|      0|          }
12879|   244k|        }
12880|   244k|      }
12881|   244k|    }
12882|   244k|  };
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9747|   187k|find_authority_delimiter_special(std::string_view view) noexcept {
 9748|       |  // performance note: we might be able to gain further performance
 9749|       |  // with SIMD intrinsics.
 9750|  1.95M|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9750:33): [True: 1.94M, False: 19.7k]
  ------------------
 9751|  1.94M|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9751:9): [True: 167k, False: 1.77M]
  ------------------
 9752|   167k|      return pos - view.begin();
 9753|   167k|    }
 9754|  1.94M|  }
 9755|  19.7k|  return size_t(view.size());
 9756|   187k|}
_ZN3ada7helpers24find_authority_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9768|    286|find_authority_delimiter(std::string_view view) noexcept {
 9769|       |  // performance note: we might be able to gain further performance
 9770|       |  // with SIMD instrinsics.
 9771|  3.53k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9771:33): [True: 3.51k, False: 18]
  ------------------
 9772|  3.51k|    if (authority_delimiter[(uint8_t)*pos]) {
  ------------------
  |  Branch (9772:9): [True: 268, False: 3.25k]
  ------------------
 9773|    268|      return pos - view.begin();
 9774|    268|    }
 9775|  3.51k|  }
 9776|     18|  return size_t(view.size());
 9777|    286|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8797|  26.0k|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8798|       |  // Let path be url's path.
 8799|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8800|       |  // Windows drive letter, then return.
 8801|  26.0k|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8801:7): [True: 398, False: 25.6k]
  ------------------
 8802|    398|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8802:7): [True: 176, False: 222]
  |  Branch (8802:54): [True: 138, False: 38]
  ------------------
 8803|    138|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8803:9): [True: 20, False: 118]
  ------------------
 8804|    138|            helpers::substring(path, 1))) {
 8805|     20|      return false;
 8806|     20|    }
 8807|    138|  }
 8808|       |
 8809|       |  // Remove path's last item, if any.
 8810|  26.0k|  size_t last_delimiter = path.rfind('/');
 8811|  26.0k|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8811:7): [True: 22.5k, False: 3.47k]
  ------------------
 8812|  22.5k|    path.erase(last_delimiter);
 8813|  22.5k|    return true;
 8814|  22.5k|  }
 8815|       |
 8816|  3.47k|  return false;
 8817|  26.0k|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9460|   526k|    const bool is_special, std::string_view& view) noexcept {
 9461|       |  /**
 9462|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9463|       |   * compute a variable called insideBrackets but this variable is only used
 9464|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9465|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9466|       |   * It is conceptually simpler and arguably more efficient to just return a
 9467|       |   * Boolean indicating whether ':' was found outside brackets.
 9468|       |   */
 9469|   526k|  const size_t view_size = view.size();
 9470|   526k|  size_t location = 0;
 9471|   526k|  bool found_colon = false;
 9472|       |  /**
 9473|       |   * Performance analysis:
 9474|       |   *
 9475|       |   * We are basically seeking the end of the hostname which can be indicated
 9476|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9477|       |   * (where '\\' is only applicable for special URLs). However, these must
 9478|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9479|       |   * '?' does not count.
 9480|       |   *
 9481|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9482|       |   * the set of delimiters, and that we handle it first.
 9483|       |   *
 9484|       |   * So the trick is to have a fast function that locates the next delimiter.
 9485|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9486|       |   * function would be provided by the C++ standard library, but it seems that
 9487|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9488|       |   *
 9489|       |   * We do not break into two loops for speed, but for clarity.
 9490|       |   */
 9491|   526k|  if (is_special) {
  ------------------
  |  Branch (9491:7): [True: 525k, False: 1.48k]
  ------------------
 9492|       |    // We move to the next delimiter.
 9493|   525k|    location = find_next_host_delimiter_special(view, location);
 9494|       |    // Unless we find '[' then we are going only going to have to call
 9495|       |    // find_next_host_delimiter_special once.
 9496|   528k|    for (; location < view_size;
  ------------------
  |  Branch (9496:12): [True: 465k, False: 62.1k]
  ------------------
 9497|   525k|         location = find_next_host_delimiter_special(view, location)) {
 9498|   465k|      if (view[location] == '[') {
  ------------------
  |  Branch (9498:11): [True: 2.92k, False: 462k]
  ------------------
 9499|  2.92k|        location = view.find(']', location);
 9500|  2.92k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9500:13): [True: 164, False: 2.75k]
  ------------------
 9501|       |          // performance: view.find might get translated to a memchr, which
 9502|       |          // has no notion of std::string_view::npos, so the code does not
 9503|       |          // reflect the assembly.
 9504|    164|          location = view_size;
 9505|    164|          break;
 9506|    164|        }
 9507|   462k|      } else {
 9508|   462k|        found_colon = view[location] == ':';
 9509|   462k|        break;
 9510|   462k|      }
 9511|   465k|    }
 9512|   525k|  } else {
 9513|       |    // We move to the next delimiter.
 9514|  1.48k|    location = find_next_host_delimiter(view, location);
 9515|       |    // Unless we find '[' then we are going only going to have to call
 9516|       |    // find_next_host_delimiter_special once.
 9517|  1.60k|    for (; location < view_size;
  ------------------
  |  Branch (9517:12): [True: 1.37k, False: 232]
  ------------------
 9518|  1.48k|         location = find_next_host_delimiter(view, location)) {
 9519|  1.37k|      if (view[location] == '[') {
  ------------------
  |  Branch (9519:11): [True: 138, False: 1.23k]
  ------------------
 9520|    138|        location = view.find(']', location);
 9521|    138|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9521:13): [True: 12, False: 126]
  ------------------
 9522|       |          // performance: view.find might get translated to a memchr, which
 9523|       |          // has no notion of std::string_view::npos, so the code does not
 9524|       |          // reflect the assembly.
 9525|     12|          location = view_size;
 9526|     12|          break;
 9527|     12|        }
 9528|  1.23k|      } else {
 9529|  1.23k|        found_colon = view[location] == ':';
 9530|  1.23k|        break;
 9531|  1.23k|      }
 9532|  1.37k|    }
 9533|  1.48k|  }
 9534|       |  // performance: remove_suffix may translate into a single instruction.
 9535|   526k|  view.remove_suffix(view_size - location);
 9536|   526k|  return {location, found_colon};
 9537|   526k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9050|   528k|    std::string_view view, size_t location) noexcept {
 9051|       |  // first check for short strings in which case we do it naively.
 9052|   528k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9052:7): [True: 409k, False: 118k]
  ------------------
 9053|  4.35M|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9053:31): [True: 4.29M, False: 60.3k]
  ------------------
 9054|  4.29M|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (9054:11): [True: 1.41k, False: 4.29M]
  |  Branch (9054:29): [True: 345k, False: 3.94M]
  |  Branch (9054:47): [True: 192, False: 3.94M]
  ------------------
 9055|  3.94M|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (9055:11): [True: 484, False: 3.94M]
  |  Branch (9055:29): [True: 1.06k, False: 3.94M]
  ------------------
 9056|   348k|        return i;
 9057|   348k|      }
 9058|  4.29M|    }
 9059|  60.3k|    return size_t(view.size());
 9060|   409k|  }
 9061|       |  // fast path for long strings (expected to be common)
 9062|   118k|  size_t i = location;
 9063|   118k|  const __m128i mask1 = _mm_set1_epi8(':');
 9064|   118k|  const __m128i mask2 = _mm_set1_epi8('/');
 9065|   118k|  const __m128i mask3 = _mm_set1_epi8('\\');
 9066|   118k|  const __m128i mask4 = _mm_set1_epi8('?');
 9067|   118k|  const __m128i mask5 = _mm_set1_epi8('[');
 9068|       |
 9069|   235k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9069:10): [True: 173k, False: 61.6k]
  ------------------
 9070|   173k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9071|   173k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9072|   173k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9073|   173k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9074|   173k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9075|   173k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9076|   173k|    __m128i m = _mm_or_si128(
 9077|   173k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9078|   173k|    int mask = _mm_movemask_epi8(m);
 9079|   173k|    if (mask != 0) {
  ------------------
  |  Branch (9079:9): [True: 57.3k, False: 116k]
  ------------------
 9080|  57.3k|      return i + trailing_zeroes(mask);
 9081|  57.3k|    }
 9082|   173k|  }
 9083|  61.6k|  if (i < view.size()) {
  ------------------
  |  Branch (9083:7): [True: 61.3k, False: 278]
  ------------------
 9084|  61.3k|    __m128i word =
 9085|  61.3k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9086|  61.3k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9087|  61.3k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9088|  61.3k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 9089|  61.3k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9090|  61.3k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9091|  61.3k|    __m128i m = _mm_or_si128(
 9092|  61.3k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 9093|  61.3k|    int mask = _mm_movemask_epi8(m);
 9094|  61.3k|    if (mask != 0) {
  ------------------
  |  Branch (9094:9): [True: 59.8k, False: 1.47k]
  ------------------
 9095|  59.8k|      return view.length() - 16 + trailing_zeroes(mask);
 9096|  59.8k|    }
 9097|  61.3k|  }
 9098|  1.75k|  return size_t(view.length());
 9099|  61.6k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8870|   118k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8871|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8872|       |  unsigned long ret;
 8873|       |  // Search the mask data from least significant bit (LSB)
 8874|       |  // to the most significant bit (MSB) for a set bit (1).
 8875|       |  _BitScanForward(&ret, input_num);
 8876|       |  return (int)ret;
 8877|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8878|   118k|  return __builtin_ctzl(input_num);
 8879|   118k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8880|   118k|}
_ZN3ada7helpers24find_next_host_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9326|  1.60k|                                                  size_t location) noexcept {
 9327|       |  // first check for short strings in which case we do it naively.
 9328|  1.60k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9328:7): [True: 516, False: 1.09k]
  ------------------
 9329|  2.78k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9329:31): [True: 2.62k, False: 166]
  ------------------
 9330|  2.62k|      if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
  ------------------
  |  Branch (9330:11): [True: 60, False: 2.56k]
  |  Branch (9330:29): [True: 194, False: 2.36k]
  |  Branch (9330:47): [True: 52, False: 2.31k]
  ------------------
 9331|  2.31k|          view[i] == '[') {
  ------------------
  |  Branch (9331:11): [True: 44, False: 2.27k]
  ------------------
 9332|    350|        return i;
 9333|    350|      }
 9334|  2.62k|    }
 9335|    166|    return size_t(view.size());
 9336|    516|  }
 9337|       |  // fast path for long strings (expected to be common)
 9338|  1.09k|  size_t i = location;
 9339|  1.09k|  const __m128i mask1 = _mm_set1_epi8(':');
 9340|  1.09k|  const __m128i mask2 = _mm_set1_epi8('/');
 9341|  1.09k|  const __m128i mask4 = _mm_set1_epi8('?');
 9342|  1.09k|  const __m128i mask5 = _mm_set1_epi8('[');
 9343|       |
 9344|  1.63k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9344:10): [True: 1.43k, False: 200]
  ------------------
 9345|  1.43k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9346|  1.43k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9347|  1.43k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9348|  1.43k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9349|  1.43k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9350|  1.43k|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9351|  1.43k|    int mask = _mm_movemask_epi8(m);
 9352|  1.43k|    if (mask != 0) {
  ------------------
  |  Branch (9352:9): [True: 890, False: 544]
  ------------------
 9353|    890|      return i + trailing_zeroes(mask);
 9354|    890|    }
 9355|  1.43k|  }
 9356|    200|  if (i < view.size()) {
  ------------------
  |  Branch (9356:7): [True: 176, False: 24]
  ------------------
 9357|    176|    __m128i word =
 9358|    176|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9359|    176|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9360|    176|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9361|    176|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9362|    176|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9363|    176|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9364|    176|    int mask = _mm_movemask_epi8(m);
 9365|    176|    if (mask != 0) {
  ------------------
  |  Branch (9365:9): [True: 134, False: 42]
  ------------------
 9366|    134|      return view.length() - 16 + trailing_zeroes(mask);
 9367|    134|    }
 9368|    176|  }
 9369|     66|  return size_t(view.length());
 9370|    200|}
_ZN3ada3url10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10413|   264k|ada_really_inline bool url::parse_host(std::string_view input) {
10414|   264k|  ada_log("parse_host ", input, " [", input.size(), " bytes]");
10415|   264k|  if (input.empty()) {
  ------------------
  |  Branch (10415:7): [True: 5, False: 264k]
  ------------------
10416|      5|    return is_valid = false;
10417|      5|  }  // technically unnecessary.
10418|       |  // If input starts with U+005B ([), then:
10419|   264k|  if (input[0] == '[') {
  ------------------
  |  Branch (10419:7): [True: 671, False: 263k]
  ------------------
10420|       |    // If input does not end with U+005D (]), validation error, return failure.
10421|    671|    if (input.back() != ']') {
  ------------------
  |  Branch (10421:9): [True: 73, False: 598]
  ------------------
10422|     73|      return is_valid = false;
10423|     73|    }
10424|    598|    ada_log("parse_host ipv6");
10425|       |
10426|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
10427|       |    // trailing U+005D (]) removed.
10428|    598|    input.remove_prefix(1);
10429|    598|    input.remove_suffix(1);
10430|    598|    return parse_ipv6(input);
10431|    671|  }
10432|       |
10433|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
10434|       |  // input.
10435|   263k|  if (!is_special()) {
  ------------------
  |  Branch (10435:7): [True: 621, False: 262k]
  ------------------
10436|    621|    return parse_opaque_host(input);
10437|    621|  }
10438|       |
10439|       |  // Fast path: try to parse as pure decimal IPv4 first.
10440|   262k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
10441|   262k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (10441:7): [True: 107k, False: 155k]
  ------------------
10442|   107k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (10442:9): [True: 107k, False: 0]
  |  Branch (10442:27): [True: 10, False: 107k]
  ------------------
10443|     10|      host = input.substr(0, input.size() - 1);
10444|   107k|    } else {
10445|   107k|      host = input;
10446|   107k|    }
10447|   107k|    host_type = IPV4;
10448|   107k|    is_valid = true;
10449|   107k|    ada_log("parse_host fast path decimal ipv4");
10450|   107k|    return true;
10451|   107k|  }
10452|       |  // Let domain be the result of running UTF-8 decode without BOM on the
10453|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
10454|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
10455|       |  // which case we do not need to call the expensive 'to_ascii' if a few
10456|       |  // conditions are met: no '%' and no 'xn-' subsequence.
10457|   155k|  const uint8_t forbidden_or_upper =
10458|   155k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
10459|   155k|                                                             input.size());
10460|   155k|  static constexpr std::string_view xn_dash{"xn-", 3};
10461|   155k|  if ((forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (10461:7): [True: 133k, False: 21.8k]
  ------------------
10462|   133k|    host = std::string(input);
10463|   133k|    if ((forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (10463:9): [True: 849, False: 132k]
  ------------------
10464|    849|      unicode::to_lower_ascii(host->data(), host->size());
10465|    849|    }
10466|   133k|    if (host->find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10466:9): [True: 73.0k, False: 60.7k]
  ------------------
10467|  73.2k|        host->find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10467:9): [True: 217, False: 60.5k]
  ------------------
10468|  73.2k|      if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10468:11): [True: 39.1k, False: 34.0k]
  ------------------
10469|  39.1k|        ada_log("parse_host fast path ipv4");
10470|  39.1k|        return parse_ipv4(*host);
10471|  39.1k|      }
10472|  34.0k|      ada_log("parse_host fast path ", *host);
10473|  34.0k|      is_valid = true;
10474|  34.0k|      return true;
10475|  73.2k|    }
10476|   133k|  } else if (const size_t first_percent = input.find('%');
10477|  21.8k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (10477:14): [True: 19.4k, False: 2.47k]
  ------------------
10478|  19.4k|    std::string decoded = unicode::percent_decode(input, first_percent);
10479|  19.4k|    const uint8_t decoded_flags =
10480|  19.4k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
10481|  19.4k|                                                               decoded.size());
10482|  19.4k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (10482:9): [True: 19.1k, False: 292]
  ------------------
10483|  19.1k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (10483:11): [True: 136, False: 18.9k]
  ------------------
10484|    136|        unicode::to_lower_ascii(decoded.data(), decoded.size());
10485|    136|      }
10486|  19.1k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10486:11): [True: 19.0k, False: 61]
  ------------------
10487|  19.0k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10487:11): [True: 26, False: 35]
  ------------------
10488|  19.0k|        host = std::move(decoded);
10489|  19.0k|        if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10489:13): [True: 18.8k, False: 182]
  ------------------
10490|  18.8k|          return parse_ipv4(*host);
10491|  18.8k|        }
10492|    182|        is_valid = true;
10493|    182|        return true;
10494|  19.0k|      }
10495|  19.1k|    }
10496|  19.4k|  }
10497|  63.3k|  ada_log("parse_host calling to_ascii");
10498|  63.3k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
10499|  63.3k|  if (!is_valid || !host.has_value()) {
  ------------------
  |  Branch (10499:7): [True: 1.44k, False: 61.9k]
  |  Branch (10499:20): [True: 0, False: 61.9k]
  ------------------
10500|  1.44k|    ada_log("parse_host to_ascii returns false");
10501|  1.44k|    return is_valid = false;
10502|  1.44k|  }
10503|  61.9k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
10504|  61.9k|          " bytes]");
10505|       |
10506|  61.9k|  if (std::any_of(host->begin(), host->end(),
  ------------------
  |  Branch (10506:7): [True: 0, False: 61.9k]
  ------------------
10507|  61.9k|                  ada::unicode::is_forbidden_domain_code_point)) {
10508|      0|    host = std::nullopt;
10509|      0|    return is_valid = false;
10510|      0|  }
10511|       |
10512|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
10513|       |  // asciiDomain.
10514|  61.9k|  if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10514:7): [True: 119, False: 61.8k]
  ------------------
10515|    119|    ada_log("parse_host got ipv4 ", *host);
10516|    119|    return parse_ipv4(*host);
10517|    119|  }
10518|       |
10519|  61.8k|  return true;
10520|  61.9k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7318|   350k|                                              size_t length) noexcept {
 7319|   350k|  size_t i = 0;
 7320|   350k|  uint8_t accumulator{};
 7321|  1.37M|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7321:10): [True: 1.02M, False: 350k]
  ------------------
 7322|  1.02M|    accumulator |=
 7323|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7324|  1.02M|    accumulator |=
 7325|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7326|  1.02M|    accumulator |=
 7327|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7328|  1.02M|    accumulator |=
 7329|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7330|  1.02M|  }
 7331|   947k|  for (; i < length; i++) {
  ------------------
  |  Branch (7331:10): [True: 597k, False: 350k]
  ------------------
 7332|   597k|    accumulator |=
 7333|   597k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7334|   597k|  }
 7335|   350k|  return accumulator;
 7336|   350k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7277|  2.26M|    const char c) noexcept {
 7278|  2.26M|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7279|  2.26M|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12868|   244k|  const auto enforce_max_input_length = [&]() {
12869|   244k|    if constexpr (store_values) {
12870|   244k|      if (url.is_valid) {
  ------------------
  |  Branch (12870:11): [True: 244k, False: 0]
  ------------------
12871|   244k|        if constexpr (result_type_is_ada_url_aggregator) {
12872|   244k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12872:15): [True: 0, False: 244k]
  ------------------
12873|      0|            url.is_valid = false;
12874|      0|          }
12875|       |        } else {
12876|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12877|       |            url.is_valid = false;
12878|       |          }
12879|       |        }
12880|   244k|      }
12881|   244k|    }
12882|   244k|  };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
11184|   121k|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
11185|   121k|  uint32_t digits = 1;
11186|   362k|  while (port >= 10) {
  ------------------
  |  Branch (11186:10): [True: 241k, False: 121k]
  ------------------
11187|   241k|    port /= 10;
11188|   241k|    ++digits;
11189|   241k|  }
11190|   121k|  return digits;
11191|   121k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
11194|  11.3k|                                             uint32_t port) {
11195|  11.3k|  buffer += ':';
11196|  11.3k|  char port_buf[5];
11197|  11.3k|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
11198|  11.3k|  (void)ec;
11199|  11.3k|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
11200|  11.3k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11342|  1.22M|                                        size_t n) noexcept {
11343|  1.22M|  const size_t rem = n - host_start;
11344|  1.22M|  if (rem == 0) {
  ------------------
  |  Branch (11344:7): [True: 0, False: 1.22M]
  ------------------
11345|      0|    return false;
11346|      0|  }
11347|       |#if ADA_NEON
11348|       |  if (rem >= 16) {
11349|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11350|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11351|       |    if (at == 0) {
11352|       |      return false;
11353|       |    }
11354|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11355|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11356|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11357|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11358|       |  }
11359|       |#elif ADA_SSE2
11360|  1.22M|  if (rem >= 16) {
  ------------------
  |  Branch (11360:7): [True: 668k, False: 560k]
  ------------------
11361|   668k|    const __m128i w =
11362|   668k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11363|   668k|    const uint16_t at = static_cast<uint16_t>(
11364|   668k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11365|   668k|    if (at == 0) {
  ------------------
  |  Branch (11365:9): [True: 608k, False: 60.0k]
  ------------------
11366|   608k|      return false;
11367|   608k|    }
11368|  60.0k|    const uint16_t delim = static_cast<uint16_t>(
11369|  60.0k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11370|  60.0k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11371|  60.0k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11372|  60.0k|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11372:12): [True: 59.3k, False: 710]
  |  Branch (11372:26): [True: 114, False: 596]
  ------------------
11373|   668k|  }
11374|   560k|#endif
11375|   560k|  const size_t lim = host_start + rem;
11376|  5.92M|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11376:31): [True: 5.86M, False: 60.4k]
  ------------------
11377|  5.86M|    const uint8_t c = p[i];
11378|  5.86M|    if (c == '@') {
  ------------------
  |  Branch (11378:9): [True: 19.1k, False: 5.84M]
  ------------------
11379|  19.1k|      return true;
11380|  19.1k|    }
11381|  5.84M|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11381:9): [True: 461k, False: 5.38M]
  |  Branch (11381:21): [True: 19.1k, False: 5.36M]
  |  Branch (11381:33): [True: 378, False: 5.36M]
  ------------------
11382|   481k|      return false;
11383|   481k|    }
11384|  5.84M|  }
11385|  60.4k|  return false;
11386|   560k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11407|   868k|                                     bool& has_x) noexcept {
11408|   868k|  has_upper = false;
11409|   868k|  has_x = false;
11410|   868k|  size_t i = start;
11411|   868k|#if ADA_PARSER_SSSE3
11412|   868k|  if (parser_use_ssse3() && (len - start >= 16)) {
  ------------------
  |  Branch (11412:7): [True: 868k, False: 0]
  |  Branch (11412:29): [True: 557k, False: 311k]
  ------------------
11413|   557k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11414|   557k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11415|   557k|    const __m128i x_splat = _mm_set1_epi8('x');
11416|   557k|    auto visit = [&](size_t at) noexcept -> bool {
11417|   557k|      const __m128i w =
11418|   557k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11419|   557k|      const int up = sse2_uppercase(w);
11420|   557k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11421|   557k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11422|   557k|      if (mask == 0) {
11423|   557k|        if (up != 0) {
11424|   557k|          has_upper = true;
11425|   557k|        }
11426|   557k|        if (xs != 0) {
11427|   557k|          has_x = true;
11428|   557k|        }
11429|   557k|        return false;
11430|   557k|      }
11431|   557k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11432|   557k|      const int valid = (1 << hit) - 1;
11433|   557k|      if ((up & valid) != 0) {
11434|   557k|        has_upper = true;
11435|   557k|      }
11436|   557k|      if ((xs & valid) != 0) {
11437|   557k|        has_x = true;
11438|   557k|      }
11439|   557k|      end = at + static_cast<size_t>(hit);
11440|   557k|      return true;
11441|   557k|    };
11442|   576k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11442:12): [True: 94.1k, False: 482k]
  ------------------
11443|  94.1k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11443:11): [True: 73.4k, False: 20.6k]
  |  Branch (11443:23): [True: 1.48k, False: 19.1k]
  ------------------
11444|  74.9k|        return k_host_class[b[end]] == 1;
11445|  74.9k|      }
11446|  94.1k|    }
11447|   540k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11447:12): [True: 481k, False: 59.4k]
  ------------------
11448|   481k|      if (visit(i)) {
  ------------------
  |  Branch (11448:11): [True: 422k, False: 58.5k]
  ------------------
11449|   422k|        return k_host_class[b[end]] == 1;
11450|   422k|      }
11451|   481k|    }
11452|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11453|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11454|  59.4k|    if (i > start && i < len) {
  ------------------
  |  Branch (11454:9): [True: 59.4k, False: 0]
  |  Branch (11454:22): [True: 59.3k, False: 32]
  ------------------
11455|  59.3k|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11455:11): [True: 59.2k, False: 112]
  |  Branch (11455:30): [True: 59.2k, False: 0]
  ------------------
11456|  59.2k|        return k_host_class[b[end]] == 1;
11457|  59.2k|      }
11458|    112|      end = len;
11459|    112|      return true;
11460|  59.3k|    }
11461|  59.4k|  }
11462|       |#elif ADA_SSE2
11463|       |  const __m128i x_splat = _mm_set1_epi8('x');
11464|       |  for (; i + 32 <= len; i += 32) {
11465|       |    for (size_t off = 0; off < 32; off += 16) {
11466|       |      const __m128i w =
11467|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11468|       |      const int up = sse2_uppercase(w);
11469|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11470|       |      const int mask = sse2_host_stop(w);
11471|       |      if (mask != 0) {
11472|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11473|       |        const int valid = (1 << hit) - 1;
11474|       |        if ((up & valid) != 0) {
11475|       |          has_upper = true;
11476|       |        }
11477|       |        if ((xs & valid) != 0) {
11478|       |          has_x = true;
11479|       |        }
11480|       |        end = i + off + static_cast<size_t>(hit);
11481|       |        return k_host_class[b[end]] == 1;
11482|       |      }
11483|       |      if (up != 0) {
11484|       |        has_upper = true;
11485|       |      }
11486|       |      if (xs != 0) {
11487|       |        has_x = true;
11488|       |      }
11489|       |    }
11490|       |  }
11491|       |  for (; i + 16 <= len; i += 16) {
11492|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11493|       |    const int up = sse2_uppercase(w);
11494|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11495|       |    const int mask = sse2_host_stop(w);
11496|       |    if (mask != 0) {
11497|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11498|       |      const int valid = (1 << hit) - 1;
11499|       |      if ((up & valid) != 0) {
11500|       |        has_upper = true;
11501|       |      }
11502|       |      if ((xs & valid) != 0) {
11503|       |        has_x = true;
11504|       |      }
11505|       |      end = i + static_cast<size_t>(hit);
11506|       |      return k_host_class[b[end]] == 1;
11507|       |    }
11508|       |    if (up != 0) {
11509|       |      has_upper = true;
11510|       |    }
11511|       |    if (xs != 0) {
11512|       |      has_x = true;
11513|       |    }
11514|       |  }
11515|       |#elif ADA_NEON
11516|       |  if (len - start >= 16) {
11517|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11518|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11519|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11520|       |    auto visit = [&](size_t at) noexcept -> bool {
11521|       |      const uint8x16_t w = vld1q_u8(b + at);
11522|       |      const uint64_t up = neon_uppercase(w);
11523|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11524|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11525|       |      if (bits == 0) {
11526|       |        if (up != 0) {
11527|       |          has_upper = true;
11528|       |        }
11529|       |        if (xs != 0) {
11530|       |          has_x = true;
11531|       |        }
11532|       |        return false;
11533|       |      }
11534|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11535|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11536|       |      if ((up & valid) != 0) {
11537|       |        has_upper = true;
11538|       |      }
11539|       |      if ((xs & valid) != 0) {
11540|       |        has_x = true;
11541|       |      }
11542|       |      end = at + hit;
11543|       |      return true;
11544|       |    };
11545|       |    for (; i + 32 <= len; i += 32) {
11546|       |      if (visit(i) || visit(i + 16)) {
11547|       |        return k_host_class[b[end]] == 1;
11548|       |      }
11549|       |    }
11550|       |    for (; i + 16 <= len; i += 16) {
11551|       |      if (visit(i)) {
11552|       |        return k_host_class[b[end]] == 1;
11553|       |      }
11554|       |    }
11555|       |    if (i > start && i < len) {
11556|       |      if (visit(len - 16) && end >= i) {
11557|       |        return k_host_class[b[end]] == 1;
11558|       |      }
11559|       |      end = len;
11560|       |      return true;
11561|       |    }
11562|       |  }
11563|       |#endif
11564|  3.35M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11564:10): [True: 3.33M, False: 19.1k]
  ------------------
11565|  3.33M|    const uint8_t c = b[i];
11566|  3.33M|    const uint8_t cls = k_host_class[c];
11567|  3.33M|    if (cls == 1) {
  ------------------
  |  Branch (11567:9): [True: 289k, False: 3.04M]
  ------------------
11568|   289k|      end = i;
11569|   289k|      return true;
11570|   289k|    }
11571|  3.04M|    if (cls == 2) {
  ------------------
  |  Branch (11571:9): [True: 2.43k, False: 3.04M]
  ------------------
11572|  2.43k|      return false;
11573|  2.43k|    }
11574|  3.04M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11574:9): [True: 2.63M, False: 406k]
  |  Branch (11574:21): [True: 876, False: 2.63M]
  ------------------
11575|    876|      has_upper = true;
11576|  3.04M|    } else if (c == 'x') {
  ------------------
  |  Branch (11576:16): [True: 323k, False: 2.71M]
  ------------------
11577|   323k|      has_x = true;
11578|   323k|    }
11579|  3.04M|  }
11580|  19.1k|  end = len;
11581|  19.1k|  return true;
11582|   311k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116parser_use_ssse3Ev:
11392|  1.81M|ada_really_inline bool parser_use_ssse3() noexcept {
11393|  1.81M|#ifdef ADA_PARSER_NEED_SSSE3_TARGET
11394|  1.81M|  static const bool supported = __builtin_cpu_supports("ssse3") != 0;
11395|  1.81M|  return supported;
11396|       |#else
11397|       |  return true;
11398|       |#endif
11399|  1.81M|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
11223|  1.27M|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
11224|  1.27M|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
11225|  1.27M|}
simple_absolute.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENKUlmE_clEm:
11416|   655k|    auto visit = [&](size_t at) noexcept -> bool {
11417|   655k|      const __m128i w =
11418|   655k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11419|   655k|      const int up = sse2_uppercase(w);
11420|   655k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11421|   655k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11422|   655k|      if (mask == 0) {
  ------------------
  |  Branch (11422:11): [True: 98.5k, False: 556k]
  ------------------
11423|  98.5k|        if (up != 0) {
  ------------------
  |  Branch (11423:13): [True: 1.50k, False: 96.9k]
  ------------------
11424|  1.50k|          has_upper = true;
11425|  1.50k|        }
11426|  98.5k|        if (xs != 0) {
  ------------------
  |  Branch (11426:13): [True: 93.2k, False: 5.29k]
  ------------------
11427|  93.2k|          has_x = true;
11428|  93.2k|        }
11429|  98.5k|        return false;
11430|  98.5k|      }
11431|   556k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11432|   556k|      const int valid = (1 << hit) - 1;
11433|   556k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11433:11): [True: 19.9k, False: 536k]
  ------------------
11434|  19.9k|        has_upper = true;
11435|  19.9k|      }
11436|   556k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11436:11): [True: 484k, False: 72.6k]
  ------------------
11437|   484k|        has_x = true;
11438|   484k|      }
11439|   556k|      end = at + static_cast<size_t>(hit);
11440|   556k|      return true;
11441|   655k|    };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11310|   655k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11311|   655k|  return _mm_movemask_epi8(_mm_and_si128(
11312|   655k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11313|   655k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11314|   655k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
11230|   775k|                                          __m128i hi_tbl) noexcept {
11231|   775k|  const __m128i nibble = _mm_set1_epi8(0x0F);
11232|   775k|  const __m128i lo = _mm_and_si128(w, nibble);
11233|   775k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
11234|   775k|  const __m128i hit =
11235|   775k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
11236|   775k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
11237|   775k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
11202|   631k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
11203|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
11204|       |  unsigned long ret;
11205|       |  _BitScanForward(&ret, input_num);
11206|       |  return static_cast<int>(ret);
11207|       |#else
11208|   631k|  return __builtin_ctz(input_num);
11209|   631k|#endif
11210|   631k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11642|   646k|                                   bool& maybe_dot_segment) noexcept {
11643|   646k|  const size_t run_start = i;
11644|   646k|#if ADA_PARSER_SSSE3
11645|   646k|  if (parser_use_ssse3() && (i + 16 <= len)) {
  ------------------
  |  Branch (11645:7): [True: 646k, False: 0]
  |  Branch (11645:29): [True: 72.3k, False: 574k]
  ------------------
11646|  72.3k|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11647|  72.3k|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11648|  79.4k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11648:12): [True: 16.0k, False: 63.3k]
  ------------------
11649|  16.0k|      const __m128i w0 =
11650|  16.0k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11651|  16.0k|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11652|  16.0k|      if (m0 != 0) {
  ------------------
  |  Branch (11652:11): [True: 7.74k, False: 8.27k]
  ------------------
11653|  7.74k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11654|  7.74k|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11655|  7.74k|                            maybe_dot_segment);
11656|  7.74k|        i += static_cast<size_t>(hit_bit);
11657|  7.74k|        return;
11658|  7.74k|      }
11659|  8.27k|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11660|  8.27k|      const __m128i w1 =
11661|  8.27k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11662|  8.27k|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11663|  8.27k|      if (m1 != 0) {
  ------------------
  |  Branch (11663:11): [True: 1.17k, False: 7.09k]
  ------------------
11664|  1.17k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11665|  1.17k|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11666|  1.17k|                            maybe_dot_segment);
11667|  1.17k|        i += 16 + static_cast<size_t>(hit_bit);
11668|  1.17k|        return;
11669|  1.17k|      }
11670|  7.09k|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11671|  7.09k|    }
11672|  65.1k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11672:12): [True: 62.5k, False: 2.61k]
  ------------------
11673|  62.5k|      const __m128i w =
11674|  62.5k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11675|  62.5k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11676|  62.5k|      if (mask != 0) {
  ------------------
  |  Branch (11676:11): [True: 60.7k, False: 1.74k]
  ------------------
11677|  60.7k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11678|  60.7k|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11679|  60.7k|                            maybe_dot_segment);
11680|  60.7k|        i += static_cast<size_t>(hit_bit);
11681|  60.7k|        return;
11682|  60.7k|      }
11683|  1.74k|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11684|  1.74k|    }
11685|  2.61k|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11685:9): [True: 2.61k, False: 0]
  |  Branch (11685:26): [True: 2.04k, False: 574]
  ------------------
11686|  2.04k|      const __m128i w =
11687|  2.04k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11688|  2.04k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11689|  2.04k|      if (mask != 0) {
  ------------------
  |  Branch (11689:11): [True: 1.04k, False: 998]
  ------------------
11690|  1.04k|        const size_t hit =
11691|  1.04k|            len - 16 +
11692|  1.04k|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11693|  1.04k|        if (hit >= i) {
  ------------------
  |  Branch (11693:13): [True: 1.04k, False: 0]
  ------------------
11694|  4.81k|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11694:30): [True: 3.77k, False: 1.04k]
  ------------------
11695|  3.77k|            if (b[j] == '.') {
  ------------------
  |  Branch (11695:17): [True: 890, False: 2.88k]
  ------------------
11696|    890|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11697|    890|            }
11698|  3.77k|          }
11699|  1.04k|          i = hit;
11700|  1.04k|          return;
11701|  1.04k|        }
11702|  1.04k|      }
11703|  8.45k|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11703:26): [True: 7.45k, False: 998]
  ------------------
11704|  7.45k|        if (b[j] == '.') {
  ------------------
  |  Branch (11704:13): [True: 1.91k, False: 5.53k]
  ------------------
11705|  1.91k|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11706|  1.91k|        }
11707|  7.45k|      }
11708|    998|      i = len;
11709|    998|      return;
11710|  2.04k|    }
11711|  2.61k|  }
11712|       |#elif ADA_SSE2
11713|       |  for (; i + 16 <= len; i += 16) {
11714|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11715|       |    const int mask = sse2_path_stop(w);
11716|       |    if (mask != 0) {
11717|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11718|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11719|       |                          maybe_dot_segment);
11720|       |      i += static_cast<size_t>(hit_bit);
11721|       |      return;
11722|       |    }
11723|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11724|       |  }
11725|       |#elif ADA_NEON
11726|       |  if (i + 16 <= len) {
11727|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11728|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11729|       |    for (; i + 32 <= len; i += 32) {
11730|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11731|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11732|       |      if (bits0 != 0) {
11733|       |        const size_t hit_off =
11734|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11735|       |        const uint64_t valid =
11736|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11737|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11738|       |        i += hit_off;
11739|       |        return;
11740|       |      }
11741|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11742|       |                               maybe_dot_segment);
11743|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11744|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11745|       |      if (bits1 != 0) {
11746|       |        const size_t hit_off =
11747|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11748|       |        const uint64_t valid =
11749|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11750|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11751|       |                                 maybe_dot_segment);
11752|       |        i += 16 + hit_off;
11753|       |        return;
11754|       |      }
11755|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11756|       |                               maybe_dot_segment);
11757|       |    }
11758|       |    for (; i + 16 <= len; i += 16) {
11759|       |      const uint8x16_t w = vld1q_u8(b + i);
11760|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11761|       |      if (bits != 0) {
11762|       |        const size_t hit_off =
11763|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11764|       |        const uint64_t valid =
11765|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11766|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11767|       |        i += hit_off;
11768|       |        return;
11769|       |      }
11770|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11771|       |                               maybe_dot_segment);
11772|       |    }
11773|       |    if (i > run_start && i < len) {
11774|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11775|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11776|       |      if (bits != 0) {
11777|       |        const size_t hit =
11778|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11779|       |        if (hit >= i) {
11780|       |          for (size_t j = i; j < hit; ++j) {
11781|       |            if (b[j] == '.') {
11782|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11783|       |            }
11784|       |          }
11785|       |          i = hit;
11786|       |          return;
11787|       |        }
11788|       |      }
11789|       |      for (size_t j = i; j < len; ++j) {
11790|       |        if (b[j] == '.') {
11791|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11792|       |        }
11793|       |      }
11794|       |      i = len;
11795|       |      return;
11796|       |    }
11797|       |  }
11798|       |#endif
11799|  2.15M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11799:10): [True: 1.73M, False: 417k]
  ------------------
11800|  1.73M|    const uint8_t c = b[i];
11801|  1.73M|    const uint8_t cls = k_path[c];
11802|  1.73M|    if (cls != 0) {
  ------------------
  |  Branch (11802:9): [True: 157k, False: 1.57M]
  ------------------
11803|   157k|      return;
11804|   157k|    }
11805|  1.57M|    if (c == '.') {
  ------------------
  |  Branch (11805:9): [True: 171k, False: 1.40M]
  ------------------
11806|   171k|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11807|   171k|    }
11808|  1.57M|  }
11809|   575k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11599|  86.8k|                                           bool& maybe_dot_segment) noexcept {
11600|  86.8k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11600:7): [True: 5.12k, False: 81.6k]
  |  Branch (11600:28): [True: 5.07k, False: 76.6k]
  ------------------
11601|  10.1k|    return;
11602|  10.1k|  }
11603|  76.6k|  const int dots =
11604|  76.6k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11605|  76.6k|  if (dots == 0) {
  ------------------
  |  Branch (11605:7): [True: 66.2k, False: 10.3k]
  ------------------
11606|  66.2k|    return;
11607|  66.2k|  }
11608|  10.3k|  const int slashes =
11609|  10.3k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11610|  10.3k|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11610:8): [True: 4.05k, False: 6.29k]
  |  Branch (11610:28): [True: 1.29k, False: 2.75k]
  |  Branch (11610:46): [True: 282, False: 2.47k]
  ------------------
11611|  8.76k|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11611:7): [True: 1.45k, False: 7.31k]
  ------------------
11612|  3.03k|    maybe_dot_segment = true;
11613|  3.03k|  }
11614|  10.3k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11586|   173k|    bool& maybe_dot_segment) noexcept {
11587|   173k|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11587:7): [True: 528, False: 173k]
  |  Branch (11587:27): [True: 39.2k, False: 134k]
  ------------------
11588|  39.7k|    maybe_dot_segment = true;
11589|  39.7k|  }
11590|   173k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11952|   179k|                                    size_t len) noexcept {
11953|   179k|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11815|   179k|  do {                                                                       \
  |  |11816|   179k|    const size_t scan_start = i;                                             \
  |  |11817|   179k|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11817:9): [True: 179k, False: 0]
  |  |  |  Branch (11817:31): [True: 4.94k, False: 174k]
  |  |  ------------------
  |  |11818|  4.94k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11819|  4.94k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11820|  12.3k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11820:14): [True: 7.98k, False: 4.32k]
  |  |  ------------------
  |  |11821|  7.98k|        const __m128i w0 =                                                   \
  |  |11822|  7.98k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11823|  7.98k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11824|  7.98k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11824:13): [True: 460, False: 7.52k]
  |  |  ------------------
  |  |11825|    460|          i += static_cast<size_t>(                                          \
  |  |11826|    460|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11827|    460|          return;                                                            \
  |  |11828|    460|        }                                                                    \
  |  |11829|  7.98k|        const __m128i w1 =                                                   \
  |  |11830|  7.52k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11831|  7.52k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11832|  7.52k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11832:13): [True: 160, False: 7.36k]
  |  |  ------------------
  |  |11833|    160|          i += 16 + static_cast<size_t>(                                     \
  |  |11834|    160|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11835|    160|          return;                                                            \
  |  |11836|    160|        }                                                                    \
  |  |11837|  7.52k|      }                                                                      \
  |  |11838|  4.94k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11838:14): [True: 1.57k, False: 3.25k]
  |  |  ------------------
  |  |11839|  1.57k|        const __m128i w =                                                    \
  |  |11840|  1.57k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11841|  1.57k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11842|  1.57k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11842:13): [True: 1.06k, False: 512]
  |  |  ------------------
  |  |11843|  1.06k|          i += static_cast<size_t>(                                          \
  |  |11844|  1.06k|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11845|  1.06k|          return;                                                            \
  |  |11846|  1.06k|        }                                                                    \
  |  |11847|  1.57k|      }                                                                      \
  |  |11848|  4.32k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11848:11): [True: 3.25k, False: 0]
  |  |  |  Branch (11848:29): [True: 3.16k, False: 90]
  |  |  ------------------
  |  |11849|  3.16k|        const __m128i w =                                                    \
  |  |11850|  3.16k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11851|  3.16k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11852|  3.16k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11852:13): [True: 2.11k, False: 1.05k]
  |  |  ------------------
  |  |11853|  2.11k|          const size_t hit = len - 16 +                                      \
  |  |11854|  2.11k|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11855|  2.11k|                                 static_cast<uint32_t>(mask)));              \
  |  |11856|  2.11k|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11856:15): [True: 2.11k, False: 0]
  |  |  ------------------
  |  |11857|  2.11k|            i = hit;                                                         \
  |  |11858|  2.11k|            return;                                                          \
  |  |11859|  2.11k|          }                                                                  \
  |  |11860|  2.11k|        }                                                                    \
  |  |11861|  3.16k|        i = len;                                                             \
  |  |11862|  1.05k|        return;                                                              \
  |  |11863|  3.16k|      }                                                                      \
  |  |11864|  3.25k|    }                                                                        \
  |  |11865|  1.21M|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11865:12): [True: 1.10M, False: 114k]
  |  |  ------------------
  |  |11866|  1.10M|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11866:11): [True: 60.1k, False: 1.04M]
  |  |  ------------------
  |  |11867|  60.1k|        return;                                                              \
  |  |11868|  60.1k|      }                                                                      \
  |  |11869|  1.10M|    }                                                                        \
  |  |11870|   174k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11870:12): [Folded, False: 114k]
  |  |  ------------------
  ------------------
11954|   179k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11957|   122k|                                   size_t len) noexcept {
11958|   122k|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11815|   122k|  do {                                                                       \
  |  |11816|   122k|    const size_t scan_start = i;                                             \
  |  |11817|   122k|    if (parser_use_ssse3() && (i + 16 <= len)) {                             \
  |  |  ------------------
  |  |  |  Branch (11817:9): [True: 122k, False: 0]
  |  |  |  Branch (11817:31): [True: 1.39k, False: 121k]
  |  |  ------------------
  |  |11818|  1.39k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11819|  1.39k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11820|  5.82k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11820:14): [True: 4.62k, False: 1.20k]
  |  |  ------------------
  |  |11821|  4.62k|        const __m128i w0 =                                                   \
  |  |11822|  4.62k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11823|  4.62k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11824|  4.62k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11824:13): [True: 148, False: 4.47k]
  |  |  ------------------
  |  |11825|    148|          i += static_cast<size_t>(                                          \
  |  |11826|    148|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11827|    148|          return;                                                            \
  |  |11828|    148|        }                                                                    \
  |  |11829|  4.62k|        const __m128i w1 =                                                   \
  |  |11830|  4.47k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11831|  4.47k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11832|  4.47k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11832:13): [True: 46, False: 4.43k]
  |  |  ------------------
  |  |11833|     46|          i += 16 + static_cast<size_t>(                                     \
  |  |11834|     46|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11835|     46|          return;                                                            \
  |  |11836|     46|        }                                                                    \
  |  |11837|  4.47k|      }                                                                      \
  |  |11838|  1.87k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11838:14): [True: 736, False: 1.13k]
  |  |  ------------------
  |  |11839|    736|        const __m128i w =                                                    \
  |  |11840|    736|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11841|    736|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11842|    736|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11842:13): [True: 62, False: 674]
  |  |  ------------------
  |  |11843|     62|          i += static_cast<size_t>(                                          \
  |  |11844|     62|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11845|     62|          return;                                                            \
  |  |11846|     62|        }                                                                    \
  |  |11847|    736|      }                                                                      \
  |  |11848|  1.20k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11848:11): [True: 1.13k, False: 0]
  |  |  |  Branch (11848:29): [True: 966, False: 172]
  |  |  ------------------
  |  |11849|    966|        const __m128i w =                                                    \
  |  |11850|    966|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11851|    966|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11852|    966|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11852:13): [True: 46, False: 920]
  |  |  ------------------
  |  |11853|     46|          const size_t hit = len - 16 +                                      \
  |  |11854|     46|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11855|     46|                                 static_cast<uint32_t>(mask)));              \
  |  |11856|     46|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11856:15): [True: 46, False: 0]
  |  |  ------------------
  |  |11857|     46|            i = hit;                                                         \
  |  |11858|     46|            return;                                                          \
  |  |11859|     46|          }                                                                  \
  |  |11860|     46|        }                                                                    \
  |  |11861|    966|        i = len;                                                             \
  |  |11862|    920|        return;                                                              \
  |  |11863|    966|      }                                                                      \
  |  |11864|  1.13k|    }                                                                        \
  |  |11865|   594k|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11865:12): [True: 473k, False: 121k]
  |  |  ------------------
  |  |11866|   473k|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11866:11): [True: 118, False: 473k]
  |  |  ------------------
  |  |11867|    118|        return;                                                              \
  |  |11868|    118|      }                                                                      \
  |  |11869|   473k|    }                                                                        \
  |  |11870|   121k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11870:12): [Folded, False: 121k]
  |  |  ------------------
  ------------------
11959|   122k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11963|  21.4k|bool path_has_dot_segment(std::string_view path) noexcept {
11964|  21.4k|  if (path.empty()) {
  ------------------
  |  Branch (11964:7): [True: 0, False: 21.4k]
  ------------------
11965|      0|    return false;
11966|      0|  }
11967|       |  // "." / ".." at the start, with or without a leading '/'.
11968|  21.4k|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11968:20): [True: 21.4k, False: 0]
  ------------------
11969|  21.4k|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11969:7): [True: 21.4k, False: 0]
  |  Branch (11969:26): [True: 1.03k, False: 20.4k]
  ------------------
11970|  1.03k|    const size_t after = i + 1;
11971|  1.03k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11971:9): [True: 28, False: 1.00k]
  |  Branch (11971:33): [True: 214, False: 788]
  ------------------
11972|    788|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11972:10): [True: 788, False: 0]
  |  Branch (11972:33): [True: 384, False: 404]
  ------------------
11973|    452|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11973:11): [True: 14, False: 370]
  |  Branch (11973:39): [True: 196, False: 174]
  ------------------
11974|    452|      return true;
11975|    452|    }
11976|  1.03k|  }
11977|  20.9k|  static constexpr std::string_view slash_dot{"/.", 2};
11978|  20.9k|  size_t p = i;
11979|  23.9k|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11979:10): [True: 22.7k, False: 1.21k]
  ------------------
11980|  22.7k|    const size_t after = p + 2;
11981|  22.7k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11981:9): [True: 86, False: 22.6k]
  |  Branch (11981:33): [True: 19.3k, False: 3.23k]
  ------------------
11982|  3.23k|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11982:10): [True: 3.23k, False: 0]
  |  Branch (11982:33): [True: 782, False: 2.45k]
  ------------------
11983|  19.7k|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11983:11): [True: 62, False: 720]
  |  Branch (11983:39): [True: 224, False: 496]
  ------------------
11984|  19.7k|      return true;
11985|  19.7k|    }
11986|  2.94k|    p = after;
11987|  2.94k|  }
11988|  1.21k|  return false;
11989|  20.9k|}
simple_absolute.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13963|   266k|    ada::url_components& components, uint32_t new_difference) {
13964|   266k|  components.username_end += new_difference;
13965|   266k|  components.host_start += new_difference;
13966|   266k|  components.host_end += new_difference;
13967|   266k|  components.pathname_start += new_difference;
13968|   266k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13968:7): [True: 0, False: 266k]
  ------------------
13969|      0|    components.search_start += new_difference;
13970|      0|  }
13971|   266k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13971:7): [True: 0, False: 266k]
  ------------------
13972|      0|    components.hash_start += new_difference;
13973|      0|  }
13974|   266k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14333|  24.2k|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14334|  24.2k|  ada_log("url_aggregator::parse_path ", input);
14335|  24.2k|  ADA_ASSERT_TRUE(validate());
14336|  24.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14337|  24.2k|  std::string tmp_buffer;
14338|  24.2k|  std::string_view internal_input;
14339|  24.2k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14339:7): [True: 0, False: 24.2k]
  ------------------
14340|      0|    tmp_buffer = input;
14341|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14342|       |    // just directly build the string from user_input.
14343|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14344|      0|    internal_input = tmp_buffer;
14345|  24.2k|  } else {
14346|  24.2k|    internal_input = input;
14347|  24.2k|  }
14348|       |
14349|       |  // If url is special, then:
14350|  24.2k|  if (is_special()) {
  ------------------
  |  Branch (14350:7): [True: 24.2k, False: 0]
  ------------------
14351|  24.2k|    if (internal_input.empty()) {
  ------------------
  |  Branch (14351:9): [True: 253, False: 24.0k]
  ------------------
14352|    253|      update_base_pathname("/");
14353|  24.0k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14353:16): [True: 24.0k, False: 0]
  |  Branch (14353:46): [True: 0, False: 0]
  ------------------
14354|  24.0k|      consume_prepared_path(internal_input.substr(1));
14355|  24.0k|    } else {
14356|      0|      consume_prepared_path(internal_input);
14357|      0|    }
14358|  24.2k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14358:14): [True: 0, False: 0]
  ------------------
14359|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14359:9): [True: 0, False: 0]
  ------------------
14360|      0|      consume_prepared_path(internal_input.substr(1));
14361|      0|    } else {
14362|      0|      consume_prepared_path(internal_input);
14363|      0|    }
14364|      0|  } else {
14365|       |    // Non-special URLs with an empty host can have their paths erased
14366|       |    // Path-only URLs cannot have their paths erased
14367|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14367:9): [True: 0, False: 0]
  |  Branch (14367:57): [True: 0, False: 0]
  ------------------
14368|      0|      update_base_pathname("/");
14369|      0|    }
14370|      0|  }
14371|  24.2k|  ADA_ASSERT_TRUE(validate());
14372|  24.2k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14466|   264k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14467|   264k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14468|   264k|          " bytes]");
14469|   264k|  ADA_ASSERT_TRUE(validate());
14470|   264k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14471|   264k|  if (input.empty()) {
  ------------------
  |  Branch (14471:7): [True: 5, False: 264k]
  ------------------
14472|      5|    return is_valid = false;
14473|      5|  }  // technically unnecessary.
14474|       |  // If input starts with U+005B ([), then:
14475|   264k|  if (input[0] == '[') {
  ------------------
  |  Branch (14475:7): [True: 671, False: 263k]
  ------------------
14476|       |    // If input does not end with U+005D (]), validation error, return failure.
14477|    671|    if (input.back() != ']') {
  ------------------
  |  Branch (14477:9): [True: 73, False: 598]
  ------------------
14478|     73|      return is_valid = false;
14479|     73|    }
14480|    598|    ada_log("parse_host ipv6");
14481|       |
14482|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14483|       |    // trailing U+005D (]) removed.
14484|    598|    input.remove_prefix(1);
14485|    598|    input.remove_suffix(1);
14486|    598|    return parse_ipv6(input);
14487|    671|  }
14488|       |
14489|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14490|       |  // input.
14491|   263k|  if (!is_special()) {
  ------------------
  |  Branch (14491:7): [True: 621, False: 262k]
  ------------------
14492|    621|    return parse_opaque_host(input);
14493|    621|  }
14494|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14495|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14496|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14497|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14498|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14499|       |
14500|       |  // Often, the input does not contain any forbidden code points, and no upper
14501|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14502|       |  // optimize for such a common case.
14503|       |
14504|       |  // Fast path: try to parse as pure decimal IPv4 first.
14505|   262k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14506|   262k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14506:7): [True: 107k, False: 155k]
  ------------------
14507|   107k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14507:9): [True: 107k, False: 0]
  |  Branch (14507:27): [True: 10, False: 107k]
  ------------------
14508|     10|      update_base_hostname(input.substr(0, input.size() - 1));
14509|   107k|    } else {
14510|   107k|      update_base_hostname(input);
14511|   107k|    }
14512|   107k|    host_type = IPV4;
14513|   107k|    is_valid = true;
14514|   107k|    ada_log("parse_host fast path decimal ipv4");
14515|   107k|    ADA_ASSERT_TRUE(validate());
14516|   107k|    return true;
14517|   107k|  }
14518|   155k|  uint8_t is_forbidden_or_upper =
14519|   155k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14520|   155k|                                                             input.size());
14521|   155k|  static constexpr std::string_view xn_dash{"xn-", 3};
14522|   155k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14522:7): [True: 133k, False: 21.8k]
  ------------------
14523|   133k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14523:9): [True: 849, False: 132k]
  ------------------
14524|    849|      std::string lowered(input);
14525|    849|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14526|    849|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14526:11): [True: 596, False: 253]
  ------------------
14527|    640|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14527:11): [True: 44, False: 209]
  ------------------
14528|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14529|       |        // This also avoids a double buffer rewrite for hex/octal IPv4.
14530|    640|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14530:13): [True: 126, False: 514]
  ------------------
14531|    126|          ada_log("parse_host fast path ipv4");
14532|    126|          return parse_ipv4(lowered, false);
14533|    126|        }
14534|    514|        update_base_hostname(lowered);
14535|    514|        ada_log("parse_host fast path ", get_hostname());
14536|    514|        is_valid = true;
14537|    514|        return true;
14538|    640|      }
14539|   132k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14539:16): [True: 72.4k, False: 60.5k]
  ------------------
14540|  72.6k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14540:16): [True: 173, False: 60.3k]
  ------------------
14541|       |      // Check IPv4 before mutating so failures leave the buffer untouched.
14542|  72.6k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14542:11): [True: 39.0k, False: 33.5k]
  ------------------
14543|  39.0k|        ada_log("parse_host fast path ipv4");
14544|  39.0k|        return parse_ipv4(input, false);
14545|  39.0k|      }
14546|  33.5k|      update_base_hostname(input);
14547|  33.5k|      ada_log("parse_host fast path ", get_hostname());
14548|  33.5k|      is_valid = true;
14549|  33.5k|      return true;
14550|  72.6k|    }
14551|   133k|  } else if (const size_t first_percent = input.find('%');
14552|  21.8k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14552:14): [True: 19.4k, False: 2.47k]
  ------------------
14553|  19.4k|    std::string decoded = unicode::percent_decode(input, first_percent);
14554|  19.4k|    const uint8_t decoded_flags =
14555|  19.4k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14556|  19.4k|                                                               decoded.size());
14557|  19.4k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14557:9): [True: 19.1k, False: 292]
  ------------------
14558|  19.1k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14558:11): [True: 136, False: 18.9k]
  ------------------
14559|    136|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14560|    136|      }
14561|  19.1k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14561:11): [True: 19.0k, False: 61]
  ------------------
14562|  19.0k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14562:11): [True: 26, False: 35]
  ------------------
14563|       |        // Check IPv4 before mutating so failures leave the buffer untouched.
14564|  19.0k|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14564:13): [True: 18.8k, False: 182]
  ------------------
14565|  18.8k|          return parse_ipv4(decoded, false);
14566|  18.8k|        }
14567|    182|        update_base_hostname(decoded);
14568|    182|        is_valid = true;
14569|    182|        return true;
14570|  19.0k|      }
14571|  19.1k|    }
14572|  19.4k|  }
14573|       |  // We have encountered at least one forbidden code point or the input contains
14574|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14575|       |  // conversion.
14576|       |
14577|  63.3k|  ada_log("parse_host calling to_ascii");
14578|  63.3k|  std::optional<std::string> host = std::string(get_hostname());
14579|  63.3k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14580|  63.3k|  if (!is_valid) {
  ------------------
  |  Branch (14580:7): [True: 1.44k, False: 61.9k]
  ------------------
14581|  1.44k|    ada_log("parse_host to_ascii returns false");
14582|  1.44k|    return is_valid = false;
14583|  1.44k|  }
14584|  61.9k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14585|  61.9k|          " bytes]");
14586|       |
14587|  61.9k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14587:7): [True: 0, False: 61.9k]
  ------------------
14588|  61.9k|                          ada::unicode::is_forbidden_domain_code_point)) {
14589|      0|    return is_valid = false;
14590|      0|  }
14591|       |
14592|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14593|       |  // asciiDomain.
14594|  61.9k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14594:7): [True: 119, False: 61.8k]
  ------------------
14595|    119|    ada_log("parse_host got ipv4 ", *host);
14596|    119|    return parse_ipv4(host.value(), false);
14597|    119|  }
14598|       |
14599|  61.8k|  update_base_hostname(host.value());
14600|  61.8k|  ADA_ASSERT_TRUE(validate());
14601|  61.8k|  return true;
14602|  61.9k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8856|  23.0k|                                                       size_t pos) {
 8857|  23.0k|  ADA_ASSERT_TRUE(pos <= input.size());
 8858|       |  // The following is safer but unneeded if we have the above line:
 8859|       |  // return pos > input.size() ? std::string_view() : input.substr(pos);
 8860|  23.0k|  return input.substr(pos);
 8861|  23.0k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15448|   237k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15449|   237k|  ada_log("url_aggregator::consume_prepared_path ", input);
15450|       |  /***
15451|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15452|       |   * unfortunate. This particular function is nearly identical, except that it
15453|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15454|       |   * very common) merely appends to the buffer. This is the same trivial path as
15455|       |   * with helpers::parse_prepared_path, except that we have the additional check
15456|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15457|       |   * modify it, and then insert it back into the buffer.
15458|       |   */
15459|   237k|  uint8_t accumulator = checkers::path_signature(input);
15460|       |  // Let us first detect a trivial case.
15461|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15462|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15463|       |  // no dot, and no character needing percent encoding.
15464|   237k|  constexpr uint8_t need_encoding = 1;
15465|   237k|  constexpr uint8_t backslash_char = 2;
15466|   237k|  constexpr uint8_t dot_char = 4;
15467|   237k|  constexpr uint8_t percent_char = 8;
15468|   237k|  bool special = type != ada::scheme::NOT_SPECIAL;
15469|   237k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15469:39): [True: 1.32k, False: 236k]
  ------------------
15470|  1.32k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15470:39): [True: 34, False: 1.28k]
  ------------------
15471|   237k|  bool trivial_path =
15472|   237k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15472:7): [True: 206k, False: 30.4k]
  |  Branch (15472:8): [True: 236k, False: 771]
  ------------------
15473|   237k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15474|    771|                  0)) &&
15475|   206k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15475:7): [True: 206k, False: 11]
  ------------------
15476|   237k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15476:7): [True: 12.8k, False: 224k]
  |  Branch (15476:34): [True: 12.8k, False: 14]
  ------------------
15477|       |    // '4' means that we have at least one dot, but nothing that requires
15478|       |    // percent encoding or decoding. The only part that is not trivial is
15479|       |    // that we may have single dots and double dots path segments.
15480|       |    // If we have such segments, then we either have a path that begins
15481|       |    // with '.' (easy to check), or we have the sequence './'.
15482|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15483|       |    // Note: we know that '\' is not present.
15484|  12.8k|    if (input[0] != '.') {
  ------------------
  |  Branch (15484:9): [True: 11.6k, False: 1.25k]
  ------------------
15485|  11.6k|      size_t slashdot = 0;
15486|  11.6k|      bool dot_is_file = true;
15487|  37.8k|      for (;;) {
15488|  37.8k|        slashdot = input.find("/.", slashdot);
15489|  37.8k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15489:13): [True: 11.6k, False: 26.2k]
  ------------------
15490|  11.6k|          break;
15491|  26.2k|        } else {  // uncommon
15492|       |          // only three cases matter: /./, /.. or a final /
15493|  26.2k|          slashdot += 2;
15494|  26.2k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15494:28): [True: 73, False: 26.1k]
  |  Branch (15494:56): [True: 12.3k, False: 13.8k]
  ------------------
15495|  13.8k|                           input[slashdot] == '/');
  ------------------
  |  Branch (15495:28): [True: 12.4k, False: 1.40k]
  ------------------
15496|  26.2k|        }
15497|  37.8k|      }
15498|  11.6k|      trivial_path = dot_is_file;
15499|  11.6k|    }
15500|  12.8k|  }
15501|   237k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15501:7): [True: 208k, False: 29.3k]
  |  Branch (15501:23): [True: 208k, False: 0]
  ------------------
15502|   208k|    ada_log("parse_path trivial");
15503|   208k|    buffer += '/';
15504|   208k|    buffer += input;
15505|   208k|    return;
15506|   208k|  }
15507|  29.3k|  std::string path = std::string(get_pathname());
15508|       |  // We are going to need to look a bit at the path, but let us see if we can
15509|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15510|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15511|       |  // there.
15512|  29.3k|  bool fast_path =
15513|  29.3k|      (special &&
  ------------------
  |  Branch (15513:8): [True: 28.9k, False: 407]
  ------------------
15514|  28.9k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15514:8): [True: 11.6k, False: 17.2k]
  ------------------
15515|  11.6k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15515:7): [True: 11.5k, False: 106]
  ------------------
15516|  29.3k|  if (fast_path) {
  ------------------
  |  Branch (15516:7): [True: 11.5k, False: 17.8k]
  ------------------
15517|  11.5k|    ada_log("parse_prepared_path fast");
15518|       |    // Here we don't need to worry about \ or percent encoding.
15519|       |    // We also do not have a file protocol. We might have dots, however,
15520|       |    // but dots must as appear as '.', and they cannot be encoded because
15521|       |    // the symbol '%' is not present.
15522|  11.5k|    size_t previous_location = 0;  // We start at 0.
15523|  71.0k|    do {
15524|  71.0k|      size_t new_location = input.find('/', previous_location);
15525|       |      // std::string_view path_view = input;
15526|       |      //  We process the last segment separately:
15527|  71.0k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15527:11): [True: 11.5k, False: 59.4k]
  ------------------
15528|  11.5k|        std::string_view path_view = input.substr(previous_location);
15529|  11.5k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15529:13): [True: 76, False: 11.5k]
  ------------------
15530|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15531|     76|          if (path.empty()) {
  ------------------
  |  Branch (15531:15): [True: 19, False: 57]
  ------------------
15532|     19|            path = '/';
15533|     19|            update_base_pathname(path);
15534|     19|            return;
15535|     19|          }
15536|       |          // Fast case where we have nothing to do:
15537|     57|          if (path.back() == '/') {
  ------------------
  |  Branch (15537:15): [True: 16, False: 41]
  ------------------
15538|     16|            update_base_pathname(path);
15539|     16|            return;
15540|     16|          }
15541|       |          // If you have the path "/joe/myfriend",
15542|       |          // then you delete 'myfriend'.
15543|     41|          path.resize(path.rfind('/') + 1);
15544|     41|          update_base_pathname(path);
15545|     41|          return;
15546|     57|        }
15547|  11.5k|        path += '/';
15548|  11.5k|        if (path_view != ".") {
  ------------------
  |  Branch (15548:13): [True: 11.4k, False: 102]
  ------------------
15549|  11.4k|          path.append(path_view);
15550|  11.4k|        }
15551|  11.5k|        update_base_pathname(path);
15552|  11.5k|        return;
15553|  59.4k|      } else {
15554|       |        // This is a non-final segment.
15555|  59.4k|        std::string_view path_view =
15556|  59.4k|            input.substr(previous_location, new_location - previous_location);
15557|  59.4k|        previous_location = new_location + 1;
15558|  59.4k|        if (path_view == "..") {
  ------------------
  |  Branch (15558:13): [True: 12.8k, False: 46.6k]
  ------------------
15559|  12.8k|          size_t last_delimiter = path.rfind('/');
15560|  12.8k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15560:15): [True: 10.8k, False: 1.92k]
  ------------------
15561|  10.8k|            path.erase(last_delimiter);
15562|  10.8k|          }
15563|  46.6k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15563:20): [True: 33.5k, False: 13.0k]
  ------------------
15564|  33.5k|          path += '/';
15565|  33.5k|          path.append(path_view);
15566|  33.5k|        }
15567|  59.4k|      }
15568|  71.0k|    } while (true);
  ------------------
  |  Branch (15568:14): [True: 59.4k, Folded]
  ------------------
15569|  17.8k|  } else {
15570|  17.8k|    ada_log("parse_path slow");
15571|       |    // we have reached the general case
15572|  17.8k|    bool needs_percent_encoding = (accumulator & 1);
15573|  17.8k|    std::string path_buffer_tmp;
15574|  65.4k|    do {
15575|  65.4k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15575:26): [True: 63.7k, False: 1.72k]
  |  Branch (15575:37): [True: 5.53k, False: 58.1k]
  ------------------
15576|  65.4k|                            ? input.find_first_of("/\\")
15577|  65.4k|                            : input.find('/');
15578|  65.4k|      std::string_view path_view = input;
15579|  65.4k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15579:11): [True: 47.6k, False: 17.8k]
  ------------------
15580|  47.6k|        path_view.remove_suffix(path_view.size() - location);
15581|  47.6k|        input.remove_prefix(location + 1);
15582|  47.6k|      }
15583|       |      // path_buffer is either path_view or it might point at a percent encoded
15584|       |      // temporary string.
15585|  65.4k|      std::string_view path_buffer =
15586|  65.4k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15586:12): [True: 14.2k, False: 51.1k]
  ------------------
15587|  14.2k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15587:12): [True: 4.20k, False: 10.0k]
  ------------------
15588|  14.2k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15589|  65.4k|              ? path_buffer_tmp
15590|  65.4k|              : path_view;
15591|  65.4k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15591:11): [True: 13.0k, False: 52.3k]
  ------------------
15592|  13.0k|        helpers::shorten_path(path, type);
15593|  13.0k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15593:13): [True: 9.76k, False: 3.28k]
  ------------------
15594|  9.76k|          path += '/';
15595|  9.76k|        }
15596|  52.3k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15596:18): [True: 2.41k, False: 49.9k]
  ------------------
15597|  2.41k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15597:18): [True: 441, False: 1.97k]
  ------------------
15598|    441|        path += '/';
15599|    441|      }
15600|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15601|  51.9k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15601:16): [True: 49.9k, False: 1.97k]
  ------------------
15602|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15603|       |        // Windows drive letter, then replace the second code point in
15604|       |        // path_buffer with U+003A (:).
15605|  49.9k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15605:13): [True: 1.74k, False: 48.2k]
  |  Branch (15605:48): [True: 500, False: 1.24k]
  ------------------
15606|    500|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15606:13): [True: 36, False: 464]
  ------------------
15607|     36|          path += '/';
15608|     36|          path += path_buffer[0];
15609|     36|          path += ':';
15610|     36|          path_buffer.remove_prefix(2);
15611|     36|          path.append(path_buffer);
15612|  49.9k|        } else {
15613|       |          // Append path_buffer to url's path.
15614|  49.9k|          path += '/';
15615|  49.9k|          path.append(path_buffer);
15616|  49.9k|        }
15617|  49.9k|      }
15618|  65.4k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15618:11): [True: 17.8k, False: 47.6k]
  ------------------
15619|  17.8k|        update_base_pathname(path);
15620|  17.8k|        return;
15621|  17.8k|      }
15622|  65.4k|    } while (true);
  ------------------
  |  Branch (15622:14): [True: 47.6k, Folded]
  ------------------
15623|  17.8k|  }
15624|  29.3k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   14|   308k|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|   308k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (16:7): [True: 189k, False: 118k]
  ------------------
   17|   189k|    return false;
   18|   189k|  }
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|   118k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 56.4k, False: 62.1k]
  ------------------
   21|  56.4k|    view.remove_suffix(1);
   22|  56.4k|  }
   23|       |  // From the last character, find the last dot.
   24|   118k|  size_t last_dot = view.rfind('.');
   25|   118k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (25:7): [True: 96.0k, False: 22.5k]
  ------------------
   26|       |    // We have at least one dot.
   27|  96.0k|    view.remove_prefix(last_dot + 1);
   28|  96.0k|  }
   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|   118k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (32:7): [True: 59.6k, False: 58.9k]
  ------------------
   33|  59.6k|    return true;
   34|  59.6k|  }
   35|       |  // It could be hex (0x), but not if there is a single character.
   36|  58.9k|  if (view.size() == 1) {
  ------------------
  |  Branch (36:7): [True: 0, False: 58.9k]
  ------------------
   37|      0|    return false;
   38|      0|  }
   39|       |  // It must start with 0x.
   40|  58.9k|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (40:7): [True: 1.39k, False: 57.5k]
  ------------------
   41|  1.39k|    return false;
   42|  1.39k|  }
   43|       |  // We must allow "0x".
   44|  57.5k|  if (view.size() == 2) {
  ------------------
  |  Branch (44:7): [True: 18.8k, False: 38.7k]
  ------------------
   45|  18.8k|    return true;
   46|  18.8k|  }
   47|       |  // We have 0x followed by some characters, we need to check that they are
   48|       |  // hexadecimals.
   49|  38.7k|  view.remove_prefix(2);
   50|  38.7k|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   51|  57.5k|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7437|   334k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7438|   334k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7438:11): [True: 334k, False: 0]
  |  Branch (7438:23): [True: 11.6k, False: 322k]
  |  Branch (7438:37): [True: 322k, False: 0]
  |  Branch (7438:49): [True: 322k, False: 798]
  ------------------
 7439|   334k|}
_ZN3ada3url12parse_schemeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
10315|   266k|ada_really_inline bool url::parse_scheme(const std::string_view input) {
10316|   266k|  auto parsed_type = ada::scheme::get_scheme_type(input);
10317|   266k|  bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
10318|       |  /**
10319|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
10320|       |   *http, https), in which case, we can go really fast.
10321|       |   **/
10322|   266k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (10322:7): [True: 261k, False: 4.71k]
  ------------------
10323|       |    if constexpr (has_state_override) {
10324|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
10325|       |      // then return.
10326|       |      if (is_special() != is_input_special) {
10327|       |        return false;
10328|       |      }
10329|       |
10330|       |      // If url includes credentials or has a non-null port, and buffer is
10331|       |      // "file", then return.
10332|       |      if ((has_credentials() || port.has_value()) &&
10333|       |          parsed_type == ada::scheme::type::FILE) {
10334|       |        return false;
10335|       |      }
10336|       |
10337|       |      // If url's scheme is "file" and its host is an empty host, then return.
10338|       |      // An empty host is the empty string.
10339|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10340|       |          host->empty()) {
10341|       |        return false;
10342|       |      }
10343|       |    }
10344|       |
10345|   261k|    type = parsed_type;
10346|       |
10347|       |    if constexpr (has_state_override) {
10348|       |      // This is uncommon.
10349|       |      uint16_t urls_scheme_port = get_special_port();
10350|       |
10351|       |      if (urls_scheme_port) {
10352|       |        // If url's port is url's scheme's default port, then set url's port to
10353|       |        // null.
10354|       |        if (port.has_value() && *port == urls_scheme_port) {
10355|       |          port = std::nullopt;
10356|       |        }
10357|       |      }
10358|       |    }
10359|   261k|  } else {  // slow path
10360|  4.71k|    std::string _buffer(input);
10361|       |    // Next function is only valid if the input is ASCII and returns false
10362|       |    // otherwise, but it seems that we always have ascii content so we do not
10363|       |    // need to check the return value.
10364|       |    // bool is_ascii =
10365|  4.71k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
10366|       |
10367|       |    if constexpr (has_state_override) {
10368|       |      // The state-override validation errors below ("return" in the WHATWG URL
10369|       |      // parser) leave the URL unchanged. The setter contract is
10370|       |      // "true on success, false if the scheme is invalid" -- the fast path
10371|       |      // above already returns false here, so the slow path must agree.
10372|       |
10373|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
10374|       |      // then return. If url's scheme is not a special scheme and buffer is a
10375|       |      // special scheme, then return.
10376|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
10377|       |        return false;
10378|       |      }
10379|       |
10380|       |      // If url includes credentials or has a non-null port, and buffer is
10381|       |      // "file", then return.
10382|       |      if ((has_credentials() || port.has_value()) && _buffer == "file") {
10383|       |        return false;
10384|       |      }
10385|       |
10386|       |      // If url's scheme is "file" and its host is an empty host, then return.
10387|       |      // An empty host is the empty string.
10388|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10389|       |          host->empty()) {
10390|       |        return false;
10391|       |      }
10392|       |    }
10393|       |
10394|  4.71k|    set_scheme(std::move(_buffer));
10395|       |
10396|       |    if constexpr (has_state_override) {
10397|       |      // This is uncommon.
10398|       |      uint16_t urls_scheme_port = get_special_port();
10399|       |
10400|       |      if (urls_scheme_port) {
10401|       |        // If url's port is url's scheme's default port, then set url's port to
10402|       |        // null.
10403|       |        if (port.has_value() && *port == urls_scheme_port) {
10404|       |          port = std::nullopt;
10405|       |        }
10406|       |      }
10407|       |    }
10408|  4.71k|  }
10409|       |
10410|   266k|  return true;
10411|   266k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13981|   266k|    const std::string_view input_with_colon) {
13982|   266k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13983|   266k|  ADA_ASSERT_TRUE(validate());
13984|   266k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13985|   266k|  std::string_view input{input_with_colon};
13986|   266k|  input.remove_suffix(1);
13987|   266k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13988|   266k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13989|       |  /**
13990|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13991|       |   *http, https), in which case, we can go really fast.
13992|       |   **/
13993|   266k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13993:7): [True: 261k, False: 4.71k]
  ------------------
13994|       |    if constexpr (has_state_override) {
13995|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13996|       |      // then return.
13997|       |      if (is_special() != is_input_special) {
13998|       |        return false;
13999|       |      }
14000|       |
14001|       |      // If url includes credentials or has a non-null port, and buffer is
14002|       |      // "file", then return.
14003|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14004|       |          parsed_type == ada::scheme::type::FILE) {
14005|       |        return false;
14006|       |      }
14007|       |
14008|       |      // If url's scheme is "file" and its host is an empty host, then return.
14009|       |      // An empty host is the empty string.
14010|       |      if (type == ada::scheme::type::FILE &&
14011|       |          components.host_start == components.host_end) {
14012|       |        return false;
14013|       |      }
14014|       |    }
14015|       |
14016|   261k|    type = parsed_type;
14017|   261k|    set_scheme_from_view_with_colon(input_with_colon);
14018|       |
14019|       |    if constexpr (has_state_override) {
14020|       |      // This is uncommon.
14021|       |      uint16_t urls_scheme_port = get_special_port();
14022|       |
14023|       |      if (urls_scheme_port) {
14024|       |        // If url's port is url's scheme's default port, then set url's port to
14025|       |        // null.
14026|       |        if (components.port == urls_scheme_port) {
14027|       |          clear_port();
14028|       |        }
14029|       |      }
14030|       |    }
14031|   261k|  } else {  // slow path
14032|  4.71k|    std::string _buffer(input);
14033|       |    // Next function is only valid if the input is ASCII and returns false
14034|       |    // otherwise, but it seems that we always have ascii content so we do not
14035|       |    // need to check the return value.
14036|  4.71k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
14037|       |
14038|       |    if constexpr (has_state_override) {
14039|       |      // The state-override validation errors below ("return" in the WHATWG URL
14040|       |      // parser) leave the URL unchanged. The setter contract is
14041|       |      // "true on success, false if the scheme is invalid" -- the fast path
14042|       |      // above already returns false here, so the slow path must agree.
14043|       |
14044|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
14045|       |      // then return. If url's scheme is not a special scheme and buffer is a
14046|       |      // special scheme, then return.
14047|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
14048|       |        return false;
14049|       |      }
14050|       |
14051|       |      // If url includes credentials or has a non-null port, and buffer is
14052|       |      // "file", then return.
14053|       |      if ((has_credentials() || components.port != url_components::omitted) &&
14054|       |          _buffer == "file") {
14055|       |        return false;
14056|       |      }
14057|       |
14058|       |      // If url's scheme is "file" and its host is an empty host, then return.
14059|       |      // An empty host is the empty string.
14060|       |      if (type == ada::scheme::type::FILE &&
14061|       |          components.host_start == components.host_end) {
14062|       |        return false;
14063|       |      }
14064|       |    }
14065|       |
14066|  4.71k|    set_scheme(_buffer);
14067|       |
14068|       |    if constexpr (has_state_override) {
14069|       |      // This is uncommon.
14070|       |      uint16_t urls_scheme_port = get_special_port();
14071|       |
14072|       |      if (urls_scheme_port) {
14073|       |        // If url's port is url's scheme's default port, then set url's port to
14074|       |        // null.
14075|       |        if (components.port == urls_scheme_port) {
14076|       |          clear_port();
14077|       |        }
14078|       |      }
14079|       |    }
14080|  4.71k|  }
14081|   266k|  ADA_ASSERT_TRUE(validate());
14082|   266k|  return true;
14083|   266k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14107|   261k|    std::string_view new_scheme_with_colon) {
14108|   261k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
14109|   261k|          new_scheme_with_colon);
14110|   261k|  ADA_ASSERT_TRUE(validate());
14111|   261k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
14112|   261k|                  new_scheme_with_colon.back() == ':');
14113|       |  // next line could overflow but unsigned arithmetic has well-defined
14114|       |  // overflows.
14115|   261k|  uint32_t new_difference =
14116|   261k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
14117|       |
14118|   261k|  if (buffer.empty()) {
  ------------------
  |  Branch (14118:7): [True: 261k, False: 0]
  ------------------
14119|   261k|    buffer.append(new_scheme_with_colon);
14120|   261k|  } else {
14121|      0|    buffer.erase(0, components.protocol_end);
14122|      0|    buffer.insert(0, new_scheme_with_colon);
14123|      0|  }
14124|   261k|  components.protocol_end += new_difference;
14125|       |
14126|   261k|  apply_shifted_non_scheme_offsets(components, new_difference);
14127|   261k|  ADA_ASSERT_TRUE(validate());
14128|   261k|}
_ZN3ada14url_aggregator10set_schemeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14130|  4.71k|inline void url_aggregator::set_scheme(std::string_view new_scheme) {
14131|  4.71k|  ada_log("url_aggregator::set_scheme ", new_scheme);
14132|  4.71k|  ADA_ASSERT_TRUE(validate());
14133|  4.71k|  ADA_ASSERT_TRUE(new_scheme.empty() || new_scheme.back() != ':');
14134|       |  // next line could overflow but unsigned arithmetic has well-defined
14135|       |  // overflows.
14136|  4.71k|  uint32_t new_difference =
14137|  4.71k|      uint32_t(new_scheme.size()) - components.protocol_end + 1;
14138|       |
14139|  4.71k|  type = ada::scheme::get_scheme_type(new_scheme);
14140|  4.71k|  if (buffer.empty()) {
  ------------------
  |  Branch (14140:7): [True: 4.71k, False: 0]
  ------------------
14141|  4.71k|    buffer.append(helpers::concat(new_scheme, ":"));
14142|  4.71k|  } else {
14143|      0|    buffer.erase(0, components.protocol_end);
14144|      0|    buffer.insert(0, helpers::concat(new_scheme, ":"));
14145|      0|  }
14146|  4.71k|  components.protocol_end = uint32_t(new_scheme.size() + 1);
14147|       |
14148|  4.71k|  apply_shifted_non_scheme_offsets(components, new_difference);
14149|  4.71k|  ADA_ASSERT_TRUE(validate());
14150|  4.71k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5868|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1085|  1.43M|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1086|  1.43M|  return !!(a[i >> 3] & (1 << (i & 7)));
 1087|  1.43M|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2215|  86.4k|  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:
 3701|  21.6k|      : impl_base(unexpect, std::move(e.value())),
 3702|  21.6k|        ctor_base(detail::default_constructor_tag{}) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2229|  43.2k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2687|  21.6k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada3urlENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3305|   618k|  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_:
 3787|   596k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3660|   596k|      : impl_base(in_place, std::forward<Args>(args)...),
 3661|   596k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2675|   596k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada3urlC2EOS0_:
 5107|   596k|  url(url&& u) noexcept = default;
_ZN3ada8url_baseD2Ev:
 1711|  2.43M|  virtual ~url_base() = default;
_ZN3ada3urlD2Ev:
 5110|  1.21M|  ~url() override = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3701|  21.6k|      : impl_base(unexpect, std::move(e.value())),
 3702|  21.6k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2687|  21.6k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3305|   618k|  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_:
 3787|   596k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3660|   596k|      : impl_base(in_place, std::forward<Args>(args)...),
 3661|   596k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2675|   596k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7921|   596k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7924|  1.21M|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6922|   541k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6923|   541k|  if (scheme.empty()) {
  ------------------
  |  Branch (6923:7): [True: 0, False: 541k]
  ------------------
 6924|      0|    return ada::scheme::NOT_SPECIAL;
 6925|      0|  }
 6926|   541k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6927|   541k|  const std::string_view target = details::is_special_list[hash_value];
 6928|   541k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6928:7): [True: 536k, False: 4.94k]
  ------------------
 6929|   536k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6929:7): [True: 528k, False: 8.10k]
  ------------------
 6930|   536k|          details::scheme_keys[hash_value]) {
 6931|   528k|    return ada::scheme::type(hash_value);
 6932|   528k|  } else {
 6933|  13.0k|    return ada::scheme::NOT_SPECIAL;
 6934|  13.0k|  }
 6935|   541k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6863|   536k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6864|   536k|  uint64_t input = (uint8_t)p[0];
 6865|   536k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6866|   536k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6867|   536k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6868|   536k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6869|   536k|  return input;
 6870|   536k|}
_ZN3ada14url_aggregatorC2Ev:
 7919|   618k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 5016|   618k|  url_components() = default;
_ZN3ada14url_aggregatoraSEOS0_:
 7922|   198k|  url_aggregator& operator=(url_aggregator&& u) noexcept = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1459|   642k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1460|   642k|  const size_t len = input.size();
 1461|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1462|   642k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1462:7): [True: 107k, False: 534k]
  |  Branch (1462:18): [True: 6.44k, False: 528k]
  ------------------
 1463|   114k|    return ipv4_fast_fail;
 1464|   114k|  }
 1465|   528k|  const char* data = input.data();
 1466|       |
 1467|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1468|       |  return detail::try_parse_ipv4_avx512(data, len);
 1469|       |#else
 1470|   528k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1471|   642k|#endif
 1472|   642k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1300|   528k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1301|   528k|  uint32_t ipv4 = 0;
 1302|  1.53M|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1302:19): [True: 1.28M, False: 252k]
  ------------------
 1303|  1.28M|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1303:9): [True: 18, False: 1.28M]
  ------------------
 1304|     18|      return ipv4_fast_fail;
 1305|     18|    }
 1306|  1.28M|    uint32_t val;
 1307|  1.28M|    char c = *p;
 1308|  1.28M|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1308:9): [True: 1.28M, False: 838]
  |  Branch (1308:21): [True: 1.08M, False: 197k]
  ------------------
 1309|  1.08M|      val = static_cast<uint32_t>(c - '0');
 1310|  1.08M|      ++p;
 1311|  1.08M|    } else {
 1312|   198k|      return ipv4_fast_fail;
 1313|   198k|    }
 1314|  1.08M|    if (p < pend) {
  ------------------
  |  Branch (1314:9): [True: 985k, False: 101k]
  ------------------
 1315|   985k|      c = *p;
 1316|   985k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1316:11): [True: 725k, False: 260k]
  |  Branch (1316:23): [True: 687k, False: 38.1k]
  ------------------
 1317|   687k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1317:13): [True: 224, False: 687k]
  ------------------
 1318|    224|          return ipv4_fast_fail;
 1319|    224|        }
 1320|   687k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1321|   687k|        ++p;
 1322|   687k|        if (p < pend) {
  ------------------
  |  Branch (1322:13): [True: 574k, False: 112k]
  ------------------
 1323|   574k|          c = *p;
 1324|   574k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1324:15): [True: 311k, False: 262k]
  |  Branch (1324:27): [True: 311k, False: 110]
  ------------------
 1325|   311k|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1326|   311k|            ++p;
 1327|   311k|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1327:17): [True: 1.28k, False: 309k]
  ------------------
 1328|  1.28k|              return ipv4_fast_fail;
 1329|  1.28k|            }
 1330|   311k|          }
 1331|   574k|        }
 1332|   687k|      }
 1333|   985k|    }
 1334|  1.08M|    ipv4 = (ipv4 << 8) | val;
 1335|  1.08M|    if (i < 3) {
  ------------------
  |  Branch (1335:9): [True: 833k, False: 252k]
  ------------------
 1336|   833k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1336:11): [True: 80, False: 833k]
  |  Branch (1336:24): [True: 75.8k, False: 757k]
  ------------------
 1337|  75.8k|        return ipv4_fast_fail;
 1338|  75.8k|      }
 1339|   757k|      ++p;
 1340|   757k|    }
 1341|  1.08M|  }
 1342|   252k|  if (p != pend) {
  ------------------
  |  Branch (1342:7): [True: 324, False: 251k]
  ------------------
 1343|    324|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1343:9): [True: 172, False: 152]
  |  Branch (1343:26): [True: 20, False: 152]
  ------------------
 1344|     20|      return ipv4;
 1345|     20|    }
 1346|    304|    return ipv4_fast_fail;
 1347|    324|  }
 1348|   251k|  return ipv4;
 1349|   252k|}
_ZNK3ada3url15has_credentialsEv:
 7450|  1.27M|[[nodiscard]] ada_really_inline bool url::has_credentials() const noexcept {
 7451|  1.27M|  return !username.empty() || !password.empty();
  ------------------
  |  Branch (7451:10): [True: 203k, False: 1.07M]
  |  Branch (7451:31): [True: 860, False: 1.07M]
  ------------------
 7452|  1.27M|}
_ZNK3ada8url_base10is_specialEv:
 7410|  5.73M|    const noexcept {
 7411|  5.73M|  return type != ada::scheme::NOT_SPECIAL;
 7412|  5.73M|}
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEEcvbEv:
 4100|   618k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEptEv:
 4069|   994k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4070|   994k|    TL_ASSERT(has_value());
  ------------------
  |  | 2122|   994k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4070:5): [True: 994k, False: 0]
  ------------------
 4071|   994k|    return valptr();
 4072|   994k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE6valptrEv:
 3365|   994k|  T* valptr() { return std::addressof(this->m_val); }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EED2Ev:
 2697|   618k|  ~expected_storage_base() {
 2698|   618k|    if (m_has_val) {
  ------------------
  |  Branch (2698:9): [True: 596k, False: 21.6k]
  ------------------
 2699|   596k|      m_val.~T();
 2700|   596k|    }
 2701|   618k|  }
_ZNK3ada3url13get_href_sizeEv:
 7708|  1.06M|[[nodiscard]] inline size_t url::get_href_size() const noexcept {
 7709|  1.06M|  size_t size = 0;
 7710|  1.06M|  if (is_special()) {
  ------------------
  |  Branch (7710:7): [True: 1.05M, False: 7.54k]
  ------------------
 7711|  1.05M|    size += ada::scheme::details::is_special_list[type].size() + 1;
 7712|  1.05M|  } else {
 7713|  7.54k|    size += non_special_scheme.size() + 1;
 7714|  7.54k|  }
 7715|  1.06M|  if (host.has_value()) {
  ------------------
  |  Branch (7715:7): [True: 1.05M, False: 4.64k]
  ------------------
 7716|  1.05M|    size += host->size();
 7717|  1.05M|    size += 2;
 7718|  1.05M|    if (has_credentials()) {
  ------------------
  |  Branch (7718:9): [True: 132k, False: 924k]
  ------------------
 7719|   132k|      size += username.size();
 7720|   132k|      if (!password.empty()) {
  ------------------
  |  Branch (7720:11): [True: 127k, False: 4.97k]
  ------------------
 7721|   127k|        size += 1 + password.size();
 7722|   127k|      }
 7723|   132k|      size += 1;
 7724|   132k|    }
 7725|  1.05M|    if (port.has_value()) {
  ------------------
  |  Branch (7725:9): [True: 209k, False: 847k]
  ------------------
 7726|   209k|      size += 1;
 7727|   209k|      uint16_t p = *port;
 7728|   209k|      size += (p >= 10000)  ? 5
  ------------------
  |  Branch (7728:15): [True: 6.03k, False: 203k]
  ------------------
 7729|   209k|              : (p >= 1000) ? 4
  ------------------
  |  Branch (7729:17): [True: 98.4k, False: 104k]
  ------------------
 7730|   203k|              : (p >= 100)  ? 3
  ------------------
  |  Branch (7730:17): [True: 418, False: 104k]
  ------------------
 7731|   104k|              : (p >= 10)   ? 2
  ------------------
  |  Branch (7731:17): [True: 94.0k, False: 10.3k]
  ------------------
 7732|   104k|                            : 1;
 7733|   209k|    }
 7734|  1.05M|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7734:14): [True: 1.46k, False: 3.17k]
  |  Branch (7734:34): [True: 91, False: 1.37k]
  ------------------
 7735|     91|    size += 2;
 7736|     91|  }
 7737|  1.06M|  size += path.size();
 7738|  1.06M|  if (query.has_value()) {
  ------------------
  |  Branch (7738:7): [True: 124k, False: 936k]
  ------------------
 7739|   124k|    size += 1 + query->size();
 7740|   124k|  }
 7741|  1.06M|  if (hash.has_value()) {
  ------------------
  |  Branch (7741:7): [True: 96.3k, False: 965k]
  ------------------
 7742|  96.3k|    size += 1 + hash->size();
 7743|  96.3k|  }
 7744|  1.06M|  return size;
 7745|  1.06M|}
_ZN3ada8checkers8is_alphaEc:
 1280|   537k|constexpr bool is_alpha(char x) noexcept {
 1281|   537k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1281:10): [True: 535k, False: 1.99k]
  |  Branch (1281:34): [True: 535k, False: 42]
  ------------------
 1282|   537k|}
_ZN3ada8checkers8to_lowerEc:
 1278|  1.07M|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada3urlaSEOS0_:
 5108|   198k|  url& operator=(url&& u) noexcept = default;
_ZNR2tl8expectedIN3ada3urlENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4082|   994k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4083|   994k|    TL_ASSERT(has_value());
  ------------------
  |  | 2122|   994k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4083:5): [True: 994k, False: 0]
  ------------------
 4084|   994k|    return val();
 4085|   994k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3374|   994k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3375|   994k|    return this->m_val;
 3376|   994k|  }
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEE9has_valueEv:
 4099|  2.40M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1253|  1.17M|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1254|  1.17M|  if (view.empty()) {
  ------------------
  |  Branch (1254:7): [True: 0, False: 1.17M]
  ------------------
 1255|      0|    return false;
 1256|      0|  }
 1257|  1.17M|  const char* start = view.data();
 1258|  1.17M|  const char* end = start + view.size();
 1259|  1.17M|  if (end[-1] == '.') {
  ------------------
  |  Branch (1259:7): [True: 59.4k, False: 1.11M]
  ------------------
 1260|  59.4k|    --end;
 1261|  59.4k|    if (end == start) {
  ------------------
  |  Branch (1261:9): [True: 1.90k, False: 57.5k]
  ------------------
 1262|  1.90k|      return false;
 1263|  1.90k|    }
 1264|  59.4k|  }
 1265|  1.16M|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1265:7): [True: 880k, False: 288k]
  ------------------
 1266|   880k|    return false;
 1267|   880k|  }
 1268|   288k|  const char* label = end;
 1269|  1.29M|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1269:10): [True: 1.27M, False: 27.7k]
  |  Branch (1269:28): [True: 1.00M, False: 260k]
  ------------------
 1270|  1.00M|    --label;
 1271|  1.00M|  }
 1272|   288k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1272:7): [True: 260k, False: 27.7k]
  |  Branch (1272:25): [True: 124k, False: 136k]
  ------------------
 1273|   124k|    return false;
 1274|   124k|  }
 1275|   164k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1275:10): [True: 164k, False: 0]
  |  Branch (1275:26): [True: 156k, False: 7.66k]
  ------------------
 1276|   288k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1247|  2.43M|constexpr bool is_ipv4_number_char(char x) noexcept {
 1248|  2.43M|  const unsigned char c = static_cast<unsigned char>(x);
 1249|  2.43M|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1249:11): [True: 2.18M, False: 257k]
  |  Branch (1249:23): [True: 308k, False: 1.87M]
  |  Branch (1249:37): [True: 1.87M, False: 257k]
  |  Branch (1249:49): [True: 830k, False: 1.04M]
  ------------------
 1250|  1.29M|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1250:11): [True: 1.04M, False: 257k]
  |  Branch (1250:23): [True: 0, False: 1.04M]
  |  Branch (1250:36): [True: 158k, False: 1.14M]
  |  Branch (1250:48): [True: 0, False: 1.14M]
  ------------------
 1251|  2.43M|}
_ZN3ada8checkers8is_digitEc:
 1245|   400k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6919|   126k|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6920|   126k|  return details::special_ports[int(type)];
 6921|   126k|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8652|  60.7k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8653|  60.7k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8654|  60.7k|          " bytes] \n", to_diagram());
 8655|  60.7k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8656|  60.7k|  ADA_ASSERT_TRUE(validate());
 8657|       |
 8658|  60.7k|  const bool begins_with_dashdash = input.starts_with("//");
 8659|  60.7k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8659:7): [True: 59.8k, False: 862]
  |  Branch (8659:32): [True: 0, False: 59.8k]
  ------------------
 8660|       |    // We must delete the ./
 8661|      0|    delete_dash_dot();
 8662|      0|  }
 8663|       |
 8664|  60.7k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8664:7): [True: 862, False: 59.8k]
  |  Branch (8664:31): [True: 862, False: 0]
  |  Branch (8664:51): [True: 21, False: 841]
  ------------------
 8665|     21|      !has_dash_dot()) {
  ------------------
  |  Branch (8665:7): [True: 21, False: 0]
  ------------------
 8666|       |    // If url's host is null, url does not have an opaque path, url's path's
 8667|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8668|       |    // output.
 8669|     21|    buffer.insert(components.pathname_start, "/.");
 8670|     21|    components.pathname_start += 2;
 8671|     21|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8671:9): [True: 0, False: 21]
  ------------------
 8672|      0|      components.search_start += 2;
 8673|      0|    }
 8674|     21|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8674:9): [True: 0, False: 21]
  ------------------
 8675|      0|      components.hash_start += 2;
 8676|      0|    }
 8677|     21|  }
 8678|       |
 8679|  60.7k|  uint32_t difference = replace_and_resize(
 8680|  60.7k|      components.pathname_start,
 8681|  60.7k|      components.pathname_start + get_pathname_length(), input);
 8682|  60.7k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8682:7): [True: 0, False: 60.7k]
  ------------------
 8683|      0|    components.search_start += difference;
 8684|      0|  }
 8685|  60.7k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8685:7): [True: 0, False: 60.7k]
  ------------------
 8686|      0|    components.hash_start += difference;
 8687|      0|  }
 8688|  60.7k|  ADA_ASSERT_TRUE(validate());
 8689|  60.7k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8494|   305k|    uint32_t start, uint32_t end, std::string_view input) {
 8495|   305k|  uint32_t current_length = end - start;
 8496|   305k|  uint32_t input_size = uint32_t(input.size());
 8497|   305k|  uint32_t new_difference = input_size - current_length;
 8498|       |
 8499|   305k|  if (current_length == 0) {
  ------------------
  |  Branch (8499:7): [True: 275k, False: 30.5k]
  ------------------
 8500|   275k|    buffer.insert(start, input);
 8501|   275k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8501:14): [True: 483, False: 30.1k]
  ------------------
 8502|    483|    if (input_size != 0) {
  ------------------
  |  Branch (8502:9): [True: 483, False: 0]
  ------------------
 8503|    483|      std::memmove(buffer.data() + start, input.data(), input_size);
 8504|    483|    }
 8505|  30.1k|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8505:14): [True: 3, False: 30.1k]
  ------------------
 8506|      3|    buffer.erase(start, current_length - input_size);
 8507|      3|    buffer.replace(start, input_size, input);
 8508|  30.1k|  } else {
 8509|  30.1k|    buffer.replace(start, current_length, input.substr(0, current_length));
 8510|  30.1k|    buffer.insert(start + current_length, input.substr(current_length));
 8511|  30.1k|  }
 8512|       |
 8513|   305k|  return new_difference;
 8514|   305k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8545|  60.7k|url_aggregator::get_pathname_length() const noexcept {
 8546|  60.7k|  ada_log("url_aggregator::get_pathname_length");
 8547|  60.7k|  uint32_t ending_index = uint32_t(buffer.size());
 8548|  60.7k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8548:7): [True: 0, False: 60.7k]
  ------------------
 8549|      0|    ending_index = components.search_start;
 8550|  60.7k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8550:14): [True: 0, False: 60.7k]
  ------------------
 8551|      0|    ending_index = components.hash_start;
 8552|      0|  }
 8553|  60.7k|  return ending_index - components.pathname_start;
 8554|  60.7k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9487|   228k|    ada_lifetime_bound {
 9488|   228k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9489|   228k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9490|   228k|          " components.search_start = ", components.search_start,
 9491|   228k|          " components.hash_start = ", components.hash_start);
 9492|   228k|  auto ending_index = uint32_t(buffer.size());
 9493|   228k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9493:7): [True: 33.8k, False: 194k]
  ------------------
 9494|  33.8k|    ending_index = components.search_start;
 9495|   194k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9495:14): [True: 10.9k, False: 183k]
  ------------------
 9496|  10.9k|    ending_index = components.hash_start;
 9497|  10.9k|  }
 9498|   228k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9499|   228k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8470|  12.2k|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8471|  12.2k|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8472|  12.2k|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8473|  12.2k|          " bytes] components.hash_start = ", components.hash_start);
 8474|  12.2k|  ADA_ASSERT_TRUE(validate());
 8475|  12.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8476|  12.2k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8476:7): [True: 0, False: 12.2k]
  ------------------
 8477|      0|    buffer.resize(components.hash_start);
 8478|      0|  }
 8479|  12.2k|  components.hash_start = uint32_t(buffer.size());
 8480|  12.2k|  buffer += "#";
 8481|  12.2k|  bool encoding_required = unicode::percent_encode<true>(
 8482|  12.2k|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8483|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8484|       |  // encoding was not deemed required.
 8485|  12.2k|  if (!encoding_required) {
  ------------------
  |  Branch (8485:7): [True: 11.9k, False: 302]
  ------------------
 8486|  11.9k|    buffer.append(input);
 8487|  11.9k|  }
 8488|  12.2k|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8489|  12.2k|          buffer, "' [", buffer.size(), " bytes]");
 8490|  12.2k|  ADA_ASSERT_TRUE(validate());
 8491|  12.2k|}
_ZN3ada3urlC2Ev:
 5105|   618k|  url() = default;
_ZN3ada3url26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7558|  12.2k|inline void url::update_unencoded_base_hash(std::string_view input) {
 7559|       |  // We do the percent encoding
 7560|  12.2k|  hash = unicode::percent_encode(input,
 7561|  12.2k|                                 ada::character_sets::FRAGMENT_PERCENT_ENCODE);
 7562|  12.2k|}
_ZN3ada3url18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7565|  12.3k|                                    const uint8_t query_percent_encode_set[]) {
 7566|  12.3k|  query = ada::unicode::percent_encode(input, query_percent_encode_set);
 7567|  12.3k|}
_ZN3ada3url20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7556|     87|inline void url::update_base_hostname(std::string_view input) { host = input; }
_ZN3ada3url20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7573|  31.0k|inline void url::update_base_pathname(const std::string_view input) {
 7574|  31.0k|  path = input;
 7575|  31.0k|}
_ZN3ada3url10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 7748|  2.26k|                                         bool check_trailing_content) noexcept {
 7749|  2.26k|  ada_log("parse_port('", view, "') ", view.size());
 7750|  2.26k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (7750:7): [True: 2.06k, False: 200]
  |  Branch (7750:24): [True: 7, False: 2.06k]
  ------------------
 7751|      7|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 7752|      7|    is_valid = false;
 7753|      7|    return 0;
 7754|      7|  }
 7755|  2.26k|  uint16_t parsed_port{};
 7756|  2.26k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 7757|  2.26k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (7757:7): [True: 25, False: 2.23k]
  ------------------
 7758|     25|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 7759|     25|    is_valid = false;
 7760|     25|    return 0;
 7761|     25|  }
 7762|  2.23k|  ada_log("parse_port: ", parsed_port);
 7763|  2.23k|  const auto consumed = size_t(r.ptr - view.data());
 7764|  2.23k|  ada_log("parse_port: consumed ", consumed);
 7765|  2.23k|  if (check_trailing_content) {
  ------------------
  |  Branch (7765:7): [True: 2.23k, False: 0]
  ------------------
 7766|  2.23k|    is_valid &=
 7767|  2.23k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (7767:10): [True: 425, False: 1.81k]
  |  Branch (7767:37): [True: 1.43k, False: 374]
  ------------------
 7768|    374|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (7768:10): [True: 114, False: 260]
  |  Branch (7768:36): [True: 248, False: 12]
  |  Branch (7768:52): [True: 65, False: 183]
  ------------------
 7769|  2.23k|  }
 7770|  2.23k|  ada_log("parse_port: is_valid = ", is_valid);
 7771|  2.23k|  if (is_valid) {
  ------------------
  |  Branch (7771:7): [True: 2.04k, False: 195]
  ------------------
 7772|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 7773|  2.04k|    auto default_port = scheme_default_port();
 7774|  2.04k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (7774:27): [True: 162, False: 1.88k]
  |  Branch (7774:48): [True: 78, False: 84]
  ------------------
 7775|  1.96k|                         (default_port != parsed_port);
  ------------------
  |  Branch (7775:26): [True: 1.96k, False: 3]
  ------------------
 7776|  2.04k|    port = (r.ec == std::errc() && is_port_valid) ? std::optional(parsed_port)
  ------------------
  |  Branch (7776:13): [True: 1.67k, False: 370]
  |  Branch (7776:36): [True: 1.66k, False: 3]
  ------------------
 7777|  2.04k|                                                  : std::nullopt;
 7778|  2.04k|  }
 7779|  2.23k|  return consumed;
 7780|  2.26k|}
_ZNK3ada8url_base19scheme_default_portEv:
 7419|  4.08k|url_base::scheme_default_port() const noexcept {
 7420|  4.08k|  return scheme::get_special_port(type);
 7421|  4.08k|}
_ZNK3ada3url12get_pathnameEv:
 7476|   198k|[[nodiscard]] constexpr std::string_view url::get_pathname() const noexcept {
 7477|   198k|  return path;
 7478|   198k|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1284|  6.29k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1285|  6.29k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1285:10): [True: 4.92k, False: 1.36k]
  ------------------
 1286|  4.92k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1286:11): [True: 3.15k, False: 1.77k]
  |  Branch (1286:34): [True: 272, False: 2.88k]
  |  Branch (1286:55): [True: 68, False: 2.81k]
  ------------------
 1287|    340|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1287:11): [True: 88, False: 252]
  |  Branch (1287:35): [True: 52, False: 200]
  |  Branch (1287:54): [True: 2, False: 198]
  ------------------
 1288|    198|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1288:35): [True: 0, False: 198]
  |  Branch (1288:54): [True: 0, False: 198]
  ------------------
 1289|  6.29k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1292|    138|    std::string_view input) noexcept {
 1293|    138|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1293:10): [True: 36, False: 102]
  |  Branch (1293:32): [True: 24, False: 12]
  |  Branch (1293:54): [True: 20, False: 4]
  ------------------
 1294|    138|}
_ZN3ada3url20set_protocol_as_fileEv:
 7601|  1.44k|constexpr void url::set_protocol_as_file() { type = ada::scheme::type::FILE; }
_ZN3ada7helpers14leading_zeroesEj:
 2000|   287k|inline int leading_zeroes(uint32_t input_num) noexcept {
 2001|       |#if ADA_REGULAR_VISUAL_STUDIO
 2002|       |  unsigned long leading_zero(0);
 2003|       |  unsigned long in(input_num);
 2004|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 2005|       |#else
 2006|   287k|  return __builtin_clz(input_num);
 2007|   287k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 2008|   287k|}
_ZN3ada14url_aggregator7reserveEj:
 9160|   266k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9161|   266k|  buffer.reserve(capacity);
 9162|   266k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8878|  37.7k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8879|  37.7k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8880|  37.7k|          "\n", to_diagram());
 8881|  37.7k|  ADA_ASSERT_TRUE(validate());
 8882|  37.7k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8883|       |#if ADA_DEVELOPMENT_CHECKS
 8884|       |  // computing the expected password.
 8885|       |  std::string password_expected = std::string(get_password());
 8886|       |  password_expected.append(input);
 8887|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8888|  37.7k|  add_authority_slashes_if_needed();
 8889|       |
 8890|       |  // If input is empty, do nothing.
 8891|  37.7k|  if (input.empty()) {
  ------------------
  |  Branch (8891:7): [True: 3.50k, False: 34.1k]
  ------------------
 8892|  3.50k|    return;
 8893|  3.50k|  }
 8894|       |
 8895|  34.1k|  uint32_t difference = uint32_t(input.size());
 8896|  34.1k|  if (has_password()) {
  ------------------
  |  Branch (8896:7): [True: 4.66k, False: 29.5k]
  ------------------
 8897|  4.66k|    buffer.insert(components.host_start, input);
 8898|  29.5k|  } else {
 8899|  29.5k|    difference++;  // Increment for ":"
 8900|  29.5k|    buffer.insert(components.username_end, ":");
 8901|  29.5k|    buffer.insert(components.username_end + 1, input);
 8902|  29.5k|  }
 8903|  34.1k|  components.host_start += difference;
 8904|       |
 8905|       |  // The following line is required to add "@" to hostname. When updating
 8906|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8907|       |  // responsibility to set it.
 8908|  34.1k|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8908:7): [True: 189, False: 34.0k]
  ------------------
 8909|    189|    buffer.insert(components.host_start, "@");
 8910|    189|    difference++;
 8911|    189|  }
 8912|       |
 8913|  34.1k|  components.host_end += difference;
 8914|  34.1k|  components.pathname_start += difference;
 8915|  34.1k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8915:7): [True: 0, False: 34.1k]
  ------------------
 8916|      0|    components.search_start += difference;
 8917|      0|  }
 8918|  34.1k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8918:7): [True: 0, False: 34.1k]
  ------------------
 8919|      0|    components.hash_start += difference;
 8920|      0|  }
 8921|       |#if ADA_DEVELOPMENT_CHECKS
 8922|       |  std::string password_after(get_password());
 8923|       |  ADA_ASSERT_EQUAL(
 8924|       |      password_expected, password_after,
 8925|       |      "append_base_password problem after inserting " + std::string(input));
 8926|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8927|  34.1k|  ADA_ASSERT_TRUE(validate());
 8928|  34.1k|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9134|   341k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9135|   341k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9136|   341k|  ADA_ASSERT_TRUE(validate());
 9137|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9138|       |  // to insert
 9139|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9140|   341k|  if (has_authority()) {
  ------------------
  |  Branch (9140:7): [True: 97.1k, False: 244k]
  ------------------
 9141|  97.1k|    return;
 9142|  97.1k|  }
 9143|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9144|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9145|       |  // the insert could be fused with another insert.
 9146|   244k|  buffer.insert(components.protocol_end, "//");
 9147|   244k|  components.username_end += 2;
 9148|   244k|  components.host_start += 2;
 9149|   244k|  components.host_end += 2;
 9150|   244k|  components.pathname_start += 2;
 9151|   244k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9151:7): [True: 0, False: 244k]
  ------------------
 9152|      0|    components.search_start += 2;
 9153|      0|  }
 9154|   244k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9154:7): [True: 0, False: 244k]
  ------------------
 9155|      0|    components.hash_start += 2;
 9156|      0|  }
 9157|   244k|  ADA_ASSERT_TRUE(validate());
 9158|   244k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8762|  58.5k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8763|  58.5k|  ada_log("url_aggregator::append_base_username ", input);
 8764|  58.5k|  ADA_ASSERT_TRUE(validate());
 8765|  58.5k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8766|       |#if ADA_DEVELOPMENT_CHECKS
 8767|       |  // computing the expected password.
 8768|       |  std::string username_expected(get_username());
 8769|       |  username_expected.append(input);
 8770|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8771|  58.5k|  add_authority_slashes_if_needed();
 8772|       |
 8773|       |  // If input is empty, do nothing.
 8774|  58.5k|  if (input.empty()) {
  ------------------
  |  Branch (8774:7): [True: 17.7k, False: 40.8k]
  ------------------
 8775|  17.7k|    return;
 8776|  17.7k|  }
 8777|       |
 8778|  40.8k|  uint32_t difference = uint32_t(input.size());
 8779|  40.8k|  buffer.insert(components.username_end, input);
 8780|  40.8k|  components.username_end += difference;
 8781|  40.8k|  components.host_start += difference;
 8782|       |
 8783|  40.8k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8783:7): [True: 30.6k, False: 10.1k]
  ------------------
 8784|  30.6k|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8784:7): [True: 30.6k, False: 0]
  ------------------
 8785|  30.6k|    buffer.insert(components.host_start, "@");
 8786|  30.6k|    difference++;
 8787|  30.6k|  }
 8788|       |
 8789|  40.8k|  components.host_end += difference;
 8790|  40.8k|  components.pathname_start += difference;
 8791|  40.8k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8791:7): [True: 0, False: 40.8k]
  ------------------
 8792|      0|    components.search_start += difference;
 8793|      0|  }
 8794|  40.8k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8794:7): [True: 0, False: 40.8k]
  ------------------
 8795|      0|    components.hash_start += difference;
 8796|      0|  }
 8797|       |#if ADA_DEVELOPMENT_CHECKS
 8798|       |  std::string username_after(get_username());
 8799|       |  ADA_ASSERT_EQUAL(
 8800|       |      username_expected, username_after,
 8801|       |      "append_base_username problem after inserting " + std::string(input));
 8802|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8803|  40.8k|  ADA_ASSERT_TRUE(validate());
 8804|  40.8k|}
_ZNK3ada14url_aggregator8get_hrefEv:
 9238|  1.19M|    const noexcept ada_lifetime_bound {
 9239|  1.19M|  ada_log("url_aggregator::get_href");
 9240|  1.19M|  return buffer;
 9241|  1.19M|}
_ZN3ada14url_aggregator16update_base_portEj:
 8930|  1.66k|inline void url_aggregator::update_base_port(uint32_t input) {
 8931|  1.66k|  ada_log("url_aggregator::update_base_port");
 8932|  1.66k|  ADA_ASSERT_TRUE(validate());
 8933|  1.66k|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8933:7): [True: 0, False: 1.66k]
  ------------------
 8934|      0|    clear_port();
 8935|      0|    return;
 8936|      0|  }
 8937|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8938|       |  // value is probably already available as a string.
 8939|  1.66k|  std::string value = helpers::concat(":", std::to_string(input));
 8940|  1.66k|  uint32_t difference = uint32_t(value.size());
 8941|       |
 8942|  1.66k|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8942:7): [True: 0, False: 1.66k]
  ------------------
 8943|      0|    difference -= components.pathname_start - components.host_end;
 8944|      0|    buffer.erase(components.host_end,
 8945|      0|                 components.pathname_start - components.host_end);
 8946|      0|  }
 8947|       |
 8948|  1.66k|  buffer.insert(components.host_end, value);
 8949|  1.66k|  components.pathname_start += difference;
 8950|  1.66k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8950:7): [True: 0, False: 1.66k]
  ------------------
 8951|      0|    components.search_start += difference;
 8952|      0|  }
 8953|  1.66k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8953:7): [True: 0, False: 1.66k]
  ------------------
 8954|      0|    components.hash_start += difference;
 8955|      0|  }
 8956|  1.66k|  components.port = input;
 8957|  1.66k|  ADA_ASSERT_TRUE(validate());
 8958|  1.66k|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1990|  1.66k|std::string concat(Args... args) {
 1991|  1.66k|  std::string answer;
 1992|  1.66k|  inner_concat(answer, args...);
 1993|  1.66k|  return answer;
 1994|  1.66k|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1979|  1.66k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1980|  1.66k|  buffer.append(t);
 1981|  1.66k|  return inner_concat(buffer, args...);
 1982|  1.66k|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1971|  1.66k|inline void inner_concat(std::string& buffer, T t) {
 1972|  1.66k|  buffer.append(t);
 1973|  1.66k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8601|  12.3k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8602|  12.3k|  ada_log("url_aggregator::update_base_search ", input,
 8603|  12.3k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8604|  12.3k|  ADA_ASSERT_TRUE(validate());
 8605|  12.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8606|       |
 8607|  12.3k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8607:7): [True: 12.3k, False: 0]
  ------------------
 8608|  12.3k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8608:9): [True: 12.3k, False: 0]
  ------------------
 8609|  12.3k|      components.search_start = uint32_t(buffer.size());
 8610|  12.3k|      buffer += "?";
 8611|  12.3k|    } else {
 8612|      0|      buffer.resize(components.search_start + 1);
 8613|      0|    }
 8614|       |
 8615|  12.3k|    bool encoding_required =
 8616|  12.3k|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8617|       |    // When encoding_required is false, then buffer is left unchanged, and
 8618|       |    // percent encoding was not deemed required.
 8619|  12.3k|    if (!encoding_required) {
  ------------------
  |  Branch (8619:9): [True: 11.9k, False: 331]
  ------------------
 8620|  11.9k|      buffer.append(input);
 8621|  11.9k|    }
 8622|  12.3k|  } else {
 8623|      0|    const size_t idx =
 8624|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8625|      0|    std::string encoded;
 8626|      0|    std::string_view replacement = input;
 8627|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8627:9): [True: 0, False: 0]
  ------------------
 8628|      0|      encoded =
 8629|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8630|      0|      replacement = encoded;
 8631|      0|    }
 8632|       |
 8633|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8633:9): [True: 0, False: 0]
  ------------------
 8634|      0|      const uint32_t difference = replace_and_resize(
 8635|      0|          components.search_start + 1, components.hash_start, replacement);
 8636|      0|      components.hash_start += difference;
 8637|      0|    } else {
 8638|      0|      components.search_start = components.hash_start;
 8639|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8640|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8640:11): [True: 0, False: 0]
  ------------------
 8641|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8642|      0|                     replacement.data(), replacement.size());
 8643|      0|      }
 8644|      0|      components.hash_start +=
 8645|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8646|      0|    }
 8647|      0|  }
 8648|       |
 8649|  12.3k|  ADA_ASSERT_TRUE(validate());
 8650|  12.3k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8516|   245k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8517|   245k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8518|   245k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8519|   245k|  ADA_ASSERT_TRUE(validate());
 8520|   245k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8521|       |
 8522|       |  // This next line is required for when parsing a URL like `foo://`
 8523|   245k|  add_authority_slashes_if_needed();
 8524|       |
 8525|   245k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8526|   245k|  uint32_t new_difference =
 8527|   245k|      replace_and_resize(components.host_start, components.host_end, input);
 8528|       |
 8529|   245k|  if (has_credentials) {
  ------------------
  |  Branch (8529:7): [True: 30.5k, False: 214k]
  ------------------
 8530|  30.5k|    buffer.insert(components.host_start, "@");
 8531|  30.5k|    new_difference++;
 8532|  30.5k|  }
 8533|   245k|  components.host_end += new_difference;
 8534|   245k|  components.pathname_start += new_difference;
 8535|   245k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8535:7): [True: 0, False: 245k]
  ------------------
 8536|      0|    components.search_start += new_difference;
 8537|      0|  }
 8538|   245k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8538:7): [True: 0, False: 245k]
  ------------------
 8539|      0|    components.hash_start += new_difference;
 8540|      0|  }
 8541|   245k|  ADA_ASSERT_TRUE(validate());
 8542|   245k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9248|  2.26k|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9249|  2.26k|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9250|  2.26k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9250:7): [True: 2.06k, False: 200]
  |  Branch (9250:24): [True: 7, False: 2.06k]
  ------------------
 9251|      7|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9252|      7|    is_valid = false;
 9253|      7|    return 0;
 9254|      7|  }
 9255|  2.26k|  uint16_t parsed_port{};
 9256|  2.26k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9257|  2.26k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9257:7): [True: 25, False: 2.23k]
  ------------------
 9258|     25|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9259|     25|    is_valid = false;
 9260|     25|    return 0;
 9261|     25|  }
 9262|  2.23k|  ada_log("parse_port: ", parsed_port);
 9263|  2.23k|  const size_t consumed = size_t(r.ptr - view.data());
 9264|  2.23k|  ada_log("parse_port: consumed ", consumed);
 9265|  2.23k|  if (check_trailing_content) {
  ------------------
  |  Branch (9265:7): [True: 2.23k, False: 0]
  ------------------
 9266|  2.23k|    is_valid &=
 9267|  2.23k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9267:10): [True: 425, False: 1.81k]
  |  Branch (9267:37): [True: 1.43k, False: 374]
  ------------------
 9268|    374|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9268:10): [True: 114, False: 260]
  |  Branch (9268:36): [True: 248, False: 12]
  |  Branch (9268:52): [True: 65, False: 183]
  ------------------
 9269|  2.23k|  }
 9270|  2.23k|  ada_log("parse_port: is_valid = ", is_valid);
 9271|  2.23k|  if (is_valid) {
  ------------------
  |  Branch (9271:7): [True: 2.04k, False: 195]
  ------------------
 9272|  2.04k|    ada_log("parse_port", r.ec == std::errc());
 9273|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9274|  2.04k|    auto default_port = scheme_default_port();
 9275|  2.04k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9275:27): [True: 162, False: 1.88k]
  |  Branch (9275:48): [True: 78, False: 84]
  ------------------
 9276|  1.96k|                         (default_port != parsed_port);
  ------------------
  |  Branch (9276:26): [True: 1.96k, False: 3]
  ------------------
 9277|  2.04k|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9277:9): [True: 1.67k, False: 370]
  |  Branch (9277:32): [True: 1.66k, False: 3]
  ------------------
 9278|  1.66k|      update_base_port(parsed_port);
 9279|  1.66k|    } else {
 9280|    373|      clear_port();
 9281|    373|    }
 9282|  2.04k|  }
 9283|  2.23k|  return consumed;
 9284|  2.26k|}
_ZN3ada14url_aggregator20set_protocol_as_fileEv:
 9286|  1.44k|constexpr void url_aggregator::set_protocol_as_file() {
 9287|  1.44k|  ada_log("url_aggregator::set_protocol_as_file ");
 9288|  1.44k|  ADA_ASSERT_TRUE(validate());
 9289|  1.44k|  type = ada::scheme::type::FILE;
 9290|       |  // next line could overflow but unsigned arithmetic has well-defined
 9291|       |  // overflows.
 9292|  1.44k|  uint32_t new_difference = 5 - components.protocol_end;
 9293|       |
 9294|  1.44k|  if (buffer.empty()) {
  ------------------
  |  Branch (9294:7): [True: 0, False: 1.44k]
  ------------------
 9295|      0|    buffer.append("file:");
 9296|  1.44k|  } else {
 9297|  1.44k|    buffer.erase(0, components.protocol_end);
 9298|  1.44k|    buffer.insert(0, "file:");
 9299|  1.44k|  }
 9300|  1.44k|  components.protocol_end = 5;
 9301|       |
 9302|       |  // Update the rest of the components.
 9303|  1.44k|  components.username_end += new_difference;
 9304|  1.44k|  components.host_start += new_difference;
 9305|  1.44k|  components.host_end += new_difference;
 9306|  1.44k|  components.pathname_start += new_difference;
 9307|  1.44k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9307:7): [True: 0, False: 1.44k]
  ------------------
 9308|      0|    components.search_start += new_difference;
 9309|      0|  }
 9310|  1.44k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9310:7): [True: 0, False: 1.44k]
  ------------------
 9311|      0|    components.hash_start += new_difference;
 9312|      0|  }
 9313|  1.44k|  ADA_ASSERT_TRUE(validate());
 9314|  1.44k|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8368|    583|                                              const uint8_t character_set[]) {
 8369|    583|  const char* data = input.data();
 8370|    583|  const size_t size = input.size();
 8371|       |
 8372|       |  // Process 8 bytes at a time using unrolled loop
 8373|    583|  size_t i = 0;
 8374|  1.27k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8374:10): [True: 722, False: 548]
  ------------------
 8375|    722|    unsigned char chunk[8];
 8376|    722|    std::memcpy(&chunk, data + i,
 8377|    722|                8);  // entices compiler to unconditionally process 8 characters
 8378|       |
 8379|       |    // Check 8 characters at once
 8380|  6.33k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8380:24): [True: 5.64k, False: 687]
  ------------------
 8381|  5.64k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8381:11): [True: 35, False: 5.60k]
  ------------------
 8382|     35|        return i + j;
 8383|     35|      }
 8384|  5.64k|    }
 8385|    722|  }
 8386|       |
 8387|       |  // Handle remaining bytes
 8388|  2.28k|  for (; i < size; i++) {
  ------------------
  |  Branch (8388:10): [True: 1.73k, False: 543]
  ------------------
 8389|  1.73k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8389:9): [True: 5, False: 1.73k]
  ------------------
 8390|      5|      return i;
 8391|      5|    }
 8392|  1.73k|  }
 8393|       |
 8394|    543|  return size;
 8395|    548|}
_ZN3ada14url_aggregator10clear_portEv:
 8960|    373|inline void url_aggregator::clear_port() {
 8961|    373|  ada_log("url_aggregator::clear_port");
 8962|    373|  ADA_ASSERT_TRUE(validate());
 8963|    373|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8963:7): [True: 373, False: 0]
  ------------------
 8964|    373|    return;
 8965|    373|  }
 8966|      0|  uint32_t length = components.pathname_start - components.host_end;
 8967|      0|  buffer.erase(components.host_end, length);
 8968|      0|  components.pathname_start -= length;
 8969|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8969:7): [True: 0, False: 0]
  ------------------
 8970|      0|    components.search_start -= length;
 8971|      0|  }
 8972|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8972:7): [True: 0, False: 0]
  ------------------
 8973|      0|    components.hash_start -= length;
 8974|      0|  }
 8975|      0|  components.port = url_components::omitted;
 8976|      0|  ADA_ASSERT_TRUE(validate());
 8977|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9125|   342k|    const noexcept {
 9126|   342k|  ada_log("url_aggregator::has_authority");
 9127|       |  // Performance: instead of doing this potentially expensive check, we could
 9128|       |  // have a boolean in the struct.
 9129|   342k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9129:10): [True: 98.0k, False: 244k]
  ------------------
 9130|  98.0k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9130:10): [True: 98.0k, False: 0]
  ------------------
 9131|  98.0k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9131:10): [True: 98.0k, False: 0]
  ------------------
 9132|   342k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9205|  59.8k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9206|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9207|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9208|       |  // U+002F (/) followed by U+002E (.) to output.
 9209|  59.8k|  ada_log("url_aggregator::has_dash_dot");
 9210|       |#if ADA_DEVELOPMENT_CHECKS
 9211|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9212|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9213|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9214|       |  if (components.pathname_start == components.host_end + 2) {
 9215|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9216|       |                     buffer[components.host_end + 1] == '.') ||
 9217|       |                    (buffer[components.host_end] == ':' &&
 9218|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9219|       |  }
 9220|       |  if (components.pathname_start == components.host_end + 2 &&
 9221|       |      buffer[components.host_end] == '/' &&
 9222|       |      buffer[components.host_end + 1] == '.') {
 9223|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9224|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9225|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9226|       |  }
 9227|       |#endif
 9228|       |  // Performance: it should be uncommon for components.pathname_start ==
 9229|       |  // components.host_end + 2 to be true. So we put this check first in the
 9230|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9231|       |  // more expensive, but should be uncommon.
 9232|  59.8k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9232:10): [True: 1.13k, False: 58.7k]
  ------------------
 9233|  1.13k|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9233:10): [True: 1.13k, False: 0]
  |  Branch (9233:30): [True: 0, False: 1.13k]
  ------------------
 9234|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9234:10): [True: 0, False: 0]
  ------------------
 9235|  59.8k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4100|   397k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4069|   994k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4070|   994k|    TL_ASSERT(has_value());
  ------------------
  |  | 2122|   994k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4070:5): [True: 994k, False: 0]
  ------------------
 4071|   994k|    return valptr();
 4072|   994k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3365|   994k|  T* valptr() { return std::addressof(this->m_val); }
_ZNR2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4082|   994k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4083|   994k|    TL_ASSERT(has_value());
  ------------------
  |  | 2122|   994k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4083:5): [True: 994k, False: 0]
  ------------------
 4084|   994k|    return val();
 4085|   994k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3374|   994k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3375|   994k|    return this->m_val;
 3376|   994k|  }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4099|  2.40M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2697|   618k|  ~expected_storage_base() {
 2698|   618k|    if (m_has_val) {
  ------------------
  |  Branch (2698:9): [True: 596k, False: 21.6k]
  ------------------
 2699|   596k|      m_val.~T();
 2700|   596k|    }
 2701|   618k|  }
_ZNK3ada14url_aggregator22has_non_empty_usernameEv:
 9164|   198k|constexpr bool url_aggregator::has_non_empty_username() const noexcept {
 9165|   198k|  ada_log("url_aggregator::has_non_empty_username");
 9166|   198k|  return components.protocol_end + 2 < components.username_end;
 9167|   198k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1912|   962k|                                                       size_t pos2) {
 1913|       |#if ADA_DEVELOPMENT_CHECKS
 1914|       |  if (pos2 < pos1) {
 1915|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1916|       |              << std::endl;
 1917|       |    abort();
 1918|       |  }
 1919|       |#endif
 1920|   962k|  return input.substr(pos1, pos2 - pos1);
 1921|   962k|}
_ZNK3ada14url_aggregator22has_non_empty_passwordEv:
 9169|   198k|constexpr bool url_aggregator::has_non_empty_password() const noexcept {
 9170|   198k|  ada_log("url_aggregator::has_non_empty_password");
 9171|   198k|  return components.host_start > components.username_end;
 9172|   198k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8557|   208k|    const noexcept {
 8558|   208k|  return buffer.size() == components.pathname_start;
 8559|   208k|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9174|  34.1k|constexpr bool url_aggregator::has_password() const noexcept {
 9175|  34.1k|  ada_log("url_aggregator::has_password");
 9176|       |  // This function does not care about the length of the password
 9177|  34.1k|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9177:10): [True: 4.66k, False: 29.5k]
  ------------------
 9178|  4.66k|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9178:10): [True: 4.66k, False: 0]
  ------------------
 9179|  34.1k|}
_ZNK3ada14url_aggregator13get_href_sizeEv:
 9243|   397k|[[nodiscard]] constexpr size_t url_aggregator::get_href_size() const noexcept {
 9244|   397k|  return buffer.size();
 9245|   397k|}
_ZNK3ada3url8get_hrefEv:
 7621|  1.39M|[[nodiscard]] ada_really_inline std::string url::get_href() const {
 7622|  1.39M|  if (is_special() && host.has_value() && username.empty() &&
  ------------------
  |  Branch (7622:7): [True: 1.38M, False: 4.06k]
  |  Branch (7622:23): [True: 1.38M, False: 0]
  |  Branch (7622:43): [True: 1.31M, False: 70.9k]
  ------------------
 7623|  1.31M|      password.empty() && !port.has_value()) [[likely]] {
  ------------------
  |  Branch (7623:7): [True: 1.31M, False: 301]
  |  Branch (7623:27): [True: 1.17M, False: 144k]
  ------------------
 7624|  1.17M|    const std::string_view scheme = ada::scheme::details::is_special_list[type];
 7625|  1.17M|    const size_t host_size = host->size();
 7626|  1.17M|    const size_t path_size = path.size();
 7627|  1.17M|    const size_t query_size = query.has_value() ? query->size() : 0;
  ------------------
  |  Branch (7627:31): [True: 223k, False: 949k]
  ------------------
 7628|  1.17M|    const size_t hash_size = hash.has_value() ? hash->size() : 0;
  ------------------
  |  Branch (7628:30): [True: 157k, False: 1.01M]
  ------------------
 7629|  1.17M|    const size_t total = scheme.size() + 3 + host_size + path_size +
 7630|  1.17M|                         (query.has_value() ? query_size + 1 : 0) +
  ------------------
  |  Branch (7630:27): [True: 223k, False: 949k]
  ------------------
 7631|  1.17M|                         (hash.has_value() ? hash_size + 1 : 0);
  ------------------
  |  Branch (7631:27): [True: 157k, False: 1.01M]
  ------------------
 7632|  1.17M|    std::string output(total, '\0');
 7633|  1.17M|    char* p = output.data();
 7634|  1.17M|    std::memcpy(p, scheme.data(), scheme.size());
 7635|  1.17M|    p += scheme.size();
 7636|  1.17M|    p[0] = ':';
 7637|  1.17M|    p[1] = '/';
 7638|  1.17M|    p[2] = '/';
 7639|  1.17M|    p += 3;
 7640|       |    // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7641|  1.17M|    std::memcpy(p, host->data(), host_size);
 7642|  1.17M|    p += host_size;
 7643|  1.17M|    std::memcpy(p, path.data(), path_size);
 7644|  1.17M|    p += path_size;
 7645|  1.17M|    if (query.has_value()) {
  ------------------
  |  Branch (7645:9): [True: 223k, False: 949k]
  ------------------
 7646|   223k|      *p++ = '?';
 7647|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7648|   223k|      std::memcpy(p, query->data(), query_size);
 7649|   223k|      p += query_size;
 7650|   223k|    }
 7651|  1.17M|    if (hash.has_value()) {
  ------------------
  |  Branch (7651:9): [True: 157k, False: 1.01M]
  ------------------
 7652|   157k|      *p++ = '#';
 7653|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7654|   157k|      std::memcpy(p, hash->data(), hash_size);
 7655|   157k|    }
 7656|  1.17M|    return output;
 7657|  1.17M|  }
 7658|       |
 7659|   220k|  std::string output;
 7660|   220k|  output.reserve(get_href_size());
 7661|       |
 7662|   220k|  if (is_special()) {
  ------------------
  |  Branch (7662:7): [True: 216k, False: 4.06k]
  ------------------
 7663|   216k|    output.append(ada::scheme::details::is_special_list[type]);
 7664|   216k|    output += ':';
 7665|   216k|  } else {
 7666|  4.06k|    output.append(non_special_scheme);
 7667|  4.06k|    output += ':';
 7668|  4.06k|  }
 7669|       |
 7670|   220k|  if (host.has_value()) {
  ------------------
  |  Branch (7670:7): [True: 217k, False: 2.49k]
  ------------------
 7671|   217k|    output += '/';
 7672|   217k|    output += '/';
 7673|   217k|    if (has_credentials()) {
  ------------------
  |  Branch (7673:9): [True: 71.3k, False: 146k]
  ------------------
 7674|  71.3k|      output.append(username);
 7675|  71.3k|      if (!password.empty()) {
  ------------------
  |  Branch (7675:11): [True: 68.6k, False: 2.68k]
  ------------------
 7676|  68.6k|        output += ':';
 7677|  68.6k|        output.append(password);
 7678|  68.6k|      }
 7679|  71.3k|      output += '@';
 7680|  71.3k|    }
 7681|   217k|    output.append(*host);
 7682|   217k|    if (port.has_value()) {
  ------------------
  |  Branch (7682:9): [True: 145k, False: 72.3k]
  ------------------
 7683|   145k|      output += ':';
 7684|   145k|      char port_buf[5];
 7685|   145k|      auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, *port);
 7686|   145k|      (void)ec;
 7687|   145k|      output.append(port_buf, static_cast<size_t>(ptr - port_buf));
 7688|   145k|    }
 7689|   217k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7689:14): [True: 791, False: 1.70k]
  |  Branch (7689:34): [True: 49, False: 742]
  ------------------
 7690|       |    // If url's host is null, url does not have an opaque path, url's path's
 7691|       |    // size is greater than 1, and url's path[0] is the empty string, then
 7692|       |    // append U+002F (/) followed by U+002E (.) to output.
 7693|     49|    output += '/';
 7694|     49|    output += '.';
 7695|     49|  }
 7696|   220k|  output.append(path);
 7697|   220k|  if (query.has_value()) {
  ------------------
  |  Branch (7697:7): [True: 13.5k, False: 206k]
  ------------------
 7698|  13.5k|    output += '?';
 7699|  13.5k|    output.append(*query);
 7700|  13.5k|  }
 7701|   220k|  if (hash.has_value()) {
  ------------------
  |  Branch (7701:7): [True: 13.1k, False: 206k]
  ------------------
 7702|  13.1k|    output += '#';
 7703|  13.1k|    output.append(*hash);
 7704|  13.1k|  }
 7705|   220k|  return output;
 7706|  1.39M|}
_ZNK3ada14url_aggregator8validateEv:
 9316|   198k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9317|   198k|  if (!is_valid) {
  ------------------
  |  Branch (9317:7): [True: 0, False: 198k]
  ------------------
 9318|      0|    return true;
 9319|      0|  }
 9320|   198k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9320:7): [True: 0, False: 198k]
  ------------------
 9321|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9322|      0|            to_diagram());
 9323|      0|    return false;
 9324|      0|  }
 9325|       |  // We have a credible components struct, but let us investivate more
 9326|       |  // carefully:
 9327|       |  /**
 9328|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9329|       |   *       |     |    |          | ^^^^|       |   |
 9330|       |   *       |     |    |          | |   |       |   `----- hash_start
 9331|       |   *       |     |    |          | |   |       `--------- search_start
 9332|       |   *       |     |    |          | |   `----------------- pathname_start
 9333|       |   *       |     |    |          | `--------------------- port
 9334|       |   *       |     |    |          `----------------------- host_end
 9335|       |   *       |     |    `---------------------------------- host_start
 9336|       |   *       |     `--------------------------------------- username_end
 9337|       |   *       `--------------------------------------------- protocol_end
 9338|       |   */
 9339|   198k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9339:7): [True: 0, False: 198k]
  ------------------
 9340|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9341|      0|    return false;
 9342|      0|  }
 9343|   198k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9343:7): [True: 0, False: 198k]
  ------------------
 9344|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9345|      0|    return false;
 9346|      0|  }
 9347|   198k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9347:7): [True: 0, False: 198k]
  ------------------
 9348|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9349|      0|    return false;
 9350|      0|  }
 9351|   198k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9351:7): [True: 0, False: 198k]
  ------------------
 9352|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9353|      0|    return false;
 9354|      0|  }
 9355|   198k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9355:7): [True: 0, False: 198k]
  ------------------
 9356|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9357|      0|    return false;
 9358|      0|  }
 9359|       |
 9360|   198k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9360:7): [True: 0, False: 198k]
  ------------------
 9361|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9362|      0|    return false;
 9363|      0|  }
 9364|   198k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9364:7): [True: 0, False: 198k]
  ------------------
 9365|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9366|      0|    return false;
 9367|      0|  }
 9368|   198k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9368:7): [True: 0, False: 198k]
  ------------------
 9369|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9370|      0|    return false;
 9371|      0|  }
 9372|   198k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9372:7): [True: 0, False: 198k]
  ------------------
 9373|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9374|      0|    return false;
 9375|      0|  }
 9376|   198k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9376:7): [True: 0, False: 198k]
  ------------------
 9377|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9378|      0|            to_diagram());
 9379|      0|    return false;
 9380|      0|  }
 9381|       |
 9382|   198k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9382:7): [True: 198k, False: 0]
  ------------------
 9383|   198k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9383:9): [True: 0, False: 198k]
  ------------------
 9384|      0|      ada_log(
 9385|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9386|      0|          to_diagram());
 9387|      0|      return false;
 9388|      0|    }
 9389|   198k|  }
 9390|       |
 9391|   198k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9391:7): [True: 198k, False: 23]
  ------------------
 9392|   198k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9392:7): [True: 10.1k, False: 188k]
  ------------------
 9393|  10.1k|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9393:9): [True: 383, False: 9.76k]
  ------------------
 9394|    383|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9394:9): [True: 0, False: 383]
  ------------------
 9395|      0|      ada_log(
 9396|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9397|      0|          "\n",
 9398|      0|          to_diagram());
 9399|      0|      return false;
 9400|      0|    }
 9401|  10.1k|  }
 9402|       |
 9403|   198k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9403:7): [True: 198k, False: 23]
  ------------------
 9404|   198k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9404:9): [True: 9.81k, False: 189k]
  ------------------
 9405|  9.81k|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9405:11): [True: 0, False: 9.81k]
  ------------------
 9406|      0|        ada_log(
 9407|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9408|      0|            to_diagram());
 9409|      0|        return false;
 9410|      0|      }
 9411|   189k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9411:16): [True: 189k, False: 0]
  ------------------
 9412|   189k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9412:16): [True: 188k, False: 485]
  ------------------
 9413|   188k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9413:11): [True: 188k, False: 383]
  ------------------
 9414|   188k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9414:13): [True: 0, False: 188k]
  ------------------
 9415|   188k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9415:13): [True: 0, False: 188k]
  ------------------
 9416|      0|          ada_log(
 9417|      0|              "url_aggregator::validate missing // between protocol and host "
 9418|      0|              "\n",
 9419|      0|              to_diagram());
 9420|      0|          return false;
 9421|      0|        }
 9422|   188k|      } else {
 9423|    383|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9423:13): [True: 383, False: 0]
  ------------------
 9424|    383|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9424:13): [True: 0, False: 383]
  ------------------
 9425|      0|          ada_log(
 9426|      0|              "url_aggregator::validate missing @ at the end of the username "
 9427|      0|              "\n",
 9428|      0|              to_diagram());
 9429|      0|          return false;
 9430|      0|        }
 9431|    383|      }
 9432|   188k|    } else {
 9433|    485|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9433:11): [True: 0, False: 485]
  ------------------
 9434|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9435|      0|                to_diagram());
 9436|      0|        return false;
 9437|      0|      }
 9438|    485|    }
 9439|   198k|  }
 9440|   198k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9440:7): [True: 198k, False: 31]
  ------------------
 9441|   198k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9441:7): [True: 20.7k, False: 178k]
  ------------------
 9442|  20.7k|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9442:9): [True: 951, False: 19.8k]
  ------------------
 9443|    951|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9443:9): [True: 7, False: 944]
  ------------------
 9444|      7|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9444:9): [True: 7, False: 0]
  ------------------
 9445|      7|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9445:11): [True: 0, False: 7]
  ------------------
 9446|      7|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9446:11): [True: 0, False: 7]
  ------------------
 9447|      7|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9447:11): [True: 0, False: 7]
  ------------------
 9448|      0|        ada_log(
 9449|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9450|      0|            to_diagram());
 9451|      0|        return false;
 9452|      0|      }
 9453|  20.7k|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9453:16): [True: 0, False: 20.7k]
  ------------------
 9454|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9455|      0|              to_diagram());
 9456|      0|      return false;
 9457|      0|    }
 9458|  20.7k|  }
 9459|   198k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9459:7): [True: 198k, False: 33]
  ------------------
 9460|   198k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9460:7): [True: 198k, False: 53]
  ------------------
 9461|   198k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9461:7): [True: 198k, False: 60]
  |  Branch (9461:60): [True: 198k, False: 177]
  ------------------
 9462|   198k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9462:9): [True: 0, False: 198k]
  ------------------
 9463|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9464|      0|              to_diagram());
 9465|      0|      return false;
 9466|      0|    }
 9467|   198k|  }
 9468|   198k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9468:7): [True: 33.8k, False: 165k]
  ------------------
 9469|  33.8k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9469:9): [True: 0, False: 33.8k]
  ------------------
 9470|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9471|      0|              to_diagram());
 9472|      0|      return false;
 9473|      0|    }
 9474|  33.8k|  }
 9475|   198k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9475:7): [True: 24.4k, False: 174k]
  ------------------
 9476|  24.4k|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9476:9): [True: 0, False: 24.4k]
  ------------------
 9477|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9478|      0|              to_diagram());
 9479|      0|      return false;
 9480|      0|    }
 9481|  24.4k|  }
 9482|       |
 9483|   198k|  return true;
 9484|   198k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7800|   198k|    const noexcept {
 7801|       |  /**
 7802|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7803|       |   *       |     |    |          | ^^^^|       |   |
 7804|       |   *       |     |    |          | |   |       |   `----- hash_start
 7805|       |   *       |     |    |          | |   |       `--------- search_start
 7806|       |   *       |     |    |          | |   `----------------- pathname_start
 7807|       |   *       |     |    |          | `--------------------- port
 7808|       |   *       |     |    |          `----------------------- host_end
 7809|       |   *       |     |    `---------------------------------- host_start
 7810|       |   *       |     `--------------------------------------- username_end
 7811|       |   *       `--------------------------------------------- protocol_end
 7812|       |   */
 7813|       |  // These conditions can be made more strict.
 7814|   198k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7814:7): [True: 0, False: 198k]
  ------------------
 7815|      0|    return false;
 7816|      0|  }
 7817|   198k|  uint32_t index = protocol_end;
 7818|       |
 7819|   198k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7819:7): [True: 0, False: 198k]
  ------------------
 7820|      0|    return false;
 7821|      0|  }
 7822|   198k|  if (username_end < index) {
  ------------------
  |  Branch (7822:7): [True: 0, False: 198k]
  ------------------
 7823|      0|    return false;
 7824|      0|  }
 7825|   198k|  index = username_end;
 7826|       |
 7827|   198k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7827:7): [True: 0, False: 198k]
  ------------------
 7828|      0|    return false;
 7829|      0|  }
 7830|   198k|  if (host_start < index) {
  ------------------
  |  Branch (7830:7): [True: 0, False: 198k]
  ------------------
 7831|      0|    return false;
 7832|      0|  }
 7833|   198k|  index = host_start;
 7834|       |
 7835|   198k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7835:7): [True: 20.7k, False: 178k]
  ------------------
 7836|  20.7k|    if (port > 0xffff) {
  ------------------
  |  Branch (7836:9): [True: 0, False: 20.7k]
  ------------------
 7837|      0|      return false;
 7838|      0|    }
 7839|  20.7k|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7840|  20.7k|    if (index + port_length < index) {
  ------------------
  |  Branch (7840:9): [True: 0, False: 20.7k]
  ------------------
 7841|      0|      return false;
 7842|      0|    }
 7843|  20.7k|    index += port_length;
 7844|  20.7k|  }
 7845|       |
 7846|   198k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7846:7): [True: 0, False: 198k]
  ------------------
 7847|      0|    return false;
 7848|      0|  }
 7849|   198k|  if (pathname_start < index) {
  ------------------
  |  Branch (7849:7): [True: 0, False: 198k]
  ------------------
 7850|      0|    return false;
 7851|      0|  }
 7852|   198k|  index = pathname_start;
 7853|       |
 7854|   198k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7854:7): [True: 33.8k, False: 165k]
  ------------------
 7855|  33.8k|    if (search_start < index) {
  ------------------
  |  Branch (7855:9): [True: 0, False: 33.8k]
  ------------------
 7856|      0|      return false;
 7857|      0|    }
 7858|  33.8k|    index = search_start;
 7859|  33.8k|  }
 7860|       |
 7861|   198k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7861:7): [True: 24.4k, False: 174k]
  ------------------
 7862|  24.4k|    if (hash_start < index) {
  ------------------
  |  Branch (7862:9): [True: 0, False: 24.4k]
  ------------------
 7863|      0|      return false;
 7864|      0|    }
 7865|  24.4k|  }
 7866|       |
 7867|   198k|  return true;
 7868|   198k|}
_ZN3ada7helpers16fast_digit_countEj:
 2016|  20.7k|inline int fast_digit_count(uint32_t x) noexcept {
 2017|  20.7k|  auto int_log2 = [](uint32_t z) -> int {
 2018|  20.7k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2019|  20.7k|  };
 2020|       |  // Compiles to very few instructions. Note that the
 2021|       |  // table is static and thus effectively a constant.
 2022|       |  // We leave it inside the function because it is meaningless
 2023|       |  // outside of it (this comes at no performance cost).
 2024|  20.7k|  const static uint64_t table[] = {
 2025|  20.7k|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2026|  20.7k|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2027|  20.7k|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2028|  20.7k|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2029|  20.7k|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2030|  20.7k|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2031|  20.7k|      42949672960, 42949672960};
 2032|  20.7k|  return int((x + table[int_log2(x)]) >> 32);
 2033|  20.7k|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2017|  20.7k|  auto int_log2 = [](uint32_t z) -> int {
 2018|  20.7k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2019|  20.7k|  };
_ZN3ada7helpers6concatIJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKcEEENS2_12basic_stringIcS5_NS2_9allocatorIcEEEEDpT_:
 1990|   203k|std::string concat(Args... args) {
 1991|   203k|  std::string answer;
 1992|   203k|  inner_concat(answer, args...);
 1993|   203k|  return answer;
 1994|   203k|}
_ZN3ada7helpers12inner_concatINSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEJPKcEEEvRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEET_DpT0_:
 1979|   203k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1980|   203k|  buffer.append(t);
 1981|   203k|  return inner_concat(buffer, args...);
 1982|   203k|}
_ZN3ada7helpers12inner_concatIPKcJEEEvRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEET_:
 1971|   203k|inline void inner_concat(std::string& buffer, T t) {
 1972|   203k|  buffer.append(t);
 1973|   203k|}
_ZN3ada7helpers6concatIJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcEEES8_DpT_:
 1990|    580|std::string concat(Args... args) {
 1991|    580|  std::string answer;
 1992|    580|  inner_concat(answer, args...);
 1993|    580|  return answer;
 1994|    580|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJPKcEEEvRS8_T_DpT0_:
 1979|    580|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1980|    580|  buffer.append(t);
 1981|    580|  return inner_concat(buffer, args...);
 1982|    580|}
_ZN3ada3url10set_schemeEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7603|  4.71k|inline void url::set_scheme(std::string&& new_scheme) noexcept {
 7604|  4.71k|  type = ada::scheme::get_scheme_type(new_scheme);
 7605|       |  // We only move the 'scheme' if it is non-special.
 7606|  4.71k|  if (!is_special()) {
  ------------------
  |  Branch (7606:7): [True: 1.81k, False: 2.90k]
  ------------------
 7607|  1.81k|    non_special_scheme = std::move(new_scheme);
 7608|  1.81k|  }
 7609|  4.71k|}

LLVMFuzzerTestOneInput:
  212|  9.36k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  213|  9.36k|  FuzzedDataProvider fdp(data, size);
  214|       |
  215|  9.36k|  fuzz_one_input(make_candidate(fdp));
  216|       |
  217|  9.36k|  if (fdp.remaining_bytes() > 0) {
  ------------------
  |  Branch (217:7): [True: 5.09k, False: 4.27k]
  ------------------
  218|  5.09k|    std::string raw = fdp.ConsumeRemainingBytesAsString();
  219|  5.09k|    if (raw.size() > 512) {
  ------------------
  |  Branch (219:9): [True: 21, False: 5.06k]
  ------------------
  220|     21|      raw.resize(512);
  221|     21|    }
  222|  5.09k|    if (!raw.empty() && (static_cast<unsigned char>(raw[0]) & 1u)) {
  ------------------
  |  Branch (222:9): [True: 5.09k, False: 0]
  |  Branch (222:25): [True: 2.23k, False: 2.85k]
  ------------------
  223|  2.23k|      raw = std::string("https://") + raw;
  224|  2.85k|    } else if (!raw.empty()) {
  ------------------
  |  Branch (224:16): [True: 2.85k, False: 0]
  ------------------
  225|  2.85k|      raw = std::string("http://") + raw;
  226|  2.85k|    }
  227|  5.09k|    fuzz_one_input(raw);
  228|  5.09k|  }
  229|       |
  230|  9.36k|  static constexpr const char* kAnchors[] = {
  231|  9.36k|      "https://example.com",
  232|  9.36k|      "https://example.com/",
  233|  9.36k|      "https://example.com?q=1",
  234|  9.36k|      "https://example.com#frag",
  235|  9.36k|      "https://example.com/?q=1#frag",
  236|  9.36k|      "http://www.example.com/path/file.js",
  237|  9.36k|      "http://WWW.Example.COM/file.js",
  238|  9.36k|      "https://www.google.com/imghp?hl=en&tab=wi",
  239|  9.36k|      "http://192.168.0.1/x",
  240|  9.36k|      "http://0x7f.1/",
  241|  9.36k|      "https://user:pass@example.com/x",
  242|  9.36k|      "https://example.com:8080/x",
  243|  9.36k|      "https://example.com/a/./b/../c",
  244|  9.36k|      "https://example.com/foo/%2e%2e",
  245|  9.36k|      "https://xn--nxasmq6b.com/",
  246|  9.36k|      "https://xn--a/",
  247|  9.36k|      "http://foo.0xffffffff/",
  248|  9.36k|      "http://example.0x/",
  249|  9.36k|      "https://example.com:0080/x",
  250|  9.36k|      "http://@19%2E68.1.10.",
  251|  9.36k|      "http://19%2E68.1.10.",
  252|  9.36k|      "http://0xffffffff.",
  253|  9.36k|  };
  254|   206k|  for (const char* seed : kAnchors) {
  ------------------
  |  Branch (254:25): [True: 206k, False: 9.36k]
  ------------------
  255|   206k|    fuzz_one_input(seed);
  256|   206k|  }
  257|       |
  258|  9.36k|  return 0;
  259|  9.36k|}
simple_absolute.cc:_ZL14fuzz_one_inputNSt3__117basic_string_viewIcNS_11char_traitsIcEEEE:
  171|   220k|static void fuzz_one_input(std::string_view input) {
  172|   220k|  auto url = ada::parse<ada::url>(input);
  173|   220k|  auto agg = ada::parse<ada::url_aggregator>(input);
  174|       |
  175|   220k|  if (url.has_value() != agg.has_value()) {
  ------------------
  |  Branch (175:7): [True: 0, False: 220k]
  ------------------
  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|   220k|  if (!url) {
  ------------------
  |  Branch (185:7): [True: 21.6k, False: 198k]
  ------------------
  186|  21.6k|    return;
  187|  21.6k|  }
  188|       |
  189|   198k|  check_components_agree(*url, *agg, input);
  190|   198k|  check_href_size(*url, input);
  191|   198k|  check_href_size(*agg, input);
  192|   198k|  check_reparse_idempotent(*url, input);
  193|   198k|  check_reparse_idempotent(*agg, input);
  194|       |
  195|   198k|  const std::string href = url->get_href();
  196|   198k|  url->set_href(href);
  197|   198k|  agg->set_href(href);
  198|   198k|  if (url->get_href() != std::string(agg->get_href())) {
  ------------------
  |  Branch (198:7): [True: 0, False: 198k]
  ------------------
  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|   198k|  check_href_size(*url, href);
  206|   198k|  check_href_size(*agg, href);
  207|       |
  208|   198k|  volatile bool valid = agg->validate();
  209|   198k|  (void)valid;
  210|   198k|}
simple_absolute.cc:_ZL22check_components_agreeRKN3ada3urlERKNS_14url_aggregatorENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  148|   198k|                                   std::string_view input) {
  149|   198k|  if (u.get_protocol() != a.get_protocol() ||
  ------------------
  |  Branch (149:7): [True: 0, False: 198k]
  |  Branch (149:7): [True: 0, False: 198k]
  ------------------
  150|   198k|      u.get_href() != std::string(a.get_href()) ||
  ------------------
  |  Branch (150:7): [True: 0, False: 198k]
  ------------------
  151|   198k|      std::string(u.get_hostname()) != std::string(a.get_hostname()) ||
  ------------------
  |  Branch (151:7): [True: 0, False: 198k]
  ------------------
  152|   198k|      std::string(u.get_pathname()) != std::string(a.get_pathname()) ||
  ------------------
  |  Branch (152:7): [True: 0, False: 198k]
  ------------------
  153|   198k|      std::string(u.get_search()) != std::string(a.get_search()) ||
  ------------------
  |  Branch (153:7): [True: 0, False: 198k]
  ------------------
  154|   198k|      std::string(u.get_hash()) != std::string(a.get_hash()) ||
  ------------------
  |  Branch (154:7): [True: 0, False: 198k]
  ------------------
  155|   198k|      std::string(u.get_port()) != std::string(a.get_port()) ||
  ------------------
  |  Branch (155:7): [True: 0, False: 198k]
  ------------------
  156|   198k|      u.get_username() != std::string(a.get_username()) ||
  ------------------
  |  Branch (156:7): [True: 0, False: 198k]
  ------------------
  157|   198k|      u.get_password() != std::string(a.get_password()) ||
  ------------------
  |  Branch (157:7): [True: 0, False: 198k]
  ------------------
  158|   198k|      std::string(u.get_host()) != std::string(a.get_host())) {
  ------------------
  |  Branch (158:7): [True: 0, False: 198k]
  ------------------
  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|   198k|}
simple_absolute.cc:_ZL15check_href_sizeRKN3ada3urlENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
   94|   397k|static void check_href_size(const ada::url& u, std::string_view input) {
   95|   397k|  if (u.get_href_size() != u.get_href().size()) {
  ------------------
  |  Branch (95:7): [True: 0, False: 397k]
  ------------------
   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|   397k|}
simple_absolute.cc:_ZL15check_href_sizeRKN3ada14url_aggregatorENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  108|   397k|                            std::string_view input) {
  109|   397k|  if (u.get_href_size() != u.get_href().size()) {
  ------------------
  |  Branch (109:7): [True: 0, False: 397k]
  ------------------
  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|   397k|}
simple_absolute.cc:_ZL24check_reparse_idempotentIN3ada3urlEEvRKT_NSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  123|   198k|                                     std::string_view input) {
  124|   198k|  const std::string href = std::string(parsed.get_href());
  125|   198k|  auto again = ada::parse<Result>(href);
  126|   198k|  if (!again) {
  ------------------
  |  Branch (126:7): [True: 0, False: 198k]
  ------------------
  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|   198k|  if (std::string(again->get_href()) != href) {
  ------------------
  |  Branch (134:7): [True: 0, False: 198k]
  ------------------
  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|   198k|}
simple_absolute.cc:_ZL24check_reparse_idempotentIN3ada14url_aggregatorEEvRKT_NSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  123|   198k|                                     std::string_view input) {
  124|   198k|  const std::string href = std::string(parsed.get_href());
  125|   198k|  auto again = ada::parse<Result>(href);
  126|   198k|  if (!again) {
  ------------------
  |  Branch (126:7): [True: 0, False: 198k]
  ------------------
  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|   198k|  if (std::string(again->get_href()) != href) {
  ------------------
  |  Branch (134:7): [True: 0, False: 198k]
  ------------------
  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|   198k|}
simple_absolute.cc:_ZL14make_candidateR18FuzzedDataProvider:
   74|  9.36k|static std::string make_candidate(FuzzedDataProvider& fdp) {
   75|  9.36k|  std::string out;
   76|  9.36k|  out += pick(fdp, kSchemes);
   77|  9.36k|  out += pick(fdp, kHosts);
   78|  9.36k|  out += pick(fdp, kPaths);
   79|  9.36k|  out += pick(fdp, kQueries);
   80|  9.36k|  out += pick(fdp, kFrags);
   81|       |
   82|  9.36k|  if (fdp.ConsumeBool() && !out.empty()) {
  ------------------
  |  Branch (82:7): [True: 3.35k, False: 6.01k]
  |  Branch (82:28): [True: 3.35k, False: 0]
  ------------------
   83|  3.35k|    std::string mid = fdp.ConsumeRandomLengthString(24);
   84|  3.35k|    size_t pos = fdp.ConsumeIntegralInRange<size_t>(0, out.size());
   85|  3.35k|    out.insert(pos, mid);
   86|  3.35k|  }
   87|  9.36k|  if (fdp.ConsumeBool() && !out.empty()) {
  ------------------
  |  Branch (87:7): [True: 2.12k, False: 7.24k]
  |  Branch (87:28): [True: 2.12k, False: 0]
  ------------------
   88|  2.12k|    size_t i = fdp.ConsumeIntegralInRange<size_t>(0, out.size() - 1);
   89|  2.12k|    out[i] = static_cast<char>(fdp.ConsumeIntegral<uint8_t>());
   90|  2.12k|  }
   91|  9.36k|  return out;
   92|  9.36k|}
simple_absolute.cc:_ZL4pickILm8EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.36k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.36k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.36k|}
simple_absolute.cc:_ZL4pickILm20EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.36k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.36k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.36k|}
simple_absolute.cc:_ZL4pickILm16EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.36k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.36k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.36k|}
simple_absolute.cc:_ZL4pickILm6EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.36k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.36k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.36k|}
simple_absolute.cc:_ZL4pickILm5EEPKcR18FuzzedDataProviderRAT__KS1_:
   70|  9.36k|static const char* pick(FuzzedDataProvider& fdp, const char* const (&arr)[N]) {
   71|  9.36k|  return arr[fdp.ConsumeIntegralInRange<size_t>(0, N - 1)];
   72|  9.36k|}

