_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  172|  2.25k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  173|  2.25k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  174|  2.25k|  size_t pos = 0;
  175|  2.25k|  const char32_t* start{utf32_output};
  176|  38.4k|  while (pos < len) {
  ------------------
  |  Branch (176:10): [True: 36.7k, False: 1.73k]
  ------------------
  177|       |    // try to convert the next block of 16 ASCII bytes
  178|  36.7k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (178:9): [True: 23.0k, False: 13.7k]
  ------------------
  179|       |                            // bytes, check that they are ascii
  180|  23.0k|      uint64_t v1;
  181|  23.0k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  182|  23.0k|      uint64_t v2;
  183|  23.0k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  184|  23.0k|      uint64_t v{v1 | v2};
  185|  23.0k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (185:11): [True: 4.33k, False: 18.6k]
  ------------------
  186|  4.33k|        size_t final_pos = pos + 16;
  187|  73.6k|        while (pos < final_pos) {
  ------------------
  |  Branch (187:16): [True: 69.2k, False: 4.33k]
  ------------------
  188|  69.2k|          *utf32_output++ = char32_t(buf[pos]);
  189|  69.2k|          pos++;
  190|  69.2k|        }
  191|  4.33k|        continue;
  192|  4.33k|      }
  193|  23.0k|    }
  194|  32.4k|    uint8_t leading_byte = data[pos];  // leading byte
  195|  32.4k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (195:9): [True: 26.9k, False: 5.44k]
  ------------------
  196|       |      // converting one ASCII byte !!!
  197|  26.9k|      *utf32_output++ = char32_t(leading_byte);
  198|  26.9k|      pos++;
  199|  26.9k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (199:16): [True: 3.29k, False: 2.15k]
  ------------------
  200|       |      // We have a two-byte UTF-8
  201|  3.29k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (201:11): [True: 38, False: 3.25k]
  ------------------
  202|     38|        return 0;
  203|     38|      }  // minimal bound checking
  204|  3.25k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (204:11): [True: 60, False: 3.19k]
  ------------------
  205|     60|        return 0;
  206|     60|      }
  207|       |      // range check
  208|  3.19k|      uint32_t code_point =
  209|  3.19k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  210|  3.19k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (210:11): [True: 8, False: 3.18k]
  |  Branch (210:32): [True: 0, False: 3.18k]
  ------------------
  211|      8|        return 0;
  212|      8|      }
  213|  3.18k|      *utf32_output++ = char32_t(code_point);
  214|  3.18k|      pos += 2;
  215|  3.18k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (215:16): [True: 1.38k, False: 774]
  ------------------
  216|       |      // We have a three-byte UTF-8
  217|  1.38k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (217:11): [True: 24, False: 1.35k]
  ------------------
  218|     24|        return 0;
  219|     24|      }  // minimal bound checking
  220|       |
  221|  1.35k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (221:11): [True: 40, False: 1.31k]
  ------------------
  222|     40|        return 0;
  223|     40|      }
  224|  1.31k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (224:11): [True: 12, False: 1.30k]
  ------------------
  225|     12|        return 0;
  226|     12|      }
  227|       |      // range check
  228|  1.30k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  229|  1.30k|                            (data[pos + 1] & 0b00111111) << 6 |
  230|  1.30k|                            (data[pos + 2] & 0b00111111);
  231|  1.30k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (231:11): [True: 6, False: 1.29k]
  |  Branch (231:33): [True: 0, False: 1.29k]
  ------------------
  232|  1.29k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (232:12): [True: 284, False: 1.01k]
  |  Branch (232:35): [True: 6, False: 278]
  ------------------
  233|     12|        return 0;
  234|     12|      }
  235|  1.29k|      *utf32_output++ = char32_t(code_point);
  236|  1.29k|      pos += 3;
  237|  1.29k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (237:16): [True: 522, False: 252]
  ------------------
  238|       |      // we have a 4-byte UTF-8 word.
  239|    522|      if (pos + 3 >= len) {
  ------------------
  |  Branch (239:11): [True: 18, False: 504]
  ------------------
  240|     18|        return 0;
  241|     18|      }  // minimal bound checking
  242|    504|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (242:11): [True: 24, False: 480]
  ------------------
  243|     24|        return 0;
  244|     24|      }
  245|    480|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (245:11): [True: 8, False: 472]
  ------------------
  246|      8|        return 0;
  247|      8|      }
  248|    472|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (248:11): [True: 6, False: 466]
  ------------------
  249|      6|        return 0;
  250|      6|      }
  251|       |
  252|       |      // range check
  253|    466|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  254|    466|                            (data[pos + 1] & 0b00111111) << 12 |
  255|    466|                            (data[pos + 2] & 0b00111111) << 6 |
  256|    466|                            (data[pos + 3] & 0b00111111);
  257|    466|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (257:11): [True: 12, False: 454]
  |  Branch (257:35): [True: 4, False: 450]
  ------------------
  258|     16|        return 0;
  259|     16|      }
  260|    450|      *utf32_output++ = char32_t(code_point);
  261|    450|      pos += 4;
  262|    450|    } else {
  263|    252|      return 0;
  264|    252|    }
  265|  32.4k|  }
  266|  1.73k|  return utf32_output - start;
  267|  2.25k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  282|  2.29k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  283|  2.29k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  284|  2.29k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|  2.29k|    return c > -65;
  288|  2.29k|  });
  289|  2.29k|}
_ZN3ada4idna9ascii_mapEPcm:
 5133|  47.0k|void ascii_map(char* input, size_t length) {
 5134|  47.0k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|  47.0k|    return 0x101010101010101ull * v;
 5136|  47.0k|  };
 5137|  47.0k|  uint64_t broadcast_80 = broadcast(0x80);
 5138|  47.0k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5139|  47.0k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5140|  47.0k|  size_t i = 0;
 5141|       |
 5142|   103k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5142:10): [True: 56.3k, False: 47.0k]
  ------------------
 5143|  56.3k|    uint64_t word{};
 5144|  56.3k|    std::memcpy(&word, input + i, sizeof(word));
 5145|  56.3k|    word ^=
 5146|  56.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|  56.3k|    std::memcpy(input + i, &word, sizeof(word));
 5148|  56.3k|  }
 5149|  47.0k|  if (i < length) {
  ------------------
  |  Branch (5149:7): [True: 24.7k, False: 22.3k]
  ------------------
 5150|  24.7k|    uint64_t word{};
 5151|  24.7k|    std::memcpy(&word, input + i, length - i);
 5152|  24.7k|    word ^=
 5153|  24.7k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5154|  24.7k|    std::memcpy(input + i, &word, length - i);
 5155|  24.7k|  }
 5156|  47.0k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5160|  2.98k|bool map(std::u32string_view input, std::u32string& out) {
 5161|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5162|  2.98k|  out.clear();
 5163|  2.98k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5163:7): [True: 0, False: 2.98k]
  ------------------
 5164|      0|    return false;
 5165|      0|  }
 5166|       |
 5167|       |  // Pass 1: validate and compute exact output length.
 5168|  2.98k|  size_t out_size = 0;
 5169|   110k|  for (char32_t x : input) {
  ------------------
  |  Branch (5169:19): [True: 110k, False: 2.89k]
  ------------------
 5170|   110k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5171|   110k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5171:9): [True: 94, False: 110k]
  ------------------
 5172|     94|      return false;
 5173|     94|    }
 5174|   110k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5174:9): [True: 92.9k, False: 17.1k]
  ------------------
 5175|  92.9k|      ++out_size;
 5176|  92.9k|      continue;
 5177|  92.9k|    }
 5178|  17.1k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5178:9): [True: 0, False: 17.1k]
  ------------------
 5179|      0|      return false;
 5180|      0|    }
 5181|  17.1k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5182|  17.1k|  }
 5183|       |
 5184|       |  // Pass 2: write into a single allocation.
 5185|  2.89k|  out.resize(out_size);
 5186|  2.89k|  size_t w = 0;
 5187|   109k|  for (char32_t x : input) {
  ------------------
  |  Branch (5187:19): [True: 109k, False: 2.89k]
  ------------------
 5188|   109k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5189|   109k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5189:9): [True: 92.6k, False: 16.8k]
  ------------------
 5190|  92.6k|      out[w++] = x;
 5191|  92.6k|      continue;
 5192|  92.6k|    }
 5193|       |    // IGNORED or mapped (status already validated in pass 1).
 5194|  16.8k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5195|  34.4k|    while (*ptr != 0) {
  ------------------
  |  Branch (5195:12): [True: 17.6k, False: 16.8k]
  ------------------
 5196|  17.6k|      out[w++] = utf8_next(ptr);
 5197|  17.6k|    }
 5198|  16.8k|  }
 5199|  2.89k|  return true;
 5200|  2.98k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5293|     44|    const std::u32string_view input) noexcept {
 5294|     44|  bool decomposition_needed{false};
 5295|     44|  size_t additional_elements{0};
 5296|  1.14k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5296:35): [True: 1.14k, False: 44]
  ------------------
 5297|  1.14k|    size_t decomposition_length{0};
 5298|       |
 5299|  1.14k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5299:9): [True: 2, False: 1.14k]
  ------------------
 5300|      2|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5300:9): [True: 0, False: 2]
  ------------------
 5301|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5302|      0|      decomposition_length = 2;
 5303|      0|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5303:11): [True: 0, False: 0]
  ------------------
 5304|      0|        decomposition_length = 3;
 5305|      0|      }
 5306|  1.14k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5306:16): [True: 1.14k, False: 0]
  ------------------
 5307|  1.14k|      const uint8_t di = decomposition_index[current_character >> 8];
 5308|  1.14k|      const uint16_t* const decomposition =
 5309|  1.14k|          decomposition_block_row(di) + (current_character % 256);
 5310|  1.14k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5311|  1.14k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5311:11): [True: 0, False: 1.14k]
  |  Branch (5311:41): [True: 0, False: 0]
  ------------------
 5312|      0|        decomposition_length = 0;
 5313|      0|      }
 5314|  1.14k|    }
 5315|  1.14k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5315:9): [True: 0, False: 1.14k]
  ------------------
 5316|      0|      decomposition_needed = true;
 5317|      0|      additional_elements += decomposition_length - 1;
 5318|      0|    }
 5319|  1.14k|  }
 5320|     44|  return {decomposition_needed, additional_elements};
 5321|     44|}
_ZN3ada4idna7get_cccEDi:
 5367|   211k|uint8_t get_ccc(char32_t c) noexcept {
 5368|   211k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5368:7): [True: 0, False: 211k]
  ------------------
 5369|      0|    return 0;
 5370|      0|  }
 5371|   211k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5372|   211k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5374|     44|void sort_marks(std::u32string& input) {
 5375|  1.14k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5375:24): [True: 1.10k, False: 44]
  ------------------
 5376|  1.10k|    uint8_t ccc = get_ccc(input[idx]);
 5377|  1.10k|    if (ccc == 0) {
  ------------------
  |  Branch (5377:9): [True: 454, False: 646]
  ------------------
 5378|    454|      continue;
 5379|    454|    }
 5380|    646|    auto current_character = input[idx];
 5381|    646|    size_t back_idx = idx;
 5382|  1.13k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5382:12): [True: 1.11k, False: 18]
  |  Branch (5382:29): [True: 490, False: 628]
  ------------------
 5383|    490|      input[back_idx] = input[back_idx - 1];
 5384|    490|      back_idx--;
 5385|    490|    }
 5386|    646|    input[back_idx] = current_character;
 5387|    646|  }
 5388|     44|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5390|     44|void decompose_nfc(std::u32string& input) {
 5391|       |  /**
 5392|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5393|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5394|       |   */
 5395|     44|  auto [decomposition_needed, additional_elements] =
 5396|     44|      compute_decomposition_length(input);
 5397|     44|  if (decomposition_needed) {
  ------------------
  |  Branch (5397:7): [True: 0, False: 44]
  ------------------
 5398|      0|    decompose(input, additional_elements);
 5399|      0|  }
 5400|     44|  sort_marks(input);
 5401|     44|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5468|  2.83k|bool is_already_nfc(std::u32string_view input) noexcept {
 5469|  2.83k|  if (input.empty()) {
  ------------------
  |  Branch (5469:7): [True: 0, False: 2.83k]
  ------------------
 5470|      0|    return true;
 5471|      0|  }
 5472|  2.83k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5472:7): [True: 0, False: 2.83k]
  |  Branch (5472:30): [True: 0, False: 0]
  ------------------
 5473|      0|    return false;
 5474|      0|  }
 5475|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5476|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5477|   108k|  for (char32_t c : input) {
  ------------------
  |  Branch (5477:19): [True: 108k, False: 2.83k]
  ------------------
 5478|   108k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5478:9): [True: 0, False: 108k]
  ------------------
 5479|      0|      return false;
 5480|      0|    }
 5481|   108k|  }
 5482|       |  // 2) Combining marks already in canonical order.
 5483|  2.83k|  uint8_t prev_ccc = 0;
 5484|   106k|  for (char32_t c : input) {
  ------------------
  |  Branch (5484:19): [True: 106k, False: 2.77k]
  ------------------
 5485|   106k|    uint8_t ccc = get_ccc(c);
 5486|   106k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5486:9): [True: 1.05k, False: 105k]
  |  Branch (5486:21): [True: 60, False: 990]
  ------------------
 5487|     60|      return false;
 5488|     60|    }
 5489|   106k|    prev_ccc = ccc;
 5490|   106k|  }
 5491|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5492|  2.77k|  return !would_compose(input);
 5493|  2.83k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5495|     44|void compose(std::u32string& input) {
 5496|       |  /**
 5497|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5498|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5499|       |   */
 5500|     44|  size_t input_count{0};
 5501|     44|  size_t composition_count{0};
 5502|    542|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5502:10): [True: 498, False: 44]
  ------------------
 5503|    498|    input[composition_count] = input[input_count];
 5504|    498|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5504:9): [True: 2, False: 496]
  ------------------
 5505|      2|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5505:9): [True: 0, False: 2]
  ------------------
 5506|      0|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5506:11): [True: 0, False: 0]
  ------------------
 5507|      0|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5507:11): [True: 0, False: 0]
  ------------------
 5508|      0|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5508:11): [True: 0, False: 0]
  ------------------
 5509|      0|        input[composition_count] =
 5510|      0|            hangul_sbase +
 5511|      0|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5512|      0|             input[input_count + 1] - hangul_vbase) *
 5513|      0|                hangul_tcount;
 5514|      0|        input_count++;
 5515|      0|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5515:13): [True: 0, False: 0]
  ------------------
 5516|      0|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5516:13): [True: 0, False: 0]
  ------------------
 5517|      0|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5517:13): [True: 0, False: 0]
  ------------------
 5518|      0|          input[composition_count] += input[++input_count] - hangul_tbase;
 5519|      0|        }
 5520|      0|      }
 5521|    498|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5521:16): [True: 2, False: 496]
  ------------------
 5522|      2|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5522:16): [True: 0, False: 2]
  ------------------
 5523|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5523:11): [True: 0, False: 0]
  ------------------
 5524|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5524:11): [True: 0, False: 0]
  ------------------
 5525|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5525:11): [True: 0, False: 0]
  ------------------
 5526|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5526:11): [True: 0, False: 0]
  ------------------
 5527|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5528|      0|      }
 5529|    498|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5529:16): [True: 498, False: 0]
  ------------------
 5530|    498|      const uint16_t* composition =
 5531|    498|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5532|    498|          (input[input_count] % 256);
 5533|    498|      size_t initial_composition_count = composition_count;
 5534|  1.14k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5534:39): [True: 1.10k, False: 44]
  ------------------
 5535|  1.10k|           input_count++) {
 5536|  1.10k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5537|       |
 5538|  1.10k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5538:13): [True: 556, False: 544]
  |  Branch (5538:49): [True: 334, False: 222]
  ------------------
 5539|    334|          int left = composition[0];
 5540|    334|          int right = composition[1];
 5541|    334|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5541:15): [True: 0, False: 334]
  |  Branch (5541:27): [True: 0, False: 334]
  ------------------
 5542|    334|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5542:15): [True: 0, False: 334]
  ------------------
 5543|      0|            break;
 5544|      0|          }
 5545|  1.14k|          while (left + 2 < right) {
  ------------------
  |  Branch (5545:18): [True: 814, False: 334]
  ------------------
 5546|    814|            int middle = left + (((right - left) >> 1) & ~1);
 5547|    814|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5547:17): [True: 462, False: 352]
  ------------------
 5548|    814|                input[input_count + 1]) {
 5549|    462|              left = middle;
 5550|    462|            }
 5551|    814|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5551:17): [True: 360, False: 454]
  ------------------
 5552|    814|                input[input_count + 1]) {
 5553|    360|              right = middle;
 5554|    360|            }
 5555|    814|          }
 5556|    334|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5556:15): [True: 334, False: 0]
  ------------------
 5557|    334|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5557:15): [True: 18, False: 316]
  ------------------
 5558|    334|                  input[input_count + 1]) {
 5559|     18|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5560|     18|            input[initial_composition_count] = composed;
 5561|     18|            composition =
 5562|     18|                composition_block_row(composition_index[composed >> 8]) +
 5563|     18|                (composed % 256);
 5564|     18|            continue;
 5565|     18|          }
 5566|    334|        }
 5567|       |
 5568|  1.08k|        if (ccc == 0) {
  ------------------
  |  Branch (5568:13): [True: 454, False: 628]
  ------------------
 5569|    454|          break;
 5570|    454|        }
 5571|    628|        previous_ccc = ccc;
 5572|    628|        input[++composition_count] = input[input_count + 1];
 5573|    628|      }
 5574|    498|    }
 5575|    498|  }
 5576|       |
 5577|     44|  if (composition_count < input_count) {
  ------------------
  |  Branch (5577:7): [True: 16, False: 28]
  ------------------
 5578|     16|    input.resize(composition_count);
 5579|     16|  }
 5580|     44|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5582|     44|bool normalize(std::u32string& input) {
 5583|       |  /**
 5584|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5585|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5586|       |   */
 5587|     44|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5587:7): [True: 0, False: 44]
  |  Branch (5587:27): [True: 0, False: 44]
  ------------------
 5588|     44|      composition_index == nullptr) {
  ------------------
  |  Branch (5588:7): [True: 0, False: 44]
  ------------------
 5589|      0|    return false;
 5590|      0|  }
 5591|     44|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5591:7): [True: 0, False: 44]
  ------------------
 5592|      0|    return true;
 5593|      0|  }
 5594|     44|  decompose_nfc(input);
 5595|     44|  compose(input);
 5596|     44|  return true;
 5597|     44|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5657|  1.34k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5658|  1.34k|  int32_t written_out{0};
 5659|  1.34k|  out.reserve(out.size() + input.size());
 5660|  1.34k|  uint32_t n = initial_n;
 5661|  1.34k|  int32_t i = 0;
 5662|  1.34k|  int32_t bias = initial_bias;
 5663|       |  // grab ascii content
 5664|  1.34k|  size_t end_of_ascii = input.find_last_of('-');
 5665|  1.34k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5665:7): [True: 524, False: 824]
  ------------------
 5666|  4.73k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5666:20): [True: 4.73k, False: 524]
  ------------------
 5667|  4.73k|      if (c >= 0x80) {
  ------------------
  |  Branch (5667:11): [True: 0, False: 4.73k]
  ------------------
 5668|      0|        return false;
 5669|      0|      }
 5670|  4.73k|      out.push_back(c);
 5671|  4.73k|      written_out++;
 5672|  4.73k|    }
 5673|    524|    input.remove_prefix(end_of_ascii + 1);
 5674|    524|  }
 5675|  13.9k|  while (!input.empty()) {
  ------------------
  |  Branch (5675:10): [True: 12.6k, False: 1.28k]
  ------------------
 5676|  12.6k|    int32_t oldi = i;
 5677|  12.6k|    int32_t w = 1;
 5678|  19.0k|    for (int32_t k = base;; k += base) {
 5679|  19.0k|      if (input.empty()) {
  ------------------
  |  Branch (5679:11): [True: 32, False: 18.9k]
  ------------------
 5680|     32|        return false;
 5681|     32|      }
 5682|  18.9k|      uint8_t code_point = input.front();
 5683|  18.9k|      input.remove_prefix(1);
 5684|  18.9k|      int32_t digit = char_to_digit_value(code_point);
 5685|  18.9k|      if (digit < 0) {
  ------------------
  |  Branch (5685:11): [True: 24, False: 18.9k]
  ------------------
 5686|     24|        return false;
 5687|     24|      }
 5688|  18.9k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5688:11): [True: 6, False: 18.9k]
  ------------------
 5689|      6|        return false;
 5690|      6|      }
 5691|  18.9k|      i = i + digit * w;
 5692|  18.9k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5692:19): [True: 4.16k, False: 14.7k]
  |  Branch (5692:38): [True: 12.9k, False: 1.84k]
  ------------------
 5693|  18.9k|      if (digit < t) {
  ------------------
  |  Branch (5693:11): [True: 12.6k, False: 6.30k]
  ------------------
 5694|  12.6k|        break;
 5695|  12.6k|      }
 5696|  6.30k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5696:11): [True: 0, False: 6.30k]
  ------------------
 5697|      0|        return false;
 5698|      0|      }
 5699|  6.30k|      w = w * (base - t);
 5700|  6.30k|    }
 5701|  12.6k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5702|  12.6k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5702:9): [True: 2, False: 12.6k]
  ------------------
 5703|      2|      return false;
 5704|      2|    }
 5705|  12.6k|    n = n + i / (written_out + 1);
 5706|  12.6k|    i = i % (written_out + 1);
 5707|  12.6k|    if (n < 0x80) {
  ------------------
  |  Branch (5707:9): [True: 0, False: 12.6k]
  ------------------
 5708|      0|      return false;
 5709|      0|    }
 5710|  12.6k|    out.insert(out.begin() + i, n);
 5711|  12.6k|    written_out++;
 5712|  12.6k|    ++i;
 5713|  12.6k|  }
 5714|       |  // See https://github.com/whatwg/url/issues/803
 5715|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5716|  1.28k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5716:7): [True: 848, False: 436]
  |  Branch (5716:26): [True: 68, False: 780]
  |  Branch (5716:44): [True: 30, False: 38]
  |  Branch (5716:62): [True: 24, False: 6]
  ------------------
 5717|     24|      out[3] == U'-') {
  ------------------
  |  Branch (5717:7): [True: 2, False: 22]
  ------------------
 5718|      2|    return false;
 5719|      2|  }
 5720|  1.28k|  return true;
 5721|  1.28k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5801|  2.27k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5802|  2.27k|  out.reserve(input.size() + out.size());
 5803|  2.27k|  uint32_t n = initial_n;
 5804|  2.27k|  int32_t d = 0;
 5805|  2.27k|  int32_t bias = initial_bias;
 5806|  2.27k|  size_t h = 0;
 5807|       |  // first push the ascii content
 5808|  33.6k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5808:19): [True: 33.6k, False: 2.27k]
  ------------------
 5809|  33.6k|    if (c < 0x80) {
  ------------------
  |  Branch (5809:9): [True: 29.5k, False: 4.09k]
  ------------------
 5810|  29.5k|      ++h;
 5811|  29.5k|      out.push_back(char(c));
 5812|  29.5k|    }
 5813|  33.6k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5813:9): [True: 0, False: 33.6k]
  |  Branch (5813:26): [True: 354, False: 33.2k]
  |  Branch (5813:41): [True: 0, False: 354]
  ------------------
 5814|      0|      return false;
 5815|      0|    }
 5816|  33.6k|  }
 5817|  2.27k|  size_t b = h;
 5818|  2.27k|  if (b > 0) {
  ------------------
  |  Branch (5818:7): [True: 1.59k, False: 680]
  ------------------
 5819|  1.59k|    out.push_back('-');
 5820|  1.59k|  }
 5821|  5.12k|  while (h < input.size()) {
  ------------------
  |  Branch (5821:10): [True: 2.85k, False: 2.27k]
  ------------------
 5822|  2.85k|    uint32_t m = 0x10FFFF;
 5823|  51.8k|    for (auto code_point : input) {
  ------------------
  |  Branch (5823:26): [True: 51.8k, False: 2.85k]
  ------------------
 5824|  51.8k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5824:11): [True: 6.07k, False: 45.7k]
  |  Branch (5824:30): [True: 3.11k, False: 2.96k]
  ------------------
 5825|  51.8k|    }
 5826|       |
 5827|  2.85k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5827:9): [True: 0, False: 2.85k]
  ------------------
 5828|      0|      return false;
 5829|      0|    }
 5830|  2.85k|    d = d + int32_t((m - n) * (h + 1));
 5831|  2.85k|    n = m;
 5832|  51.8k|    for (auto c : input) {
  ------------------
  |  Branch (5832:17): [True: 51.8k, False: 2.85k]
  ------------------
 5833|  51.8k|      if (c < n) {
  ------------------
  |  Branch (5833:11): [True: 45.7k, False: 6.07k]
  ------------------
 5834|  45.7k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5834:13): [True: 0, False: 45.7k]
  ------------------
 5835|      0|          return false;
 5836|      0|        }
 5837|  45.7k|        ++d;
 5838|  45.7k|      }
 5839|  51.8k|      if (c == n) {
  ------------------
  |  Branch (5839:11): [True: 4.09k, False: 47.7k]
  ------------------
 5840|  4.09k|        int32_t q = d;
 5841|  11.1k|        for (int32_t k = base;; k += base) {
 5842|  11.1k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5842:23): [True: 4.88k, False: 6.29k]
  |  Branch (5842:42): [True: 5.88k, False: 410]
  ------------------
 5843|       |
 5844|  11.1k|          if (q < t) {
  ------------------
  |  Branch (5844:15): [True: 4.09k, False: 7.08k]
  ------------------
 5845|  4.09k|            break;
 5846|  4.09k|          }
 5847|  7.08k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5848|  7.08k|          q = (q - t) / (base - t);
 5849|  7.08k|        }
 5850|  4.09k|        out.push_back(digit_to_char(q));
 5851|  4.09k|        bias = adapt(d, int32_t(h + 1), h == b);
 5852|  4.09k|        d = 0;
 5853|  4.09k|        ++h;
 5854|  4.09k|      }
 5855|  51.8k|    }
 5856|  2.85k|    ++d;
 5857|  2.85k|    ++n;
 5858|  2.85k|  }
 5859|  2.27k|  return true;
 5860|  2.27k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  3.73k|bool is_label_valid(const std::u32string_view label) {
 5945|  3.73k|  if (label.empty()) {
  ------------------
  |  Branch (5945:7): [True: 0, False: 3.73k]
  ------------------
 5946|      0|    return true;
 5947|      0|  }
 5948|  3.73k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5948:7): [True: 0, False: 3.73k]
  |  Branch (5948:27): [True: 0, False: 3.73k]
  |  Branch (5948:58): [True: 0, False: 3.73k]
  ------------------
 5949|  3.73k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5949:7): [True: 0, False: 3.73k]
  |  Branch (5949:31): [True: 0, False: 3.73k]
  ------------------
 5950|      0|    return false;
 5951|      0|  }
 5952|       |
 5953|       |  ///////////////
 5954|       |  // We have a normalization step which ensures that we are in NFC.
 5955|       |  // If we receive punycode, we normalize and check that the normalized
 5956|       |  // version matches the original.
 5957|       |  // --------------------------------------
 5958|       |  // The label must be in Unicode Normalization Form NFC.
 5959|       |
 5960|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5961|       |  // ---------------------------------------
 5962|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5963|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5964|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5965|       |
 5966|       |  // This is not necessary because we segment the
 5967|       |  // labels by '.'.
 5968|       |  // ---------------------------------------
 5969|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5970|       |  // if (label.find('.') != std::string_view::npos) return false;
 5971|       |
 5972|       |  // The label must not begin with a combining mark.
 5973|       |  // Range membership via lower_bound on range end.
 5974|  3.73k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5975|  3.73k|                                               combining_range_count};
 5976|  3.73k|  const auto comb_it = std::ranges::lower_bound(
 5977|  3.73k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5978|  3.73k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5978:7): [True: 3.73k, False: 0]
  |  Branch (5978:7): [True: 36, False: 3.69k]
  |  Branch (5978:37): [True: 36, False: 3.69k]
  ------------------
 5979|     36|    return false;
 5980|     36|  }
 5981|       |  // We verify this next step as part of the mapping:
 5982|       |  // ---------------------------------------------
 5983|       |  // Each code point in the label must only have certain status values
 5984|       |  // according to Section 5, IDNA Mapping Table:
 5985|       |  // - For Transitional Processing, each value must be valid.
 5986|       |  // - For Nontransitional Processing, each value must be either valid or
 5987|       |  // deviation.
 5988|       |
 5989|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 5990|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 5991|       |  // Applications (IDNA) [IDNA2008].
 5992|  3.69k|  constexpr static uint32_t virama[] = {
 5993|  3.69k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 5994|  3.69k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 5995|  3.69k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 5996|  3.69k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 5997|  3.69k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 5998|  3.69k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 5999|  3.69k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6000|  3.69k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6001|  3.69k|  constexpr static uint32_t R[] = {
 6002|  3.69k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6003|  3.69k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6004|  3.69k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6005|  3.69k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6006|  3.69k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6007|  3.69k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6008|  3.69k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6009|  3.69k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6010|  3.69k|  constexpr static uint32_t L[] = {0xa872};
 6011|  3.69k|  constexpr static uint32_t D[] = {
 6012|  3.69k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6013|  3.69k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6014|  3.69k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6015|  3.69k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6016|  3.69k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6017|  3.69k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6018|  3.69k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6019|  3.69k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6020|  3.69k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6021|  3.69k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6022|  3.69k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6023|  3.69k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6024|  3.69k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6025|  3.69k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6026|  3.69k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6027|  3.69k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6028|  3.69k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6029|  3.69k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6030|  3.69k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6031|  3.69k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6032|  3.69k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6033|  3.69k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6034|  3.69k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6035|  3.69k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6036|  3.69k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6037|  3.69k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6038|  3.69k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6039|  3.69k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6040|  3.69k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6041|  3.69k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6042|  3.69k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6043|  3.69k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6044|  3.69k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6045|  3.69k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6046|  3.69k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6047|  3.69k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6048|  3.69k|      0xa870, 0xa871};
 6049|       |
 6050|  56.2k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6050:22): [True: 52.5k, False: 3.62k]
  ------------------
 6051|  52.5k|    uint32_t c = label[i];
 6052|  52.5k|    if (c == 0x200c) {
  ------------------
  |  Branch (6052:9): [True: 70, False: 52.5k]
  ------------------
 6053|     70|      if (i > 0) {
  ------------------
  |  Branch (6053:11): [True: 70, False: 0]
  ------------------
 6054|     70|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6054:13): [True: 0, False: 70]
  ------------------
 6055|      0|          return true;
 6056|      0|        }
 6057|     70|      }
 6058|     70|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6058:11): [True: 0, False: 70]
  |  Branch (6058:23): [True: 6, False: 64]
  ------------------
 6059|      6|        return false;
 6060|      6|      }
 6061|       |      // we go backward looking for L or D
 6062|     64|      auto is_l_or_d = [](uint32_t code) {
 6063|     64|        return std::ranges::binary_search(L, code) ||
 6064|     64|               std::ranges::binary_search(D, code);
 6065|     64|      };
 6066|     64|      auto is_r_or_d = [](uint32_t code) {
 6067|     64|        return std::ranges::binary_search(R, code) ||
 6068|     64|               std::ranges::binary_search(D, code);
 6069|     64|      };
 6070|     64|      std::u32string_view before = label.substr(0, i);
 6071|     64|      std::u32string_view after = label.substr(i + 1);
 6072|     64|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6072:14): [True: 44, False: 20]
  ------------------
 6073|     64|              before.end()) &&
 6074|     44|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6074:14): [True: 26, False: 18]
  ------------------
 6075|     44|              after.end());
 6076|  52.5k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6076:16): [True: 4, False: 52.5k]
  ------------------
 6077|      4|      if (i > 0) {
  ------------------
  |  Branch (6077:11): [True: 4, False: 0]
  ------------------
 6078|      4|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6078:13): [True: 0, False: 4]
  ------------------
 6079|      0|          return true;
 6080|      0|        }
 6081|      4|      }
 6082|      4|      return false;
 6083|      4|    }
 6084|  52.5k|  }
 6085|       |
 6086|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6087|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6088|       |  // Section 2.
 6089|       |
 6090|       |  // The following rule, consisting of six conditions, applies to labels
 6091|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6092|       |  // described in Section 3.  All of the conditions must be satisfied for
 6093|       |  // the rule to be satisfied.
 6094|       |  //
 6095|       |  //  1.  The first character must be a character with Bidi property L, R,
 6096|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6097|       |  //     has the L property, it is an LTR label.
 6098|       |  //
 6099|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6100|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6101|       |  //
 6102|       |  //   3.  In an RTL label, the end of the label must be a character with
 6103|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6104|       |  //       characters with Bidi property NSM.
 6105|       |  //
 6106|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6107|       |  //       vice versa.
 6108|       |  //
 6109|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6110|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6111|       |  //
 6112|       |  //   6.  In an LTR label, the end of the label must be a character with
 6113|       |  //       Bidi property L or EN, followed by zero or more characters with
 6114|       |  //       Bidi property NSM.
 6115|       |
 6116|  3.62k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6117|  3.62k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6117:7): [True: 0, False: 3.62k]
  ------------------
 6118|      0|    return false;
 6119|      0|  }
 6120|       |
 6121|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6122|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6123|       |  // domain names.
 6124|  3.62k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6124:7): [True: 894, False: 2.73k]
  ------------------
 6125|       |    // The first character must be a character with Bidi property L, R,
 6126|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6127|       |    // has the L property, it is an LTR label.
 6128|       |
 6129|    894|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6129:9): [True: 178, False: 716]
  ------------------
 6130|       |      // Eval as LTR
 6131|       |
 6132|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6133|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6134|  5.63k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6134:26): [True: 5.63k, False: 0]
  ------------------
 6135|  5.63k|        const direction d = find_direction(label[i]);
 6136|  5.63k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6136:15): [True: 2.00k, False: 3.63k]
  |  Branch (6136:36): [True: 730, False: 2.90k]
  |  Branch (6136:58): [True: 122, False: 2.77k]
  ------------------
 6137|  2.77k|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6137:15): [True: 288, False: 2.49k]
  |  Branch (6137:37): [True: 380, False: 2.11k]
  |  Branch (6137:59): [True: 596, False: 1.51k]
  ------------------
 6138|  1.51k|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6138:15): [True: 1.30k, False: 212]
  |  Branch (6138:37): [True: 34, False: 178]
  ------------------
 6139|    178|          return false;
 6140|    178|        }
 6141|  5.63k|      }
 6142|       |
 6143|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6144|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6144:13): [True: 0, False: 0]
  |  Branch (6144:41): [True: 0, False: 0]
  ------------------
 6145|      0|        return false;
 6146|      0|      }
 6147|       |
 6148|      0|      return true;
 6149|       |
 6150|    716|    } else {
 6151|       |      // Eval as RTL
 6152|       |
 6153|       |      // The first character must be R or AL; a leading AN (or any other
 6154|       |      // direction) does not start a valid RTL label.
 6155|    716|      const direction first_dir = find_direction(label[0]);
 6156|    716|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6156:11): [True: 428, False: 288]
  |  Branch (6156:40): [True: 18, False: 410]
  ------------------
 6157|     18|        return false;
 6158|     18|      }
 6159|       |
 6160|    698|      bool has_an = false;
 6161|    698|      bool has_en = false;
 6162|  4.22k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6162:26): [True: 3.64k, False: 582]
  ------------------
 6163|  3.64k|        const direction d = find_direction(label[i]);
 6164|       |
 6165|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6166|       |        // versa.
 6167|  3.64k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6167:14): [True: 720, False: 2.92k]
  |  Branch (6167:37): [True: 720, False: 0]
  |  Branch (6167:56): [True: 6, False: 714]
  ------------------
 6168|  3.63k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6168:14): [True: 42, False: 3.59k]
  |  Branch (6168:37): [True: 42, False: 0]
  |  Branch (6168:56): [True: 0, False: 42]
  ------------------
 6169|      6|          return false;
 6170|      6|        }
 6171|       |
 6172|  3.63k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6172:15): [True: 506, False: 3.13k]
  |  Branch (6172:36): [True: 794, False: 2.33k]
  |  Branch (6172:58): [True: 42, False: 2.29k]
  ------------------
 6173|  2.29k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6173:15): [True: 714, False: 1.58k]
  |  Branch (6173:37): [True: 92, False: 1.48k]
  |  Branch (6173:59): [True: 120, False: 1.36k]
  ------------------
 6174|  1.36k|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6174:15): [True: 356, False: 1.01k]
  |  Branch (6174:37): [True: 148, False: 864]
  |  Branch (6174:59): [True: 596, False: 268]
  ------------------
 6175|    268|              d == direction::NSM)) {
  ------------------
  |  Branch (6175:15): [True: 208, False: 60]
  ------------------
 6176|     60|          return false;
 6177|     60|        }
 6178|       |
 6179|  3.57k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6179:13): [True: 632, False: 2.94k]
  ------------------
 6180|    632|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6180:15): [True: 174, False: 458]
  |  Branch (6180:36): [True: 294, False: 164]
  |  Branch (6180:58): [True: 4, False: 160]
  ------------------
 6181|    160|              d == direction::EN)) {
  ------------------
  |  Branch (6181:15): [True: 110, False: 50]
  ------------------
 6182|     50|          return false;
 6183|     50|        }
 6184|  3.57k|      }
 6185|       |
 6186|    582|      return true;
 6187|    698|    }
 6188|    894|  }
 6189|       |
 6190|  2.73k|  return true;
 6191|  3.62k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6348|  49.3k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6349|  49.3k|  out.clear();
 6350|  49.3k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6350:7): [True: 0, False: 49.3k]
  ------------------
 6351|      0|    return false;
 6352|      0|  }
 6353|  49.3k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6353:7): [True: 47.0k, False: 2.29k]
  ------------------
 6354|  47.0k|    from_ascii_to_ascii(ut8_string, out);
 6355|  47.0k|    return true;
 6356|  47.0k|  }
 6357|       |
 6358|       |#ifdef ADA_USE_SIMDUTF
 6359|       |  size_t utf32_length =
 6360|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6361|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6362|       |    return false;
 6363|       |  }
 6364|       |  std::u32string working(utf32_length, U'\0');
 6365|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6366|       |      ut8_string.data(), ut8_string.size(), working.data());
 6367|       |#else
 6368|  2.29k|  size_t utf32_length =
 6369|  2.29k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6370|  2.29k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6370:7): [True: 38, False: 2.25k]
  |  Branch (6370:28): [True: 38, False: 0]
  ------------------
 6371|     38|    return false;
 6372|     38|  }
 6373|  2.25k|  std::u32string working(utf32_length, U'\0');
 6374|  2.25k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6375|  2.25k|      ut8_string.data(), ut8_string.size(), working.data());
 6376|  2.25k|#endif
 6377|  2.25k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6377:7): [True: 518, False: 1.73k]
  |  Branch (6377:35): [True: 0, False: 1.73k]
  ------------------
 6378|    518|    return false;
 6379|    518|  }
 6380|  1.73k|  working.resize(actual_utf32_length);
 6381|       |
 6382|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6383|  1.73k|  std::u32string mapped;
 6384|  1.73k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6384:7): [True: 28, False: 1.70k]
  ------------------
 6385|     28|    return false;
 6386|     28|  }
 6387|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6388|  1.70k|  working.clear();
 6389|       |
 6390|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6391|  1.70k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6391:7): [True: 1.67k, False: 38]
  |  Branch (6391:28): [True: 18, False: 1.65k]
  ------------------
 6392|     18|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6392:9): [True: 0, False: 18]
  ------------------
 6393|      0|      return false;
 6394|      0|    }
 6395|     18|  }
 6396|       |
 6397|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6398|  1.70k|  out.reserve(mapped.size() + 8);
 6399|       |
 6400|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6401|  1.70k|  const char32_t* p = mapped.data();
 6402|  1.70k|  const char32_t* const end = p + mapped.size();
 6403|  1.70k|  std::u32string post_map;
 6404|       |
 6405|  9.42k|  while (p < end) {
  ------------------
  |  Branch (6405:10): [True: 8.37k, False: 1.04k]
  ------------------
 6406|  8.37k|    const char32_t* label_begin = p;
 6407|  95.5k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6407:12): [True: 94.0k, False: 1.46k]
  |  Branch (6407:23): [True: 87.1k, False: 6.91k]
  ------------------
 6408|  87.1k|      ++p;
 6409|  87.1k|    }
 6410|  8.37k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6411|  8.37k|    std::u32string_view label_view(label_begin, label_size);
 6412|  8.37k|    const bool is_last_label = (p == end);
 6413|  8.37k|    if (p < end) {
  ------------------
  |  Branch (6413:9): [True: 6.91k, False: 1.46k]
  ------------------
 6414|  6.91k|      ++p;  // skip dot
 6415|  6.91k|    }
 6416|       |
 6417|  8.37k|    if (label_size == 0) {
  ------------------
  |  Branch (6417:9): [True: 1.57k, False: 6.80k]
  ------------------
 6418|       |      // empty label
 6419|  6.80k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6419:16): [True: 1.36k, False: 5.44k]
  ------------------
 6420|  30.8k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6420:23): [True: 30.8k, False: 1.34k]
  ------------------
 6421|  30.8k|        if (c >= 0x80) {
  ------------------
  |  Branch (6421:13): [True: 12, False: 30.8k]
  ------------------
 6422|     12|          out.clear();
 6423|     12|          return false;
 6424|     12|        }
 6425|  30.8k|      }
 6426|  1.34k|      append_ascii_label(out, label_view);
 6427|  1.34k|      std::string_view puny_segment_ascii(
 6428|  1.34k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6429|  1.34k|      working.clear();
 6430|  1.34k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6430:11): [True: 66, False: 1.28k]
  ------------------
 6431|     66|        out.clear();
 6432|     66|        return false;
 6433|     66|      }
 6434|  1.28k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6434:11): [True: 34, False: 1.24k]
  ------------------
 6435|     34|        out.clear();
 6436|     34|        return false;
 6437|     34|      }
 6438|  1.24k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6438:11): [True: 66, False: 1.18k]
  |  Branch (6438:49): [True: 62, False: 1.12k]
  ------------------
 6439|    128|        out.clear();
 6440|    128|        return false;
 6441|    128|      }
 6442|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6443|  1.12k|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6443:11): [True: 1.12k, False: 0]
  |  Branch (6443:34): [True: 26, False: 1.09k]
  ------------------
 6444|     26|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6444:13): [True: 0, False: 26]
  |  Branch (6444:37): [True: 26, False: 0]
  ------------------
 6445|     26|          out.clear();
 6446|     26|          return false;
 6447|     26|        }
 6448|     26|      }
 6449|  1.09k|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6449:11): [True: 0, False: 1.09k]
  |  Branch (6449:31): [True: 32, False: 1.06k]
  ------------------
 6450|     32|        out.clear();
 6451|     32|        return false;
 6452|     32|      }
 6453|  5.44k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6453:16): [True: 2.80k, False: 2.64k]
  ------------------
 6454|  2.80k|      append_ascii_label(out, label_view);
 6455|  2.80k|    } else {
 6456|  2.64k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6456:11): [True: 364, False: 2.27k]
  ------------------
 6457|    364|        out.clear();
 6458|    364|        return false;
 6459|    364|      }
 6460|  2.27k|      out.append("xn--");
 6461|  2.27k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6461:11): [True: 0, False: 2.27k]
  ------------------
 6462|      0|        out.clear();
 6463|      0|        return false;
 6464|      0|      }
 6465|  2.27k|    }
 6466|  7.71k|    if (!is_last_label) {
  ------------------
  |  Branch (6466:9): [True: 6.74k, False: 970]
  ------------------
 6467|  6.74k|      out.push_back('.');
 6468|  6.74k|    }
 6469|  7.71k|  }
 6470|  1.04k|  return true;
 6471|  1.70k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6473|  49.3k|std::string to_ascii(std::string_view ut8_string) {
 6474|  49.3k|  std::string out;
 6475|  49.3k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6475:7): [True: 1.24k, False: 48.1k]
  ------------------
 6476|  1.24k|    return {};
 6477|  1.24k|  }
 6478|  48.1k|  return out;
 6479|  49.3k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7165|    760|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7166|       |  // next line is for safety only, we expect users to avoid calling
 7167|       |  // percent_decode when first_percent is outside the range.
 7168|    760|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7168:7): [True: 0, False: 760]
  ------------------
 7169|      0|    return std::string(input);
 7170|      0|  }
 7171|    760|  std::string dest;
 7172|    760|  dest.reserve(input.length());
 7173|    760|  dest.append(input.substr(0, first_percent));
 7174|    760|  const char* pointer = input.data() + first_percent;
 7175|    760|  const char* end = input.data() + input.size();
 7176|       |  // Optimization opportunity: if the following code gets
 7177|       |  // called often, it can be optimized quite a bit.
 7178|  31.5k|  while (pointer < end) {
  ------------------
  |  Branch (7178:10): [True: 30.7k, False: 760]
  ------------------
 7179|  30.7k|    const char ch = pointer[0];
 7180|  30.7k|    size_t remaining = end - pointer - 1;
 7181|  30.7k|    if (ch != '%' || remaining < 2 ||
  ------------------
  |  Branch (7181:9): [True: 26.5k, False: 4.23k]
  |  Branch (7181:22): [True: 122, False: 4.11k]
  ------------------
 7182|  4.11k|        (  // ch == '%' && // It is unnecessary to check that ch == '%'.
 7183|  4.11k|            (!is_ascii_hex_digit(pointer[1]) ||
  ------------------
  |  Branch (7183:14): [True: 1.40k, False: 2.71k]
  ------------------
 7184|  28.7k|             !is_ascii_hex_digit(pointer[2])))) {
  ------------------
  |  Branch (7184:14): [True: 664, False: 2.04k]
  ------------------
 7185|  28.7k|      dest += ch;
 7186|  28.7k|      pointer++;
 7187|  28.7k|    } else {
 7188|  2.04k|      unsigned a = convert_hex_to_binary(pointer[1]);
 7189|  2.04k|      unsigned b = convert_hex_to_binary(pointer[2]);
 7190|  2.04k|      char c = static_cast<char>(a * 16 + b);
 7191|  2.04k|      dest += c;
 7192|  2.04k|      pointer += 3;
 7193|  2.04k|    }
 7194|  30.7k|  }
 7195|    760|  return dest;
 7196|    760|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7281|  74.6k|                           const uint8_t character_set[]) {
 7282|  74.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7283|  74.6k|    return character_sets::bit_at(character_set, c);
 7284|  74.6k|  });
 7285|       |  // Optimization: Don't iterate if percent encode is not required
 7286|  74.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7286:7): [True: 71.7k, False: 2.88k]
  ------------------
 7287|  71.7k|    return std::string(input);
 7288|  71.7k|  }
 7289|       |
 7290|  2.88k|  std::string result;
 7291|  2.88k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7292|       |                                   // produce 3 characters.
 7293|  2.88k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7294|       |
 7295|  48.2k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7295:10): [True: 45.3k, False: 2.88k]
  ------------------
 7296|  45.3k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7296:9): [True: 33.4k, False: 11.9k]
  ------------------
 7297|  33.4k|      result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7298|  33.4k|    } else {
 7299|  11.9k|      result += *pointer;
 7300|  11.9k|    }
 7301|  45.3k|  }
 7302|       |
 7303|  2.88k|  return result;
 7304|  74.6k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7342|  49.3k|              size_t first_percent) {
 7343|  49.3k|  std::string percent_decoded_buffer;
 7344|  49.3k|  std::string_view input = plain;
 7345|  49.3k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7345:7): [True: 760, False: 48.6k]
  ------------------
 7346|    760|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7347|    760|    input = percent_decoded_buffer;
 7348|    760|  }
 7349|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7350|  49.3k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7351|  49.3k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7351:7): [True: 1.24k, False: 48.1k]
  |  Branch (7351:29): [True: 754, False: 47.3k]
  ------------------
 7352|  48.1k|                                idna_ascii.data(), idna_ascii.size())) {
 7353|  2.00k|    return false;
 7354|  2.00k|  }
 7355|  47.3k|  out = std::move(idna_ascii);
 7356|  47.3k|  return true;
 7357|  49.3k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7360|     39|                           const uint8_t character_set[], size_t index) {
 7361|     39|  std::string out;
 7362|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7363|     39|  out.append(input.data(), index);
 7364|     39|  auto pointer = input.begin() + index;
 7365|    496|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7365:10): [True: 457, False: 39]
  ------------------
 7366|    457|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7366:9): [True: 228, False: 229]
  ------------------
 7367|    228|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7368|    229|    } else {
 7369|    229|      out += *pointer;
 7370|    229|    }
 7371|    457|  }
 7372|     39|  return out;
 7373|     39|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7437|    338|    size_t& compress_length) noexcept {
 7438|    338|  compress = 0;
 7439|    338|  compress_length = 0;
 7440|    338|  size_t i = 0;
 7441|  1.38k|  while (i < 8) {
  ------------------
  |  Branch (7441:10): [True: 1.04k, False: 338]
  ------------------
 7442|  1.04k|    if (address[i] != 0) {
  ------------------
  |  Branch (7442:9): [True: 668, False: 376]
  ------------------
 7443|    668|      ++i;
 7444|    668|      continue;
 7445|    668|    }
 7446|    376|    size_t next = i + 1;
 7447|  2.03k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7447:12): [True: 1.90k, False: 130]
  |  Branch (7447:24): [True: 1.66k, False: 246]
  ------------------
 7448|  1.66k|      ++next;
 7449|  1.66k|    }
 7450|    376|    const size_t count = next - i;
 7451|    376|    if (count > compress_length) {
  ------------------
  |  Branch (7451:9): [True: 338, False: 38]
  ------------------
 7452|    338|      compress_length = count;
 7453|    338|      compress = i;
 7454|    338|    }
 7455|    376|    i = next;
 7456|    376|  }
 7457|    338|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7459|    338|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7460|    338|  size_t compress = 0;
 7461|    338|  size_t compress_length = 0;
 7462|    338|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7463|       |
 7464|       |  // Skip compression when the longest zero run is a single piece.
 7465|    338|  if (compress_length <= 1) {
  ------------------
  |  Branch (7465:7): [True: 28, False: 310]
  ------------------
 7466|     28|    compress = compress_length = 8;
 7467|     28|  }
 7468|       |
 7469|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7470|    338|  std::string output(4 * 8 + 7 + 2, '\0');
 7471|    338|  char* point = output.data();
 7472|    338|  *point++ = '[';
 7473|    338|  size_t piece_index = 0;
 7474|    870|  while (true) {
  ------------------
  |  Branch (7474:10): [True: 870, Folded]
  ------------------
 7475|    870|    if (piece_index == compress) {
  ------------------
  |  Branch (7475:9): [True: 310, False: 560]
  ------------------
 7476|    310|      *point++ = ':';
 7477|       |      // If we skip a value initially, we need to write '::'.
 7478|    310|      if (piece_index == 0) {
  ------------------
  |  Branch (7478:11): [True: 204, False: 106]
  ------------------
 7479|    204|        *point++ = ':';
 7480|    204|      }
 7481|    310|      piece_index += compress_length;
 7482|    310|      if (piece_index == 8) {
  ------------------
  |  Branch (7482:11): [True: 124, False: 186]
  ------------------
 7483|    124|        break;
 7484|    124|      }
 7485|    310|    }
 7486|    746|    point = write_hex_u16(point, address[piece_index]);
 7487|    746|    ++piece_index;
 7488|    746|    if (piece_index == 8) {
  ------------------
  |  Branch (7488:9): [True: 214, False: 532]
  ------------------
 7489|    214|      break;
 7490|    214|    }
 7491|    532|    *point++ = ':';
 7492|    532|  }
 7493|    338|  *point++ = ']';
 7494|    338|  output.resize(static_cast<size_t>(point - output.data()));
 7495|    338|  return output;
 7496|    338|}
_ZN3ada11serializers4ipv4Em:
 7498|  8.83k|std::string ipv4(const uint64_t address) {
 7499|  8.83k|  std::string output(15, '\0');
 7500|  8.83k|  char* point = output.data();
 7501|  8.83k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7502|  8.83k|  *point++ = '.';
 7503|  8.83k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7504|  8.83k|  *point++ = '.';
 7505|  8.83k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7506|  8.83k|  *point++ = '.';
 7507|  8.83k|  point = write_u8(point, static_cast<uint8_t>(address));
 7508|  8.83k|  output.resize(static_cast<size_t>(point - output.data()));
 7509|  8.83k|  return output;
 7510|  8.83k|}
_ZN3ada5parseINS_3urlEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 7782|   187k|    std::string_view input, const result_type* base_url) {
 7783|   187k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 7784|   187k|  if (!u.is_valid) {
  ------------------
  |  Branch (7784:7): [True: 1.80k, False: 186k]
  ------------------
 7785|  1.80k|    return tl::unexpected(errors::type_error);
 7786|  1.80k|  }
 7787|   186k|  return u;
 7788|   187k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 7782|   187k|    std::string_view input, const result_type* base_url) {
 7783|   187k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 7784|   187k|  if (!u.is_valid) {
  ------------------
  |  Branch (7784:7): [True: 1.80k, False: 186k]
  ------------------
 7785|  1.80k|    return tl::unexpected(errors::type_error);
 7786|  1.80k|  }
 7787|   186k|  return u;
 7788|   187k|}
_ZN3ada20get_max_input_lengthEv:
 7531|   499k|uint32_t get_max_input_length() {
 7532|   499k|  return max_input_length_.load(std::memory_order_relaxed);
 7533|   499k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8724|   168k|void trim_c0_whitespace(std::string_view& input) noexcept {
 8725|   169k|  while (!input.empty() &&
  ------------------
  |  Branch (8725:10): [True: 169k, False: 0]
  ------------------
 8726|   169k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (8726:10): [True: 352, False: 168k]
  ------------------
 8727|    352|    input.remove_prefix(1);
 8728|    352|  }
 8729|   172k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (8729:10): [True: 172k, False: 0]
  |  Branch (8729:28): [True: 3.74k, False: 168k]
  ------------------
 8730|  3.74k|    input.remove_suffix(1);
 8731|  3.74k|  }
 8732|   168k|}
_ZN3ada3url17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9176|    449|bool url::parse_opaque_host(std::string_view input) {
 9177|    449|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
 9178|    449|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (9178:7): [True: 29, False: 420]
  ------------------
 9179|     29|    return is_valid = false;
 9180|     29|  }
 9181|       |
 9182|       |  // Return the result of running UTF-8 percent-encode on input using the C0
 9183|       |  // control percent-encode set.
 9184|    420|  host = ada::unicode::percent_encode(
 9185|    420|      input, ada::character_sets::C0_CONTROL_PERCENT_ENCODE);
 9186|    420|  return true;
 9187|    449|}
_ZN3ada3url10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9189|  4.67k|bool url::parse_ipv4(std::string_view input) {
 9190|  4.67k|  ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
 9191|  4.67k|  if (input.empty()) {
  ------------------
  |  Branch (9191:7): [True: 0, False: 4.67k]
  ------------------
 9192|      0|    return is_valid = false;
 9193|      0|  }
 9194|  4.67k|  std::string_view original_input = input;
 9195|  4.67k|  if (original_input.back() == '.') {
  ------------------
  |  Branch (9195:7): [True: 60, False: 4.61k]
  ------------------
 9196|     60|    original_input.remove_suffix(1);
 9197|     60|  }
 9198|  4.67k|  if (input.back() == '.') {
  ------------------
  |  Branch (9198:7): [True: 60, False: 4.61k]
  ------------------
 9199|     60|    input.remove_suffix(1);
 9200|     60|    if (input.empty()) {
  ------------------
  |  Branch (9200:9): [True: 0, False: 60]
  ------------------
 9201|      0|      return is_valid = false;
 9202|      0|    }
 9203|     60|  }
 9204|       |
 9205|  4.67k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
 9206|  4.67k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (9206:7): [True: 4, False: 4.67k]
  ------------------
 9207|      4|    host = original_input;
 9208|      4|    host_type = IPV4;
 9209|      4|    return true;
 9210|      4|  }
 9211|       |
 9212|  4.67k|  const char* p = input.data();
 9213|  4.67k|  const char* end = p + input.size();
 9214|  4.67k|  uint64_t ipv4 = 0;
 9215|  4.67k|  int digit_count = 0;
 9216|  4.67k|  int pure_decimal_count = 0;
 9217|       |
 9218|  8.81k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (9218:10): [True: 8.79k, False: 24]
  |  Branch (9218:29): [True: 8.79k, False: 0]
  ------------------
 9219|  8.79k|    uint64_t segment = 0;
 9220|  8.79k|    bool pure = false;
 9221|  8.79k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (9221:9): [True: 192, False: 8.60k]
  ------------------
 9222|    192|      return is_valid = false;
 9223|    192|    }
 9224|  8.60k|    if (pure) {
  ------------------
  |  Branch (9224:9): [True: 4.62k, False: 3.97k]
  ------------------
 9225|  4.62k|      ++pure_decimal_count;
 9226|  4.62k|    }
 9227|  8.60k|    if (p >= end) {
  ------------------
  |  Branch (9227:9): [True: 4.42k, False: 4.17k]
  ------------------
 9228|  4.42k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
 9229|  4.42k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (9229:11): [True: 14, False: 4.41k]
  ------------------
 9230|     14|        return is_valid = false;
 9231|     14|      }
 9232|  4.41k|      ipv4 = (ipv4 << shift) | segment;
 9233|  4.41k|      host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9233:14): [True: 0, False: 4.41k]
  ------------------
 9234|  4.41k|                                       : ada::serializers::ipv4(ipv4);
 9235|  4.41k|      host_type = IPV4;
 9236|  4.41k|      return true;
 9237|  4.42k|    }
 9238|  4.17k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (9238:9): [True: 30, False: 4.14k]
  |  Branch (9238:26): [True: 0, False: 4.14k]
  ------------------
 9239|     30|      return is_valid = false;
 9240|     30|    }
 9241|  4.14k|    ipv4 = (ipv4 << 8) | segment;
 9242|  4.14k|    ++p;
 9243|  4.14k|  }
 9244|     24|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (9244:7): [True: 0, False: 24]
  |  Branch (9244:27): [True: 24, False: 0]
  ------------------
 9245|     24|    return is_valid = false;
 9246|     24|  }
 9247|      0|  host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9247:10): [True: 0, False: 0]
  ------------------
 9248|      0|                                   : ada::serializers::ipv4(ipv4);
 9249|      0|  host_type = IPV4;
 9250|      0|  return true;
 9251|     24|}
_ZN3ada3url10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9253|    244|bool url::parse_ipv6(std::string_view input) {
 9254|    244|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
 9255|    244|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (9255:7): [True: 3, False: 241]
  |  Branch (9255:24): [True: 4, False: 237]
  ------------------
 9256|      7|    return is_valid = false;
 9257|      7|  }
 9258|       |#if defined(ADA_AVX512)
 9259|       |  // One masked load classifies colon/dot shape; rejects impossible inputs
 9260|       |  // before the piece parser (free on AVX-512BW+VL builds).
 9261|       |  if (!detail::ipv6_structure_plausible(input.data(), input.size()))
 9262|       |      [[unlikely]] {
 9263|       |    return is_valid = false;
 9264|       |  }
 9265|       |#endif
 9266|       |
 9267|    237|  std::array<uint16_t, 8> address{};
 9268|    237|  const char* pointer = input.data();
 9269|    237|  const char* const end = pointer + input.size();
 9270|    237|  int piece_index = 0;
 9271|    237|  int compress = -1;
 9272|       |
 9273|    237|  if (*pointer == ':') {
  ------------------
  |  Branch (9273:7): [True: 114, False: 123]
  ------------------
 9274|    114|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (9274:9): [True: 3, False: 111]
  |  Branch (9274:30): [True: 4, False: 107]
  ------------------
 9275|      7|      return is_valid = false;
 9276|      7|    }
 9277|    107|    pointer += 2;
 9278|    107|    compress = ++piece_index;
 9279|    107|  }
 9280|       |
 9281|    697|  while (pointer != end) {
  ------------------
  |  Branch (9281:10): [True: 523, False: 174]
  ------------------
 9282|    523|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (9282:9): [True: 1, False: 522]
  ------------------
 9283|      1|      return is_valid = false;
 9284|      1|    }
 9285|    522|    if (*pointer == ':') {
  ------------------
  |  Branch (9285:9): [True: 58, False: 464]
  ------------------
 9286|     58|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (9286:11): [True: 1, False: 57]
  ------------------
 9287|      1|        return is_valid = false;
 9288|      1|      }
 9289|     57|      ++pointer;
 9290|     57|      compress = ++piece_index;
 9291|     57|      continue;
 9292|     58|    }
 9293|       |
 9294|    464|    uint16_t value = 0;
 9295|    464|    const int length = detail::parse_hex_piece(pointer, end, value);
 9296|       |
 9297|    464|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (9297:9): [True: 346, False: 118]
  |  Branch (9297:27): [True: 23, False: 323]
  ------------------
 9298|     23|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9298:11): [True: 3, False: 20]
  ------------------
 9299|      3|        return is_valid = false;
 9300|      3|      }
 9301|     20|      pointer -= length;
 9302|     20|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (9302:11): [True: 1, False: 19]
  ------------------
 9303|      1|        return is_valid = false;
 9304|      1|      }
 9305|       |
 9306|     19|      int numbers_seen = 0;
 9307|     57|      while (pointer != end) {
  ------------------
  |  Branch (9307:14): [True: 54, False: 3]
  ------------------
 9308|     54|        int ipv4_piece = -1;
 9309|     54|        if (numbers_seen > 0) {
  ------------------
  |  Branch (9309:13): [True: 35, False: 19]
  ------------------
 9310|     35|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (9310:15): [True: 27, False: 8]
  |  Branch (9310:34): [True: 25, False: 2]
  ------------------
 9311|     25|            ++pointer;
 9312|     25|          } else {
 9313|     10|            return is_valid = false;
 9314|     10|          }
 9315|     35|        }
 9316|     44|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (9316:13): [True: 2, False: 42]
  |  Branch (9316:31): [True: 2, False: 40]
  |  Branch (9316:49): [True: 1, False: 39]
  ------------------
 9317|      5|          return is_valid = false;
 9318|      5|        }
 9319|     39|        ipv4_piece = *pointer - '0';
 9320|     39|        ++pointer;
 9321|     39|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9321:13): [True: 38, False: 1]
  |  Branch (9321:31): [True: 27, False: 11]
  |  Branch (9321:50): [True: 27, False: 0]
  ------------------
 9322|     27|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (9322:15): [True: 1, False: 26]
  ------------------
 9323|      1|            return is_valid = false;
 9324|      1|          }
 9325|     26|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9326|     26|          ++pointer;
 9327|     26|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9327:15): [True: 25, False: 1]
  |  Branch (9327:33): [True: 16, False: 9]
  |  Branch (9327:52): [True: 15, False: 1]
  ------------------
 9328|     15|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9329|     15|            ++pointer;
 9330|     15|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (9330:17): [True: 0, False: 15]
  ------------------
 9331|      0|              return is_valid = false;
 9332|      0|            }
 9333|     15|          }
 9334|     26|        }
 9335|     38|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
 9336|     38|            address[static_cast<size_t>(piece_index)] * 0x100 +
 9337|     38|            static_cast<uint16_t>(ipv4_piece));
 9338|     38|        ++numbers_seen;
 9339|     38|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (9339:13): [True: 11, False: 27]
  |  Branch (9339:34): [True: 4, False: 23]
  ------------------
 9340|     15|          ++piece_index;
 9341|     15|        }
 9342|     38|      }
 9343|      3|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (9343:11): [True: 2, False: 1]
  ------------------
 9344|      2|        return is_valid = false;
 9345|      2|      }
 9346|      1|      break;
 9347|      3|    }
 9348|       |
 9349|    441|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9349:9): [True: 25, False: 416]
  ------------------
 9350|     25|      return is_valid = false;
 9351|     25|    }
 9352|       |
 9353|    416|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (9353:9): [True: 298, False: 118]
  |  Branch (9353:27): [True: 294, False: 4]
  ------------------
 9354|    294|      ++pointer;
 9355|    294|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (9355:11): [True: 2, False: 292]
  ------------------
 9356|      2|        return is_valid = false;
 9357|      2|      }
 9358|    294|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (9358:16): [True: 4, False: 118]
  ------------------
 9359|      4|      return is_valid = false;
 9360|      4|    }
 9361|       |
 9362|    410|    address[static_cast<size_t>(piece_index)] = value;
 9363|    410|    ++piece_index;
 9364|    410|  }
 9365|       |
 9366|    175|  if (compress != -1) {
  ------------------
  |  Branch (9366:7): [True: 157, False: 18]
  ------------------
 9367|    157|    const int right = piece_index - compress;
 9368|    157|    if (right > 0) {
  ------------------
  |  Branch (9368:9): [True: 101, False: 56]
  ------------------
 9369|    101|      const size_t dest = static_cast<size_t>(8 - right);
 9370|    101|      const size_t src = static_cast<size_t>(compress);
 9371|    101|      if (dest != src) {
  ------------------
  |  Branch (9371:11): [True: 97, False: 4]
  ------------------
 9372|    270|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (9372:53): [True: 173, False: 97]
  ------------------
 9373|    173|          address[dest + i] = address[src + i];
 9374|    173|          address[src + i] = 0;
 9375|    173|        }
 9376|     97|      }
 9377|    101|    }
 9378|    157|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (9378:14): [True: 6, False: 12]
  ------------------
 9379|      6|    return is_valid = false;
 9380|      6|  }
 9381|       |
 9382|    169|  host = ada::serializers::ipv6(address);
 9383|    169|  ada_log("parse_ipv6 ", *host);
 9384|    169|  host_type = IPV6;
 9385|    169|  return true;
 9386|    175|}
_ZNK3ada3url12get_protocolEv:
 9697|  62.0k|[[nodiscard]] std::string url::get_protocol() const {
 9698|  62.0k|  if (is_special()) {
  ------------------
  |  Branch (9698:7): [True: 61.7k, False: 312]
  ------------------
 9699|  61.7k|    return helpers::concat(ada::scheme::details::is_special_list[type], ":");
 9700|  61.7k|  }
 9701|       |  // We only move the 'scheme' if it is non-special.
 9702|    312|  return helpers::concat(non_special_scheme, ":");
 9703|  62.0k|}
_ZNK3ada3url8get_hostEv:
 9705|  62.0k|[[nodiscard]] std::string url::get_host() const {
 9706|       |  // If url's host is null, then return the empty string.
 9707|       |  // If url's port is null, return url's host, serialized.
 9708|       |  // Return url's host, serialized, followed by U+003A (:) and url's port,
 9709|       |  // serialized.
 9710|  62.0k|  if (!host.has_value()) {
  ------------------
  |  Branch (9710:7): [True: 155, False: 61.8k]
  ------------------
 9711|    155|    return "";
 9712|    155|  }
 9713|  61.8k|  if (port.has_value()) {
  ------------------
  |  Branch (9713:7): [True: 4.11k, False: 57.7k]
  ------------------
 9714|  4.11k|    return host.value() + ":" + get_port();
 9715|  4.11k|  }
 9716|  57.7k|  return host.value();
 9717|  61.8k|}
_ZNK3ada3url12get_hostnameEv:
 9719|  62.0k|[[nodiscard]] std::string url::get_hostname() const {
 9720|  62.0k|  return host.value_or("");
 9721|  62.0k|}
_ZNK3ada3url10get_searchEv:
 9723|  62.0k|[[nodiscard]] std::string url::get_search() const {
 9724|       |  // If this's URL's query is either null or the empty string, then return the
 9725|       |  // empty string. Return U+003F (?), followed by this's URL's query.
 9726|  62.0k|  return (!query.has_value() || (query->empty())) ? "" : "?" + query.value();
  ------------------
  |  Branch (9726:11): [True: 49.0k, False: 12.9k]
  |  Branch (9726:33): [True: 393, False: 12.5k]
  ------------------
 9727|  62.0k|}
_ZNK3ada3url12get_usernameEv:
 9729|  62.0k|[[nodiscard]] const std::string& url::get_username() const noexcept {
 9730|  62.0k|  return username;
 9731|  62.0k|}
_ZNK3ada3url12get_passwordEv:
 9733|  62.0k|[[nodiscard]] const std::string& url::get_password() const noexcept {
 9734|  62.0k|  return password;
 9735|  62.0k|}
_ZNK3ada3url8get_portEv:
 9737|  66.1k|[[nodiscard]] std::string url::get_port() const {
 9738|  66.1k|  return port.has_value() ? std::to_string(port.value()) : "";
  ------------------
  |  Branch (9738:10): [True: 8.23k, False: 57.9k]
  ------------------
 9739|  66.1k|}
_ZNK3ada3url8get_hashEv:
 9741|  62.0k|[[nodiscard]] std::string url::get_hash() const {
 9742|       |  // If this's URL's fragment is either null or the empty string, then return
 9743|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
 9744|  62.0k|  return (!hash.has_value() || (hash->empty())) ? "" : "#" + hash.value();
  ------------------
  |  Branch (9744:11): [True: 52.6k, False: 9.42k]
  |  Branch (9744:32): [True: 597, False: 8.82k]
  ------------------
 9745|  62.0k|}
_ZN3ada3url8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10028|  62.0k|bool url::set_href(const std::string_view input) {
10029|  62.0k|  ada::result<ada::url> out = ada::parse<ada::url>(input);
10030|       |
10031|  62.0k|  if (out) {
  ------------------
  |  Branch (10031:7): [True: 62.0k, False: 0]
  ------------------
10032|       |    // The parser enforces get_max_input_length() on both the input and the
10033|       |    // normalized result. This is a defense-in-depth check.
10034|  62.0k|    if (out->get_href_size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (10034:9): [True: 0, False: 62.0k]
  ------------------
10035|      0|      return false;
10036|      0|    }
10037|  62.0k|    *this = *out;
10038|  62.0k|  }
10039|       |
10040|  62.0k|  return out.has_value();
10041|  62.0k|}
_ZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
10358|   187k|                           const result_type* base_url) {
10359|       |  // We can specialize the implementation per type.
10360|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
10361|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
10362|       |  // something else } is free (at runtime). This means that ada::url_aggregator
10363|       |  // and ada::url **do not have to support the exact same API**.
10364|   187k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
10365|   187k|  constexpr bool result_type_is_ada_url_aggregator =
10366|   187k|      std::is_same_v<url_aggregator, result_type>;
10367|   187k|  static_assert(result_type_is_ada_url ||
10368|   187k|                result_type_is_ada_url_aggregator);  // We don't support
10369|       |                                                     // anything else for now.
10370|       |
10371|   187k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
10372|   187k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
10373|   187k|          ")");
10374|       |
10375|   187k|  state state = state::SCHEME_START;
10376|   187k|  result_type url{};
10377|       |
10378|   187k|  const uint32_t max_input_length = ada::get_max_input_length();
10379|       |
10380|       |  // We refuse to parse URL strings that exceed the maximum input length.
10381|       |  // By default, this is 4GB but can be configured via
10382|       |  // ada::set_max_input_length().
10383|   187k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10383:7): [True: 0, False: 187k]
  ------------------
10384|      0|    url.is_valid = false;
10385|      0|  }
10386|       |  // Going forward, user_input.size() is in [0,
10387|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
10388|       |  // base, or the optional_url was invalid, we must return.
10389|   187k|  if (base_url != nullptr) {
  ------------------
  |  Branch (10389:7): [True: 0, False: 187k]
  ------------------
10390|      0|    url.is_valid &= base_url->is_valid;
10391|      0|  }
10392|   187k|  if (!url.is_valid) {
  ------------------
  |  Branch (10392:7): [True: 0, False: 187k]
  ------------------
10393|      0|    return url;
10394|      0|  }
10395|       |
10396|       |  // Simple absolute http(s) fast path (before tabs/newline scan).
10397|       |  // Skip digit-led hosts (IPv4) with a cheap peek.
10398|   187k|  if constexpr (store_values) {
10399|   187k|    if (base_url == nullptr) {
  ------------------
  |  Branch (10399:9): [True: 187k, False: 0]
  ------------------
10400|   187k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
10401|   187k|      const size_t n = user_input.size();
10402|   187k|      const bool digit_led_host = (n >= 8 && p[4] == ':' && p[5] == '/' &&
  ------------------
  |  Branch (10402:36): [True: 187k, False: 26]
  |  Branch (10402:46): [True: 51.9k, False: 135k]
  |  Branch (10402:61): [True: 51.5k, False: 437]
  ------------------
10403|  51.5k|                                   p[6] == '/' && p[7] >= '0' && p[7] <= '9') ||
  ------------------
  |  Branch (10403:36): [True: 51.4k, False: 102]
  |  Branch (10403:51): [True: 50.3k, False: 1.09k]
  |  Branch (10403:66): [True: 24.2k, False: 26.1k]
  ------------------
10404|   163k|                                  (n >= 9 && p[5] == ':' && p[6] == '/' &&
  ------------------
  |  Branch (10404:36): [True: 163k, False: 77]
  |  Branch (10404:46): [True: 135k, False: 28.2k]
  |  Branch (10404:61): [True: 134k, False: 396]
  ------------------
10405|   134k|                                   p[7] == '/' && p[8] >= '0' && p[8] <= '9');
  ------------------
  |  Branch (10405:36): [True: 134k, False: 36]
  |  Branch (10405:51): [True: 134k, False: 525]
  |  Branch (10405:66): [True: 1.08k, False: 133k]
  ------------------
10406|   187k|      if (!digit_led_host && try_parse_simple_absolute(user_input, url)) {
  ------------------
  |  Branch (10406:11): [True: 162k, False: 25.3k]
  |  Branch (10406:30): [True: 103k, False: 59.0k]
  ------------------
10407|       |        if constexpr (result_type_is_ada_url_aggregator) {
10408|       |          if (url.buffer.size() > max_input_length) [[unlikely]] {
10409|       |            url.is_valid = false;
10410|       |          }
10411|   103k|        } else {
10412|   103k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10412:15): [True: 0, False: 103k]
  ------------------
10413|      0|            url.is_valid = false;
10414|      0|          }
10415|   103k|        }
10416|   103k|        return url;
10417|   103k|      }
10418|   187k|    }
10419|   187k|  }
10420|       |
10421|  84.3k|  std::string tmp_buffer;
10422|   187k|  std::string_view url_data;
10423|   187k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (10423:7): [True: 322, False: 187k]
  ------------------
10424|    322|    tmp_buffer = user_input;
10425|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10426|       |    // just directly build the string from user_input.
10427|    322|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10428|    322|    url_data = tmp_buffer;
10429|   187k|  } else [[likely]] {
10430|   187k|    url_data = user_input;
10431|   187k|  }
10432|       |
10433|       |  // Leading and trailing control characters are uncommon and easy to deal with
10434|       |  // (no performance concern).
10435|   187k|  helpers::trim_c0_whitespace(url_data);
10436|       |
10437|       |  if constexpr (result_type_is_ada_url_aggregator && store_values) {
10438|       |    // Most of the time, we just need user_input.size().
10439|       |    // In some instances, we may need a bit more.
10440|       |    ///////////////////////////
10441|       |    // This is *very* important. This line should *not* be removed
10442|       |    // hastily. There are principled reasons why reserve is important
10443|       |    // for performance. If you have a benchmark with small inputs,
10444|       |    // it may not matter, but in other instances, it could.
10445|       |    ////
10446|       |    // This rounds up to the next power of two.
10447|       |    // We know that user_input.size() is in [0,
10448|       |    // std::numeric_limits<uint32_t>::max).
10449|       |    uint32_t reserve_capacity =
10450|       |        (0xFFFFFFFF >>
10451|       |         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
10452|       |        1;
10453|       |    url.reserve(reserve_capacity);
10454|       |  }
10455|       |
10456|       |  // Optimization opportunity. Most websites do not have fragment.
10457|   187k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
10458|       |  // We add it last so that an implementation like ada::url_aggregator
10459|       |  // can append it last to its internal buffer, thus improving performance.
10460|       |
10461|       |  // Here url_data no longer has its fragment.
10462|       |  // We are going to access the data from url_data (it is immutable).
10463|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
10464|       |  // The input_position variable should range from 0 to input_size.
10465|       |  // It is illegal to access url_data at input_size.
10466|   187k|  size_t input_position = 0;
10467|   187k|  const size_t input_size = url_data.size();
10468|       |  // Keep running the following state machine by switching on state.
10469|       |  // If after a run pointer points to the EOF code point, go to the next step.
10470|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
10471|       |  // We never decrement input_position.
10472|   768k|  while (input_position <= input_size) {
  ------------------
  |  Branch (10472:10): [True: 588k, False: 179k]
  ------------------
10473|   588k|    ada_log("In parsing at ", input_position, " out of ", input_size,
10474|   588k|            " in state ", ada::to_string(state));
10475|   588k|    switch (state) {
10476|  84.3k|      case state::SCHEME_START: {
  ------------------
  |  Branch (10476:7): [True: 84.3k, False: 504k]
  ------------------
10477|  84.3k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
10478|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
10479|       |        // state to scheme state.
10480|  84.3k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10480:13): [True: 84.3k, False: 1]
  ------------------
10481|  84.3k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (10481:13): [True: 84.3k, False: 32]
  ------------------
10482|  84.3k|          state = state::SCHEME;
10483|  84.3k|          input_position++;
10484|  84.3k|        } else {
10485|       |          // Otherwise, if state override is not given, set state to no scheme
10486|       |          // state and decrease pointer by 1.
10487|     33|          state = state::NO_SCHEME;
10488|     33|        }
10489|  84.3k|        break;
10490|      0|      }
10491|  84.3k|      case state::SCHEME: {
  ------------------
  |  Branch (10491:7): [True: 84.3k, False: 504k]
  ------------------
10492|  84.3k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
10493|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
10494|       |        // append c, lowercased, to buffer.
10495|   392k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (10495:16): [True: 392k, False: 3]
  ------------------
10496|   392k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (10496:16): [True: 307k, False: 84.3k]
  ------------------
10497|   307k|          input_position++;
10498|   307k|        }
10499|       |        // Otherwise, if c is U+003A (:), then:
10500|  84.3k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10500:13): [True: 84.3k, False: 3]
  ------------------
10501|  84.3k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (10501:13): [True: 84.2k, False: 48]
  ------------------
10502|  84.2k|          ada_log("SCHEME the scheme should be ",
10503|  84.2k|                  url_data.substr(0, input_position));
10504|  84.2k|          if constexpr (result_type_is_ada_url) {
10505|  84.2k|            if (!url.parse_scheme(url_data.substr(0, input_position))) {
  ------------------
  |  Branch (10505:17): [True: 0, False: 84.2k]
  ------------------
10506|      0|              return url;
10507|      0|            }
10508|       |          } else {
10509|       |            // we pass the colon along instead of painfully adding it back.
10510|       |            if (!url.parse_scheme_with_colon(
10511|       |                    url_data.substr(0, input_position + 1))) {
10512|       |              return url;
10513|       |            }
10514|       |          }
10515|  84.2k|          ada_log("SCHEME the scheme is ", url.get_protocol());
10516|       |
10517|       |          // If url's scheme is "file", then:
10518|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
10519|  84.2k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (10519:15): [True: 671, False: 83.6k]
  ------------------
10520|       |            // Set state to file state.
10521|    671|            state = state::FILE;
10522|    671|          }
10523|       |          // Otherwise, if url is special, base is non-null, and base's scheme
10524|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
10525|       |          // != nullptr is false.
10526|  83.6k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (10526:20): [True: 82.6k, False: 990]
  |  Branch (10526:40): [True: 0, False: 82.6k]
  ------------------
10527|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (10527:20): [True: 0, False: 0]
  ------------------
10528|       |            // Set state to special relative or authority state.
10529|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
10530|      0|          }
10531|       |          // Otherwise, if url is special, set state to special authority
10532|       |          // slashes state.
10533|  83.6k|          else if (url.is_special()) {
  ------------------
  |  Branch (10533:20): [True: 82.6k, False: 990]
  ------------------
10534|  82.6k|            state = state::SPECIAL_AUTHORITY_SLASHES;
10535|  82.6k|          }
10536|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
10537|       |          // path or authority state and increase pointer by 1.
10538|    990|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (10538:20): [True: 978, False: 12]
  ------------------
10539|    978|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (10539:20): [True: 669, False: 309]
  ------------------
10540|    669|            state = state::PATH_OR_AUTHORITY;
10541|    669|            input_position++;
10542|    669|          }
10543|       |          // Otherwise, set url's path to the empty string and set state to
10544|       |          // opaque path state.
10545|    321|          else {
10546|    321|            state = state::OPAQUE_PATH;
10547|    321|          }
10548|  84.2k|        }
10549|       |        // Otherwise, if state override is not given, set buffer to the empty
10550|       |        // string, state to no scheme state, and start over (from the first code
10551|       |        // point in input).
10552|     51|        else {
10553|     51|          state = state::NO_SCHEME;
10554|     51|          input_position = 0;
10555|     51|          break;
10556|     51|        }
10557|  84.2k|        input_position++;
10558|  84.2k|        break;
10559|  84.3k|      }
10560|     84|      case state::NO_SCHEME: {
  ------------------
  |  Branch (10560:7): [True: 84, False: 588k]
  ------------------
10561|     84|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
10562|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
10563|       |        // validation error, return failure.
10564|     84|        if (base_url == nullptr ||
  ------------------
  |  Branch (10564:13): [True: 84, False: 0]
  ------------------
10565|     84|            (base_url->has_opaque_path && !fragment.has_value())) {
  ------------------
  |  Branch (10565:14): [True: 0, False: 0]
  |  Branch (10565:43): [True: 0, False: 0]
  ------------------
10566|     84|          ada_log("NO_SCHEME validation error");
10567|     84|          url.is_valid = false;
10568|     84|          return url;
10569|     84|        }
10570|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
10571|       |        // set url's scheme to base's scheme, url's path to base's path, url's
10572|       |        // query to base's query, and set state to fragment state.
10573|      0|        else if (base_url->has_opaque_path && fragment.has_value() &&
  ------------------
  |  Branch (10573:18): [True: 0, False: 0]
  |  Branch (10573:47): [True: 0, False: 0]
  ------------------
10574|      0|                 input_position == input_size) {
  ------------------
  |  Branch (10574:18): [True: 0, False: 0]
  ------------------
10575|      0|          ada_log("NO_SCHEME opaque base with fragment");
10576|      0|          url.copy_scheme(*base_url);
10577|      0|          url.has_opaque_path = base_url->has_opaque_path;
10578|       |
10579|      0|          if constexpr (result_type_is_ada_url) {
10580|      0|            url.path = base_url->path;
10581|      0|            url.query = base_url->query;
10582|       |          } else {
10583|       |            url.update_base_pathname(base_url->get_pathname());
10584|       |            if (base_url->has_search()) {
10585|       |              // get_search() returns "" for an empty query string (URL ends
10586|       |              // with '?'). update_base_search("") would incorrectly clear the
10587|       |              // query, so pass "?" to preserve the empty query distinction.
10588|       |              auto s = base_url->get_search();
10589|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
10590|       |            }
10591|       |          }
10592|      0|          url.update_unencoded_base_hash(*fragment);
10593|      0|          return url;
10594|      0|        }
10595|       |        // Otherwise, if base's scheme is not "file", set state to relative
10596|       |        // state and decrease pointer by 1.
10597|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
10598|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (10598:18): [True: 0, False: 0]
  ------------------
10599|      0|          ada_log("NO_SCHEME non-file relative path");
10600|      0|          state = state::RELATIVE_SCHEME;
10601|      0|        }
10602|       |        // Otherwise, set state to file state and decrease pointer by 1.
10603|      0|        else {
10604|      0|          ada_log("NO_SCHEME file base type");
10605|      0|          state = state::FILE;
10606|      0|        }
10607|      0|        break;
10608|     84|      }
10609|  83.1k|      case state::AUTHORITY: {
  ------------------
  |  Branch (10609:7): [True: 83.1k, False: 505k]
  ------------------
10610|  83.1k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
10611|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
10612|       |        // about AUTHORITY. Of course, we could have @ and still not have to
10613|       |        // worry about AUTHORITY.
10614|       |        // TODO: Instead of just collecting a bool, collect the location of the
10615|       |        // '@' and do something useful with it.
10616|       |        // TODO: We could do various processing early on, using a single pass
10617|       |        // over the string to collect information about it, e.g., telling us
10618|       |        // whether there is a @ and if so, where (or how many).
10619|       |
10620|       |        // Check if url data contains an @.
10621|  83.1k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (10621:13): [True: 70.7k, False: 12.3k]
  ------------------
10622|  70.7k|          state = state::HOST;
10623|  70.7k|          break;
10624|  70.7k|        }
10625|  12.3k|        bool at_sign_seen{false};
10626|  12.3k|        bool password_token_seen{false};
10627|       |        /**
10628|       |         * We expect something of the sort...
10629|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
10630|       |         * --------^
10631|       |         */
10632|  32.1k|        do {
10633|  32.1k|          std::string_view view = url_data.substr(input_position);
10634|       |          // The delimiters are @, /, ? \\.
10635|  32.1k|          size_t location =
10636|  32.1k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (10636:15): [True: 32.0k, False: 134]
  ------------------
10637|  32.1k|                               : helpers::find_authority_delimiter(view);
10638|  32.1k|          std::string_view authority_view = view.substr(0, location);
10639|  32.1k|          size_t end_of_authority = input_position + authority_view.size();
10640|       |          // If c is U+0040 (@), then:
10641|  32.1k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (10641:15): [True: 31.8k, False: 254]
  ------------------
10642|  31.8k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (10642:15): [True: 19.7k, False: 12.1k]
  ------------------
10643|       |            // If atSignSeen is true, then prepend "%40" to buffer.
10644|  19.7k|            if (at_sign_seen) {
  ------------------
  |  Branch (10644:17): [True: 7.53k, False: 12.2k]
  ------------------
10645|  7.53k|              if (password_token_seen) {
  ------------------
  |  Branch (10645:19): [True: 3.70k, False: 3.83k]
  ------------------
10646|  3.70k|                if constexpr (result_type_is_ada_url) {
10647|  3.70k|                  url.password += "%40";
10648|       |                } else {
10649|       |                  url.append_base_password("%40");
10650|       |                }
10651|  3.83k|              } else {
10652|  3.83k|                if constexpr (result_type_is_ada_url) {
10653|  3.83k|                  url.username += "%40";
10654|       |                } else {
10655|       |                  url.append_base_username("%40");
10656|       |                }
10657|  3.83k|              }
10658|  7.53k|            }
10659|       |
10660|  19.7k|            at_sign_seen = true;
10661|       |
10662|  19.7k|            if (!password_token_seen) {
  ------------------
  |  Branch (10662:17): [True: 16.0k, False: 3.70k]
  ------------------
10663|  16.0k|              size_t password_token_location = authority_view.find(':');
10664|  16.0k|              password_token_seen =
10665|  16.0k|                  password_token_location != std::string_view::npos;
10666|       |
10667|  16.0k|              if constexpr (store_values) {
10668|  16.0k|                if (!password_token_seen) {
  ------------------
  |  Branch (10668:21): [True: 4.37k, False: 11.6k]
  ------------------
10669|  4.37k|                  if constexpr (result_type_is_ada_url) {
10670|  4.37k|                    url.username += unicode::percent_encode(
10671|  4.37k|                        authority_view,
10672|  4.37k|                        character_sets::USERINFO_PERCENT_ENCODE);
10673|       |                  } else {
10674|       |                    url.append_base_username(unicode::percent_encode(
10675|       |                        authority_view,
10676|       |                        character_sets::USERINFO_PERCENT_ENCODE));
10677|       |                  }
10678|  11.6k|                } else {
10679|  11.6k|                  if constexpr (result_type_is_ada_url) {
10680|  11.6k|                    url.username += unicode::percent_encode(
10681|  11.6k|                        authority_view.substr(0, password_token_location),
10682|  11.6k|                        character_sets::USERINFO_PERCENT_ENCODE);
10683|  11.6k|                    url.password += unicode::percent_encode(
10684|  11.6k|                        authority_view.substr(password_token_location + 1),
10685|  11.6k|                        character_sets::USERINFO_PERCENT_ENCODE);
10686|       |                  } else {
10687|       |                    url.append_base_username(unicode::percent_encode(
10688|       |                        authority_view.substr(0, password_token_location),
10689|       |                        character_sets::USERINFO_PERCENT_ENCODE));
10690|       |                    url.append_base_password(unicode::percent_encode(
10691|       |                        authority_view.substr(password_token_location + 1),
10692|       |                        character_sets::USERINFO_PERCENT_ENCODE));
10693|       |                  }
10694|  11.6k|                }
10695|  16.0k|              }
10696|  16.0k|            } else if constexpr (store_values) {
10697|  3.70k|              if constexpr (result_type_is_ada_url) {
10698|  3.70k|                url.password += unicode::percent_encode(
10699|  3.70k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
10700|       |              } else {
10701|       |                url.append_base_password(unicode::percent_encode(
10702|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
10703|       |              }
10704|  3.70k|            }
10705|  19.7k|          }
10706|       |          // Otherwise, if one of the following is true:
10707|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
10708|       |          // - url is special and c is U+005C (\)
10709|  12.3k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (10709:20): [True: 254, False: 12.1k]
  ------------------
10710|  12.1k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (10710:20): [True: 12.0k, False: 100]
  ------------------
10711|    100|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (10711:20): [True: 65, False: 35]
  ------------------
10712|  12.3k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (10712:21): [True: 35, False: 0]
  |  Branch (10712:41): [True: 35, False: 0]
  ------------------
10713|       |            // If atSignSeen is true and authority_view is the empty string,
10714|       |            // validation error, return failure.
10715|  12.3k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (10715:17): [True: 12.2k, False: 164]
  |  Branch (10715:33): [True: 92, False: 12.1k]
  ------------------
10716|     92|              url.is_valid = false;
10717|     92|              return url;
10718|     92|            }
10719|  12.2k|            state = state::HOST;
10720|  12.2k|            break;
10721|  12.3k|          }
10722|  19.7k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (10722:15): [True: 0, False: 19.7k]
  ------------------
10723|      0|            if constexpr (store_values) {
10724|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (10724:19): [True: 0, False: 0]
  ------------------
10725|      0|                url.update_unencoded_base_hash(*fragment);
10726|      0|              }
10727|      0|            }
10728|      0|            return url;
10729|      0|          }
10730|  19.7k|          input_position = end_of_authority + 1;
10731|  19.7k|        } while (true);
  ------------------
  |  Branch (10731:18): [True: 19.7k, Folded]
  ------------------
10732|       |
10733|  12.2k|        break;
10734|  12.3k|      }
10735|  12.2k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (10735:7): [True: 0, False: 588k]
  ------------------
10736|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
10737|      0|                helpers::substring(url_data, input_position));
10738|       |
10739|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
10740|       |        // then set state to special authority ignore slashes state and increase
10741|       |        // pointer by 1.
10742|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (10742:13): [True: 0, False: 0]
  ------------------
10743|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
10744|      0|          input_position += 2;
10745|      0|        } else {
10746|       |          // Otherwise, validation error, set state to relative state and
10747|       |          // decrease pointer by 1.
10748|      0|          state = state::RELATIVE_SCHEME;
10749|      0|        }
10750|       |
10751|      0|        break;
10752|  12.3k|      }
10753|    669|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (10753:7): [True: 669, False: 588k]
  ------------------
10754|    669|        ada_log("PATH_OR_AUTHORITY ",
10755|    669|                helpers::substring(url_data, input_position));
10756|       |
10757|       |        // If c is U+002F (/), then set state to authority state.
10758|    669|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10758:13): [True: 654, False: 15]
  ------------------
10759|    654|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10759:13): [True: 525, False: 129]
  ------------------
10760|    525|          state = state::AUTHORITY;
10761|    525|          input_position++;
10762|    525|        } else {
10763|       |          // Otherwise, set state to path state, and decrease pointer by 1.
10764|    144|          state = state::PATH;
10765|    144|        }
10766|       |
10767|    669|        break;
10768|  12.3k|      }
10769|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (10769:7): [True: 0, False: 588k]
  ------------------
10770|      0|        ada_log("RELATIVE_SCHEME ",
10771|      0|                helpers::substring(url_data, input_position));
10772|       |
10773|       |        // Set url's scheme to base's scheme.
10774|      0|        url.copy_scheme(*base_url);
10775|       |
10776|       |        // If c is U+002F (/), then set state to relative slash state.
10777|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10777:13): [True: 0, False: 0]
  ------------------
10778|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
10779|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10779:13): [True: 0, False: 0]
  ------------------
10780|      0|          ada_log(
10781|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
10782|      0|              "slash state");
10783|      0|          state = state::RELATIVE_SLASH;
10784|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (10784:20): [True: 0, False: 0]
  |  Branch (10784:40): [True: 0, False: 0]
  ------------------
10785|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (10785:20): [True: 0, False: 0]
  ------------------
10786|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
10787|       |          // set state to relative slash state.
10788|      0|          ada_log(
10789|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
10790|      0|              "error, set state to relative slash state");
10791|      0|          state = state::RELATIVE_SLASH;
10792|      0|        } else {
10793|      0|          ada_log("RELATIVE_SCHEME otherwise");
10794|       |          // Set url's username to base's username, url's password to base's
10795|       |          // password, url's host to base's host, url's port to base's port,
10796|       |          // url's path to a clone of base's path, and url's query to base's
10797|       |          // query.
10798|      0|          if constexpr (result_type_is_ada_url) {
10799|      0|            url.username = base_url->username;
10800|      0|            url.password = base_url->password;
10801|      0|            url.host = base_url->host;
10802|      0|            url.port = base_url->port;
10803|       |            // cloning the base path includes cloning the has_opaque_path flag
10804|      0|            url.has_opaque_path = base_url->has_opaque_path;
10805|      0|            url.path = base_url->path;
10806|      0|            url.query = base_url->query;
10807|       |          } else {
10808|       |            url.update_base_authority(base_url->get_href(),
10809|       |                                      base_url->get_components());
10810|       |            url.update_host_to_base_host(base_url->get_hostname());
10811|       |            url.update_base_port(base_url->retrieve_base_port());
10812|       |            // cloning the base path includes cloning the has_opaque_path flag
10813|       |            url.has_opaque_path = base_url->has_opaque_path;
10814|       |            url.update_base_pathname(base_url->get_pathname());
10815|       |            if (base_url->has_search()) {
10816|       |              // get_search() returns "" for an empty query string (URL ends
10817|       |              // with '?'). update_base_search("") would incorrectly clear the
10818|       |              // query, so pass "?" to preserve the empty query distinction.
10819|       |              auto s = base_url->get_search();
10820|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
10821|       |            }
10822|       |          }
10823|       |
10824|      0|          url.has_opaque_path = base_url->has_opaque_path;
10825|       |
10826|       |          // If c is U+003F (?), then set url's query to the empty string, and
10827|       |          // state to query state.
10828|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (10828:15): [True: 0, False: 0]
  ------------------
10829|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (10829:15): [True: 0, False: 0]
  ------------------
10830|      0|            state = state::QUERY;
10831|      0|          }
10832|       |          // Otherwise, if c is not the EOF code point:
10833|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (10833:20): [True: 0, False: 0]
  ------------------
10834|       |            // Set url's query to null.
10835|      0|            url.clear_search();
10836|      0|            if constexpr (result_type_is_ada_url) {
10837|       |              // Shorten url's path.
10838|      0|              helpers::shorten_path(url.path, url.type);
10839|       |            } else {
10840|       |              std::string_view path = url.get_pathname();
10841|       |              if (helpers::shorten_path(path, url.type)) {
10842|       |                url.update_base_pathname(std::move(std::string(path)));
10843|       |              }
10844|       |            }
10845|       |            // Set state to path state and decrease pointer by 1.
10846|      0|            state = state::PATH;
10847|      0|            break;
10848|      0|          }
10849|      0|        }
10850|      0|        input_position++;
10851|      0|        break;
10852|      0|      }
10853|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (10853:7): [True: 0, False: 588k]
  ------------------
10854|      0|        ada_log("RELATIVE_SLASH ",
10855|      0|                helpers::substring(url_data, input_position));
10856|       |
10857|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
10858|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
10859|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (10859:13): [True: 0, False: 0]
  |  Branch (10859:33): [True: 0, False: 0]
  ------------------
10860|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (10860:14): [True: 0, False: 0]
  ------------------
10861|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (10861:14): [True: 0, False: 0]
  ------------------
10862|       |          // Set state to special authority ignore slashes state.
10863|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
10864|      0|        }
10865|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
10866|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (10866:18): [True: 0, False: 0]
  ------------------
10867|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10867:18): [True: 0, False: 0]
  ------------------
10868|      0|          state = state::AUTHORITY;
10869|      0|        }
10870|       |        // Otherwise, set
10871|       |        // - url's username to base's username,
10872|       |        // - url's password to base's password,
10873|       |        // - url's host to base's host,
10874|       |        // - url's port to base's port,
10875|       |        // - state to path state, and then, decrease pointer by 1.
10876|      0|        else {
10877|      0|          if constexpr (result_type_is_ada_url) {
10878|      0|            url.username = base_url->username;
10879|      0|            url.password = base_url->password;
10880|      0|            url.host = base_url->host;
10881|      0|            url.port = base_url->port;
10882|       |          } else {
10883|       |            url.update_base_authority(base_url->get_href(),
10884|       |                                      base_url->get_components());
10885|       |            url.update_host_to_base_host(base_url->get_hostname());
10886|       |            url.update_base_port(base_url->retrieve_base_port());
10887|       |          }
10888|      0|          state = state::PATH;
10889|      0|          break;
10890|      0|        }
10891|       |
10892|      0|        input_position++;
10893|      0|        break;
10894|      0|      }
10895|  82.6k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (10895:7): [True: 82.6k, False: 506k]
  ------------------
10896|  82.6k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
10897|  82.6k|                helpers::substring(url_data, input_position));
10898|       |
10899|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
10900|       |        // then set state to special authority ignore slashes state and increase
10901|       |        // pointer by 1.
10902|  82.6k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (10902:13): [True: 81.9k, False: 707]
  ------------------
10903|  81.9k|          input_position += 2;
10904|  81.9k|        }
10905|       |
10906|  82.6k|        [[fallthrough]];
10907|  82.6k|      }
10908|  82.6k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (10908:7): [True: 0, False: 588k]
  ------------------
10909|  82.6k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
10910|  82.6k|                helpers::substring(url_data, input_position));
10911|       |
10912|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
10913|       |        // authority state and decrease pointer by 1.
10914|  84.1k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (10914:16): [True: 84.0k, False: 52]
  ------------------
10915|  84.0k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (10915:17): [True: 582, False: 83.4k]
  ------------------
10916|  83.4k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (10916:17): [True: 913, False: 82.5k]
  ------------------
10917|  1.49k|          input_position++;
10918|  1.49k|        }
10919|  82.6k|        state = state::AUTHORITY;
10920|       |
10921|  82.6k|        break;
10922|  82.6k|      }
10923|  5.24k|      case state::QUERY: {
  ------------------
  |  Branch (10923:7): [True: 5.24k, False: 583k]
  ------------------
10924|  5.24k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
10925|  5.24k|        if constexpr (store_values) {
10926|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
10927|       |          // if url is special; otherwise the query percent-encode set.
10928|  5.24k|          const uint8_t* query_percent_encode_set =
10929|  5.24k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (10929:15): [True: 4.60k, False: 636]
  ------------------
10930|  5.24k|                               : character_sets::QUERY_PERCENT_ENCODE;
10931|       |
10932|       |          // Percent-encode after encoding, with encoding, buffer, and
10933|       |          // queryPercentEncodeSet, and append the result to url's query.
10934|  5.24k|          url.update_base_search(url_data.substr(input_position),
10935|  5.24k|                                 query_percent_encode_set);
10936|  5.24k|          ada_log("QUERY update_base_search completed ");
10937|  5.24k|          if (fragment.has_value()) {
  ------------------
  |  Branch (10937:15): [True: 3.78k, False: 1.45k]
  ------------------
10938|  3.78k|            url.update_unencoded_base_hash(*fragment);
10939|  3.78k|          }
10940|  5.24k|        }
10941|  5.24k|        return url;
10942|  82.6k|      }
10943|  83.0k|      case state::HOST: {
  ------------------
  |  Branch (10943:7): [True: 83.0k, False: 505k]
  ------------------
10944|  83.0k|        ada_log("HOST ", helpers::substring(url_data, input_position));
10945|       |
10946|  83.0k|        std::string_view host_view = url_data.substr(input_position);
10947|  83.0k|        auto [location, found_colon] =
10948|  83.0k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
10949|  83.0k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (10949:26): [True: 83.0k, False: 0]
  ------------------
10950|  83.0k|                             ? input_position + location
10951|  83.0k|                             : input_size;
10952|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
10953|       |        // Note: the 'found_colon' value is true if and only if a colon was
10954|       |        // encountered while not inside brackets.
10955|  83.0k|        if (found_colon) {
  ------------------
  |  Branch (10955:13): [True: 12.8k, False: 70.2k]
  ------------------
10956|       |          // If buffer is the empty string, validation error, return failure.
10957|       |          // Let host be the result of host parsing buffer with url is not
10958|       |          // special.
10959|  12.8k|          ada_log("HOST parsing ", host_view);
10960|  12.8k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (10960:15): [True: 164, False: 12.6k]
  ------------------
10961|    164|            return url;
10962|    164|          }
10963|  12.6k|          ada_log("HOST parsing results in ", url.get_hostname());
10964|       |          // Set url's host to host, buffer to the empty string, and state to
10965|       |          // port state.
10966|  12.6k|          state = state::PORT;
10967|  12.6k|          input_position++;
10968|  12.6k|        }
10969|       |        // Otherwise, if one of the following is true:
10970|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
10971|       |        // - url is special and c is U+005C (\)
10972|       |        // The get_host_delimiter_location function either brings us to
10973|       |        // the colon outside of the bracket, or to one of those characters.
10974|  70.2k|        else {
10975|       |          // If url is special and host_view is the empty string, validation
10976|       |          // error, return failure.
10977|  70.2k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (10977:15): [True: 96, False: 70.1k]
  |  Branch (10977:36): [True: 63, False: 33]
  ------------------
10978|     63|            url.is_valid = false;
10979|     63|            return url;
10980|     63|          }
10981|  70.1k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
10982|       |          // Let host be the result of host parsing host_view with url is not
10983|       |          // special.
10984|  70.1k|          if (host_view.empty()) {
  ------------------
  |  Branch (10984:15): [True: 33, False: 70.1k]
  ------------------
10985|     33|            url.update_base_hostname("");
10986|  70.1k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (10986:22): [True: 1.21k, False: 68.9k]
  ------------------
10987|  1.21k|            return url;
10988|  1.21k|          }
10989|  68.9k|          ada_log("HOST parsing results in ", url.get_hostname(),
10990|  68.9k|                  " href=", url.get_href());
10991|       |
10992|       |          // Set url's host to host, and state to path start state.
10993|  68.9k|          state = state::PATH_START;
10994|  68.9k|        }
10995|       |
10996|  81.6k|        break;
10997|  83.0k|      }
10998|  81.6k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (10998:7): [True: 321, False: 588k]
  ------------------
10999|    321|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
11000|       |        // Opaque path, query, and fragment are structurally always valid:
11001|       |        // the parser would just percent-encode whatever is there. When we
11002|       |        // are not storing values (can_parse), we can return immediately.
11003|       |        // We must set has_opaque_path = true before returning so that when
11004|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
11005|       |        // correctly rejects relative inputs against an opaque-path base
11006|       |        // (e.g. can_parse("", &"W:") must return false).
11007|       |        if constexpr (!store_values) {
11008|       |          url.has_opaque_path = true;
11009|       |          return url;
11010|       |        }
11011|    321|        std::string_view view = url_data.substr(input_position);
11012|       |        // If c is U+003F (?), then set url's query to the empty string and
11013|       |        // state to query state.
11014|    321|        size_t location = view.find('?');
11015|    321|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (11015:13): [True: 210, False: 111]
  ------------------
11016|    210|          view.remove_suffix(view.size() - location);
11017|    210|          state = state::QUERY;
11018|    210|          input_position += location + 1;
11019|    210|        } else {
11020|    111|          input_position = input_size + 1;
11021|    111|        }
11022|    321|        url.has_opaque_path = true;
11023|       |
11024|       |        // This is a really unlikely scenario in real world. We should not seek
11025|       |        // to optimize it.
11026|    321|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (11026:13): [True: 10, False: 311]
  ------------------
11027|     10|          std::string modified_view =
11028|     10|              std::string(view.substr(0, view.size() - 1)) + "%20";
11029|     10|          url.update_base_pathname(unicode::percent_encode(
11030|     10|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11031|    311|        } else {
11032|    311|          url.update_base_pathname(unicode::percent_encode(
11033|    311|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11034|    311|        }
11035|    321|        break;
11036|  83.0k|      }
11037|  12.6k|      case state::PORT: {
  ------------------
  |  Branch (11037:7): [True: 12.6k, False: 576k]
  ------------------
11038|  12.6k|        ada_log("PORT ", helpers::substring(url_data, input_position));
11039|  12.6k|        std::string_view port_view = url_data.substr(input_position);
11040|  12.6k|        input_position += url.parse_port(port_view, true);
11041|  12.6k|        if (!url.is_valid) {
  ------------------
  |  Branch (11041:13): [True: 144, False: 12.5k]
  ------------------
11042|    144|          return url;
11043|    144|        }
11044|  12.5k|        state = state::PATH_START;
11045|  12.5k|        [[fallthrough]];
11046|  12.5k|      }
11047|  82.0k|      case state::PATH_START: {
  ------------------
  |  Branch (11047:7): [True: 69.4k, False: 519k]
  ------------------
11048|  82.0k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
11049|       |        // Path, query, and fragment are structurally always valid: the
11050|       |        // parser would just percent-encode whatever is there. When we are
11051|       |        // not storing values (can_parse), we can return immediately since
11052|       |        // no subsequent state can invalidate the URL.
11053|       |        if constexpr (!store_values) {
11054|       |          return url;
11055|       |        }
11056|       |
11057|       |        // If url is special, then:
11058|  82.0k|        if (url.is_special()) {
  ------------------
  |  Branch (11058:13): [True: 81.5k, False: 471]
  ------------------
11059|       |          // Set state to path state.
11060|  81.5k|          state = state::PATH;
11061|       |
11062|       |          // Optimization: Avoiding going into PATH state improves the
11063|       |          // performance of urls ending with /.
11064|  81.5k|          if (input_position == input_size) {
  ------------------
  |  Branch (11064:15): [True: 976, False: 80.5k]
  ------------------
11065|    976|            if constexpr (store_values) {
11066|    976|              url.update_base_pathname("/");
11067|    976|              if (fragment.has_value()) {
  ------------------
  |  Branch (11067:19): [True: 216, False: 760]
  ------------------
11068|    216|                url.update_unencoded_base_hash(*fragment);
11069|    216|              }
11070|    976|            }
11071|    976|            return url;
11072|    976|          }
11073|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
11074|       |          // by 1. We know that (input_position == input_size) is impossible
11075|       |          // here, because of the previous if-check.
11076|  80.5k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (11076:15): [True: 501, False: 80.0k]
  ------------------
11077|    501|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (11077:15): [True: 309, False: 192]
  ------------------
11078|    309|            break;
11079|    309|          }
11080|  80.5k|        }
11081|       |        // Otherwise, if state override is not given and c is U+003F (?),
11082|       |        // set url's query to the empty string and state to query state.
11083|    471|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (11083:18): [True: 378, False: 93]
  ------------------
11084|    378|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (11084:18): [True: 75, False: 303]
  ------------------
11085|     75|          state = state::QUERY;
11086|     75|        }
11087|       |        // Otherwise, if c is not the EOF code point:
11088|    396|        else if (input_position != input_size) {
  ------------------
  |  Branch (11088:18): [True: 303, False: 93]
  ------------------
11089|       |          // Set state to path state.
11090|    303|          state = state::PATH;
11091|       |
11092|       |          // If c is not U+002F (/), then decrease pointer by 1.
11093|    303|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (11093:15): [True: 0, False: 303]
  ------------------
11094|      0|            break;
11095|      0|          }
11096|    303|        }
11097|       |
11098|  80.7k|        input_position++;
11099|  80.7k|        break;
11100|  82.0k|      }
11101|  81.1k|      case state::PATH: {
  ------------------
  |  Branch (11101:7): [True: 81.1k, False: 507k]
  ------------------
11102|  81.1k|        ada_log("PATH ", helpers::substring(url_data, input_position));
11103|       |        // Path, query, and fragment are structurally always valid: the
11104|       |        // parser would just percent-encode whatever is there. When we are
11105|       |        // not storing values (can_parse), we can return immediately since
11106|       |        // no subsequent state can invalidate the URL.
11107|       |        if constexpr (!store_values) {
11108|       |          return url;
11109|       |        }
11110|  81.1k|        std::string_view view = url_data.substr(input_position);
11111|       |
11112|       |        // Most time, we do not need percent encoding.
11113|       |        // Furthermore, we can immediately locate the '?'.
11114|  81.1k|        size_t locofquestionmark = view.find('?');
11115|  81.1k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (11115:13): [True: 4.95k, False: 76.1k]
  ------------------
11116|  4.95k|          state = state::QUERY;
11117|  4.95k|          view.remove_suffix(view.size() - locofquestionmark);
11118|  4.95k|          input_position += locofquestionmark + 1;
11119|  76.1k|        } else {
11120|  76.1k|          input_position = input_size + 1;
11121|  76.1k|        }
11122|  81.1k|        if constexpr (store_values) {
11123|  81.1k|          if constexpr (result_type_is_ada_url) {
11124|  81.1k|            helpers::parse_prepared_path(view, url.type, url.path);
11125|       |          } else {
11126|       |            url.consume_prepared_path(view);
11127|       |            ADA_ASSERT_TRUE(url.validate());
11128|       |          }
11129|  81.1k|        }
11130|  81.1k|        break;
11131|  82.0k|      }
11132|    602|      case state::FILE_SLASH: {
  ------------------
  |  Branch (11132:7): [True: 602, False: 588k]
  ------------------
11133|    602|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
11134|       |
11135|       |        // If c is U+002F (/) or U+005C (\), then:
11136|    602|        if ((input_position != input_size) &&
  ------------------
  |  Branch (11136:13): [True: 601, False: 1]
  ------------------
11137|    601|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11137:14): [True: 575, False: 26]
  ------------------
11138|    578|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11138:14): [True: 3, False: 23]
  ------------------
11139|    578|          ada_log("FILE_SLASH c is U+002F or U+005C");
11140|       |          // Set state to file host state.
11141|    578|          state = state::FILE_HOST;
11142|    578|          input_position++;
11143|    578|        } else {
11144|     24|          ada_log("FILE_SLASH otherwise");
11145|       |          // If base is non-null and base's scheme is "file", then:
11146|       |          // Note: it is unsafe to do base_url->scheme unless you know that
11147|       |          // base_url_has_value() is true.
11148|     24|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11148:15): [True: 0, False: 24]
  |  Branch (11148:38): [True: 0, False: 0]
  ------------------
11149|       |            // Set url's host to base's host.
11150|      0|            if constexpr (result_type_is_ada_url) {
11151|      0|              url.host = base_url->host;
11152|       |            } else {
11153|       |              url.update_host_to_base_host(base_url->get_host());
11154|       |            }
11155|       |            // If the code point substring from pointer to the end of input does
11156|       |            // not start with a Windows drive letter and base's path[0] is a
11157|       |            // normalized Windows drive letter, then append base's path[0] to
11158|       |            // url's path.
11159|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (11159:17): [True: 0, False: 0]
  ------------------
11160|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (11160:19): [True: 0, False: 0]
  ------------------
11161|      0|                      url_data.substr(input_position))) {
11162|      0|                std::string_view first_base_url_path =
11163|      0|                    base_url->get_pathname().substr(1);
11164|      0|                size_t loc = first_base_url_path.find('/');
11165|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (11165:21): [True: 0, False: 0]
  ------------------
11166|      0|                  helpers::resize(first_base_url_path, loc);
11167|      0|                }
11168|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (11168:21): [True: 0, False: 0]
  ------------------
11169|      0|                        first_base_url_path)) {
11170|      0|                  if constexpr (result_type_is_ada_url) {
11171|      0|                    url.path += '/';
11172|      0|                    url.path += first_base_url_path;
11173|       |                  } else {
11174|       |                    url.append_base_pathname(
11175|       |                        helpers::concat("/", first_base_url_path));
11176|       |                  }
11177|      0|                }
11178|      0|              }
11179|      0|            }
11180|      0|          }
11181|       |
11182|       |          // Set state to path state, and decrease pointer by 1.
11183|     24|          state = state::PATH;
11184|     24|        }
11185|       |
11186|    602|        break;
11187|  82.0k|      }
11188|    578|      case state::FILE_HOST: {
  ------------------
  |  Branch (11188:7): [True: 578, False: 588k]
  ------------------
11189|    578|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
11190|    578|        std::string_view view = url_data.substr(input_position);
11191|       |
11192|    578|        size_t location = view.find_first_of("/\\?");
11193|    578|        std::string_view file_host_buffer = view.substr(
11194|    578|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (11194:16): [True: 563, False: 15]
  ------------------
11195|       |
11196|    578|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (11196:13): [True: 2, False: 576]
  ------------------
11197|      2|          state = state::PATH;
11198|    576|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (11198:20): [True: 207, False: 369]
  ------------------
11199|       |          // Set url's host to the empty string.
11200|    207|          if constexpr (result_type_is_ada_url) {
11201|    207|            url.host = "";
11202|       |          } else {
11203|       |            url.update_base_hostname("");
11204|       |          }
11205|       |          // Set state to path start state.
11206|    207|          state = state::PATH_START;
11207|    369|        } else {
11208|    369|          size_t consumed_bytes = file_host_buffer.size();
11209|    369|          input_position += consumed_bytes;
11210|       |          // Let host be the result of host parsing buffer with url is not
11211|       |          // special.
11212|    369|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (11212:15): [True: 47, False: 322]
  ------------------
11213|     47|            return url;
11214|     47|          }
11215|       |
11216|    322|          if constexpr (result_type_is_ada_url) {
11217|       |            // If host is "localhost", then set host to the empty string.
11218|    322|            if (url.host.has_value() && url.host.value() == "localhost") {
  ------------------
  |  Branch (11218:17): [True: 322, False: 0]
  |  Branch (11218:41): [True: 1, False: 321]
  ------------------
11219|      1|              url.host = "";
11220|      1|            }
11221|       |          } else {
11222|       |            if (url.get_hostname() == "localhost") {
11223|       |              url.update_base_hostname("");
11224|       |            }
11225|       |          }
11226|       |
11227|       |          // Set buffer to the empty string and state to path start state.
11228|    322|          state = state::PATH_START;
11229|    322|        }
11230|       |
11231|    531|        break;
11232|    578|      }
11233|    671|      case state::FILE: {
  ------------------
  |  Branch (11233:7): [True: 671, False: 588k]
  ------------------
11234|    671|        ada_log("FILE ", helpers::substring(url_data, input_position));
11235|    671|        std::string_view file_view = url_data.substr(input_position);
11236|       |
11237|    671|        url.set_protocol_as_file();
11238|    671|        if constexpr (result_type_is_ada_url) {
11239|       |          // Set url's host to the empty string.
11240|    671|          url.host = "";
11241|       |        } else {
11242|       |          url.update_base_hostname("");
11243|       |        }
11244|       |        // If c is U+002F (/) or U+005C (\), then:
11245|    671|        if (input_position != input_size &&
  ------------------
  |  Branch (11245:13): [True: 670, False: 1]
  ------------------
11246|    670|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11246:14): [True: 598, False: 72]
  ------------------
11247|    602|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11247:14): [True: 4, False: 68]
  ------------------
11248|    602|          ada_log("FILE c is U+002F or U+005C");
11249|       |          // Set state to file slash state.
11250|    602|          state = state::FILE_SLASH;
11251|    602|        }
11252|       |        // Otherwise, if base is non-null and base's scheme is "file":
11253|     69|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11253:18): [True: 0, False: 69]
  |  Branch (11253:41): [True: 0, False: 0]
  ------------------
11254|       |          // Set url's host to base's host, url's path to a clone of base's
11255|       |          // path, and url's query to base's query.
11256|      0|          ada_log("FILE base non-null");
11257|      0|          if constexpr (result_type_is_ada_url) {
11258|      0|            url.host = base_url->host;
11259|      0|            url.path = base_url->path;
11260|      0|            url.query = base_url->query;
11261|       |          } else {
11262|       |            url.update_host_to_base_host(base_url->get_hostname());
11263|       |            url.update_base_pathname(base_url->get_pathname());
11264|       |            if (base_url->has_search()) {
11265|       |              // get_search() returns "" for an empty query string (URL ends
11266|       |              // with '?'). update_base_search("") would incorrectly clear the
11267|       |              // query, so pass "?" to preserve the empty query distinction.
11268|       |              auto s = base_url->get_search();
11269|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
11270|       |            }
11271|       |          }
11272|      0|          url.has_opaque_path = base_url->has_opaque_path;
11273|       |
11274|       |          // If c is U+003F (?), then set url's query to the empty string and
11275|       |          // state to query state.
11276|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (11276:15): [True: 0, False: 0]
  |  Branch (11276:47): [True: 0, False: 0]
  ------------------
11277|      0|            state = state::QUERY;
11278|      0|          }
11279|       |          // Otherwise, if c is not the EOF code point:
11280|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (11280:20): [True: 0, False: 0]
  ------------------
11281|       |            // Set url's query to null.
11282|      0|            url.clear_search();
11283|       |            // If the code point substring from pointer to the end of input does
11284|       |            // not start with a Windows drive letter, then shorten url's path.
11285|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (11285:17): [True: 0, False: 0]
  ------------------
11286|      0|              if constexpr (result_type_is_ada_url) {
11287|      0|                helpers::shorten_path(url.path, url.type);
11288|       |              } else {
11289|       |                std::string_view path = url.get_pathname();
11290|       |                if (helpers::shorten_path(path, url.type)) {
11291|       |                  url.update_base_pathname(std::move(std::string(path)));
11292|       |                }
11293|       |              }
11294|      0|            }
11295|       |            // Otherwise:
11296|      0|            else {
11297|       |              // Set url's path to an empty list.
11298|      0|              url.clear_pathname();
11299|      0|              url.has_opaque_path = true;
11300|      0|            }
11301|       |
11302|       |            // Set state to path state and decrease pointer by 1.
11303|      0|            state = state::PATH;
11304|      0|            break;
11305|      0|          }
11306|      0|        }
11307|       |        // Otherwise, set state to path state, and decrease pointer by 1.
11308|     69|        else {
11309|     69|          ada_log("FILE go to path");
11310|     69|          state = state::PATH;
11311|     69|          break;
11312|     69|        }
11313|       |
11314|    602|        input_position++;
11315|    602|        break;
11316|    671|      }
11317|      0|      default:
  ------------------
  |  Branch (11317:7): [True: 0, False: 588k]
  ------------------
11318|      0|        unreachable();
11319|   588k|    }
11320|   588k|  }
11321|   179k|  if constexpr (store_values) {
11322|   179k|    if (fragment.has_value()) {
  ------------------
  |  Branch (11322:9): [True: 1.45k, False: 178k]
  ------------------
11323|  1.45k|      url.update_unencoded_base_hash(*fragment);
11324|  1.45k|    }
11325|   179k|  }
11326|       |  // Check the resulting (normalized) URL size against the maximum input length.
11327|       |  // Normalization (percent-encoding, IDNA, etc.) can expand the URL beyond the
11328|       |  // original input size.
11329|   179k|  if constexpr (store_values) {
11330|   179k|    if (url.is_valid) {
  ------------------
  |  Branch (11330:9): [True: 76.3k, False: 103k]
  ------------------
11331|       |      if constexpr (result_type_is_ada_url_aggregator) {
11332|       |        if (url.buffer.size() > max_input_length) {
11333|       |          url.is_valid = false;
11334|       |        }
11335|  76.3k|      } else {
11336|  76.3k|        if (url.get_href_size() > max_input_length) {
  ------------------
  |  Branch (11336:13): [True: 0, False: 76.3k]
  ------------------
11337|      0|          url.is_valid = false;
11338|      0|        }
11339|  76.3k|      }
11340|  76.3k|    }
11341|   179k|  }
11342|   179k|  return url;
11343|   187k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
10358|   187k|                           const result_type* base_url) {
10359|       |  // We can specialize the implementation per type.
10360|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
10361|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
10362|       |  // something else } is free (at runtime). This means that ada::url_aggregator
10363|       |  // and ada::url **do not have to support the exact same API**.
10364|   187k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
10365|   187k|  constexpr bool result_type_is_ada_url_aggregator =
10366|   187k|      std::is_same_v<url_aggregator, result_type>;
10367|   187k|  static_assert(result_type_is_ada_url ||
10368|   187k|                result_type_is_ada_url_aggregator);  // We don't support
10369|       |                                                     // anything else for now.
10370|       |
10371|   187k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
10372|   187k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
10373|   187k|          ")");
10374|       |
10375|   187k|  state state = state::SCHEME_START;
10376|   187k|  result_type url{};
10377|       |
10378|   187k|  const uint32_t max_input_length = ada::get_max_input_length();
10379|       |
10380|       |  // We refuse to parse URL strings that exceed the maximum input length.
10381|       |  // By default, this is 4GB but can be configured via
10382|       |  // ada::set_max_input_length().
10383|   187k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10383:7): [True: 0, False: 187k]
  ------------------
10384|      0|    url.is_valid = false;
10385|      0|  }
10386|       |  // Going forward, user_input.size() is in [0,
10387|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
10388|       |  // base, or the optional_url was invalid, we must return.
10389|   187k|  if (base_url != nullptr) {
  ------------------
  |  Branch (10389:7): [True: 0, False: 187k]
  ------------------
10390|      0|    url.is_valid &= base_url->is_valid;
10391|      0|  }
10392|   187k|  if (!url.is_valid) {
  ------------------
  |  Branch (10392:7): [True: 0, False: 187k]
  ------------------
10393|      0|    return url;
10394|      0|  }
10395|       |
10396|       |  // Simple absolute http(s) fast path (before tabs/newline scan).
10397|       |  // Skip digit-led hosts (IPv4) with a cheap peek.
10398|   187k|  if constexpr (store_values) {
10399|   187k|    if (base_url == nullptr) {
  ------------------
  |  Branch (10399:9): [True: 187k, False: 0]
  ------------------
10400|   187k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
10401|   187k|      const size_t n = user_input.size();
10402|   187k|      const bool digit_led_host = (n >= 8 && p[4] == ':' && p[5] == '/' &&
  ------------------
  |  Branch (10402:36): [True: 187k, False: 26]
  |  Branch (10402:46): [True: 51.9k, False: 135k]
  |  Branch (10402:61): [True: 51.5k, False: 437]
  ------------------
10403|  51.5k|                                   p[6] == '/' && p[7] >= '0' && p[7] <= '9') ||
  ------------------
  |  Branch (10403:36): [True: 51.4k, False: 102]
  |  Branch (10403:51): [True: 50.3k, False: 1.09k]
  |  Branch (10403:66): [True: 24.2k, False: 26.1k]
  ------------------
10404|   163k|                                  (n >= 9 && p[5] == ':' && p[6] == '/' &&
  ------------------
  |  Branch (10404:36): [True: 163k, False: 77]
  |  Branch (10404:46): [True: 135k, False: 28.2k]
  |  Branch (10404:61): [True: 134k, False: 396]
  ------------------
10405|   134k|                                   p[7] == '/' && p[8] >= '0' && p[8] <= '9');
  ------------------
  |  Branch (10405:36): [True: 134k, False: 36]
  |  Branch (10405:51): [True: 134k, False: 525]
  |  Branch (10405:66): [True: 1.08k, False: 133k]
  ------------------
10406|   187k|      if (!digit_led_host && try_parse_simple_absolute(user_input, url)) {
  ------------------
  |  Branch (10406:11): [True: 162k, False: 25.3k]
  |  Branch (10406:30): [True: 103k, False: 59.0k]
  ------------------
10407|   103k|        if constexpr (result_type_is_ada_url_aggregator) {
10408|   103k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10408:15): [True: 0, False: 103k]
  ------------------
10409|      0|            url.is_valid = false;
10410|      0|          }
10411|       |        } else {
10412|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
10413|       |            url.is_valid = false;
10414|       |          }
10415|       |        }
10416|   103k|        return url;
10417|   103k|      }
10418|   187k|    }
10419|   187k|  }
10420|       |
10421|  84.3k|  std::string tmp_buffer;
10422|   187k|  std::string_view url_data;
10423|   187k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (10423:7): [True: 322, False: 187k]
  ------------------
10424|    322|    tmp_buffer = user_input;
10425|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10426|       |    // just directly build the string from user_input.
10427|    322|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10428|    322|    url_data = tmp_buffer;
10429|   187k|  } else [[likely]] {
10430|   187k|    url_data = user_input;
10431|   187k|  }
10432|       |
10433|       |  // Leading and trailing control characters are uncommon and easy to deal with
10434|       |  // (no performance concern).
10435|   187k|  helpers::trim_c0_whitespace(url_data);
10436|       |
10437|   187k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
10438|       |    // Most of the time, we just need user_input.size().
10439|       |    // In some instances, we may need a bit more.
10440|       |    ///////////////////////////
10441|       |    // This is *very* important. This line should *not* be removed
10442|       |    // hastily. There are principled reasons why reserve is important
10443|       |    // for performance. If you have a benchmark with small inputs,
10444|       |    // it may not matter, but in other instances, it could.
10445|       |    ////
10446|       |    // This rounds up to the next power of two.
10447|       |    // We know that user_input.size() is in [0,
10448|       |    // std::numeric_limits<uint32_t>::max).
10449|   187k|    uint32_t reserve_capacity =
10450|   187k|        (0xFFFFFFFF >>
10451|   187k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
10452|   187k|        1;
10453|   187k|    url.reserve(reserve_capacity);
10454|   187k|  }
10455|       |
10456|       |  // Optimization opportunity. Most websites do not have fragment.
10457|   187k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
10458|       |  // We add it last so that an implementation like ada::url_aggregator
10459|       |  // can append it last to its internal buffer, thus improving performance.
10460|       |
10461|       |  // Here url_data no longer has its fragment.
10462|       |  // We are going to access the data from url_data (it is immutable).
10463|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
10464|       |  // The input_position variable should range from 0 to input_size.
10465|       |  // It is illegal to access url_data at input_size.
10466|   187k|  size_t input_position = 0;
10467|   187k|  const size_t input_size = url_data.size();
10468|       |  // Keep running the following state machine by switching on state.
10469|       |  // If after a run pointer points to the EOF code point, go to the next step.
10470|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
10471|       |  // We never decrement input_position.
10472|   768k|  while (input_position <= input_size) {
  ------------------
  |  Branch (10472:10): [True: 588k, False: 179k]
  ------------------
10473|   588k|    ada_log("In parsing at ", input_position, " out of ", input_size,
10474|   588k|            " in state ", ada::to_string(state));
10475|   588k|    switch (state) {
10476|  84.3k|      case state::SCHEME_START: {
  ------------------
  |  Branch (10476:7): [True: 84.3k, False: 504k]
  ------------------
10477|  84.3k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
10478|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
10479|       |        // state to scheme state.
10480|  84.3k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10480:13): [True: 84.3k, False: 1]
  ------------------
10481|  84.3k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (10481:13): [True: 84.3k, False: 32]
  ------------------
10482|  84.3k|          state = state::SCHEME;
10483|  84.3k|          input_position++;
10484|  84.3k|        } else {
10485|       |          // Otherwise, if state override is not given, set state to no scheme
10486|       |          // state and decrease pointer by 1.
10487|     33|          state = state::NO_SCHEME;
10488|     33|        }
10489|  84.3k|        break;
10490|      0|      }
10491|  84.3k|      case state::SCHEME: {
  ------------------
  |  Branch (10491:7): [True: 84.3k, False: 504k]
  ------------------
10492|  84.3k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
10493|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
10494|       |        // append c, lowercased, to buffer.
10495|   392k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (10495:16): [True: 392k, False: 3]
  ------------------
10496|   392k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (10496:16): [True: 307k, False: 84.3k]
  ------------------
10497|   307k|          input_position++;
10498|   307k|        }
10499|       |        // Otherwise, if c is U+003A (:), then:
10500|  84.3k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10500:13): [True: 84.3k, False: 3]
  ------------------
10501|  84.3k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (10501:13): [True: 84.2k, False: 48]
  ------------------
10502|  84.2k|          ada_log("SCHEME the scheme should be ",
10503|  84.2k|                  url_data.substr(0, input_position));
10504|       |          if constexpr (result_type_is_ada_url) {
10505|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
10506|       |              return url;
10507|       |            }
10508|  84.2k|          } else {
10509|       |            // we pass the colon along instead of painfully adding it back.
10510|  84.2k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (10510:17): [True: 0, False: 84.2k]
  ------------------
10511|  84.2k|                    url_data.substr(0, input_position + 1))) {
10512|      0|              return url;
10513|      0|            }
10514|  84.2k|          }
10515|  84.2k|          ada_log("SCHEME the scheme is ", url.get_protocol());
10516|       |
10517|       |          // If url's scheme is "file", then:
10518|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
10519|  84.2k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (10519:15): [True: 671, False: 83.6k]
  ------------------
10520|       |            // Set state to file state.
10521|    671|            state = state::FILE;
10522|    671|          }
10523|       |          // Otherwise, if url is special, base is non-null, and base's scheme
10524|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
10525|       |          // != nullptr is false.
10526|  83.6k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (10526:20): [True: 82.6k, False: 990]
  |  Branch (10526:40): [True: 0, False: 82.6k]
  ------------------
10527|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (10527:20): [True: 0, False: 0]
  ------------------
10528|       |            // Set state to special relative or authority state.
10529|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
10530|      0|          }
10531|       |          // Otherwise, if url is special, set state to special authority
10532|       |          // slashes state.
10533|  83.6k|          else if (url.is_special()) {
  ------------------
  |  Branch (10533:20): [True: 82.6k, False: 990]
  ------------------
10534|  82.6k|            state = state::SPECIAL_AUTHORITY_SLASHES;
10535|  82.6k|          }
10536|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
10537|       |          // path or authority state and increase pointer by 1.
10538|    990|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (10538:20): [True: 978, False: 12]
  ------------------
10539|    978|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (10539:20): [True: 669, False: 309]
  ------------------
10540|    669|            state = state::PATH_OR_AUTHORITY;
10541|    669|            input_position++;
10542|    669|          }
10543|       |          // Otherwise, set url's path to the empty string and set state to
10544|       |          // opaque path state.
10545|    321|          else {
10546|    321|            state = state::OPAQUE_PATH;
10547|    321|          }
10548|  84.2k|        }
10549|       |        // Otherwise, if state override is not given, set buffer to the empty
10550|       |        // string, state to no scheme state, and start over (from the first code
10551|       |        // point in input).
10552|     51|        else {
10553|     51|          state = state::NO_SCHEME;
10554|     51|          input_position = 0;
10555|     51|          break;
10556|     51|        }
10557|  84.2k|        input_position++;
10558|  84.2k|        break;
10559|  84.3k|      }
10560|     84|      case state::NO_SCHEME: {
  ------------------
  |  Branch (10560:7): [True: 84, False: 588k]
  ------------------
10561|     84|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
10562|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
10563|       |        // validation error, return failure.
10564|     84|        if (base_url == nullptr ||
  ------------------
  |  Branch (10564:13): [True: 84, False: 0]
  ------------------
10565|     84|            (base_url->has_opaque_path && !fragment.has_value())) {
  ------------------
  |  Branch (10565:14): [True: 0, False: 0]
  |  Branch (10565:43): [True: 0, False: 0]
  ------------------
10566|     84|          ada_log("NO_SCHEME validation error");
10567|     84|          url.is_valid = false;
10568|     84|          return url;
10569|     84|        }
10570|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
10571|       |        // set url's scheme to base's scheme, url's path to base's path, url's
10572|       |        // query to base's query, and set state to fragment state.
10573|      0|        else if (base_url->has_opaque_path && fragment.has_value() &&
  ------------------
  |  Branch (10573:18): [True: 0, False: 0]
  |  Branch (10573:47): [True: 0, False: 0]
  ------------------
10574|      0|                 input_position == input_size) {
  ------------------
  |  Branch (10574:18): [True: 0, False: 0]
  ------------------
10575|      0|          ada_log("NO_SCHEME opaque base with fragment");
10576|      0|          url.copy_scheme(*base_url);
10577|      0|          url.has_opaque_path = base_url->has_opaque_path;
10578|       |
10579|       |          if constexpr (result_type_is_ada_url) {
10580|       |            url.path = base_url->path;
10581|       |            url.query = base_url->query;
10582|      0|          } else {
10583|      0|            url.update_base_pathname(base_url->get_pathname());
10584|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (10584:17): [True: 0, False: 0]
  ------------------
10585|       |              // get_search() returns "" for an empty query string (URL ends
10586|       |              // with '?'). update_base_search("") would incorrectly clear the
10587|       |              // query, so pass "?" to preserve the empty query distinction.
10588|      0|              auto s = base_url->get_search();
10589|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (10589:38): [True: 0, False: 0]
  ------------------
10590|      0|            }
10591|      0|          }
10592|      0|          url.update_unencoded_base_hash(*fragment);
10593|      0|          return url;
10594|      0|        }
10595|       |        // Otherwise, if base's scheme is not "file", set state to relative
10596|       |        // state and decrease pointer by 1.
10597|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
10598|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (10598:18): [True: 0, False: 0]
  ------------------
10599|      0|          ada_log("NO_SCHEME non-file relative path");
10600|      0|          state = state::RELATIVE_SCHEME;
10601|      0|        }
10602|       |        // Otherwise, set state to file state and decrease pointer by 1.
10603|      0|        else {
10604|      0|          ada_log("NO_SCHEME file base type");
10605|      0|          state = state::FILE;
10606|      0|        }
10607|      0|        break;
10608|     84|      }
10609|  83.1k|      case state::AUTHORITY: {
  ------------------
  |  Branch (10609:7): [True: 83.1k, False: 505k]
  ------------------
10610|  83.1k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
10611|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
10612|       |        // about AUTHORITY. Of course, we could have @ and still not have to
10613|       |        // worry about AUTHORITY.
10614|       |        // TODO: Instead of just collecting a bool, collect the location of the
10615|       |        // '@' and do something useful with it.
10616|       |        // TODO: We could do various processing early on, using a single pass
10617|       |        // over the string to collect information about it, e.g., telling us
10618|       |        // whether there is a @ and if so, where (or how many).
10619|       |
10620|       |        // Check if url data contains an @.
10621|  83.1k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (10621:13): [True: 70.7k, False: 12.3k]
  ------------------
10622|  70.7k|          state = state::HOST;
10623|  70.7k|          break;
10624|  70.7k|        }
10625|  12.3k|        bool at_sign_seen{false};
10626|  12.3k|        bool password_token_seen{false};
10627|       |        /**
10628|       |         * We expect something of the sort...
10629|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
10630|       |         * --------^
10631|       |         */
10632|  32.1k|        do {
10633|  32.1k|          std::string_view view = url_data.substr(input_position);
10634|       |          // The delimiters are @, /, ? \\.
10635|  32.1k|          size_t location =
10636|  32.1k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (10636:15): [True: 32.0k, False: 134]
  ------------------
10637|  32.1k|                               : helpers::find_authority_delimiter(view);
10638|  32.1k|          std::string_view authority_view = view.substr(0, location);
10639|  32.1k|          size_t end_of_authority = input_position + authority_view.size();
10640|       |          // If c is U+0040 (@), then:
10641|  32.1k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (10641:15): [True: 31.8k, False: 254]
  ------------------
10642|  31.8k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (10642:15): [True: 19.7k, False: 12.1k]
  ------------------
10643|       |            // If atSignSeen is true, then prepend "%40" to buffer.
10644|  19.7k|            if (at_sign_seen) {
  ------------------
  |  Branch (10644:17): [True: 7.53k, False: 12.2k]
  ------------------
10645|  7.53k|              if (password_token_seen) {
  ------------------
  |  Branch (10645:19): [True: 3.70k, False: 3.83k]
  ------------------
10646|       |                if constexpr (result_type_is_ada_url) {
10647|       |                  url.password += "%40";
10648|  3.70k|                } else {
10649|  3.70k|                  url.append_base_password("%40");
10650|  3.70k|                }
10651|  3.83k|              } else {
10652|       |                if constexpr (result_type_is_ada_url) {
10653|       |                  url.username += "%40";
10654|  3.83k|                } else {
10655|  3.83k|                  url.append_base_username("%40");
10656|  3.83k|                }
10657|  3.83k|              }
10658|  7.53k|            }
10659|       |
10660|  19.7k|            at_sign_seen = true;
10661|       |
10662|  19.7k|            if (!password_token_seen) {
  ------------------
  |  Branch (10662:17): [True: 16.0k, False: 3.70k]
  ------------------
10663|  16.0k|              size_t password_token_location = authority_view.find(':');
10664|  16.0k|              password_token_seen =
10665|  16.0k|                  password_token_location != std::string_view::npos;
10666|       |
10667|  16.0k|              if constexpr (store_values) {
10668|  16.0k|                if (!password_token_seen) {
  ------------------
  |  Branch (10668:21): [True: 4.37k, False: 11.6k]
  ------------------
10669|       |                  if constexpr (result_type_is_ada_url) {
10670|       |                    url.username += unicode::percent_encode(
10671|       |                        authority_view,
10672|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10673|  4.37k|                  } else {
10674|  4.37k|                    url.append_base_username(unicode::percent_encode(
10675|  4.37k|                        authority_view,
10676|  4.37k|                        character_sets::USERINFO_PERCENT_ENCODE));
10677|  4.37k|                  }
10678|  11.6k|                } else {
10679|       |                  if constexpr (result_type_is_ada_url) {
10680|       |                    url.username += unicode::percent_encode(
10681|       |                        authority_view.substr(0, password_token_location),
10682|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10683|       |                    url.password += unicode::percent_encode(
10684|       |                        authority_view.substr(password_token_location + 1),
10685|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10686|  11.6k|                  } else {
10687|  11.6k|                    url.append_base_username(unicode::percent_encode(
10688|  11.6k|                        authority_view.substr(0, password_token_location),
10689|  11.6k|                        character_sets::USERINFO_PERCENT_ENCODE));
10690|  11.6k|                    url.append_base_password(unicode::percent_encode(
10691|  11.6k|                        authority_view.substr(password_token_location + 1),
10692|  11.6k|                        character_sets::USERINFO_PERCENT_ENCODE));
10693|  11.6k|                  }
10694|  11.6k|                }
10695|  16.0k|              }
10696|  16.0k|            } else if constexpr (store_values) {
10697|       |              if constexpr (result_type_is_ada_url) {
10698|       |                url.password += unicode::percent_encode(
10699|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
10700|  3.70k|              } else {
10701|  3.70k|                url.append_base_password(unicode::percent_encode(
10702|  3.70k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
10703|  3.70k|              }
10704|  3.70k|            }
10705|  19.7k|          }
10706|       |          // Otherwise, if one of the following is true:
10707|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
10708|       |          // - url is special and c is U+005C (\)
10709|  12.3k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (10709:20): [True: 254, False: 12.1k]
  ------------------
10710|  12.1k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (10710:20): [True: 12.0k, False: 100]
  ------------------
10711|    100|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (10711:20): [True: 65, False: 35]
  ------------------
10712|  12.3k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (10712:21): [True: 35, False: 0]
  |  Branch (10712:41): [True: 35, False: 0]
  ------------------
10713|       |            // If atSignSeen is true and authority_view is the empty string,
10714|       |            // validation error, return failure.
10715|  12.3k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (10715:17): [True: 12.2k, False: 164]
  |  Branch (10715:33): [True: 92, False: 12.1k]
  ------------------
10716|     92|              url.is_valid = false;
10717|     92|              return url;
10718|     92|            }
10719|  12.2k|            state = state::HOST;
10720|  12.2k|            break;
10721|  12.3k|          }
10722|  19.7k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (10722:15): [True: 0, False: 19.7k]
  ------------------
10723|      0|            if constexpr (store_values) {
10724|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (10724:19): [True: 0, False: 0]
  ------------------
10725|      0|                url.update_unencoded_base_hash(*fragment);
10726|      0|              }
10727|      0|            }
10728|      0|            return url;
10729|      0|          }
10730|  19.7k|          input_position = end_of_authority + 1;
10731|  19.7k|        } while (true);
  ------------------
  |  Branch (10731:18): [True: 19.7k, Folded]
  ------------------
10732|       |
10733|  12.2k|        break;
10734|  12.3k|      }
10735|  12.2k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (10735:7): [True: 0, False: 588k]
  ------------------
10736|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
10737|      0|                helpers::substring(url_data, input_position));
10738|       |
10739|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
10740|       |        // then set state to special authority ignore slashes state and increase
10741|       |        // pointer by 1.
10742|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (10742:13): [True: 0, False: 0]
  ------------------
10743|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
10744|      0|          input_position += 2;
10745|      0|        } else {
10746|       |          // Otherwise, validation error, set state to relative state and
10747|       |          // decrease pointer by 1.
10748|      0|          state = state::RELATIVE_SCHEME;
10749|      0|        }
10750|       |
10751|      0|        break;
10752|  12.3k|      }
10753|    669|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (10753:7): [True: 669, False: 588k]
  ------------------
10754|    669|        ada_log("PATH_OR_AUTHORITY ",
10755|    669|                helpers::substring(url_data, input_position));
10756|       |
10757|       |        // If c is U+002F (/), then set state to authority state.
10758|    669|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10758:13): [True: 654, False: 15]
  ------------------
10759|    654|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10759:13): [True: 525, False: 129]
  ------------------
10760|    525|          state = state::AUTHORITY;
10761|    525|          input_position++;
10762|    525|        } else {
10763|       |          // Otherwise, set state to path state, and decrease pointer by 1.
10764|    144|          state = state::PATH;
10765|    144|        }
10766|       |
10767|    669|        break;
10768|  12.3k|      }
10769|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (10769:7): [True: 0, False: 588k]
  ------------------
10770|      0|        ada_log("RELATIVE_SCHEME ",
10771|      0|                helpers::substring(url_data, input_position));
10772|       |
10773|       |        // Set url's scheme to base's scheme.
10774|      0|        url.copy_scheme(*base_url);
10775|       |
10776|       |        // If c is U+002F (/), then set state to relative slash state.
10777|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10777:13): [True: 0, False: 0]
  ------------------
10778|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
10779|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10779:13): [True: 0, False: 0]
  ------------------
10780|      0|          ada_log(
10781|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
10782|      0|              "slash state");
10783|      0|          state = state::RELATIVE_SLASH;
10784|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (10784:20): [True: 0, False: 0]
  |  Branch (10784:40): [True: 0, False: 0]
  ------------------
10785|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (10785:20): [True: 0, False: 0]
  ------------------
10786|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
10787|       |          // set state to relative slash state.
10788|      0|          ada_log(
10789|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
10790|      0|              "error, set state to relative slash state");
10791|      0|          state = state::RELATIVE_SLASH;
10792|      0|        } else {
10793|      0|          ada_log("RELATIVE_SCHEME otherwise");
10794|       |          // Set url's username to base's username, url's password to base's
10795|       |          // password, url's host to base's host, url's port to base's port,
10796|       |          // url's path to a clone of base's path, and url's query to base's
10797|       |          // query.
10798|       |          if constexpr (result_type_is_ada_url) {
10799|       |            url.username = base_url->username;
10800|       |            url.password = base_url->password;
10801|       |            url.host = base_url->host;
10802|       |            url.port = base_url->port;
10803|       |            // cloning the base path includes cloning the has_opaque_path flag
10804|       |            url.has_opaque_path = base_url->has_opaque_path;
10805|       |            url.path = base_url->path;
10806|       |            url.query = base_url->query;
10807|      0|          } else {
10808|      0|            url.update_base_authority(base_url->get_href(),
10809|      0|                                      base_url->get_components());
10810|      0|            url.update_host_to_base_host(base_url->get_hostname());
10811|      0|            url.update_base_port(base_url->retrieve_base_port());
10812|       |            // cloning the base path includes cloning the has_opaque_path flag
10813|      0|            url.has_opaque_path = base_url->has_opaque_path;
10814|      0|            url.update_base_pathname(base_url->get_pathname());
10815|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (10815:17): [True: 0, False: 0]
  ------------------
10816|       |              // get_search() returns "" for an empty query string (URL ends
10817|       |              // with '?'). update_base_search("") would incorrectly clear the
10818|       |              // query, so pass "?" to preserve the empty query distinction.
10819|      0|              auto s = base_url->get_search();
10820|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (10820:38): [True: 0, False: 0]
  ------------------
10821|      0|            }
10822|      0|          }
10823|       |
10824|      0|          url.has_opaque_path = base_url->has_opaque_path;
10825|       |
10826|       |          // If c is U+003F (?), then set url's query to the empty string, and
10827|       |          // state to query state.
10828|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (10828:15): [True: 0, False: 0]
  ------------------
10829|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (10829:15): [True: 0, False: 0]
  ------------------
10830|      0|            state = state::QUERY;
10831|      0|          }
10832|       |          // Otherwise, if c is not the EOF code point:
10833|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (10833:20): [True: 0, False: 0]
  ------------------
10834|       |            // Set url's query to null.
10835|      0|            url.clear_search();
10836|       |            if constexpr (result_type_is_ada_url) {
10837|       |              // Shorten url's path.
10838|       |              helpers::shorten_path(url.path, url.type);
10839|      0|            } else {
10840|      0|              std::string_view path = url.get_pathname();
10841|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (10841:19): [True: 0, False: 0]
  ------------------
10842|      0|                url.update_base_pathname(std::move(std::string(path)));
10843|      0|              }
10844|      0|            }
10845|       |            // Set state to path state and decrease pointer by 1.
10846|      0|            state = state::PATH;
10847|      0|            break;
10848|      0|          }
10849|      0|        }
10850|      0|        input_position++;
10851|      0|        break;
10852|      0|      }
10853|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (10853:7): [True: 0, False: 588k]
  ------------------
10854|      0|        ada_log("RELATIVE_SLASH ",
10855|      0|                helpers::substring(url_data, input_position));
10856|       |
10857|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
10858|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
10859|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (10859:13): [True: 0, False: 0]
  |  Branch (10859:33): [True: 0, False: 0]
  ------------------
10860|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (10860:14): [True: 0, False: 0]
  ------------------
10861|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (10861:14): [True: 0, False: 0]
  ------------------
10862|       |          // Set state to special authority ignore slashes state.
10863|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
10864|      0|        }
10865|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
10866|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (10866:18): [True: 0, False: 0]
  ------------------
10867|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10867:18): [True: 0, False: 0]
  ------------------
10868|      0|          state = state::AUTHORITY;
10869|      0|        }
10870|       |        // Otherwise, set
10871|       |        // - url's username to base's username,
10872|       |        // - url's password to base's password,
10873|       |        // - url's host to base's host,
10874|       |        // - url's port to base's port,
10875|       |        // - state to path state, and then, decrease pointer by 1.
10876|      0|        else {
10877|       |          if constexpr (result_type_is_ada_url) {
10878|       |            url.username = base_url->username;
10879|       |            url.password = base_url->password;
10880|       |            url.host = base_url->host;
10881|       |            url.port = base_url->port;
10882|      0|          } else {
10883|      0|            url.update_base_authority(base_url->get_href(),
10884|      0|                                      base_url->get_components());
10885|      0|            url.update_host_to_base_host(base_url->get_hostname());
10886|      0|            url.update_base_port(base_url->retrieve_base_port());
10887|      0|          }
10888|      0|          state = state::PATH;
10889|      0|          break;
10890|      0|        }
10891|       |
10892|      0|        input_position++;
10893|      0|        break;
10894|      0|      }
10895|  82.6k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (10895:7): [True: 82.6k, False: 506k]
  ------------------
10896|  82.6k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
10897|  82.6k|                helpers::substring(url_data, input_position));
10898|       |
10899|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
10900|       |        // then set state to special authority ignore slashes state and increase
10901|       |        // pointer by 1.
10902|  82.6k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (10902:13): [True: 81.9k, False: 707]
  ------------------
10903|  81.9k|          input_position += 2;
10904|  81.9k|        }
10905|       |
10906|  82.6k|        [[fallthrough]];
10907|  82.6k|      }
10908|  82.6k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (10908:7): [True: 0, False: 588k]
  ------------------
10909|  82.6k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
10910|  82.6k|                helpers::substring(url_data, input_position));
10911|       |
10912|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
10913|       |        // authority state and decrease pointer by 1.
10914|  84.1k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (10914:16): [True: 84.0k, False: 52]
  ------------------
10915|  84.0k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (10915:17): [True: 582, False: 83.4k]
  ------------------
10916|  83.4k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (10916:17): [True: 913, False: 82.5k]
  ------------------
10917|  1.49k|          input_position++;
10918|  1.49k|        }
10919|  82.6k|        state = state::AUTHORITY;
10920|       |
10921|  82.6k|        break;
10922|  82.6k|      }
10923|  5.24k|      case state::QUERY: {
  ------------------
  |  Branch (10923:7): [True: 5.24k, False: 583k]
  ------------------
10924|  5.24k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
10925|  5.24k|        if constexpr (store_values) {
10926|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
10927|       |          // if url is special; otherwise the query percent-encode set.
10928|  5.24k|          const uint8_t* query_percent_encode_set =
10929|  5.24k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (10929:15): [True: 4.60k, False: 636]
  ------------------
10930|  5.24k|                               : character_sets::QUERY_PERCENT_ENCODE;
10931|       |
10932|       |          // Percent-encode after encoding, with encoding, buffer, and
10933|       |          // queryPercentEncodeSet, and append the result to url's query.
10934|  5.24k|          url.update_base_search(url_data.substr(input_position),
10935|  5.24k|                                 query_percent_encode_set);
10936|  5.24k|          ada_log("QUERY update_base_search completed ");
10937|  5.24k|          if (fragment.has_value()) {
  ------------------
  |  Branch (10937:15): [True: 3.78k, False: 1.45k]
  ------------------
10938|  3.78k|            url.update_unencoded_base_hash(*fragment);
10939|  3.78k|          }
10940|  5.24k|        }
10941|  5.24k|        return url;
10942|  82.6k|      }
10943|  83.0k|      case state::HOST: {
  ------------------
  |  Branch (10943:7): [True: 83.0k, False: 505k]
  ------------------
10944|  83.0k|        ada_log("HOST ", helpers::substring(url_data, input_position));
10945|       |
10946|  83.0k|        std::string_view host_view = url_data.substr(input_position);
10947|  83.0k|        auto [location, found_colon] =
10948|  83.0k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
10949|  83.0k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (10949:26): [True: 83.0k, False: 0]
  ------------------
10950|  83.0k|                             ? input_position + location
10951|  83.0k|                             : input_size;
10952|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
10953|       |        // Note: the 'found_colon' value is true if and only if a colon was
10954|       |        // encountered while not inside brackets.
10955|  83.0k|        if (found_colon) {
  ------------------
  |  Branch (10955:13): [True: 12.8k, False: 70.2k]
  ------------------
10956|       |          // If buffer is the empty string, validation error, return failure.
10957|       |          // Let host be the result of host parsing buffer with url is not
10958|       |          // special.
10959|  12.8k|          ada_log("HOST parsing ", host_view);
10960|  12.8k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (10960:15): [True: 164, False: 12.6k]
  ------------------
10961|    164|            return url;
10962|    164|          }
10963|  12.6k|          ada_log("HOST parsing results in ", url.get_hostname());
10964|       |          // Set url's host to host, buffer to the empty string, and state to
10965|       |          // port state.
10966|  12.6k|          state = state::PORT;
10967|  12.6k|          input_position++;
10968|  12.6k|        }
10969|       |        // Otherwise, if one of the following is true:
10970|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
10971|       |        // - url is special and c is U+005C (\)
10972|       |        // The get_host_delimiter_location function either brings us to
10973|       |        // the colon outside of the bracket, or to one of those characters.
10974|  70.2k|        else {
10975|       |          // If url is special and host_view is the empty string, validation
10976|       |          // error, return failure.
10977|  70.2k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (10977:15): [True: 96, False: 70.1k]
  |  Branch (10977:36): [True: 63, False: 33]
  ------------------
10978|     63|            url.is_valid = false;
10979|     63|            return url;
10980|     63|          }
10981|  70.1k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
10982|       |          // Let host be the result of host parsing host_view with url is not
10983|       |          // special.
10984|  70.1k|          if (host_view.empty()) {
  ------------------
  |  Branch (10984:15): [True: 33, False: 70.1k]
  ------------------
10985|     33|            url.update_base_hostname("");
10986|  70.1k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (10986:22): [True: 1.21k, False: 68.9k]
  ------------------
10987|  1.21k|            return url;
10988|  1.21k|          }
10989|  68.9k|          ada_log("HOST parsing results in ", url.get_hostname(),
10990|  68.9k|                  " href=", url.get_href());
10991|       |
10992|       |          // Set url's host to host, and state to path start state.
10993|  68.9k|          state = state::PATH_START;
10994|  68.9k|        }
10995|       |
10996|  81.6k|        break;
10997|  83.0k|      }
10998|  81.6k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (10998:7): [True: 321, False: 588k]
  ------------------
10999|    321|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
11000|       |        // Opaque path, query, and fragment are structurally always valid:
11001|       |        // the parser would just percent-encode whatever is there. When we
11002|       |        // are not storing values (can_parse), we can return immediately.
11003|       |        // We must set has_opaque_path = true before returning so that when
11004|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
11005|       |        // correctly rejects relative inputs against an opaque-path base
11006|       |        // (e.g. can_parse("", &"W:") must return false).
11007|       |        if constexpr (!store_values) {
11008|       |          url.has_opaque_path = true;
11009|       |          return url;
11010|       |        }
11011|    321|        std::string_view view = url_data.substr(input_position);
11012|       |        // If c is U+003F (?), then set url's query to the empty string and
11013|       |        // state to query state.
11014|    321|        size_t location = view.find('?');
11015|    321|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (11015:13): [True: 210, False: 111]
  ------------------
11016|    210|          view.remove_suffix(view.size() - location);
11017|    210|          state = state::QUERY;
11018|    210|          input_position += location + 1;
11019|    210|        } else {
11020|    111|          input_position = input_size + 1;
11021|    111|        }
11022|    321|        url.has_opaque_path = true;
11023|       |
11024|       |        // This is a really unlikely scenario in real world. We should not seek
11025|       |        // to optimize it.
11026|    321|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (11026:13): [True: 10, False: 311]
  ------------------
11027|     10|          std::string modified_view =
11028|     10|              std::string(view.substr(0, view.size() - 1)) + "%20";
11029|     10|          url.update_base_pathname(unicode::percent_encode(
11030|     10|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11031|    311|        } else {
11032|    311|          url.update_base_pathname(unicode::percent_encode(
11033|    311|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11034|    311|        }
11035|    321|        break;
11036|  83.0k|      }
11037|  12.6k|      case state::PORT: {
  ------------------
  |  Branch (11037:7): [True: 12.6k, False: 576k]
  ------------------
11038|  12.6k|        ada_log("PORT ", helpers::substring(url_data, input_position));
11039|  12.6k|        std::string_view port_view = url_data.substr(input_position);
11040|  12.6k|        input_position += url.parse_port(port_view, true);
11041|  12.6k|        if (!url.is_valid) {
  ------------------
  |  Branch (11041:13): [True: 144, False: 12.5k]
  ------------------
11042|    144|          return url;
11043|    144|        }
11044|  12.5k|        state = state::PATH_START;
11045|  12.5k|        [[fallthrough]];
11046|  12.5k|      }
11047|  82.0k|      case state::PATH_START: {
  ------------------
  |  Branch (11047:7): [True: 69.4k, False: 519k]
  ------------------
11048|  82.0k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
11049|       |        // Path, query, and fragment are structurally always valid: the
11050|       |        // parser would just percent-encode whatever is there. When we are
11051|       |        // not storing values (can_parse), we can return immediately since
11052|       |        // no subsequent state can invalidate the URL.
11053|       |        if constexpr (!store_values) {
11054|       |          return url;
11055|       |        }
11056|       |
11057|       |        // If url is special, then:
11058|  82.0k|        if (url.is_special()) {
  ------------------
  |  Branch (11058:13): [True: 81.5k, False: 471]
  ------------------
11059|       |          // Set state to path state.
11060|  81.5k|          state = state::PATH;
11061|       |
11062|       |          // Optimization: Avoiding going into PATH state improves the
11063|       |          // performance of urls ending with /.
11064|  81.5k|          if (input_position == input_size) {
  ------------------
  |  Branch (11064:15): [True: 976, False: 80.5k]
  ------------------
11065|    976|            if constexpr (store_values) {
11066|    976|              url.update_base_pathname("/");
11067|    976|              if (fragment.has_value()) {
  ------------------
  |  Branch (11067:19): [True: 216, False: 760]
  ------------------
11068|    216|                url.update_unencoded_base_hash(*fragment);
11069|    216|              }
11070|    976|            }
11071|    976|            return url;
11072|    976|          }
11073|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
11074|       |          // by 1. We know that (input_position == input_size) is impossible
11075|       |          // here, because of the previous if-check.
11076|  80.5k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (11076:15): [True: 501, False: 80.0k]
  ------------------
11077|    501|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (11077:15): [True: 309, False: 192]
  ------------------
11078|    309|            break;
11079|    309|          }
11080|  80.5k|        }
11081|       |        // Otherwise, if state override is not given and c is U+003F (?),
11082|       |        // set url's query to the empty string and state to query state.
11083|    471|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (11083:18): [True: 378, False: 93]
  ------------------
11084|    378|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (11084:18): [True: 75, False: 303]
  ------------------
11085|     75|          state = state::QUERY;
11086|     75|        }
11087|       |        // Otherwise, if c is not the EOF code point:
11088|    396|        else if (input_position != input_size) {
  ------------------
  |  Branch (11088:18): [True: 303, False: 93]
  ------------------
11089|       |          // Set state to path state.
11090|    303|          state = state::PATH;
11091|       |
11092|       |          // If c is not U+002F (/), then decrease pointer by 1.
11093|    303|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (11093:15): [True: 0, False: 303]
  ------------------
11094|      0|            break;
11095|      0|          }
11096|    303|        }
11097|       |
11098|  80.7k|        input_position++;
11099|  80.7k|        break;
11100|  82.0k|      }
11101|  81.1k|      case state::PATH: {
  ------------------
  |  Branch (11101:7): [True: 81.1k, False: 507k]
  ------------------
11102|  81.1k|        ada_log("PATH ", helpers::substring(url_data, input_position));
11103|       |        // Path, query, and fragment are structurally always valid: the
11104|       |        // parser would just percent-encode whatever is there. When we are
11105|       |        // not storing values (can_parse), we can return immediately since
11106|       |        // no subsequent state can invalidate the URL.
11107|       |        if constexpr (!store_values) {
11108|       |          return url;
11109|       |        }
11110|  81.1k|        std::string_view view = url_data.substr(input_position);
11111|       |
11112|       |        // Most time, we do not need percent encoding.
11113|       |        // Furthermore, we can immediately locate the '?'.
11114|  81.1k|        size_t locofquestionmark = view.find('?');
11115|  81.1k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (11115:13): [True: 4.95k, False: 76.1k]
  ------------------
11116|  4.95k|          state = state::QUERY;
11117|  4.95k|          view.remove_suffix(view.size() - locofquestionmark);
11118|  4.95k|          input_position += locofquestionmark + 1;
11119|  76.1k|        } else {
11120|  76.1k|          input_position = input_size + 1;
11121|  76.1k|        }
11122|  81.1k|        if constexpr (store_values) {
11123|       |          if constexpr (result_type_is_ada_url) {
11124|       |            helpers::parse_prepared_path(view, url.type, url.path);
11125|  81.1k|          } else {
11126|  81.1k|            url.consume_prepared_path(view);
11127|  81.1k|            ADA_ASSERT_TRUE(url.validate());
11128|  81.1k|          }
11129|  81.1k|        }
11130|  81.1k|        break;
11131|  82.0k|      }
11132|    602|      case state::FILE_SLASH: {
  ------------------
  |  Branch (11132:7): [True: 602, False: 588k]
  ------------------
11133|    602|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
11134|       |
11135|       |        // If c is U+002F (/) or U+005C (\), then:
11136|    602|        if ((input_position != input_size) &&
  ------------------
  |  Branch (11136:13): [True: 601, False: 1]
  ------------------
11137|    601|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11137:14): [True: 575, False: 26]
  ------------------
11138|    578|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11138:14): [True: 3, False: 23]
  ------------------
11139|    578|          ada_log("FILE_SLASH c is U+002F or U+005C");
11140|       |          // Set state to file host state.
11141|    578|          state = state::FILE_HOST;
11142|    578|          input_position++;
11143|    578|        } else {
11144|     24|          ada_log("FILE_SLASH otherwise");
11145|       |          // If base is non-null and base's scheme is "file", then:
11146|       |          // Note: it is unsafe to do base_url->scheme unless you know that
11147|       |          // base_url_has_value() is true.
11148|     24|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11148:15): [True: 0, False: 24]
  |  Branch (11148:38): [True: 0, False: 0]
  ------------------
11149|       |            // Set url's host to base's host.
11150|       |            if constexpr (result_type_is_ada_url) {
11151|       |              url.host = base_url->host;
11152|      0|            } else {
11153|      0|              url.update_host_to_base_host(base_url->get_host());
11154|      0|            }
11155|       |            // If the code point substring from pointer to the end of input does
11156|       |            // not start with a Windows drive letter and base's path[0] is a
11157|       |            // normalized Windows drive letter, then append base's path[0] to
11158|       |            // url's path.
11159|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (11159:17): [True: 0, False: 0]
  ------------------
11160|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (11160:19): [True: 0, False: 0]
  ------------------
11161|      0|                      url_data.substr(input_position))) {
11162|      0|                std::string_view first_base_url_path =
11163|      0|                    base_url->get_pathname().substr(1);
11164|      0|                size_t loc = first_base_url_path.find('/');
11165|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (11165:21): [True: 0, False: 0]
  ------------------
11166|      0|                  helpers::resize(first_base_url_path, loc);
11167|      0|                }
11168|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (11168:21): [True: 0, False: 0]
  ------------------
11169|      0|                        first_base_url_path)) {
11170|       |                  if constexpr (result_type_is_ada_url) {
11171|       |                    url.path += '/';
11172|       |                    url.path += first_base_url_path;
11173|      0|                  } else {
11174|      0|                    url.append_base_pathname(
11175|      0|                        helpers::concat("/", first_base_url_path));
11176|      0|                  }
11177|      0|                }
11178|      0|              }
11179|      0|            }
11180|      0|          }
11181|       |
11182|       |          // Set state to path state, and decrease pointer by 1.
11183|     24|          state = state::PATH;
11184|     24|        }
11185|       |
11186|    602|        break;
11187|  82.0k|      }
11188|    578|      case state::FILE_HOST: {
  ------------------
  |  Branch (11188:7): [True: 578, False: 588k]
  ------------------
11189|    578|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
11190|    578|        std::string_view view = url_data.substr(input_position);
11191|       |
11192|    578|        size_t location = view.find_first_of("/\\?");
11193|    578|        std::string_view file_host_buffer = view.substr(
11194|    578|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (11194:16): [True: 563, False: 15]
  ------------------
11195|       |
11196|    578|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (11196:13): [True: 2, False: 576]
  ------------------
11197|      2|          state = state::PATH;
11198|    576|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (11198:20): [True: 207, False: 369]
  ------------------
11199|       |          // Set url's host to the empty string.
11200|       |          if constexpr (result_type_is_ada_url) {
11201|       |            url.host = "";
11202|    207|          } else {
11203|    207|            url.update_base_hostname("");
11204|    207|          }
11205|       |          // Set state to path start state.
11206|    207|          state = state::PATH_START;
11207|    369|        } else {
11208|    369|          size_t consumed_bytes = file_host_buffer.size();
11209|    369|          input_position += consumed_bytes;
11210|       |          // Let host be the result of host parsing buffer with url is not
11211|       |          // special.
11212|    369|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (11212:15): [True: 47, False: 322]
  ------------------
11213|     47|            return url;
11214|     47|          }
11215|       |
11216|       |          if constexpr (result_type_is_ada_url) {
11217|       |            // If host is "localhost", then set host to the empty string.
11218|       |            if (url.host.has_value() && url.host.value() == "localhost") {
11219|       |              url.host = "";
11220|       |            }
11221|    322|          } else {
11222|    322|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (11222:17): [True: 1, False: 321]
  ------------------
11223|      1|              url.update_base_hostname("");
11224|      1|            }
11225|    322|          }
11226|       |
11227|       |          // Set buffer to the empty string and state to path start state.
11228|    322|          state = state::PATH_START;
11229|    322|        }
11230|       |
11231|    531|        break;
11232|    578|      }
11233|    671|      case state::FILE: {
  ------------------
  |  Branch (11233:7): [True: 671, False: 588k]
  ------------------
11234|    671|        ada_log("FILE ", helpers::substring(url_data, input_position));
11235|    671|        std::string_view file_view = url_data.substr(input_position);
11236|       |
11237|    671|        url.set_protocol_as_file();
11238|       |        if constexpr (result_type_is_ada_url) {
11239|       |          // Set url's host to the empty string.
11240|       |          url.host = "";
11241|    671|        } else {
11242|    671|          url.update_base_hostname("");
11243|    671|        }
11244|       |        // If c is U+002F (/) or U+005C (\), then:
11245|    671|        if (input_position != input_size &&
  ------------------
  |  Branch (11245:13): [True: 670, False: 1]
  ------------------
11246|    670|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11246:14): [True: 598, False: 72]
  ------------------
11247|    602|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11247:14): [True: 4, False: 68]
  ------------------
11248|    602|          ada_log("FILE c is U+002F or U+005C");
11249|       |          // Set state to file slash state.
11250|    602|          state = state::FILE_SLASH;
11251|    602|        }
11252|       |        // Otherwise, if base is non-null and base's scheme is "file":
11253|     69|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11253:18): [True: 0, False: 69]
  |  Branch (11253:41): [True: 0, False: 0]
  ------------------
11254|       |          // Set url's host to base's host, url's path to a clone of base's
11255|       |          // path, and url's query to base's query.
11256|      0|          ada_log("FILE base non-null");
11257|       |          if constexpr (result_type_is_ada_url) {
11258|       |            url.host = base_url->host;
11259|       |            url.path = base_url->path;
11260|       |            url.query = base_url->query;
11261|      0|          } else {
11262|      0|            url.update_host_to_base_host(base_url->get_hostname());
11263|      0|            url.update_base_pathname(base_url->get_pathname());
11264|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (11264:17): [True: 0, False: 0]
  ------------------
11265|       |              // get_search() returns "" for an empty query string (URL ends
11266|       |              // with '?'). update_base_search("") would incorrectly clear the
11267|       |              // query, so pass "?" to preserve the empty query distinction.
11268|      0|              auto s = base_url->get_search();
11269|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (11269:38): [True: 0, False: 0]
  ------------------
11270|      0|            }
11271|      0|          }
11272|      0|          url.has_opaque_path = base_url->has_opaque_path;
11273|       |
11274|       |          // If c is U+003F (?), then set url's query to the empty string and
11275|       |          // state to query state.
11276|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (11276:15): [True: 0, False: 0]
  |  Branch (11276:47): [True: 0, False: 0]
  ------------------
11277|      0|            state = state::QUERY;
11278|      0|          }
11279|       |          // Otherwise, if c is not the EOF code point:
11280|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (11280:20): [True: 0, False: 0]
  ------------------
11281|       |            // Set url's query to null.
11282|      0|            url.clear_search();
11283|       |            // If the code point substring from pointer to the end of input does
11284|       |            // not start with a Windows drive letter, then shorten url's path.
11285|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (11285:17): [True: 0, False: 0]
  ------------------
11286|       |              if constexpr (result_type_is_ada_url) {
11287|       |                helpers::shorten_path(url.path, url.type);
11288|      0|              } else {
11289|      0|                std::string_view path = url.get_pathname();
11290|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (11290:21): [True: 0, False: 0]
  ------------------
11291|      0|                  url.update_base_pathname(std::move(std::string(path)));
11292|      0|                }
11293|      0|              }
11294|      0|            }
11295|       |            // Otherwise:
11296|      0|            else {
11297|       |              // Set url's path to an empty list.
11298|      0|              url.clear_pathname();
11299|      0|              url.has_opaque_path = true;
11300|      0|            }
11301|       |
11302|       |            // Set state to path state and decrease pointer by 1.
11303|      0|            state = state::PATH;
11304|      0|            break;
11305|      0|          }
11306|      0|        }
11307|       |        // Otherwise, set state to path state, and decrease pointer by 1.
11308|     69|        else {
11309|     69|          ada_log("FILE go to path");
11310|     69|          state = state::PATH;
11311|     69|          break;
11312|     69|        }
11313|       |
11314|    602|        input_position++;
11315|    602|        break;
11316|    671|      }
11317|      0|      default:
  ------------------
  |  Branch (11317:7): [True: 0, False: 588k]
  ------------------
11318|      0|        unreachable();
11319|   588k|    }
11320|   588k|  }
11321|   179k|  if constexpr (store_values) {
11322|   179k|    if (fragment.has_value()) {
  ------------------
  |  Branch (11322:9): [True: 1.45k, False: 178k]
  ------------------
11323|  1.45k|      url.update_unencoded_base_hash(*fragment);
11324|  1.45k|    }
11325|   179k|  }
11326|       |  // Check the resulting (normalized) URL size against the maximum input length.
11327|       |  // Normalization (percent-encoding, IDNA, etc.) can expand the URL beyond the
11328|       |  // original input size.
11329|   179k|  if constexpr (store_values) {
11330|   179k|    if (url.is_valid) {
  ------------------
  |  Branch (11330:9): [True: 76.3k, False: 103k]
  ------------------
11331|  76.3k|      if constexpr (result_type_is_ada_url_aggregator) {
11332|  76.3k|        if (url.buffer.size() > max_input_length) {
  ------------------
  |  Branch (11332:13): [True: 0, False: 76.3k]
  ------------------
11333|      0|          url.is_valid = false;
11334|      0|        }
11335|       |      } else {
11336|       |        if (url.get_href_size() > max_input_length) {
11337|       |          url.is_valid = false;
11338|       |        }
11339|       |      }
11340|  76.3k|    }
11341|   179k|  }
11342|   179k|  return url;
11343|   187k|}
_ZN3ada14url_aggregator8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11867|  62.0k|bool url_aggregator::set_href(const std::string_view input) {
11868|  62.0k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
11869|  62.0k|  ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
11870|  62.0k|  ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
11871|  62.0k|  ada_log("url_aggregator::set_href, success :", out.has_value());
11872|       |
11873|  62.0k|  if (out) {
  ------------------
  |  Branch (11873:7): [True: 62.0k, False: 0]
  ------------------
11874|       |    // The parser enforces get_max_input_length() on both the input and the
11875|       |    // normalized result. This is a defense-in-depth check.
11876|  62.0k|    if (out->buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (11876:9): [True: 0, False: 62.0k]
  ------------------
11877|      0|      return false;
11878|      0|    }
11879|  62.0k|    ada_log("url_aggregator::set_href, parsed ", out->to_string());
11880|       |    // TODO: Figure out why the following line puts test to never finish.
11881|  62.0k|    *this = *out;
11882|  62.0k|  }
11883|       |
11884|  62.0k|  return out.has_value();
11885|  62.0k|}
_ZNK3ada14url_aggregator12get_usernameEv:
12177|  62.0k|    ada_lifetime_bound {
12178|  62.0k|  ada_log("url_aggregator::get_username");
12179|  62.0k|  if (has_non_empty_username()) {
  ------------------
  |  Branch (12179:7): [True: 3.99k, False: 58.0k]
  ------------------
12180|  3.99k|    return helpers::substring(buffer, components.protocol_end + 2,
12181|  3.99k|                              components.username_end);
12182|  3.99k|  }
12183|  58.0k|  return "";
12184|  62.0k|}
_ZNK3ada14url_aggregator12get_passwordEv:
12187|  62.0k|    ada_lifetime_bound {
12188|  62.0k|  ada_log("url_aggregator::get_password");
12189|  62.0k|  if (has_non_empty_password()) {
  ------------------
  |  Branch (12189:7): [True: 3.86k, False: 58.1k]
  ------------------
12190|  3.86k|    return helpers::substring(buffer, components.username_end + 1,
12191|  3.86k|                              components.host_start);
12192|  3.86k|  }
12193|  58.1k|  return "";
12194|  62.0k|}
_ZNK3ada14url_aggregator8get_portEv:
12197|  62.0k|    ada_lifetime_bound {
12198|  62.0k|  ada_log("url_aggregator::get_port");
12199|  62.0k|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (12199:7): [True: 57.9k, False: 4.11k]
  ------------------
12200|  57.9k|    return "";
12201|  57.9k|  }
12202|  4.11k|  return helpers::substring(buffer, components.host_end + 1,
12203|  4.11k|                            components.pathname_start);
12204|  62.0k|}
_ZNK3ada14url_aggregator8get_hashEv:
12207|  62.0k|    ada_lifetime_bound {
12208|  62.0k|  ada_log("url_aggregator::get_hash");
12209|       |  // If this's URL's fragment is either null or the empty string, then return
12210|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
12211|  62.0k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (12211:7): [True: 52.6k, False: 9.42k]
  ------------------
12212|  52.6k|    return "";
12213|  52.6k|  }
12214|  9.42k|  if (buffer.size() - components.hash_start <= 1) {
  ------------------
  |  Branch (12214:7): [True: 597, False: 8.82k]
  ------------------
12215|    597|    return "";
12216|    597|  }
12217|  8.82k|  return helpers::substring(buffer, components.hash_start);
12218|  9.42k|}
_ZNK3ada14url_aggregator8get_hostEv:
12221|  62.0k|    ada_lifetime_bound {
12222|  62.0k|  ada_log("url_aggregator::get_host");
12223|       |  // Technically, we should check if there is a hostname, but
12224|       |  // the code below works even if there isn't.
12225|       |  // if(!has_hostname()) { return ""; }
12226|  62.0k|  size_t start = components.host_start;
12227|  62.0k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (12227:7): [True: 61.7k, False: 267]
  ------------------
12228|  61.7k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (12228:7): [True: 4.01k, False: 57.7k]
  ------------------
12229|  4.01k|    start++;
12230|  4.01k|  }
12231|       |  // if we have an empty host, then the space between components.host_end and
12232|       |  // components.pathname_start may be occupied by /.
12233|  62.0k|  if (start == components.host_end) {
  ------------------
  |  Branch (12233:7): [True: 267, False: 61.7k]
  ------------------
12234|    267|    return {};
12235|    267|  }
12236|  61.7k|  return helpers::substring(buffer, start, components.pathname_start);
12237|  62.0k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
12240|   129k|    ada_lifetime_bound {
12241|   129k|  ada_log("url_aggregator::get_hostname");
12242|       |  // Technically, we should check if there is a hostname, but
12243|       |  // the code below works even if there isn't.
12244|       |  // if(!has_hostname()) { return ""; }
12245|   129k|  size_t start = components.host_start;
12246|       |  // So host_start is not where the host begins.
12247|   129k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (12247:7): [True: 104k, False: 25.1k]
  ------------------
12248|   104k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (12248:7): [True: 16.0k, False: 88.4k]
  ------------------
12249|  16.0k|    start++;
12250|  16.0k|  }
12251|   129k|  return helpers::substring(buffer, start, components.host_end);
12252|   129k|}
_ZNK3ada14url_aggregator10get_searchEv:
12255|  62.0k|    ada_lifetime_bound {
12256|  62.0k|  ada_log("url_aggregator::get_search");
12257|       |  // If this's URL's query is either null or the empty string, then return the
12258|       |  // empty string. Return U+003F (?), followed by this's URL's query.
12259|  62.0k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (12259:7): [True: 49.0k, False: 12.9k]
  ------------------
12260|  49.0k|    return "";
12261|  49.0k|  }
12262|  12.9k|  auto ending_index = uint32_t(buffer.size());
12263|  12.9k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (12263:7): [True: 5.13k, False: 7.83k]
  ------------------
12264|  5.13k|    ending_index = components.hash_start;
12265|  5.13k|  }
12266|  12.9k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (12266:7): [True: 393, False: 12.5k]
  ------------------
12267|    393|    return "";
12268|    393|  }
12269|  12.5k|  return helpers::substring(buffer, components.search_start, ending_index);
12270|  12.9k|}
_ZNK3ada14url_aggregator12get_protocolEv:
12273|  62.0k|    ada_lifetime_bound {
12274|  62.0k|  ada_log("url_aggregator::get_protocol");
12275|  62.0k|  return helpers::substring(buffer, 0, components.protocol_end);
12276|  62.0k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
12385|  4.67k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
12386|  4.67k|  ada_log("parse_ipv4 ", input, " [", input.size(),
12387|  4.67k|          " bytes], overlaps with buffer: ",
12388|  4.67k|          helpers::overlaps(input, buffer) ? "yes" : "no");
12389|  4.67k|  ADA_ASSERT_TRUE(validate());
12390|  4.67k|  if (input.empty()) {
  ------------------
  |  Branch (12390:7): [True: 0, False: 4.67k]
  ------------------
12391|      0|    return is_valid = false;
12392|      0|  }
12393|  4.67k|  const bool trailing_dot = (input.back() == '.');
12394|  4.67k|  if (trailing_dot) {
  ------------------
  |  Branch (12394:7): [True: 60, False: 4.61k]
  ------------------
12395|     60|    input.remove_suffix(1);
12396|     60|    if (input.empty()) {
  ------------------
  |  Branch (12396:9): [True: 0, False: 60]
  ------------------
12397|      0|      return is_valid = false;
12398|      0|    }
12399|     60|  }
12400|       |
12401|  4.67k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
12402|  4.67k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (12402:7): [True: 4, False: 4.67k]
  ------------------
12403|       |    // Pure decimal: keep the buffer when it already holds the address.
12404|       |    // Otherwise write the (trailing-dot-stripped) input.
12405|      4|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (12405:11): [True: 0, False: 4]
  |  Branch (12405:23): [True: 0, False: 0]
  ------------------
12406|      4|      update_base_hostname(input);
12407|      4|    }
12408|      4|    host_type = IPV4;
12409|      4|    ADA_ASSERT_TRUE(validate());
12410|      4|    return true;
12411|      4|  }
12412|       |
12413|  4.67k|  const char* p = input.data();
12414|  4.67k|  const char* end = p + input.size();
12415|  4.67k|  uint64_t ipv4 = 0;
12416|  4.67k|  int digit_count = 0;
12417|  4.67k|  int pure_decimal_count = 0;
12418|       |
12419|  8.81k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (12419:10): [True: 8.79k, False: 24]
  |  Branch (12419:29): [True: 8.79k, False: 0]
  ------------------
12420|  8.79k|    uint64_t segment = 0;
12421|  8.79k|    bool pure = false;
12422|  8.79k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (12422:9): [True: 192, False: 8.60k]
  ------------------
12423|    192|      return is_valid = false;
12424|    192|    }
12425|  8.60k|    if (pure) {
  ------------------
  |  Branch (12425:9): [True: 4.62k, False: 3.97k]
  ------------------
12426|  4.62k|      ++pure_decimal_count;
12427|  4.62k|    }
12428|  8.60k|    if (p >= end) {
  ------------------
  |  Branch (12428:9): [True: 4.42k, False: 4.17k]
  ------------------
12429|  4.42k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
12430|  4.42k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (12430:11): [True: 14, False: 4.41k]
  ------------------
12431|     14|        return is_valid = false;
12432|     14|      }
12433|  4.41k|      ipv4 = (ipv4 << shift) | segment;
12434|  4.41k|      goto ipv4_done;
12435|  4.42k|    }
12436|  4.17k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (12436:9): [True: 30, False: 4.14k]
  |  Branch (12436:26): [True: 0, False: 4.14k]
  ------------------
12437|     30|      return is_valid = false;
12438|     30|    }
12439|  4.14k|    ipv4 = (ipv4 << 8) | segment;
12440|  4.14k|    ++p;
12441|  4.14k|  }
12442|     24|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (12442:7): [True: 0, False: 24]
  |  Branch (12442:27): [True: 24, False: 0]
  ------------------
12443|     24|    return is_valid = false;
12444|     24|  }
12445|  4.41k|ipv4_done:
12446|  4.41k|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
12447|  4.41k|          " host: ", get_host());
12448|  4.41k|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (12448:7): [True: 4.38k, False: 35]
  |  Branch (12448:19): [True: 0, False: 4.38k]
  |  Branch (12448:46): [True: 0, False: 0]
  ------------------
12449|      0|    ada_log(
12450|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
12451|      0|        "buffer");
12452|  4.41k|  } else {
12453|  4.41k|    update_base_hostname(ada::serializers::ipv4(ipv4));
12454|  4.41k|  }
12455|  4.41k|  host_type = IPV4;
12456|  4.41k|  ADA_ASSERT_TRUE(validate());
12457|  4.41k|  return true;
12458|     24|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12460|    244|bool url_aggregator::parse_ipv6(std::string_view input) {
12461|    244|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
12462|    244|  ADA_ASSERT_TRUE(validate());
12463|    244|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
12464|    244|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (12464:7): [True: 3, False: 241]
  |  Branch (12464:24): [True: 4, False: 237]
  ------------------
12465|      7|    return is_valid = false;
12466|      7|  }
12467|       |#if defined(ADA_AVX512)
12468|       |  if (!detail::ipv6_structure_plausible(input.data(), input.size()))
12469|       |      [[unlikely]] {
12470|       |    return is_valid = false;
12471|       |  }
12472|       |#endif
12473|       |
12474|    237|  std::array<uint16_t, 8> address{};
12475|    237|  const char* pointer = input.data();
12476|    237|  const char* const end = pointer + input.size();
12477|    237|  int piece_index = 0;
12478|    237|  int compress = -1;
12479|       |
12480|    237|  if (*pointer == ':') {
  ------------------
  |  Branch (12480:7): [True: 114, False: 123]
  ------------------
12481|    114|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (12481:9): [True: 3, False: 111]
  |  Branch (12481:30): [True: 4, False: 107]
  ------------------
12482|      7|      return is_valid = false;
12483|      7|    }
12484|    107|    pointer += 2;
12485|    107|    compress = ++piece_index;
12486|    107|  }
12487|       |
12488|    697|  while (pointer != end) {
  ------------------
  |  Branch (12488:10): [True: 523, False: 174]
  ------------------
12489|    523|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (12489:9): [True: 1, False: 522]
  ------------------
12490|      1|      return is_valid = false;
12491|      1|    }
12492|    522|    if (*pointer == ':') {
  ------------------
  |  Branch (12492:9): [True: 58, False: 464]
  ------------------
12493|     58|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (12493:11): [True: 1, False: 57]
  ------------------
12494|      1|        return is_valid = false;
12495|      1|      }
12496|     57|      ++pointer;
12497|     57|      compress = ++piece_index;
12498|     57|      continue;
12499|     58|    }
12500|       |
12501|    464|    uint16_t value = 0;
12502|    464|    const int length = detail::parse_hex_piece(pointer, end, value);
12503|       |
12504|    464|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (12504:9): [True: 346, False: 118]
  |  Branch (12504:27): [True: 23, False: 323]
  ------------------
12505|     23|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (12505:11): [True: 3, False: 20]
  ------------------
12506|      3|        return is_valid = false;
12507|      3|      }
12508|     20|      pointer -= length;
12509|     20|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (12509:11): [True: 1, False: 19]
  ------------------
12510|      1|        return is_valid = false;
12511|      1|      }
12512|       |
12513|     19|      int numbers_seen = 0;
12514|     57|      while (pointer != end) {
  ------------------
  |  Branch (12514:14): [True: 54, False: 3]
  ------------------
12515|     54|        int ipv4_piece = -1;
12516|     54|        if (numbers_seen > 0) {
  ------------------
  |  Branch (12516:13): [True: 35, False: 19]
  ------------------
12517|     35|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (12517:15): [True: 27, False: 8]
  |  Branch (12517:34): [True: 25, False: 2]
  ------------------
12518|     25|            ++pointer;
12519|     25|          } else {
12520|     10|            return is_valid = false;
12521|     10|          }
12522|     35|        }
12523|     44|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (12523:13): [True: 2, False: 42]
  |  Branch (12523:31): [True: 2, False: 40]
  |  Branch (12523:49): [True: 1, False: 39]
  ------------------
12524|      5|          return is_valid = false;
12525|      5|        }
12526|     39|        ipv4_piece = *pointer - '0';
12527|     39|        ++pointer;
12528|     39|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (12528:13): [True: 38, False: 1]
  |  Branch (12528:31): [True: 27, False: 11]
  |  Branch (12528:50): [True: 27, False: 0]
  ------------------
12529|     27|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (12529:15): [True: 1, False: 26]
  ------------------
12530|      1|            return is_valid = false;
12531|      1|          }
12532|     26|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
12533|     26|          ++pointer;
12534|     26|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (12534:15): [True: 25, False: 1]
  |  Branch (12534:33): [True: 16, False: 9]
  |  Branch (12534:52): [True: 15, False: 1]
  ------------------
12535|     15|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
12536|     15|            ++pointer;
12537|     15|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (12537:17): [True: 0, False: 15]
  ------------------
12538|      0|              return is_valid = false;
12539|      0|            }
12540|     15|          }
12541|     26|        }
12542|     38|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
12543|     38|            address[static_cast<size_t>(piece_index)] * 0x100 +
12544|     38|            static_cast<uint16_t>(ipv4_piece));
12545|     38|        ++numbers_seen;
12546|     38|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (12546:13): [True: 11, False: 27]
  |  Branch (12546:34): [True: 4, False: 23]
  ------------------
12547|     15|          ++piece_index;
12548|     15|        }
12549|     38|      }
12550|      3|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (12550:11): [True: 2, False: 1]
  ------------------
12551|      2|        return is_valid = false;
12552|      2|      }
12553|      1|      break;
12554|      3|    }
12555|       |
12556|    441|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (12556:9): [True: 25, False: 416]
  ------------------
12557|     25|      return is_valid = false;
12558|     25|    }
12559|       |
12560|    416|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (12560:9): [True: 298, False: 118]
  |  Branch (12560:27): [True: 294, False: 4]
  ------------------
12561|    294|      ++pointer;
12562|    294|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (12562:11): [True: 2, False: 292]
  ------------------
12563|      2|        return is_valid = false;
12564|      2|      }
12565|    294|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (12565:16): [True: 4, False: 118]
  ------------------
12566|      4|      return is_valid = false;
12567|      4|    }
12568|       |
12569|    410|    address[static_cast<size_t>(piece_index)] = value;
12570|    410|    ++piece_index;
12571|    410|  }
12572|       |
12573|    175|  if (compress != -1) {
  ------------------
  |  Branch (12573:7): [True: 157, False: 18]
  ------------------
12574|    157|    const int right = piece_index - compress;
12575|    157|    if (right > 0) {
  ------------------
  |  Branch (12575:9): [True: 101, False: 56]
  ------------------
12576|    101|      const size_t dest = static_cast<size_t>(8 - right);
12577|    101|      const size_t src = static_cast<size_t>(compress);
12578|    101|      if (dest != src) {
  ------------------
  |  Branch (12578:11): [True: 97, False: 4]
  ------------------
12579|    270|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (12579:53): [True: 173, False: 97]
  ------------------
12580|    173|          address[dest + i] = address[src + i];
12581|    173|          address[src + i] = 0;
12582|    173|        }
12583|     97|      }
12584|    101|    }
12585|    157|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (12585:14): [True: 6, False: 12]
  ------------------
12586|      6|    return is_valid = false;
12587|      6|  }
12588|       |
12589|       |  // Serialize once; skip rewrite when hostname is already canonical.
12590|    169|  const std::string serialized = ada::serializers::ipv6(address);
12591|    169|  const std::string_view current = get_hostname();
12592|    169|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (12592:7): [True: 0, False: 169]
  ------------------
12593|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (12593:7): [True: 0, False: 0]
  ------------------
12594|      0|    ada_log("parse_ipv6 in-place canonical match");
12595|    169|  } else {
12596|    169|    update_base_hostname(serialized);
12597|    169|  }
12598|    169|  ada_log("parse_ipv6 ", get_hostname());
12599|    169|  ADA_ASSERT_TRUE(validate());
12600|    169|  host_type = IPV6;
12601|    169|  return true;
12602|    175|}
_ZN3ada14url_aggregator17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12604|    449|bool url_aggregator::parse_opaque_host(std::string_view input) {
12605|    449|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
12606|    449|  ADA_ASSERT_TRUE(validate());
12607|    449|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
12608|    449|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (12608:7): [True: 29, False: 420]
  ------------------
12609|     29|    return is_valid = false;
12610|     29|  }
12611|       |
12612|       |  // Return the result of running UTF-8 percent-encode on input using the C0
12613|       |  // control percent-encode set.
12614|    420|  size_t idx = ada::unicode::percent_encode_index(
12615|    420|      input, character_sets::C0_CONTROL_PERCENT_ENCODE);
12616|    420|  if (idx == input.size()) {
  ------------------
  |  Branch (12616:7): [True: 381, False: 39]
  ------------------
12617|    381|    update_base_hostname(input);
12618|    381|  } else {
12619|       |    // We only create a temporary string if we need to.
12620|     39|    update_base_hostname(ada::unicode::percent_encode(
12621|     39|        input, character_sets::C0_CONTROL_PERCENT_ENCODE, idx));
12622|     39|  }
12623|    420|  ADA_ASSERT_TRUE(validate());
12624|    420|  return true;
12625|    449|}
simple_absolute.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  284|   128k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|   128k|    return c > -65;
  288|   128k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  490|      2|inline Huff make_fixed_litlen_huff() {
  491|      2|  Huff h;
  492|      2|  uint8_t lens[288];
  493|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  494|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (494:19): [True: 288, False: 2]
  ------------------
  495|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (495:21): [True: 224, False: 2]
  ------------------
  496|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (496:21): [True: 48, False: 2]
  ------------------
  497|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (497:21): [True: 16, False: 2]
  ------------------
  498|      2|  h.build(lens, 288);
  499|      2|  return h;
  500|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  439|     16|  bool build(const uint8_t* lens, int n) {
  440|     16|    std::memset(counts, 0, sizeof(counts));
  441|     16|    std::memset(first_code, 0, sizeof(first_code));
  442|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  443|     16|    nsymbols = n;
  444|     16|    max_bits = 0;
  445|  1.98k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (445:21): [True: 1.96k, False: 16]
  ------------------
  446|  1.96k|      lengths[i] = lens[i];
  447|  1.96k|      if (lens[i]) {
  ------------------
  |  Branch (447:11): [True: 1.91k, False: 49]
  ------------------
  448|  1.91k|        counts[lens[i]]++;
  449|  1.91k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (449:13): [True: 46, False: 1.87k]
  ------------------
  450|  1.91k|      }
  451|  1.96k|    }
  452|       |    // Canonical first code for each bit length (RFC 1951).
  453|     16|    int code = 0;
  454|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (454:24): [True: 240, False: 16]
  ------------------
  455|    240|      code = (code + counts[bits - 1]) << 1;
  456|    240|      first_code[bits] = code;
  457|    240|    }
  458|     16|    int idx = 0;
  459|    158|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (459:24): [True: 142, False: 16]
  ------------------
  460|    142|      base_idx[bits] = idx;
  461|       |      // assign symbols in symbol order for codes of this length
  462|  21.6k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (462:25): [True: 21.5k, False: 142]
  ------------------
  463|  21.5k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (463:13): [True: 1.91k, False: 19.6k]
  ------------------
  464|  1.91k|          symbols[idx++] = static_cast<int16_t>(sym);
  465|  1.91k|        }
  466|  21.5k|      }
  467|    142|    }
  468|     16|    return true;
  469|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  502|      2|inline Huff make_fixed_dist_huff() {
  503|      2|  Huff h;
  504|      2|  uint8_t lens[32];
  505|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (505:19): [True: 64, False: 2]
  ------------------
  506|      2|  h.build(lens, 32);
  507|      2|  return h;
  508|      2|}
simple_absolute.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5134|   141k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|   141k|    return 0x101010101010101ull * v;
 5136|   141k|  };
_ZN3ada4idna13ensure_tablesEv:
 4885|  6.76k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4886|  6.76k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4887|  6.76k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4887:7): [True: 6.76k, False: 1]
  ------------------
 4888|  6.76k|    return true;
 4889|  6.76k|  }
 4890|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4890:7): [True: 0, False: 1]
  ------------------
 4891|      0|    return false;
 4892|      0|  }
 4893|       |
 4894|      1|  uint8_t expected = kTablesUninit;
 4895|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4895:7): [True: 1, False: 0]
  ------------------
 4896|      1|                                                std::memory_order_acq_rel,
 4897|      1|                                                std::memory_order_acquire)) {
 4898|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4899|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4899:9): [True: 0, False: 1]
  ------------------
 4900|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4901|      0|      return false;
 4902|      0|    }
 4903|       |
 4904|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4905|      1|                                          table_blob::compressed_size, buffer,
 4906|      1|                                          table_blob::uncompressed_size);
 4907|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4907:9): [True: 0, False: 1]
  ------------------
 4908|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4908:9): [True: 0, False: 1]
  ------------------
 4909|      0|      delete[] buffer;
 4910|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4911|      0|      return false;
 4912|      0|    }
 4913|       |
 4914|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4915|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4916|       |
 4917|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|      1|      return buffer + off;
 4919|      1|    };
 4920|       |
 4921|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4922|       |    // acquire on tables_init_state and then observe these writes.
 4923|      1|    idna_stage1 =
 4924|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4925|      1|    idna_stage2 =
 4926|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4927|      1|    idna_bool_blocks =
 4928|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4929|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4930|       |
 4931|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4932|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_decomposition_block));
 4934|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4935|      1|        at(table_blob::off_decomposition_data));
 4936|      1|    ccc_index = at(table_blob::off_ccc_index);
 4937|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4938|      1|    composition_index = at(table_blob::off_composition_index);
 4939|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4940|      1|        at(table_blob::off_composition_block));
 4941|      1|    composition_data =
 4942|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4943|       |
 4944|      1|    id_continue =
 4945|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4946|      1|    id_start =
 4947|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4948|       |
 4949|      1|    dir_start =
 4950|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4951|      1|    dir_final =
 4952|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4953|      1|    dir_value = at(table_blob::off_dir_value);
 4954|      1|    combining_ranges =
 4955|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4956|       |
 4957|      1|    tables_buffer = buffer;
 4958|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4959|      1|    return true;
 4960|      1|  }
 4961|       |
 4962|       |  // Another thread owns init (or finished between our loads).
 4963|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4963:28): [True: 0, False: 0]
  ------------------
 4964|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4965|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4965:9): [True: 0, False: 0]
  ------------------
 4966|      0|      return true;
 4967|      0|    }
 4968|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4968:9): [True: 0, False: 0]
  ------------------
 4969|      0|      return false;
 4970|      0|    }
 4971|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4972|      0|    defined(_M_IX86)
 4973|      0|#if defined(__GNUC__) || defined(__clang__)
 4974|      0|    __builtin_ia32_pause();
 4975|      0|#endif
 4976|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4977|       |#if defined(__GNUC__) || defined(__clang__)
 4978|       |    asm volatile("yield" ::: "memory");
 4979|       |#endif
 4980|       |#endif
 4981|      0|  }
 4982|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4983|      0|  return false;
 4984|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  535|      1|                          size_t dst_cap) {
  536|      1|  BitReader br(src, src_len);
  537|      1|  size_t out = 0;
  538|      4|  for (;;) {
  539|      4|    uint32_t bfinal = br.get(1);
  540|      4|    uint32_t btype = br.get(2);
  541|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (541:9): [True: 0, False: 4]
  |  Branch (541:33): [True: 0, False: 4]
  ------------------
  542|      4|    if (btype == 0) {
  ------------------
  |  Branch (542:9): [True: 0, False: 4]
  ------------------
  543|       |      // stored
  544|      0|      br.align_byte();
  545|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // read 16+16 from bit buffer awkwardly - use byte path
  547|       |      // Align: bits is multiple of 8
  548|       |      // Get len from remaining bits then bytes
  549|      0|      uint32_t len = br.get(16);
  550|      0|      uint32_t nlen = br.get(16);
  551|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  |  Branch (551:32): [True: 0, False: 0]
  ------------------
  552|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|       |      // After get, may have bits in acc from previous - for stored, should be
  554|       |      // byte aligned Copy len bytes from p
  555|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (555:11): [True: 0, False: 0]
  ------------------
  556|       |        // leftover bits should be 0 if aligned
  557|      0|      }
  558|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (558:11): [True: 0, False: 0]
  ------------------
  559|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (559:11): [True: 0, False: 0]
  ------------------
  560|      0|      std::memcpy(dst + out, br.p, len);
  561|      0|      br.p += len;
  562|      0|      out += len;
  563|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (563:16): [True: 0, False: 4]
  |  Branch (563:30): [True: 4, False: 0]
  ------------------
  564|      4|      Huff lit, dist;
  565|      4|      if (btype == 1) {
  ------------------
  |  Branch (565:11): [True: 0, False: 4]
  ------------------
  566|       |        // use fixed via functions
  567|      4|      } else {
  568|       |        // dynamic
  569|      4|        uint32_t hlit = br.get(5);
  570|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (570:13): [True: 0, False: 4]
  ------------------
  571|      4|        hlit += 257;
  572|      4|        uint32_t hdist = br.get(5);
  573|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (573:13): [True: 0, False: 4]
  ------------------
  574|      4|        hdist += 1;
  575|      4|        uint32_t hclen = br.get(4);
  576|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:13): [True: 0, False: 4]
  ------------------
  577|      4|        hclen += 4;
  578|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  579|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  580|      4|        uint8_t clen[19]{};
  581|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (581:30): [True: 65, False: 4]
  ------------------
  582|     65|          uint32_t v = br.get(3);
  583|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 65]
  ------------------
  584|     65|          clen[order[i]] = uint8_t(v);
  585|     65|        }
  586|      4|        Huff cl;
  587|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (587:13): [True: 0, False: 4]
  ------------------
  588|      4|        uint8_t lens[288 + 32]{};
  589|      4|        uint32_t n = hlit + hdist;
  590|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (590:30): [True: 1.08k, False: 4]
  ------------------
  591|  1.08k|          int sym = cl.decode(br);
  592|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (592:15): [True: 0, False: 1.08k]
  ------------------
  593|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (593:15): [True: 1.03k, False: 49]
  ------------------
  594|  1.03k|            lens[i++] = uint8_t(sym);
  595|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (595:22): [True: 49, False: 0]
  ------------------
  596|     49|            uint32_t rep = br.get(2);
  597|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 49]
  ------------------
  598|     49|            rep += 3;
  599|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (599:17): [True: 0, False: 49]
  ------------------
  600|     49|            uint8_t v = lens[i - 1];
  601|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (601:20): [True: 214, False: 49]
  ------------------
  602|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (602:22): [True: 0, False: 0]
  ------------------
  603|      0|            uint32_t rep = br.get(3);
  604|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|            rep += 3;
  606|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (606:20): [True: 0, False: 0]
  ------------------
  607|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (607:22): [True: 0, False: 0]
  ------------------
  608|      0|            uint32_t rep = br.get(7);
  609|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|            rep += 11;
  611|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (611:20): [True: 0, False: 0]
  ------------------
  612|      0|          } else
  613|      0|            return 0;
  614|  1.08k|        }
  615|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 4]
  ------------------
  616|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (616:13): [True: 0, False: 4]
  ------------------
  617|      4|      }
  618|  52.2k|      for (;;) {
  619|  52.2k|        int sym;
  620|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (620:13): [True: 0, False: 52.2k]
  ------------------
  621|      0|          sym = fixed_litlen(br);
  622|  52.2k|        else
  623|  52.2k|          sym = lit.decode(br);
  624|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (624:13): [True: 0, False: 52.2k]
  ------------------
  625|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (625:13): [True: 37.2k, False: 14.9k]
  ------------------
  626|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (626:15): [True: 0, False: 37.2k]
  ------------------
  627|  37.2k|          dst[out++] = uint8_t(sym);
  628|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (628:20): [True: 4, False: 14.9k]
  ------------------
  629|      4|          break;
  630|  14.9k|        } else {
  631|  14.9k|          int len_code = sym - 257;
  632|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (632:15): [True: 0, False: 14.9k]
  |  Branch (632:31): [True: 0, False: 14.9k]
  ------------------
  633|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  634|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (634:15): [True: 2.03k, False: 12.9k]
  |  Branch (634:38): [True: 0, False: 2.03k]
  ------------------
  635|  14.9k|          uint32_t length =
  636|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (636:37): [True: 2.03k, False: 12.9k]
  ------------------
  637|  14.9k|          int dsym;
  638|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (638:15): [True: 0, False: 14.9k]
  ------------------
  639|      0|            dsym = fixed_dist(br);
  640|  14.9k|          else
  641|  14.9k|            dsym = dist.decode(br);
  642|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (642:15): [True: 0, False: 14.9k]
  |  Branch (642:27): [True: 0, False: 14.9k]
  ------------------
  643|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  644|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (644:15): [True: 9.97k, False: 5.01k]
  |  Branch (644:35): [True: 0, False: 9.97k]
  ------------------
  645|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (645:50): [True: 9.97k, False: 5.01k]
  ------------------
  646|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (646:15): [True: 0, False: 14.9k]
  |  Branch (646:33): [True: 0, False: 14.9k]
  ------------------
  647|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (647:32): [True: 187k, False: 14.9k]
  ------------------
  648|   187k|            dst[out] = dst[out - distance];
  649|   187k|            out++;
  650|   187k|          }
  651|  14.9k|        }
  652|  52.2k|      }
  653|      4|    } else {
  654|      0|      return 0;  // reserved
  655|      0|    }
  656|      4|    if (bfinal) break;
  ------------------
  |  Branch (656:9): [True: 1, False: 3]
  ------------------
  657|      4|  }
  658|      1|  return out;
  659|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  402|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  412|   457k|  uint32_t get(int n) {
  413|   457k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (413:9): [True: 0, False: 457k]
  ------------------
  414|   457k|    uint32_t v = acc & ((1u << n) - 1);
  415|   457k|    acc >>= n;
  416|   457k|    bits -= n;
  417|   457k|    return v;
  418|   457k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  404|   457k|  bool ensure(int n) {
  405|   520k|    while (bits < n) {
  ------------------
  |  Branch (405:12): [True: 62.3k, False: 457k]
  ------------------
  406|  62.3k|      if (p >= end) return false;
  ------------------
  |  Branch (406:11): [True: 0, False: 62.3k]
  ------------------
  407|  62.3k|      acc |= uint32_t(*p++) << bits;
  408|  62.3k|      bits += 8;
  409|  62.3k|    }
  410|   457k|    return true;
  411|   457k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  471|  68.3k|  int decode(BitReader& br) const {
  472|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (472:9): [True: 0, False: 68.3k]
  ------------------
  473|  68.3k|    int code = 0;
  474|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (474:23): [True: 427k, False: 0]
  ------------------
  475|   427k|      uint32_t b = br.get(1);
  476|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (476:11): [True: 0, False: 427k]
  ------------------
  477|   427k|      code = (code << 1) | int(b);
  478|   427k|      int first = first_code[len];
  479|   427k|      int cnt = counts[len];
  480|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (480:11): [True: 263k, False: 164k]
  |  Branch (480:18): [True: 68.3k, False: 195k]
  ------------------
  481|  68.3k|        return symbols[base_idx[len] + (code - first)];
  482|  68.3k|      }
  483|   427k|    }
  484|      0|    return -1;
  485|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4868|      1|                                         size_t len) noexcept {
 4869|      1|  uint32_t c = 0xFFFFFFFFu;
 4870|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4870:22): [True: 224k, False: 1]
  ------------------
 4871|   224k|    c ^= data[i];
 4872|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4872:21): [True: 1.79M, False: 224k]
  ------------------
 4873|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4874|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4875|  1.79M|    }
 4876|   224k|  }
 4877|      1|  return ~c;
 4878|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4691|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4692|      1|  if constexpr (std::endian::native == std::endian::little) {
 4693|      1|    (void)buffer;
 4694|      1|    return;
 4695|      1|  }
 4696|      0|  auto u16 = [&](size_t off, size_t count) {
 4697|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4698|      1|  };
 4699|      1|  auto u32 = [&](size_t off, size_t count) {
 4700|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4701|      1|  };
 4702|      1|  auto u64 = [&](size_t off, size_t count) {
 4703|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4704|      1|  };
 4705|       |
 4706|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4707|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4708|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4709|      1|  u16(table_blob::off_decomposition_block,
 4710|      1|      table_blob::count_decomposition_block);
 4711|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4712|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4713|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4714|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4715|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4716|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4717|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4718|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4719|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4917|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|     18|      return buffer + off;
 4919|     18|    };
simple_absolute.cc:_ZN3ada4idnaL11idna_lookupEj:
 5072|   219k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5073|   219k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5073:7): [True: 219k, False: 74]
  ------------------
 5074|   219k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5075|   219k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5075:9): [True: 102k, False: 116k]
  ------------------
 5076|   102k|      uint32_t bit_idx =
 5077|   102k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5078|   102k|          (cp & IDNA_BLOCK_MASK);
 5079|   102k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5080|   102k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5080:14): [True: 102k, False: 18]
  ------------------
 5081|   102k|    }
 5082|   116k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5083|   219k|  }
 5084|       |
 5085|     74|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5085:7): [True: 50, False: 24]
  |  Branch (5085:40): [True: 12, False: 38]
  ------------------
 5086|     12|    return IDNA_IGNORED;
 5087|     12|  }
 5088|       |
 5089|     62|  return IDNA_DISALLOWED;
 5090|     74|}
simple_absolute.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5115|  17.1k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5116|  17.1k|  size_t n = 0;
 5117|  35.1k|  while (*ptr != 0) {
  ------------------
  |  Branch (5117:10): [True: 18.0k, False: 17.1k]
  ------------------
 5118|  18.0k|    ++n;
 5119|  18.0k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5119:9): [True: 14.9k, False: 3.09k]
  ------------------
 5120|  14.9k|      ++ptr;
 5121|  14.9k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5121:16): [True: 1.98k, False: 1.11k]
  ------------------
 5122|  1.98k|      ptr += 2;
 5123|  1.98k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5123:16): [True: 670, False: 444]
  ------------------
 5124|    670|      ptr += 3;
 5125|    670|    } else {
 5126|    444|      ptr += 4;
 5127|    444|    }
 5128|  18.0k|  }
 5129|  17.1k|  return n;
 5130|  17.1k|}
simple_absolute.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5093|  17.6k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5094|  17.6k|  uint8_t b0 = *ptr++;
 5095|  17.6k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5095:7): [True: 14.9k, False: 2.66k]
  ------------------
 5096|  2.66k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5096:7): [True: 1.97k, False: 692]
  ------------------
 5097|  1.97k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5098|  1.97k|    cp |= (*ptr++ & 0x3Fu);
 5099|  1.97k|    return static_cast<char32_t>(cp);
 5100|  1.97k|  }
 5101|    692|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5101:7): [True: 402, False: 290]
  ------------------
 5102|    402|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5103|    402|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5104|    402|    cp |= (*ptr++ & 0x3Fu);
 5105|    402|    return static_cast<char32_t>(cp);
 5106|    402|  }
 5107|    290|  uint32_t cp = (b0 & 0x07u) << 18;
 5108|    290|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5109|    290|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5110|    290|  cp |= (*ptr++ & 0x3Fu);
 5111|    290|  return static_cast<char32_t>(cp);
 5112|    692|}
_ZN3ada4idna23decomposition_block_rowEh:
 4989|   107k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4990|   107k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 107k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|   107k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4994|   107k|}
_ZN3ada4idna13ccc_block_rowEh:
 4996|   211k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4997|   211k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 211k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|   211k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5001|   211k|}
_ZN3ada4idna16tables_are_readyEv:
 4880|  2.83k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4881|  2.83k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4882|  2.83k|}
simple_absolute.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5272|   108k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5273|   108k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5273:7): [True: 3.39k, False: 104k]
  ------------------
 5274|  3.39k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5274:7): [True: 1.96k, False: 1.43k]
  ------------------
 5275|       |    // Hangul precomposed syllables are NFC.
 5276|  1.96k|    return 0;
 5277|  1.96k|  }
 5278|   106k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5278:7): [True: 0, False: 106k]
  ------------------
 5279|      0|    return 0;
 5280|      0|  }
 5281|   106k|  const uint8_t di = decomposition_index[current_character >> 8];
 5282|   106k|  const uint16_t* const decomposition =
 5283|   106k|      decomposition_block_row(di) + (current_character % 256);
 5284|   106k|  size_t decomposition_length =
 5285|   106k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5286|   106k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5286:7): [True: 1.46k, False: 104k]
  |  Branch (5286:37): [True: 0, False: 1.46k]
  ------------------
 5287|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5288|      0|  }
 5289|   106k|  return decomposition_length;
 5290|   106k|}
simple_absolute.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5404|  2.77k|static bool would_compose(std::u32string_view input) noexcept {
 5405|   108k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5405:32): [True: 105k, False: 2.74k]
  ------------------
 5406|   105k|    const char32_t current = input[input_count];
 5407|   105k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5407:9): [True: 7.99k, False: 97.3k]
  |  Branch (5407:36): [True: 370, False: 7.62k]
  ------------------
 5408|    370|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5408:11): [True: 348, False: 22]
  ------------------
 5409|    348|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5409:11): [True: 50, False: 298]
  ------------------
 5410|     50|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5410:11): [True: 0, False: 50]
  ------------------
 5411|      0|        return true;
 5412|      0|      }
 5413|    370|      ++input_count;
 5414|    370|      continue;
 5415|    370|    }
 5416|   104k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5416:9): [True: 3.29k, False: 101k]
  |  Branch (5416:36): [True: 1.96k, False: 1.33k]
  ------------------
 5417|  1.96k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5417:11): [True: 1.70k, False: 252]
  ------------------
 5418|  1.70k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5418:11): [True: 1.58k, False: 124]
  ------------------
 5419|  1.58k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5419:11): [True: 1.27k, False: 308]
  ------------------
 5420|  1.27k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5420:11): [True: 0, False: 1.27k]
  ------------------
 5421|      0|        return true;
 5422|      0|      }
 5423|  1.96k|      ++input_count;
 5424|  1.96k|      continue;
 5425|  1.96k|    }
 5426|   102k|    if (current < 0x110000) {
  ------------------
  |  Branch (5426:9): [True: 102k, False: 0]
  ------------------
 5427|   102k|      const uint16_t* composition =
 5428|   102k|          composition_block_row(composition_index[current >> 8]) +
 5429|   102k|          (current % 256);
 5430|   102k|      int32_t previous_ccc = -1;
 5431|   102k|      size_t j = input_count;
 5432|   103k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5432:14): [True: 101k, False: 2.58k]
  ------------------
 5433|   101k|        uint8_t ccc = get_ccc(input[j + 1]);
 5434|   101k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5434:13): [True: 47.3k, False: 53.8k]
  |  Branch (5434:49): [True: 47.2k, False: 110]
  ------------------
 5435|  47.2k|          int left = composition[0];
 5436|  47.2k|          int right = composition[1];
 5437|  47.2k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5437:15): [True: 0, False: 47.2k]
  |  Branch (5437:27): [True: 0, False: 47.2k]
  ------------------
 5438|  47.2k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5438:15): [True: 0, False: 47.2k]
  ------------------
 5439|      0|            break;
 5440|      0|          }
 5441|   152k|          while (left + 2 < right) {
  ------------------
  |  Branch (5441:18): [True: 105k, False: 47.2k]
  ------------------
 5442|   105k|            int middle = left + (((right - left) >> 1) & ~1);
 5443|   105k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5443:17): [True: 3.09k, False: 102k]
  ------------------
 5444|  3.09k|              left = middle;
 5445|  3.09k|            }
 5446|   105k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5446:17): [True: 102k, False: 3.08k]
  ------------------
 5447|   102k|              right = middle;
 5448|   102k|            }
 5449|   105k|          }
 5450|  47.2k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5450:15): [True: 47.2k, False: 0]
  ------------------
 5451|  47.2k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5451:15): [True: 28, False: 47.1k]
  ------------------
 5452|     28|            return true;
 5453|     28|          }
 5454|  47.2k|        }
 5455|   101k|        if (ccc == 0) {
  ------------------
  |  Branch (5455:13): [True: 100k, False: 744]
  ------------------
 5456|   100k|          break;
 5457|   100k|        }
 5458|    744|        previous_ccc = ccc;
 5459|    744|      }
 5460|   102k|      input_count = j + 1;
 5461|   102k|      continue;
 5462|   102k|    }
 5463|      0|    ++input_count;
 5464|      0|  }
 5465|  2.74k|  return false;
 5466|  2.77k|}
_ZN3ada4idna21composition_block_rowEh:
 5003|   103k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5004|   103k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5004:7): [True: 0, False: 103k]
  ------------------
 5005|      0|    bi = 0;
 5006|      0|  }
 5007|   103k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5008|   103k|}
simple_absolute.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5632|  18.9k|static constexpr int32_t char_to_digit_value(char value) {
 5633|  18.9k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5633:7): [True: 17.1k, False: 1.85k]
  |  Branch (5633:23): [True: 17.1k, False: 6]
  ------------------
 5634|  1.85k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5634:7): [True: 1.84k, False: 16]
  |  Branch (5634:23): [True: 1.83k, False: 8]
  ------------------
 5635|     24|  return -1;
 5636|  1.85k|}
simple_absolute.cc:_ZN3ada4idnaL5adaptEiib:
 5642|  16.7k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5643|  16.7k|  if (firsttime) {
  ------------------
  |  Branch (5643:7): [True: 3.57k, False: 13.1k]
  ------------------
 5644|  3.57k|    d = d / damp;
 5645|  13.1k|  } else {
 5646|  13.1k|    d = d / 2;
 5647|  13.1k|  }
 5648|  16.7k|  d += d / n;
 5649|  16.7k|  int32_t k = 0;
 5650|  19.3k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5650:10): [True: 2.67k, False: 16.7k]
  ------------------
 5651|  2.67k|    d /= base - tmin;
 5652|  2.67k|    k += base;
 5653|  2.67k|  }
 5654|  16.7k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5655|  16.7k|}
simple_absolute.cc:_ZN3ada4idnaL13digit_to_charEi:
 5638|  11.1k|static constexpr char digit_to_char(int32_t digit) {
 5639|  11.1k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5639:10): [True: 7.84k, False: 3.32k]
  ------------------
 5640|  11.1k|}
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5977|  32.1k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6062|    692|      auto is_l_or_d = [](uint32_t code) {
 6063|    692|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6063:16): [True: 0, False: 692]
  ------------------
 6064|    692|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6064:16): [True: 44, False: 648]
  ------------------
 6065|    692|      };
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6066|    646|      auto is_r_or_d = [](uint32_t code) {
 6067|    646|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6067:16): [True: 6, False: 640]
  ------------------
 6068|    640|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6068:16): [True: 20, False: 620]
  ------------------
 6069|    646|      };
simple_absolute.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5924|  3.62k|    const std::u32string_view label) noexcept {
 5925|  3.96k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5925:52): [True: 3.96k, False: 0]
  ------------------
 5926|  3.96k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5926:9): [True: 3.62k, False: 342]
  ------------------
 5927|       |
 5928|      0|  return std::u32string_view::npos;
 5929|  3.62k|}
simple_absolute.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5933|  3.62k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5934|  3.62k|  const size_t mask =
 5935|  3.62k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5936|       |
 5937|  3.62k|  size_t directions = 0;
 5938|  54.7k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5938:22): [True: 51.1k, False: 3.62k]
  ------------------
 5939|  51.1k|    directions |= 1u << find_direction(label[i]);
 5940|  51.1k|  }
 5941|  3.62k|  return (directions & mask) != 0;
 5942|  3.62k|}
simple_absolute.cc:_ZN3ada4idnaL14find_directionEj:
 5905|  66.0k|inline static direction find_direction(uint32_t code_point) noexcept {
 5906|       |  // Binary search on dir_final (sorted upper bounds).
 5907|  66.0k|  size_t lo = 0, hi = dir_table_count;
 5908|   750k|  while (lo < hi) {
  ------------------
  |  Branch (5908:10): [True: 684k, False: 66.0k]
  ------------------
 5909|   684k|    size_t mid = lo + (hi - lo) / 2;
 5910|   684k|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5910:9): [True: 213k, False: 471k]
  ------------------
 5911|   213k|      lo = mid + 1;
 5912|   471k|    } else {
 5913|   471k|      hi = mid;
 5914|   471k|    }
 5915|   684k|  }
 5916|  66.0k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5916:7): [True: 0, False: 66.0k]
  ------------------
 5917|      0|    return direction::NONE;
 5918|      0|  }
 5919|  66.0k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5919:10): [True: 65.3k, False: 686]
  ------------------
 5920|  66.0k|                                     : direction::NONE;
 5921|  66.0k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6290|  49.3k|bool constexpr is_ascii(std::string_view view) {
 6291|   600k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6291:18): [True: 600k, False: 47.0k]
  ------------------
 6292|   600k|    if (c >= 0x80) {
  ------------------
  |  Branch (6292:9): [True: 2.29k, False: 597k]
  ------------------
 6293|  2.29k|      return false;
 6294|  2.29k|    }
 6295|   600k|  }
 6296|  47.0k|  return true;
 6297|  49.3k|}
simple_absolute.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6327|  47.0k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6328|  47.0k|  out.assign(ut8_string);
 6329|  47.0k|  ascii_map(out.data(), out.size());
 6330|  47.0k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6281|  9.55k|bool constexpr is_ascii(std::u32string_view view) {
 6282|  57.2k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6282:19): [True: 57.2k, False: 2.87k]
  ------------------
 6283|  57.2k|    if (c >= 0x80) {
  ------------------
  |  Branch (6283:9): [True: 6.67k, False: 50.5k]
  ------------------
 6284|  6.67k|      return false;
 6285|  6.67k|    }
 6286|  57.2k|  }
 6287|  2.87k|  return true;
 6288|  9.55k|}
simple_absolute.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6343|  6.80k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6344|  6.80k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6344:10): [True: 3.77k, False: 3.02k]
  |  Branch (6344:31): [True: 1.58k, False: 2.18k]
  |  Branch (6344:51): [True: 1.46k, False: 126]
  ------------------
 6345|  1.46k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6345:10): [True: 1.42k, False: 42]
  |  Branch (6345:30): [True: 1.36k, False: 60]
  ------------------
 6346|  6.80k|}
simple_absolute.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6333|  4.14k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6334|  4.14k|  const size_t old = out.size();
 6335|  4.14k|  out.resize(old + label.size());
 6336|  4.14k|  char* dest = out.data() + old;
 6337|  44.2k|  for (char32_t c : label) {
  ------------------
  |  Branch (6337:19): [True: 44.2k, False: 4.14k]
  ------------------
 6338|  44.2k|    *dest++ = static_cast<char>(c);
 6339|  44.2k|  }
 6340|  4.14k|}
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7071|  6.82k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7072|  6.82k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7072:11): [True: 4.96k, False: 1.86k]
  |  Branch (7072:23): [True: 1.95k, False: 3.01k]
  |  Branch (7072:37): [True: 2.99k, False: 1.88k]
  |  Branch (7072:49): [True: 950, False: 2.04k]
  ------------------
 7073|  3.92k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7073:11): [True: 1.92k, False: 2.00k]
  |  Branch (7073:23): [True: 1.85k, False: 66]
  ------------------
 7074|  6.82k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7161|  4.09k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7162|  4.09k|  return hex_to_binary_table[c - '0'];
 7163|  4.09k|}
simple_absolute.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7282|   486k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7283|   486k|    return character_sets::bit_at(character_set, c);
 7284|   486k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 6998|   110k|    const char* input, size_t length) noexcept {
 6999|   110k|  size_t i = 0;
 7000|   110k|  uint8_t accumulator{};
 7001|   425k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7001:10): [True: 314k, False: 110k]
  ------------------
 7002|   314k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7003|   314k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7004|   314k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7005|   314k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7006|   314k|  }
 7007|   258k|  for (; i < length; i++) {
  ------------------
  |  Branch (7007:10): [True: 147k, False: 110k]
  ------------------
 7008|   147k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7009|   147k|  }
 7010|   110k|  return accumulator;
 7011|   110k|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7413|    746|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7414|    746|  static constexpr char kHex[] = "0123456789abcdef";
 7415|    746|  if (v >= 0x1000) {
  ------------------
  |  Branch (7415:7): [True: 96, False: 650]
  ------------------
 7416|     96|    *p++ = kHex[(v >> 12) & 0xf];
 7417|     96|    *p++ = kHex[(v >> 8) & 0xf];
 7418|     96|    *p++ = kHex[(v >> 4) & 0xf];
 7419|     96|    *p++ = kHex[v & 0xf];
 7420|    650|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7420:14): [True: 116, False: 534]
  ------------------
 7421|    116|    *p++ = kHex[(v >> 8) & 0xf];
 7422|    116|    *p++ = kHex[(v >> 4) & 0xf];
 7423|    116|    *p++ = kHex[v & 0xf];
 7424|    534|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7424:14): [True: 130, False: 404]
  ------------------
 7425|    130|    *p++ = kHex[(v >> 4) & 0xf];
 7426|    130|    *p++ = kHex[v & 0xf];
 7427|    404|  } else {
 7428|    404|    *p++ = kHex[v & 0xf];
 7429|    404|  }
 7430|    746|  return p;
 7431|    746|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7399|  35.3k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7400|  35.3k|  if (v < 10) {
  ------------------
  |  Branch (7400:7): [True: 26.5k, False: 8.77k]
  ------------------
 7401|  26.5k|    *p++ = static_cast<char>('0' + v);
 7402|  26.5k|  } else if (v < 100) {
  ------------------
  |  Branch (7402:14): [True: 260, False: 8.51k]
  ------------------
 7403|    260|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7404|    260|    p += 2;
 7405|  8.51k|  } else {
 7406|  8.51k|    *p++ = static_cast<char>('0' + v / 100);
 7407|  8.51k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7408|  8.51k|    p += 2;
 7409|  8.51k|  }
 7410|  35.3k|  return p;
 7411|  35.3k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6847|   168k|    std::string_view user_input) noexcept {
 6848|       |  // first check for short strings in which case we do it naively.
 6849|   168k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6849:7): [True: 31.9k, False: 136k]
  ------------------
 6850|  31.9k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6851|  31.9k|  }
 6852|       |  // fast path for long strings (expected to be common)
 6853|   136k|  size_t i = 0;
 6854|   136k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6855|   136k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6856|   136k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6857|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6858|   136k|  __m128i running{0};
 6859|   343k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6859:10): [True: 206k, False: 136k]
  ------------------
 6860|   206k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6861|   206k|    running = _mm_or_si128(
 6862|   206k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6863|   206k|                                           _mm_cmpeq_epi8(word, mask2))),
 6864|   206k|        _mm_cmpeq_epi8(word, mask3));
 6865|   206k|  }
 6866|   136k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6866:7): [True: 135k, False: 1.71k]
  ------------------
 6867|   135k|    __m128i word = _mm_loadu_si128(
 6868|   135k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6869|   135k|    running = _mm_or_si128(
 6870|   135k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6871|   135k|                                           _mm_cmpeq_epi8(word, mask2))),
 6872|   135k|        _mm_cmpeq_epi8(word, mask3));
 6873|   135k|  }
 6874|   136k|  return _mm_movemask_epi8(running) != 0;
 6875|   168k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6742|   442k|constexpr bool is_tabs_or_newline(char c) noexcept {
 6743|   442k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6743:10): [True: 16, False: 442k]
  |  Branch (6743:23): [True: 14, False: 442k]
  |  Branch (6743:36): [True: 26, False: 442k]
  ------------------
 6744|   442k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8054|    644|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8055|       |  // if this ever becomes a performance issue, we could use an approach similar
 8056|       |  // to has_tabs_or_newline
 8057|    644|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8058|    644|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7092|  74.8k|    const char c) noexcept {
 7093|  74.8k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7093:10): [True: 950, False: 73.9k]
  |  Branch (7093:23): [True: 418, False: 73.5k]
  |  Branch (7093:36): [True: 1.98k, False: 71.5k]
  ------------------
 7094|  74.8k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7087|   341k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7088|   341k|  return (unsigned char)c <= ' ';
 7089|   341k|}
_ZN3ada7helpers19parse_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS_6scheme4typeERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 8736|  81.1k|                                           std::string& path) {
 8737|  81.1k|  ada_log("parse_prepared_path ", input);
 8738|  81.1k|  uint8_t accumulator = checkers::path_signature(input);
 8739|       |  // Let us first detect a trivial case.
 8740|       |  // If it is special, we check that we have no dot, no %,  no \ and no
 8741|       |  // character needing percent encoding. Otherwise, we check that we have no %,
 8742|       |  // no dot, and no character needing percent encoding.
 8743|  81.1k|  constexpr uint8_t need_encoding = 1;
 8744|  81.1k|  constexpr uint8_t backslash_char = 2;
 8745|  81.1k|  constexpr uint8_t dot_char = 4;
 8746|  81.1k|  constexpr uint8_t percent_char = 8;
 8747|  81.1k|  bool special = type != ada::scheme::NOT_SPECIAL;
 8748|  81.1k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8748:39): [True: 609, False: 80.4k]
  ------------------
 8749|    609|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (8749:39): [True: 37, False: 572]
  ------------------
 8750|  81.1k|  bool trivial_path =
 8751|  81.1k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (8751:7): [True: 69.5k, False: 11.5k]
  |  Branch (8751:8): [True: 80.6k, False: 447]
  ------------------
 8752|  81.1k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
 8753|    447|                  0)) &&
 8754|  69.5k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (8754:7): [True: 69.5k, False: 13]
  ------------------
 8755|  81.1k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (8755:7): [True: 5.04k, False: 76.0k]
  |  Branch (8755:34): [True: 5.02k, False: 12]
  ------------------
 8756|       |    // '4' means that we have at least one dot, but nothing that requires
 8757|       |    // percent encoding or decoding. The only part that is not trivial is
 8758|       |    // that we may have single dots and double dots path segments.
 8759|       |    // If we have such segments, then we either have a path that begins
 8760|       |    // with '.' (easy to check), or we have the sequence './'.
 8761|       |    // Note: input cannot be empty, it must at least contain one character ('.')
 8762|       |    // Note: we know that '\' is not present.
 8763|  5.02k|    if (input[0] != '.') {
  ------------------
  |  Branch (8763:9): [True: 4.54k, False: 486]
  ------------------
 8764|  4.54k|      size_t slashdot = 0;
 8765|  4.54k|      bool dot_is_file = true;
 8766|  14.6k|      for (;;) {
 8767|  14.6k|        slashdot = input.find("/.", slashdot);
 8768|  14.6k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (8768:13): [True: 4.54k, False: 10.1k]
  ------------------
 8769|  4.54k|          break;
 8770|  10.1k|        } else {  // uncommon
 8771|       |          // only three cases matter: /./, /.. or a final /
 8772|  10.1k|          slashdot += 2;
 8773|  10.1k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (8773:28): [True: 9, False: 10.1k]
  |  Branch (8773:56): [True: 5.07k, False: 5.07k]
  ------------------
 8774|  5.07k|                           input[slashdot] == '/');
  ------------------
  |  Branch (8774:28): [True: 3.98k, False: 1.09k]
  ------------------
 8775|  10.1k|        }
 8776|  14.6k|      }
 8777|  4.54k|      trivial_path = dot_is_file;
 8778|  4.54k|    }
 8779|  5.02k|  }
 8780|  81.1k|  if (trivial_path) {
  ------------------
  |  Branch (8780:7): [True: 70.0k, False: 11.0k]
  ------------------
 8781|  70.0k|    ada_log("parse_path trivial");
 8782|  70.0k|    path += '/';
 8783|  70.0k|    path += input;
 8784|  70.0k|    return;
 8785|  70.0k|  }
 8786|       |  // We are going to need to look a bit at the path, but let us see if we can
 8787|       |  // ignore percent encoding *and* backslashes *and* percent characters.
 8788|       |  // Except for the trivial case, this is likely to capture 99% of paths out
 8789|       |  // there.
 8790|  11.0k|  bool fast_path =
 8791|  11.0k|      (special &&
  ------------------
  |  Branch (8791:8): [True: 10.8k, False: 243]
  ------------------
 8792|  10.8k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (8792:8): [True: 4.47k, False: 6.32k]
  ------------------
 8793|  4.47k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (8793:7): [True: 4.40k, False: 66]
  ------------------
 8794|  11.0k|  if (fast_path) {
  ------------------
  |  Branch (8794:7): [True: 4.40k, False: 6.63k]
  ------------------
 8795|  4.40k|    ada_log("parse_prepared_path fast");
 8796|       |    // Here we don't need to worry about \ or percent encoding.
 8797|       |    // We also do not have a file protocol. We might have dots, however,
 8798|       |    // but dots must as appear as '.', and they cannot be encoded because
 8799|       |    // the symbol '%' is not present.
 8800|  4.40k|    size_t previous_location = 0;  // We start at 0.
 8801|  27.8k|    do {
 8802|  27.8k|      size_t new_location = input.find('/', previous_location);
 8803|       |      // std::string_view path_view = input;
 8804|       |      //  We process the last segment separately:
 8805|  27.8k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (8805:11): [True: 4.40k, False: 23.4k]
  ------------------
 8806|  4.40k|        std::string_view path_view = input.substr(previous_location);
 8807|  4.40k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (8807:13): [True: 30, False: 4.37k]
  ------------------
 8808|       |          // e.g., if you receive ".." with an empty path, you go to "/".
 8809|     30|          if (path.empty()) {
  ------------------
  |  Branch (8809:15): [True: 6, False: 24]
  ------------------
 8810|      6|            path = '/';
 8811|      6|            return;
 8812|      6|          }
 8813|       |          // Fast case where we have nothing to do:
 8814|     24|          if (path.back() == '/') {
  ------------------
  |  Branch (8814:15): [True: 3, False: 21]
  ------------------
 8815|      3|            return;
 8816|      3|          }
 8817|       |          // If you have the path "/joe/myfriend",
 8818|       |          // then you delete 'myfriend'.
 8819|     21|          path.resize(path.rfind('/') + 1);
 8820|     21|          return;
 8821|     24|        }
 8822|  4.37k|        path += '/';
 8823|  4.37k|        if (path_view != ".") {
  ------------------
  |  Branch (8823:13): [True: 4.35k, False: 22]
  ------------------
 8824|  4.35k|          path.append(path_view);
 8825|  4.35k|        }
 8826|  4.37k|        return;
 8827|  23.4k|      } else {
 8828|       |        // This is a non-final segment.
 8829|  23.4k|        std::string_view path_view =
 8830|  23.4k|            input.substr(previous_location, new_location - previous_location);
 8831|  23.4k|        previous_location = new_location + 1;
 8832|  23.4k|        if (path_view == "..") {
  ------------------
  |  Branch (8832:13): [True: 4.47k, False: 18.9k]
  ------------------
 8833|  4.47k|          size_t last_delimiter = path.rfind('/');
 8834|  4.47k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8834:15): [True: 4.17k, False: 303]
  ------------------
 8835|  4.17k|            path.erase(last_delimiter);
 8836|  4.17k|          }
 8837|  18.9k|        } else if (path_view != ".") {
  ------------------
  |  Branch (8837:20): [True: 14.8k, False: 4.14k]
  ------------------
 8838|  14.8k|          path += '/';
 8839|  14.8k|          path.append(path_view);
 8840|  14.8k|        }
 8841|  23.4k|      }
 8842|  27.8k|    } while (true);
  ------------------
  |  Branch (8842:14): [True: 23.4k, Folded]
  ------------------
 8843|  6.63k|  } else {
 8844|  6.63k|    ada_log("parse_path slow");
 8845|       |    // we have reached the general case
 8846|  6.63k|    bool needs_percent_encoding = (accumulator & 1);
 8847|  6.63k|    std::string path_buffer_tmp;
 8848|  27.3k|    do {
 8849|  27.3k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (8849:26): [True: 26.4k, False: 952]
  |  Branch (8849:37): [True: 2.01k, False: 24.4k]
  ------------------
 8850|  27.3k|                            ? input.find_first_of("/\\")
 8851|  27.3k|                            : input.find('/');
 8852|  27.3k|      std::string_view path_view = input;
 8853|  27.3k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (8853:11): [True: 20.7k, False: 6.63k]
  ------------------
 8854|  20.7k|        path_view.remove_suffix(path_view.size() - location);
 8855|  20.7k|        input.remove_prefix(location + 1);
 8856|  20.7k|      }
 8857|       |      // path_buffer is either path_view or it might point at a percent encoded
 8858|       |      // temporary file.
 8859|  27.3k|      std::string_view path_buffer =
 8860|  27.3k|          (needs_percent_encoding &&
  ------------------
  |  Branch (8860:12): [True: 6.36k, False: 21.0k]
  ------------------
 8861|  6.36k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (8861:12): [True: 1.62k, False: 4.74k]
  ------------------
 8862|  6.36k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
 8863|  27.3k|              ? path_buffer_tmp
 8864|  27.3k|              : path_view;
 8865|  27.3k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (8865:11): [True: 4.51k, False: 22.8k]
  ------------------
 8866|  4.51k|        helpers::shorten_path(path, type);
 8867|  4.51k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (8867:13): [True: 3.73k, False: 785]
  ------------------
 8868|  3.73k|          path += '/';
 8869|  3.73k|        }
 8870|  22.8k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (8870:18): [True: 607, False: 22.2k]
  ------------------
 8871|    607|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (8871:18): [True: 192, False: 415]
  ------------------
 8872|    192|        path += '/';
 8873|    192|      }
 8874|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
 8875|  22.6k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (8875:16): [True: 22.2k, False: 415]
  ------------------
 8876|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
 8877|       |        // Windows drive letter, then replace the second code point in
 8878|       |        // path_buffer with U+003A (:).
 8879|  22.2k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (8879:13): [True: 1.31k, False: 20.9k]
  |  Branch (8879:48): [True: 351, False: 964]
  ------------------
 8880|    351|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (8880:13): [True: 39, False: 312]
  ------------------
 8881|     39|          path += '/';
 8882|     39|          path += path_buffer[0];
 8883|     39|          path += ':';
 8884|     39|          path_buffer.remove_prefix(2);
 8885|     39|          path.append(path_buffer);
 8886|  22.2k|        } else {
 8887|       |          // Append path_buffer to url's path.
 8888|  22.2k|          path += '/';
 8889|  22.2k|          path.append(path_buffer);
 8890|  22.2k|        }
 8891|  22.2k|      }
 8892|  27.3k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (8892:11): [True: 6.63k, False: 20.7k]
  ------------------
 8893|  6.63k|        return;
 8894|  6.63k|      }
 8895|  27.3k|    } while (true);
  ------------------
  |  Branch (8895:14): [True: 20.7k, Folded]
  ------------------
 8896|  6.63k|  }
 8897|  11.0k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   87|   162k|    std::string_view input) noexcept {
   88|       |  // The path percent-encode set is the query percent-encode set and U+003F (?),
   89|       |  // U+0060 (`), U+007B ({), and U+007D (}). The query percent-encode set is the
   90|       |  // C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#),
   91|       |  // U+003C (<), and U+003E (>). The C0 control percent-encode set are the C0
   92|       |  // controls and all code points greater than U+007E (~).
   93|   162k|  size_t i = 0;
   94|   162k|  uint8_t accumulator{};
   95|   225k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (95:10): [True: 63.4k, False: 162k]
  ------------------
   96|  63.4k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   97|  63.4k|                           path_signature_table[uint8_t(input[i + 1])] |
   98|  63.4k|                           path_signature_table[uint8_t(input[i + 2])] |
   99|  63.4k|                           path_signature_table[uint8_t(input[i + 3])] |
  100|  63.4k|                           path_signature_table[uint8_t(input[i + 4])] |
  101|  63.4k|                           path_signature_table[uint8_t(input[i + 5])] |
  102|  63.4k|                           path_signature_table[uint8_t(input[i + 6])] |
  103|  63.4k|                           path_signature_table[uint8_t(input[i + 7])]);
  104|  63.4k|  }
  105|   294k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (105:10): [True: 132k, False: 162k]
  ------------------
  106|   132k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
  107|   132k|  }
  108|   162k|  return accumulator;
  109|   162k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7308|  12.7k|                    std::string& out) {
 7309|  12.7k|  ada_log("percent_encode ", input, " to output string while ",
 7310|  12.7k|          append ? "appending" : "overwriting");
 7311|  12.7k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7312|  12.7k|    return character_sets::bit_at(character_set, c);
 7313|  12.7k|  });
 7314|  12.7k|  ada_log("percent_encode done checking, moved to ",
 7315|  12.7k|          std::distance(input.begin(), pointer));
 7316|       |
 7317|       |  // Optimization: Don't iterate if percent encode is not required
 7318|  12.7k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7318:7): [True: 9.48k, False: 3.24k]
  ------------------
 7319|  9.48k|    ada_log("percent_encode encoding not needed.");
 7320|  9.48k|    return false;
 7321|  9.48k|  }
 7322|  3.24k|  if constexpr (!append) {
 7323|  3.24k|    out.clear();
 7324|  3.24k|  }
 7325|  3.24k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7326|  3.24k|          " bytes");
 7327|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7328|  3.24k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7329|  3.24k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7330|  3.24k|          " bytes");
 7331|  38.2k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7331:10): [True: 34.9k, False: 3.24k]
  ------------------
 7332|  34.9k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7332:9): [True: 23.8k, False: 11.1k]
  ------------------
 7333|  23.8k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7334|  23.8k|    } else {
 7335|  11.1k|      out += *pointer;
 7336|  11.1k|    }
 7337|  34.9k|  }
 7338|  3.24k|  return true;
 7339|  12.7k|}
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7311|  22.1k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7312|  22.1k|    return character_sets::bit_at(character_set, c);
 7313|  22.1k|  });
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7100|  54.7k|    std::string_view input) noexcept {
 7101|       |  // This will catch most cases:
 7102|       |  // The length must be 2,4 or 6.
 7103|       |  // We divide by two and require
 7104|       |  // that the result be between 1 and 3 inclusively.
 7105|  54.7k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7106|  54.7k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7106:7): [True: 26.9k, False: 27.8k]
  ------------------
 7107|  26.9k|    return false;
 7108|  26.9k|  }
 7109|       |  // We have a string of length 2, 4 or 6.
 7110|       |  // We now check the first character:
 7111|  27.8k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7111:7): [True: 24.0k, False: 3.75k]
  |  Branch (7111:28): [True: 12.0k, False: 12.0k]
  ------------------
 7112|  12.0k|    return false;
 7113|  12.0k|  }
 7114|       |  // We are unlikely the get beyond this point.
 7115|  15.7k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7116|  15.7k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7117|  15.7k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7117:7): [True: 3.79k, False: 11.9k]
  ------------------
 7118|  3.79k|    return false;
 7119|  3.79k|  }
 7120|       |  // We almost never get here.
 7121|       |  // Optimizing the rest is relatively unimportant.
 7122|  11.9k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7123|  11.9k|    uint16_t A, B;
 7124|  11.9k|    memcpy(&A, a.data(), sizeof(A));
 7125|  11.9k|    memcpy(&B, b.data(), sizeof(B));
 7126|  11.9k|    return A == B;
 7127|  11.9k|  };
 7128|  11.9k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7128:7): [True: 1.89k, False: 10.1k]
  ------------------
 7129|  1.89k|    return false;
 7130|  1.89k|  }
 7131|  40.8k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7131:22): [True: 31.8k, False: 9.03k]
  ------------------
 7132|  31.8k|    char c = input[i];
 7133|  31.8k|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7133:9): [True: 1.07k, False: 30.7k]
  |  Branch (7133:10): [True: 15.7k, False: 16.1k]
  ------------------
 7134|  1.07k|      return false;
 7135|  1.07k|    }
 7136|  31.8k|  }
 7137|  9.03k|  return true;
 7138|       |  // The above code might be a bit better than the code below. Compilers
 7139|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7140|       |  // 6 and other tricks.
 7141|       |  // return input == ".." ||
 7142|       |  //  input == ".%2e" || input == ".%2E" ||
 7143|       |  //  input == "%2e." || input == "%2E." ||
 7144|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7145|       |  //  "%2e%2E";
 7146|  10.1k|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7122|  11.9k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7123|  11.9k|    uint16_t A, B;
 7124|  11.9k|    memcpy(&A, a.data(), sizeof(A));
 7125|  11.9k|    memcpy(&B, b.data(), sizeof(B));
 7126|  11.9k|    return A == B;
 7127|  11.9k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7149|  91.0k|    std::string_view input) noexcept {
 7150|  91.0k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7150:10): [True: 1.27k, False: 89.8k]
  |  Branch (7150:26): [True: 724, False: 89.0k]
  |  Branch (7150:44): [True: 48, False: 89.0k]
  ------------------
 7151|  91.0k|}
_ZN3ada7unicode28is_forbidden_host_code_pointEc:
 6970|  11.6k|    const char c) noexcept {
 6971|  11.6k|  return is_forbidden_host_code_point_table[uint8_t(c)];
 6972|  11.6k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9014|  17.5k|                              bool& is_pure_decimal) noexcept {
 9015|  17.5k|  is_pure_decimal = false;
 9016|  17.5k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9016:7): [True: 0, False: 17.5k]
  ------------------
 9017|      0|    return false;
 9018|      0|  }
 9019|  17.5k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9019:7): [True: 9.35k, False: 8.22k]
  |  Branch (9019:23): [True: 8.27k, False: 1.08k]
  |  Branch (9019:38): [True: 7.82k, False: 446]
  ------------------
 9020|  7.82k|    p += 2;
 9021|  7.82k|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9021:9): [True: 22, False: 7.80k]
  |  Branch (9021:21): [True: 20, False: 7.78k]
  ------------------
 9022|     42|      value = 0;
 9023|     42|      return true;
 9024|     42|    }
 9025|  7.78k|    uint64_t v = 0;
 9026|  7.78k|    int digits = 0;
 9027|  24.2k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9027:12): [True: 24.0k, False: 146]
  |  Branch (9027:23): [True: 16.5k, False: 7.51k]
  ------------------
 9028|  16.5k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9029|  16.5k|      if (nib == 0xff || digits >= 8) [[unlikely]] {
  ------------------
  |  Branch (9029:11): [True: 34, False: 16.5k]
  |  Branch (9029:26): [True: 94, False: 16.4k]
  ------------------
 9030|    128|        return false;
 9031|    128|      }
 9032|  16.4k|      v = (v << 4) | nib;
 9033|  16.4k|      ++p;
 9034|  16.4k|      ++digits;
 9035|  16.4k|    }
 9036|  7.65k|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9036:9): [True: 0, False: 7.65k]
  ------------------
 9037|      0|      return false;
 9038|      0|    }
 9039|  7.65k|    value = v;
 9040|  7.65k|    return true;
 9041|  7.65k|  }
 9042|  9.75k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9042:7): [True: 1.52k, False: 8.22k]
  |  Branch (9042:23): [True: 446, False: 1.08k]
  |  Branch (9042:38): [True: 328, False: 118]
  |  Branch (9042:53): [True: 326, False: 2]
  ------------------
 9043|    326|    ++p;
 9044|    326|    uint64_t v = 0;
 9045|  2.45k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9045:12): [True: 2.32k, False: 126]
  |  Branch (9045:23): [True: 2.19k, False: 126]
  ------------------
 9046|  2.19k|      const char c = *p;
 9047|  2.19k|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9047:11): [True: 2, False: 2.19k]
  |  Branch (9047:22): [True: 30, False: 2.16k]
  ------------------
 9048|     32|        return false;
 9049|     32|      }
 9050|  2.16k|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9050:11): [True: 42, False: 2.12k]
  ------------------
 9051|     42|        return false;
 9052|     42|      }
 9053|  2.12k|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9054|  2.12k|      ++p;
 9055|  2.12k|    }
 9056|    252|    value = v;
 9057|    252|    return true;
 9058|    326|  }
 9059|  9.43k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9059:7): [True: 42, False: 9.38k]
  |  Branch (9059:19): [True: 78, False: 9.31k]
  ------------------
 9060|    120|    return false;
 9061|    120|  }
 9062|  9.31k|  is_pure_decimal = true;
 9063|  9.31k|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9064|  9.31k|  ++p;
 9065|  13.0k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9065:10): [True: 4.48k, False: 8.56k]
  |  Branch (9065:21): [True: 3.80k, False: 684]
  ------------------
 9066|  3.80k|    const char c = *p;
 9067|  3.80k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9067:9): [True: 10, False: 3.79k]
  |  Branch (9067:20): [True: 18, False: 3.77k]
  ------------------
 9068|     28|      return false;
 9069|     28|    }
 9070|  3.77k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9070:9): [True: 34, False: 3.74k]
  ------------------
 9071|     34|      return false;
 9072|     34|    }
 9073|  3.74k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9074|  3.74k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9074:9): [True: 0, False: 3.74k]
  ------------------
 9075|      0|      return false;
 9076|      0|    }
 9077|  3.74k|    ++p;
 9078|  3.74k|  }
 9079|  9.24k|  value = v;
 9080|  9.24k|  return true;
 9081|  9.31k|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9085|    928|                           uint16_t& value) noexcept {
 9086|    928|  if (pointer == end) {
  ------------------
  |  Branch (9086:7): [True: 0, False: 928]
  ------------------
 9087|      0|    return 0;
 9088|      0|  }
 9089|    928|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9090|    928|  if (n0 == 0xff) {
  ------------------
  |  Branch (9090:7): [True: 56, False: 872]
  ------------------
 9091|     56|    return 0;
 9092|     56|  }
 9093|    872|  uint32_t v = n0;
 9094|    872|  ++pointer;
 9095|    872|  int length = 1;
 9096|    872|  if (pointer != end) {
  ------------------
  |  Branch (9096:7): [True: 732, False: 140]
  ------------------
 9097|    732|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9098|    732|    if (n1 != 0xff) {
  ------------------
  |  Branch (9098:9): [True: 412, False: 320]
  ------------------
 9099|    412|      v = (v << 4) | n1;
 9100|    412|      ++pointer;
 9101|    412|      ++length;
 9102|    412|      if (pointer != end) {
  ------------------
  |  Branch (9102:11): [True: 374, False: 38]
  ------------------
 9103|    374|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9104|    374|        if (n2 != 0xff) {
  ------------------
  |  Branch (9104:13): [True: 246, False: 128]
  ------------------
 9105|    246|          v = (v << 4) | n2;
 9106|    246|          ++pointer;
 9107|    246|          ++length;
 9108|    246|          if (pointer != end) {
  ------------------
  |  Branch (9108:15): [True: 206, False: 40]
  ------------------
 9109|    206|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9110|    206|            if (n3 != 0xff) {
  ------------------
  |  Branch (9110:17): [True: 114, False: 92]
  ------------------
 9111|    114|              v = (v << 4) | n3;
 9112|    114|              ++pointer;
 9113|    114|              ++length;
 9114|    114|            }
 9115|    206|          }
 9116|    246|        }
 9117|    374|      }
 9118|    412|    }
 9119|    732|  }
 9120|    872|  value = static_cast<uint16_t>(v);
 9121|    872|  return length;
 9122|    928|}
_ZN3ada7unicode13is_alnum_plusEc:
 7064|   784k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7065|   784k|  return is_alnum_plus_table[uint8_t(c)];
 7066|       |  // A table is almost surely much faster than the
 7067|       |  // following under most compilers: return
 7068|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7069|   784k|}
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7994|   168k|    std::string_view& input) noexcept {
 7995|       |  // compiles down to 20--30 instructions including a class to memchr (C
 7996|       |  // function). this function should be quite fast.
 7997|   168k|  size_t location_of_first = input.find('#');
 7998|   168k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (7998:7): [True: 156k, False: 11.7k]
  ------------------
 7999|   156k|    return std::nullopt;
 8000|   156k|  }
 8001|  11.7k|  std::string_view hash = input;
 8002|  11.7k|  hash.remove_prefix(location_of_first + 1);
 8003|  11.7k|  input.remove_suffix(input.size() - location_of_first);
 8004|  11.7k|  return hash;
 8005|   168k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8932|  64.0k|find_authority_delimiter_special(std::string_view view) noexcept {
 8933|       |  // performance note: we might be able to gain further performance
 8934|       |  // with SIMD intrinsics.
 8935|   731k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (8935:33): [True: 730k, False: 484]
  ------------------
 8936|   730k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (8936:9): [True: 63.5k, False: 667k]
  ------------------
 8937|  63.5k|      return pos - view.begin();
 8938|  63.5k|    }
 8939|   730k|  }
 8940|    484|  return size_t(view.size());
 8941|  64.0k|}
_ZN3ada7helpers24find_authority_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8953|    268|find_authority_delimiter(std::string_view view) noexcept {
 8954|       |  // performance note: we might be able to gain further performance
 8955|       |  // with SIMD instrinsics.
 8956|  3.93k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (8956:33): [True: 3.91k, False: 24]
  ------------------
 8957|  3.91k|    if (authority_delimiter[(uint8_t)*pos]) {
  ------------------
  |  Branch (8957:9): [True: 244, False: 3.66k]
  ------------------
 8958|    244|      return pos - view.begin();
 8959|    244|    }
 8960|  3.91k|  }
 8961|     24|  return size_t(view.size());
 8962|    268|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8007|  9.03k|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8008|       |  // Let path be url's path.
 8009|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8010|       |  // Windows drive letter, then return.
 8011|  9.03k|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8011:7): [True: 256, False: 8.77k]
  ------------------
 8012|    256|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8012:7): [True: 128, False: 128]
  |  Branch (8012:54): [True: 92, False: 36]
  ------------------
 8013|     92|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8013:9): [True: 20, False: 72]
  ------------------
 8014|     92|            helpers::substring(path, 1))) {
 8015|     20|      return false;
 8016|     20|    }
 8017|     92|  }
 8018|       |
 8019|       |  // Remove path's last item, if any.
 8020|  9.01k|  size_t last_delimiter = path.rfind('/');
 8021|  9.01k|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8021:7): [True: 8.46k, False: 546]
  ------------------
 8022|  8.46k|    path.erase(last_delimiter);
 8023|  8.46k|    return true;
 8024|  8.46k|  }
 8025|       |
 8026|    546|  return false;
 8027|  9.01k|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8645|   166k|    const bool is_special, std::string_view& view) noexcept {
 8646|       |  /**
 8647|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 8648|       |   * compute a variable called insideBrackets but this variable is only used
 8649|       |   * once, to check whether a ':' character was found outside brackets. Exact
 8650|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 8651|       |   * It is conceptually simpler and arguably more efficient to just return a
 8652|       |   * Boolean indicating whether ':' was found outside brackets.
 8653|       |   */
 8654|   166k|  const size_t view_size = view.size();
 8655|   166k|  size_t location = 0;
 8656|   166k|  bool found_colon = false;
 8657|       |  /**
 8658|       |   * Performance analysis:
 8659|       |   *
 8660|       |   * We are basically seeking the end of the hostname which can be indicated
 8661|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 8662|       |   * (where '\\' is only applicable for special URLs). However, these must
 8663|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 8664|       |   * '?' does not count.
 8665|       |   *
 8666|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 8667|       |   * the set of delimiters, and that we handle it first.
 8668|       |   *
 8669|       |   * So the trick is to have a fast function that locates the next delimiter.
 8670|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 8671|       |   * function would be provided by the C++ standard library, but it seems that
 8672|       |   * find_first_of is not very fast, so we are forced to roll our own.
 8673|       |   *
 8674|       |   * We do not break into two loops for speed, but for clarity.
 8675|       |   */
 8676|   166k|  if (is_special) {
  ------------------
  |  Branch (8676:7): [True: 165k, False: 1.04k]
  ------------------
 8677|       |    // We move to the next delimiter.
 8678|   165k|    location = find_next_host_delimiter_special(view, location);
 8679|       |    // Unless we find '[' then we are going only going to have to call
 8680|       |    // find_next_host_delimiter_special once.
 8681|   166k|    for (; location < view_size;
  ------------------
  |  Branch (8681:12): [True: 162k, False: 3.20k]
  ------------------
 8682|   165k|         location = find_next_host_delimiter_special(view, location)) {
 8683|   162k|      if (view[location] == '[') {
  ------------------
  |  Branch (8683:11): [True: 1.14k, False: 161k]
  ------------------
 8684|  1.14k|        location = view.find(']', location);
 8685|  1.14k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (8685:13): [True: 178, False: 966]
  ------------------
 8686|       |          // performance: view.find might get translated to a memchr, which
 8687|       |          // has no notion of std::string_view::npos, so the code does not
 8688|       |          // reflect the assembly.
 8689|    178|          location = view_size;
 8690|    178|          break;
 8691|    178|        }
 8692|   161k|      } else {
 8693|   161k|        found_colon = view[location] == ':';
 8694|   161k|        break;
 8695|   161k|      }
 8696|   162k|    }
 8697|   165k|  } else {
 8698|       |    // We move to the next delimiter.
 8699|  1.04k|    location = find_next_host_delimiter(view, location);
 8700|       |    // Unless we find '[' then we are going only going to have to call
 8701|       |    // find_next_host_delimiter_special once.
 8702|  1.18k|    for (; location < view_size;
  ------------------
  |  Branch (8702:12): [True: 1.06k, False: 122]
  ------------------
 8703|  1.06k|         location = find_next_host_delimiter(view, location)) {
 8704|  1.06k|      if (view[location] == '[') {
  ------------------
  |  Branch (8704:11): [True: 150, False: 916]
  ------------------
 8705|    150|        location = view.find(']', location);
 8706|    150|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (8706:13): [True: 8, False: 142]
  ------------------
 8707|       |          // performance: view.find might get translated to a memchr, which
 8708|       |          // has no notion of std::string_view::npos, so the code does not
 8709|       |          // reflect the assembly.
 8710|      8|          location = view_size;
 8711|      8|          break;
 8712|      8|        }
 8713|    916|      } else {
 8714|    916|        found_colon = view[location] == ':';
 8715|    916|        break;
 8716|    916|      }
 8717|  1.06k|    }
 8718|  1.04k|  }
 8719|       |  // performance: remove_suffix may translate into a single instruction.
 8720|   166k|  view.remove_suffix(view_size - location);
 8721|   166k|  return {location, found_colon};
 8722|   166k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8222|   166k|    std::string_view view, size_t location) noexcept {
 8223|       |  // first check for short strings in which case we do it naively.
 8224|   166k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8224:7): [True: 94.8k, False: 71.1k]
  ------------------
 8225|   899k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8225:31): [True: 896k, False: 2.29k]
  ------------------
 8226|   896k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8226:11): [True: 1.00k, False: 895k]
  |  Branch (8226:29): [True: 90.7k, False: 804k]
  |  Branch (8226:47): [True: 132, False: 804k]
  ------------------
 8227|   804k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8227:11): [True: 246, False: 804k]
  |  Branch (8227:29): [True: 388, False: 804k]
  ------------------
 8228|  92.5k|        return i;
 8229|  92.5k|      }
 8230|   896k|    }
 8231|  2.29k|    return size_t(view.size());
 8232|  94.8k|  }
 8233|       |  // fast path for long strings (expected to be common)
 8234|  71.1k|  size_t i = location;
 8235|  71.1k|  const __m128i mask1 = _mm_set1_epi8(':');
 8236|  71.1k|  const __m128i mask2 = _mm_set1_epi8('/');
 8237|  71.1k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8238|  71.1k|  const __m128i mask4 = _mm_set1_epi8('?');
 8239|  71.1k|  const __m128i mask5 = _mm_set1_epi8('[');
 8240|       |
 8241|   108k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8241:10): [True: 84.8k, False: 23.6k]
  ------------------
 8242|  84.8k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8243|  84.8k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8244|  84.8k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8245|  84.8k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8246|  84.8k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8247|  84.8k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8248|  84.8k|    __m128i m = _mm_or_si128(
 8249|  84.8k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8250|  84.8k|    int mask = _mm_movemask_epi8(m);
 8251|  84.8k|    if (mask != 0) {
  ------------------
  |  Branch (8251:9): [True: 47.5k, False: 37.3k]
  ------------------
 8252|  47.5k|      return i + trailing_zeroes(mask);
 8253|  47.5k|    }
 8254|  84.8k|  }
 8255|  23.6k|  if (i < view.size()) {
  ------------------
  |  Branch (8255:7): [True: 23.5k, False: 122]
  ------------------
 8256|  23.5k|    __m128i word =
 8257|  23.5k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8258|  23.5k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8259|  23.5k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8260|  23.5k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8261|  23.5k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8262|  23.5k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8263|  23.5k|    __m128i m = _mm_or_si128(
 8264|  23.5k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8265|  23.5k|    int mask = _mm_movemask_epi8(m);
 8266|  23.5k|    if (mask != 0) {
  ------------------
  |  Branch (8266:9): [True: 22.7k, False: 786]
  ------------------
 8267|  22.7k|      return view.length() - 16 + trailing_zeroes(mask);
 8268|  22.7k|    }
 8269|  23.5k|  }
 8270|    908|  return size_t(view.length());
 8271|  23.6k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8075|  71.0k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8076|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8077|       |  unsigned long ret;
 8078|       |  // Search the mask data from least significant bit (LSB)
 8079|       |  // to the most significant bit (MSB) for a set bit (1).
 8080|       |  _BitScanForward(&ret, input_num);
 8081|       |  return (int)ret;
 8082|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8083|  71.0k|  return __builtin_ctzl(input_num);
 8084|  71.0k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8085|  71.0k|}
_ZN3ada7helpers24find_next_host_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8511|  1.18k|                                                  size_t location) noexcept {
 8512|       |  // first check for short strings in which case we do it naively.
 8513|  1.18k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8513:7): [True: 336, False: 852]
  ------------------
 8514|  2.16k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8514:31): [True: 2.07k, False: 90]
  ------------------
 8515|  2.07k|      if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
  ------------------
  |  Branch (8515:11): [True: 52, False: 2.02k]
  |  Branch (8515:29): [True: 108, False: 1.91k]
  |  Branch (8515:47): [True: 54, False: 1.86k]
  ------------------
 8516|  1.86k|          view[i] == '[') {
  ------------------
  |  Branch (8516:11): [True: 32, False: 1.83k]
  ------------------
 8517|    246|        return i;
 8518|    246|      }
 8519|  2.07k|    }
 8520|     90|    return size_t(view.size());
 8521|    336|  }
 8522|       |  // fast path for long strings (expected to be common)
 8523|    852|  size_t i = location;
 8524|    852|  const __m128i mask1 = _mm_set1_epi8(':');
 8525|    852|  const __m128i mask2 = _mm_set1_epi8('/');
 8526|    852|  const __m128i mask4 = _mm_set1_epi8('?');
 8527|    852|  const __m128i mask5 = _mm_set1_epi8('[');
 8528|       |
 8529|  1.18k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8529:10): [True: 1.09k, False: 92]
  ------------------
 8530|  1.09k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8531|  1.09k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8532|  1.09k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8533|  1.09k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8534|  1.09k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8535|  1.09k|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 8536|  1.09k|    int mask = _mm_movemask_epi8(m);
 8537|  1.09k|    if (mask != 0) {
  ------------------
  |  Branch (8537:9): [True: 760, False: 330]
  ------------------
 8538|    760|      return i + trailing_zeroes(mask);
 8539|    760|    }
 8540|  1.09k|  }
 8541|     92|  if (i < view.size()) {
  ------------------
  |  Branch (8541:7): [True: 80, False: 12]
  ------------------
 8542|     80|    __m128i word =
 8543|     80|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8544|     80|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8545|     80|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8546|     80|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8547|     80|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8548|     80|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 8549|     80|    int mask = _mm_movemask_epi8(m);
 8550|     80|    if (mask != 0) {
  ------------------
  |  Branch (8550:9): [True: 60, False: 20]
  ------------------
 8551|     60|      return view.length() - 16 + trailing_zeroes(mask);
 8552|     60|    }
 8553|     80|  }
 8554|     32|  return size_t(view.length());
 8555|     92|}
_ZN3ada3url10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9487|  83.3k|ada_really_inline bool url::parse_host(std::string_view input) {
 9488|  83.3k|  ada_log("parse_host ", input, " [", input.size(), " bytes]");
 9489|  83.3k|  if (input.empty()) {
  ------------------
  |  Branch (9489:7): [True: 14, False: 83.3k]
  ------------------
 9490|     14|    return is_valid = false;
 9491|     14|  }  // technically unnecessary.
 9492|       |  // If input starts with U+005B ([), then:
 9493|  83.3k|  if (input[0] == '[') {
  ------------------
  |  Branch (9493:7): [True: 287, False: 83.0k]
  ------------------
 9494|       |    // If input does not end with U+005D (]), validation error, return failure.
 9495|    287|    if (input.back() != ']') {
  ------------------
  |  Branch (9495:9): [True: 43, False: 244]
  ------------------
 9496|     43|      return is_valid = false;
 9497|     43|    }
 9498|    244|    ada_log("parse_host ipv6");
 9499|       |
 9500|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
 9501|       |    // trailing U+005D (]) removed.
 9502|    244|    input.remove_prefix(1);
 9503|    244|    input.remove_suffix(1);
 9504|    244|    return parse_ipv6(input);
 9505|    287|  }
 9506|       |
 9507|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
 9508|       |  // input.
 9509|  83.0k|  if (!is_special()) {
  ------------------
  |  Branch (9509:7): [True: 449, False: 82.5k]
  ------------------
 9510|    449|    return parse_opaque_host(input);
 9511|    449|  }
 9512|       |
 9513|       |  // Fast path: try to parse as pure decimal IPv4(a.b.c.d) first.
 9514|  82.5k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
 9515|  82.5k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (9515:7): [True: 20.0k, False: 62.5k]
  ------------------
 9516|       |    // Fast path succeeded - input is pure decimal IPv4
 9517|  20.0k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (9517:9): [True: 20.0k, False: 0]
  |  Branch (9517:27): [True: 3, False: 20.0k]
  ------------------
 9518|      3|      host = input.substr(0, input.size() - 1);
 9519|  20.0k|    } else {
 9520|  20.0k|      host = input;
 9521|  20.0k|    }
 9522|  20.0k|    host_type = IPV4;
 9523|  20.0k|    is_valid = true;
 9524|  20.0k|    ada_log("parse_host fast path decimal ipv4");
 9525|  20.0k|    return true;
 9526|  20.0k|  }
 9527|       |  // Let domain be the result of running UTF-8 decode without BOM on the
 9528|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
 9529|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
 9530|       |  // which case we do not need to call the expensive 'to_ascii' if a few
 9531|       |  // conditions are met: no '%' and no 'xn-' subsequence.
 9532|  62.5k|  std::string buffer = std::string(input);
 9533|       |  // This next function checks that the result is ascii, but we are going to
 9534|       |  // to check anyhow with is_forbidden.
 9535|       |  // bool is_ascii =
 9536|  62.5k|  unicode::to_lower_ascii(buffer.data(), buffer.size());
 9537|  62.5k|  bool is_forbidden = unicode::contains_forbidden_domain_code_point(
 9538|  62.5k|      buffer.data(), buffer.size());
 9539|  62.5k|  static constexpr std::string_view xn_dash{"xn-", 3};
 9540|  62.5k|  if (is_forbidden == 0 && buffer.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (9540:7): [True: 61.1k, False: 1.40k]
  |  Branch (9540:28): [True: 38.0k, False: 23.0k]
  ------------------
 9541|       |    // fast path
 9542|  38.0k|    host = std::move(buffer);
 9543|       |
 9544|       |    // Check for other IPv4 formats (hex, octal, etc.)
 9545|  38.0k|    if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (9545:9): [True: 4.62k, False: 33.4k]
  ------------------
 9546|  4.62k|      ada_log("parse_host fast path ipv4");
 9547|  4.62k|      return parse_ipv4(host.value());
 9548|  4.62k|    }
 9549|  33.4k|    ada_log("parse_host fast path ", *host);
 9550|  33.4k|    is_valid = true;
 9551|  33.4k|    return true;
 9552|  38.0k|  }
 9553|  24.5k|  ada_log("parse_host calling to_ascii");
 9554|  24.5k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
 9555|  24.5k|  if (!is_valid || !host.has_value()) {
  ------------------
  |  Branch (9555:7): [True: 1.00k, False: 23.4k]
  |  Branch (9555:20): [True: 0, False: 23.4k]
  ------------------
 9556|  1.00k|    ada_log("parse_host to_ascii returns false");
 9557|  1.00k|    return is_valid = false;
 9558|  1.00k|  }
 9559|  23.4k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
 9560|  23.4k|          " bytes]");
 9561|       |
 9562|  23.4k|  if (std::any_of(host->begin(), host->end(),
  ------------------
  |  Branch (9562:7): [True: 0, False: 23.4k]
  ------------------
 9563|  23.4k|                  ada::unicode::is_forbidden_domain_code_point)) {
 9564|      0|    host = std::nullopt;
 9565|      0|    return is_valid = false;
 9566|      0|  }
 9567|       |
 9568|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
 9569|       |  // asciiDomain.
 9570|  23.4k|  if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (9570:7): [True: 58, False: 23.4k]
  ------------------
 9571|     58|    ada_log("parse_host got ipv4 ", *host);
 9572|     58|    return parse_ipv4(*host);
 9573|     58|  }
 9574|       |
 9575|  23.4k|  return true;
 9576|  23.4k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 6993|   597k|    const char c) noexcept {
 6994|   597k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 6995|   597k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7308|  10.6k|                    std::string& out) {
 7309|  10.6k|  ada_log("percent_encode ", input, " to output string while ",
 7310|  10.6k|          append ? "appending" : "overwriting");
 7311|  10.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7312|  10.6k|    return character_sets::bit_at(character_set, c);
 7313|  10.6k|  });
 7314|  10.6k|  ada_log("percent_encode done checking, moved to ",
 7315|  10.6k|          std::distance(input.begin(), pointer));
 7316|       |
 7317|       |  // Optimization: Don't iterate if percent encode is not required
 7318|  10.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7318:7): [True: 10.4k, False: 285]
  ------------------
 7319|  10.4k|    ada_log("percent_encode encoding not needed.");
 7320|  10.4k|    return false;
 7321|  10.4k|  }
 7322|       |  if constexpr (!append) {
 7323|       |    out.clear();
 7324|       |  }
 7325|    285|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7326|    285|          " bytes");
 7327|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7328|    285|  out.append(input.data(), std::distance(input.begin(), pointer));
 7329|    285|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7330|    285|          " bytes");
 7331|  15.0k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7331:10): [True: 14.7k, False: 285]
  ------------------
 7332|  14.7k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7332:9): [True: 9.17k, False: 5.58k]
  ------------------
 7333|  9.17k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7334|  9.17k|    } else {
 7335|  5.58k|      out += *pointer;
 7336|  5.58k|    }
 7337|  14.7k|  }
 7338|    285|  return true;
 7339|  10.6k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7311|   119k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7312|   119k|    return character_sets::bit_at(character_set, c);
 7313|   119k|  });
simple_absolute.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
11427|  84.2k|    ada::url_components& components, uint32_t new_difference) {
11428|  84.2k|  components.username_end += new_difference;
11429|  84.2k|  components.host_start += new_difference;
11430|  84.2k|  components.host_end += new_difference;
11431|  84.2k|  components.pathname_start += new_difference;
11432|  84.2k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (11432:7): [True: 0, False: 84.2k]
  ------------------
11433|      0|    components.search_start += new_difference;
11434|      0|  }
11435|  84.2k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (11435:7): [True: 0, False: 84.2k]
  ------------------
11436|      0|    components.hash_start += new_difference;
11437|      0|  }
11438|  84.2k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11887|  83.3k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
11888|  83.3k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
11889|  83.3k|          " bytes]");
11890|  83.3k|  ADA_ASSERT_TRUE(validate());
11891|  83.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
11892|  83.3k|  if (input.empty()) {
  ------------------
  |  Branch (11892:7): [True: 14, False: 83.3k]
  ------------------
11893|     14|    return is_valid = false;
11894|     14|  }  // technically unnecessary.
11895|       |  // If input starts with U+005B ([), then:
11896|  83.3k|  if (input[0] == '[') {
  ------------------
  |  Branch (11896:7): [True: 287, False: 83.0k]
  ------------------
11897|       |    // If input does not end with U+005D (]), validation error, return failure.
11898|    287|    if (input.back() != ']') {
  ------------------
  |  Branch (11898:9): [True: 43, False: 244]
  ------------------
11899|     43|      return is_valid = false;
11900|     43|    }
11901|    244|    ada_log("parse_host ipv6");
11902|       |
11903|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
11904|       |    // trailing U+005D (]) removed.
11905|    244|    input.remove_prefix(1);
11906|    244|    input.remove_suffix(1);
11907|    244|    return parse_ipv6(input);
11908|    287|  }
11909|       |
11910|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
11911|       |  // input.
11912|  83.0k|  if (!is_special()) {
  ------------------
  |  Branch (11912:7): [True: 449, False: 82.5k]
  ------------------
11913|    449|    return parse_opaque_host(input);
11914|    449|  }
11915|       |  // Let domain be the result of running UTF-8 decode without BOM on the
11916|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
11917|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
11918|       |  // which case we do not need to call the expensive 'to_ascii' if a few
11919|       |  // conditions are met: no '%' and no 'xn-' subsequence.
11920|       |
11921|       |  // Often, the input does not contain any forbidden code points, and no upper
11922|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
11923|       |  // optimize for such a common case.
11924|       |
11925|       |  // Fast path: try to parse as pure decimal IPv4(a.b.c.d) first.
11926|  82.5k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
11927|  82.5k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (11927:7): [True: 20.0k, False: 62.5k]
  ------------------
11928|       |    // Fast path succeeded - input is pure decimal IPv4
11929|  20.0k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (11929:9): [True: 20.0k, False: 0]
  |  Branch (11929:27): [True: 3, False: 20.0k]
  ------------------
11930|      3|      update_base_hostname(input.substr(0, input.size() - 1));
11931|  20.0k|    } else {
11932|  20.0k|      update_base_hostname(input);
11933|  20.0k|    }
11934|  20.0k|    host_type = IPV4;
11935|  20.0k|    is_valid = true;
11936|  20.0k|    ada_log("parse_host fast path decimal ipv4");
11937|  20.0k|    ADA_ASSERT_TRUE(validate());
11938|  20.0k|    return true;
11939|  20.0k|  }
11940|  62.5k|  uint8_t is_forbidden_or_upper =
11941|  62.5k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
11942|  62.5k|                                                             input.size());
11943|       |  // Minor optimization opportunity:
11944|       |  // contains_forbidden_domain_code_point_or_upper could be extend to check for
11945|       |  // the presence of characters that cannot appear in the ipv4 address and we
11946|       |  // could also check whether x and n and - are present, and so we could skip
11947|       |  // some of the checks below. However, the gains are likely to be small, and
11948|       |  // the code would be more complex.
11949|  62.5k|  static constexpr std::string_view xn_dash{"xn-", 3};
11950|  62.5k|  if (is_forbidden_or_upper == 0 &&
  ------------------
  |  Branch (11950:7): [True: 60.6k, False: 1.89k]
  ------------------
11951|  60.6k|      input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (11951:7): [True: 37.6k, False: 22.9k]
  ------------------
11952|       |    // fast path
11953|  37.6k|    update_base_hostname(input);
11954|       |
11955|       |    // Check for other IPv4 formats (hex, octal, etc.)
11956|  37.6k|    if (checkers::is_ipv4(get_hostname())) {
  ------------------
  |  Branch (11956:9): [True: 4.55k, False: 33.1k]
  ------------------
11957|  4.55k|      ada_log("parse_host fast path ipv4");
11958|  4.55k|      return parse_ipv4(get_hostname(), true);
11959|  4.55k|    }
11960|  33.1k|    ada_log("parse_host fast path ", get_hostname());
11961|  33.1k|    is_valid = true;
11962|  33.1k|    return true;
11963|  37.6k|  }
11964|       |  // We have encountered at least one forbidden code point or the input contains
11965|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
11966|       |  // conversion.
11967|       |
11968|  24.8k|  ada_log("parse_host calling to_ascii");
11969|  24.8k|  std::optional<std::string> host = std::string(get_hostname());
11970|  24.8k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
11971|  24.8k|  if (!is_valid) {
  ------------------
  |  Branch (11971:7): [True: 1.00k, False: 23.8k]
  ------------------
11972|  1.00k|    ada_log("parse_host to_ascii returns false");
11973|  1.00k|    return is_valid = false;
11974|  1.00k|  }
11975|  23.8k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
11976|  23.8k|          " bytes]");
11977|       |
11978|  23.8k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (11978:7): [True: 0, False: 23.8k]
  ------------------
11979|  23.8k|                          ada::unicode::is_forbidden_domain_code_point)) {
11980|      0|    return is_valid = false;
11981|      0|  }
11982|       |
11983|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
11984|       |  // asciiDomain.
11985|  23.8k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (11985:7): [True: 128, False: 23.7k]
  ------------------
11986|    128|    ada_log("parse_host got ipv4 ", *host);
11987|    128|    return parse_ipv4(host.value(), false);
11988|    128|  }
11989|       |
11990|  23.7k|  update_base_hostname(host.value());
11991|  23.7k|  ADA_ASSERT_TRUE(validate());
11992|  23.7k|  return true;
11993|  23.8k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7034|  62.5k|                                              size_t length) noexcept {
 7035|  62.5k|  size_t i = 0;
 7036|  62.5k|  uint8_t accumulator{};
 7037|   221k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7037:10): [True: 158k, False: 62.5k]
  ------------------
 7038|   158k|    accumulator |=
 7039|   158k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7040|   158k|    accumulator |=
 7041|   158k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7042|   158k|    accumulator |=
 7043|   158k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7044|   158k|    accumulator |=
 7045|   158k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7046|   158k|  }
 7047|   182k|  for (; i < length; i++) {
  ------------------
  |  Branch (7047:10): [True: 119k, False: 62.5k]
  ------------------
 7048|   119k|    accumulator |=
 7049|   119k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7050|   119k|  }
 7051|  62.5k|  return accumulator;
 7052|  62.5k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8061|  8.91k|                                                       size_t pos) {
 8062|  8.91k|  ADA_ASSERT_TRUE(pos <= input.size());
 8063|       |  // The following is safer but unneeded if we have the above line:
 8064|       |  // return pos > input.size() ? std::string_view() : input.substr(pos);
 8065|  8.91k|  return input.substr(pos);
 8066|  8.91k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12800|  81.1k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
12801|  81.1k|  ada_log("url_aggregator::consume_prepared_path ", input);
12802|       |  /***
12803|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
12804|       |   * unfortunate. This particular function is nearly identical, except that it
12805|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
12806|       |   * very common) merely appends to the buffer. This is the same trivial path as
12807|       |   * with helpers::parse_prepared_path, except that we have the additional check
12808|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
12809|       |   * modify it, and then insert it back into the buffer.
12810|       |   */
12811|  81.1k|  uint8_t accumulator = checkers::path_signature(input);
12812|       |  // Let us first detect a trivial case.
12813|       |  // If it is special, we check that we have no dot, no %,  no \ and no
12814|       |  // character needing percent encoding. Otherwise, we check that we have no %,
12815|       |  // no dot, and no character needing percent encoding.
12816|  81.1k|  constexpr uint8_t need_encoding = 1;
12817|  81.1k|  constexpr uint8_t backslash_char = 2;
12818|  81.1k|  constexpr uint8_t dot_char = 4;
12819|  81.1k|  constexpr uint8_t percent_char = 8;
12820|  81.1k|  bool special = type != ada::scheme::NOT_SPECIAL;
12821|  81.1k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (12821:39): [True: 609, False: 80.4k]
  ------------------
12822|    609|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (12822:39): [True: 37, False: 572]
  ------------------
12823|  81.1k|  bool trivial_path =
12824|  81.1k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (12824:7): [True: 69.5k, False: 11.5k]
  |  Branch (12824:8): [True: 80.6k, False: 447]
  ------------------
12825|  81.1k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
12826|    447|                  0)) &&
12827|  69.5k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (12827:7): [True: 69.5k, False: 13]
  ------------------
12828|  81.1k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (12828:7): [True: 5.04k, False: 76.0k]
  |  Branch (12828:34): [True: 5.02k, False: 12]
  ------------------
12829|       |    // '4' means that we have at least one dot, but nothing that requires
12830|       |    // percent encoding or decoding. The only part that is not trivial is
12831|       |    // that we may have single dots and double dots path segments.
12832|       |    // If we have such segments, then we either have a path that begins
12833|       |    // with '.' (easy to check), or we have the sequence './'.
12834|       |    // Note: input cannot be empty, it must at least contain one character ('.')
12835|       |    // Note: we know that '\' is not present.
12836|  5.02k|    if (input[0] != '.') {
  ------------------
  |  Branch (12836:9): [True: 4.54k, False: 486]
  ------------------
12837|  4.54k|      size_t slashdot = 0;
12838|  4.54k|      bool dot_is_file = true;
12839|  14.6k|      for (;;) {
12840|  14.6k|        slashdot = input.find("/.", slashdot);
12841|  14.6k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (12841:13): [True: 4.54k, False: 10.1k]
  ------------------
12842|  4.54k|          break;
12843|  10.1k|        } else {  // uncommon
12844|       |          // only three cases matter: /./, /.. or a final /
12845|  10.1k|          slashdot += 2;
12846|  10.1k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (12846:28): [True: 9, False: 10.1k]
  |  Branch (12846:56): [True: 5.07k, False: 5.07k]
  ------------------
12847|  5.07k|                           input[slashdot] == '/');
  ------------------
  |  Branch (12847:28): [True: 3.98k, False: 1.09k]
  ------------------
12848|  10.1k|        }
12849|  14.6k|      }
12850|  4.54k|      trivial_path = dot_is_file;
12851|  4.54k|    }
12852|  5.02k|  }
12853|  81.1k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (12853:7): [True: 70.0k, False: 11.0k]
  |  Branch (12853:23): [True: 70.0k, False: 0]
  ------------------
12854|  70.0k|    ada_log("parse_path trivial");
12855|  70.0k|    buffer += '/';
12856|  70.0k|    buffer += input;
12857|  70.0k|    return;
12858|  70.0k|  }
12859|  11.0k|  std::string path = std::string(get_pathname());
12860|       |  // We are going to need to look a bit at the path, but let us see if we can
12861|       |  // ignore percent encoding *and* backslashes *and* percent characters.
12862|       |  // Except for the trivial case, this is likely to capture 99% of paths out
12863|       |  // there.
12864|  11.0k|  bool fast_path =
12865|  11.0k|      (special &&
  ------------------
  |  Branch (12865:8): [True: 10.8k, False: 243]
  ------------------
12866|  10.8k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (12866:8): [True: 4.47k, False: 6.32k]
  ------------------
12867|  4.47k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (12867:7): [True: 4.40k, False: 66]
  ------------------
12868|  11.0k|  if (fast_path) {
  ------------------
  |  Branch (12868:7): [True: 4.40k, False: 6.63k]
  ------------------
12869|  4.40k|    ada_log("parse_prepared_path fast");
12870|       |    // Here we don't need to worry about \ or percent encoding.
12871|       |    // We also do not have a file protocol. We might have dots, however,
12872|       |    // but dots must as appear as '.', and they cannot be encoded because
12873|       |    // the symbol '%' is not present.
12874|  4.40k|    size_t previous_location = 0;  // We start at 0.
12875|  27.8k|    do {
12876|  27.8k|      size_t new_location = input.find('/', previous_location);
12877|       |      // std::string_view path_view = input;
12878|       |      //  We process the last segment separately:
12879|  27.8k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (12879:11): [True: 4.40k, False: 23.4k]
  ------------------
12880|  4.40k|        std::string_view path_view = input.substr(previous_location);
12881|  4.40k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (12881:13): [True: 30, False: 4.37k]
  ------------------
12882|       |          // e.g., if you receive ".." with an empty path, you go to "/".
12883|     30|          if (path.empty()) {
  ------------------
  |  Branch (12883:15): [True: 6, False: 24]
  ------------------
12884|      6|            path = '/';
12885|      6|            update_base_pathname(path);
12886|      6|            return;
12887|      6|          }
12888|       |          // Fast case where we have nothing to do:
12889|     24|          if (path.back() == '/') {
  ------------------
  |  Branch (12889:15): [True: 3, False: 21]
  ------------------
12890|      3|            update_base_pathname(path);
12891|      3|            return;
12892|      3|          }
12893|       |          // If you have the path "/joe/myfriend",
12894|       |          // then you delete 'myfriend'.
12895|     21|          path.resize(path.rfind('/') + 1);
12896|     21|          update_base_pathname(path);
12897|     21|          return;
12898|     24|        }
12899|  4.37k|        path += '/';
12900|  4.37k|        if (path_view != ".") {
  ------------------
  |  Branch (12900:13): [True: 4.35k, False: 22]
  ------------------
12901|  4.35k|          path.append(path_view);
12902|  4.35k|        }
12903|  4.37k|        update_base_pathname(path);
12904|  4.37k|        return;
12905|  23.4k|      } else {
12906|       |        // This is a non-final segment.
12907|  23.4k|        std::string_view path_view =
12908|  23.4k|            input.substr(previous_location, new_location - previous_location);
12909|  23.4k|        previous_location = new_location + 1;
12910|  23.4k|        if (path_view == "..") {
  ------------------
  |  Branch (12910:13): [True: 4.47k, False: 18.9k]
  ------------------
12911|  4.47k|          size_t last_delimiter = path.rfind('/');
12912|  4.47k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (12912:15): [True: 4.17k, False: 303]
  ------------------
12913|  4.17k|            path.erase(last_delimiter);
12914|  4.17k|          }
12915|  18.9k|        } else if (path_view != ".") {
  ------------------
  |  Branch (12915:20): [True: 14.8k, False: 4.14k]
  ------------------
12916|  14.8k|          path += '/';
12917|  14.8k|          path.append(path_view);
12918|  14.8k|        }
12919|  23.4k|      }
12920|  27.8k|    } while (true);
  ------------------
  |  Branch (12920:14): [True: 23.4k, Folded]
  ------------------
12921|  6.63k|  } else {
12922|  6.63k|    ada_log("parse_path slow");
12923|       |    // we have reached the general case
12924|  6.63k|    bool needs_percent_encoding = (accumulator & 1);
12925|  6.63k|    std::string path_buffer_tmp;
12926|  27.3k|    do {
12927|  27.3k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (12927:26): [True: 26.4k, False: 952]
  |  Branch (12927:37): [True: 2.01k, False: 24.4k]
  ------------------
12928|  27.3k|                            ? input.find_first_of("/\\")
12929|  27.3k|                            : input.find('/');
12930|  27.3k|      std::string_view path_view = input;
12931|  27.3k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (12931:11): [True: 20.7k, False: 6.63k]
  ------------------
12932|  20.7k|        path_view.remove_suffix(path_view.size() - location);
12933|  20.7k|        input.remove_prefix(location + 1);
12934|  20.7k|      }
12935|       |      // path_buffer is either path_view or it might point at a percent encoded
12936|       |      // temporary string.
12937|  27.3k|      std::string_view path_buffer =
12938|  27.3k|          (needs_percent_encoding &&
  ------------------
  |  Branch (12938:12): [True: 6.36k, False: 21.0k]
  ------------------
12939|  6.36k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (12939:12): [True: 1.62k, False: 4.74k]
  ------------------
12940|  6.36k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
12941|  27.3k|              ? path_buffer_tmp
12942|  27.3k|              : path_view;
12943|  27.3k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (12943:11): [True: 4.51k, False: 22.8k]
  ------------------
12944|  4.51k|        helpers::shorten_path(path, type);
12945|  4.51k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (12945:13): [True: 3.73k, False: 785]
  ------------------
12946|  3.73k|          path += '/';
12947|  3.73k|        }
12948|  22.8k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (12948:18): [True: 607, False: 22.2k]
  ------------------
12949|    607|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (12949:18): [True: 192, False: 415]
  ------------------
12950|    192|        path += '/';
12951|    192|      }
12952|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
12953|  22.6k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (12953:16): [True: 22.2k, False: 415]
  ------------------
12954|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
12955|       |        // Windows drive letter, then replace the second code point in
12956|       |        // path_buffer with U+003A (:).
12957|  22.2k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (12957:13): [True: 1.31k, False: 20.9k]
  |  Branch (12957:48): [True: 351, False: 964]
  ------------------
12958|    351|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (12958:13): [True: 39, False: 312]
  ------------------
12959|     39|          path += '/';
12960|     39|          path += path_buffer[0];
12961|     39|          path += ':';
12962|     39|          path_buffer.remove_prefix(2);
12963|     39|          path.append(path_buffer);
12964|  22.2k|        } else {
12965|       |          // Append path_buffer to url's path.
12966|  22.2k|          path += '/';
12967|  22.2k|          path.append(path_buffer);
12968|  22.2k|        }
12969|  22.2k|      }
12970|  27.3k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (12970:11): [True: 6.63k, False: 20.7k]
  ------------------
12971|  6.63k|        update_base_pathname(path);
12972|  6.63k|        return;
12973|  6.63k|      }
12974|  27.3k|    } while (true);
  ------------------
  |  Branch (12974:14): [True: 20.7k, Folded]
  ------------------
12975|  6.63k|  }
12976|  11.0k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6750|  81.8k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6751|  81.8k|  uint64_t broadcast_80 = broadcast(0x80);
 6752|  81.8k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6753|  81.8k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6754|  81.8k|  uint64_t non_ascii = 0;
 6755|  81.8k|  size_t i = 0;
 6756|       |
 6757|   167k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6757:10): [True: 86.0k, False: 81.8k]
  ------------------
 6758|  86.0k|    uint64_t word{};
 6759|  86.0k|    memcpy(&word, input + i, sizeof(word));
 6760|  86.0k|    non_ascii |= (word & broadcast_80);
 6761|  86.0k|    word ^=
 6762|  86.0k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6763|  86.0k|    memcpy(input + i, &word, sizeof(word));
 6764|  86.0k|  }
 6765|  81.8k|  if (i < length) {
  ------------------
  |  Branch (6765:7): [True: 70.3k, False: 11.5k]
  ------------------
 6766|  70.3k|    uint64_t word{};
 6767|  70.3k|    memcpy(&word, input + i, length - i);
 6768|  70.3k|    non_ascii |= (word & broadcast_80);
 6769|  70.3k|    word ^=
 6770|  70.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6771|  70.3k|    memcpy(input + i, &word, length - i);
 6772|  70.3k|  }
 6773|  81.8k|  return non_ascii == 0;
 6774|  81.8k|}
_ZN3ada7unicode9broadcastEh:
 6746|   245k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6747|   245k|  return 0x101010101010101ull * v;
 6748|   245k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|   392k|ada_really_inline constexpr bool is_ipv4(std::string_view view) noexcept {
   13|       |  // The string is not empty and does not contain upper case ASCII characters.
   14|       |  //
   15|       |  // Optimization. To be considered as a possible ipv4, the string must end
   16|       |  // with 'x' or a lowercase hex character.
   17|       |  // Most of the time, this will be false so this simple check will save a lot
   18|       |  // of effort.
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|   392k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 1.89k, False: 390k]
  ------------------
   21|  1.89k|    view.remove_suffix(1);
   22|  1.89k|    if (view.empty()) {
  ------------------
  |  Branch (22:9): [True: 720, False: 1.17k]
  ------------------
   23|    720|      return false;
   24|    720|    }
   25|  1.89k|  }
   26|   391k|  char last_char = view.back();
   27|   391k|  bool possible_ipv4 = (last_char >= '0' && last_char <= '9') ||
  ------------------
  |  Branch (27:25): [True: 389k, False: 1.70k]
  |  Branch (27:45): [True: 10.3k, False: 379k]
  ------------------
   28|   380k|                       (last_char >= 'a' && last_char <= 'f') ||
  ------------------
  |  Branch (28:25): [True: 379k, False: 1.86k]
  |  Branch (28:45): [True: 50.2k, False: 328k]
  ------------------
   29|   330k|                       last_char == 'x';
  ------------------
  |  Branch (29:24): [True: 420, False: 330k]
  ------------------
   30|   391k|  if (!possible_ipv4) {
  ------------------
  |  Branch (30:7): [True: 330k, False: 61.0k]
  ------------------
   31|   330k|    return false;
   32|   330k|  }
   33|       |  // From the last character, find the last dot.
   34|  61.0k|  size_t last_dot = view.rfind('.');
   35|  61.0k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (35:7): [True: 10.5k, False: 50.5k]
  ------------------
   36|       |    // We have at least one dot.
   37|  10.5k|    view.remove_prefix(last_dot + 1);
   38|  10.5k|  }
   39|       |  /** Optimization opportunity: we have basically identified the last number of
   40|       |     the ipv4 if we return true here. We might as well parse it and have at
   41|       |     least one number parsed when we get to parse_ipv4. */
   42|  61.0k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (42:7): [True: 9.06k, False: 51.9k]
  ------------------
   43|  9.06k|    return true;
   44|  9.06k|  }
   45|       |  // It could be hex (0x), but not if there is a single character.
   46|  51.9k|  if (view.size() == 1) {
  ------------------
  |  Branch (46:7): [True: 2.64k, False: 49.3k]
  ------------------
   47|  2.64k|    return false;
   48|  2.64k|  }
   49|       |  // It must start with 0x.
   50|  49.3k|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (50:7): [True: 48.4k, False: 938]
  ------------------
   51|  48.4k|    return false;
   52|  48.4k|  }
   53|       |  // We must allow "0x".
   54|    938|  if (view.size() == 2) {
  ------------------
  |  Branch (54:7): [True: 40, False: 898]
  ------------------
   55|     40|    return true;
   56|     40|  }
   57|       |  // We have 0x followed by some characters, we need to check that they are
   58|       |  // hexadecimals.
   59|    898|  view.remove_prefix(2);
   60|    898|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   61|    938|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7153|  11.5k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7154|  11.5k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7154:11): [True: 11.4k, False: 132]
  |  Branch (7154:23): [True: 6.12k, False: 5.32k]
  |  Branch (7154:37): [True: 5.28k, False: 174]
  |  Branch (7154:49): [True: 4.85k, False: 436]
  ------------------
 7155|  11.5k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
10103|   162k|                                                result_type& out) {
10104|   162k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
10105|   162k|  constexpr bool is_aggregator =
10106|   162k|      std::is_same_v<result_type, ada::url_aggregator>;
10107|   162k|  static_assert(is_ada_url || is_aggregator);
10108|       |
10109|   162k|  const size_t len = input.size();
10110|   162k|  if (len < 8) [[unlikely]] {
  ------------------
  |  Branch (10110:7): [True: 26, False: 162k]
  ------------------
10111|     26|    return false;
10112|     26|  }
10113|   162k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
10114|       |
10115|   162k|  size_t pos;
10116|   162k|  ada::scheme::type scheme_type;
10117|   162k|  uint32_t protocol_end;
10118|   162k|  if (b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p') {
  ------------------
  |  Branch (10118:7): [True: 160k, False: 1.90k]
  |  Branch (10118:22): [True: 160k, False: 74]
  |  Branch (10118:37): [True: 160k, False: 274]
  |  Branch (10118:52): [True: 160k, False: 44]
  ------------------
10119|   160k|    if (b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (10119:9): [True: 26.5k, False: 133k]
  |  Branch (10119:24): [True: 26.3k, False: 272]
  |  Branch (10119:39): [True: 26.2k, False: 44]
  ------------------
10120|  26.2k|      pos = 7;
10121|  26.2k|      scheme_type = ada::scheme::type::HTTP;
10122|  26.2k|      protocol_end = 5;
10123|   133k|    } else if (len >= 8 && b[4] == 's' && b[5] == ':' && b[6] == '/' &&
  ------------------
  |  Branch (10123:16): [True: 133k, False: 0]
  |  Branch (10123:28): [True: 133k, False: 356]
  |  Branch (10123:43): [True: 133k, False: 20]
  |  Branch (10123:58): [True: 133k, False: 286]
  ------------------
10124|   133k|               b[7] == '/') {
  ------------------
  |  Branch (10124:16): [True: 133k, False: 9]
  ------------------
10125|   133k|      pos = 8;
10126|   133k|      scheme_type = ada::scheme::type::HTTPS;
10127|   133k|      protocol_end = 6;
10128|   133k|    } else {
10129|    671|      return false;
10130|    671|    }
10131|   160k|  } else {
10132|  2.29k|    return false;
10133|  2.29k|  }
10134|   159k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (10134:7): [True: 159k, False: 1]
  |  Branch (10134:21): [True: 94, False: 159k]
  |  Branch (10134:38): [True: 27, False: 159k]
  ------------------
10135|    121|    return false;
10136|    121|  }
10137|       |
10138|       |  // Digit-led hosts are IPv4/numeric; skip before scanning.
10139|   159k|  if (pos < len && b[pos] >= '0' && b[pos] <= '9') {
  ------------------
  |  Branch (10139:7): [True: 159k, False: 1]
  |  Branch (10139:20): [True: 158k, False: 1.20k]
  |  Branch (10139:37): [True: 0, False: 158k]
  ------------------
10140|      0|    return false;
10141|      0|  }
10142|       |
10143|   159k|  const size_t host_start = pos;
10144|   159k|  bool has_upper = false;
10145|   159k|  size_t i = pos;
10146|  1.96M|  for (; i < len; ++i) {
  ------------------
  |  Branch (10146:10): [True: 1.95M, False: 3.77k]
  ------------------
10147|  1.95M|    const uint8_t c = b[i];
10148|  1.95M|    const uint8_t cls = k_host_class[c];
10149|  1.95M|    if (cls == 1) {
  ------------------
  |  Branch (10149:9): [True: 130k, False: 1.82M]
  ------------------
10150|   130k|      break;
10151|   130k|    }
10152|  1.82M|    if (cls == 2) [[unlikely]] {
  ------------------
  |  Branch (10152:9): [True: 24.9k, False: 1.80M]
  ------------------
10153|  24.9k|      return false;
10154|  24.9k|    }
10155|  1.80M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (10155:9): [True: 1.56M, False: 239k]
  |  Branch (10155:21): [True: 33.6k, False: 1.52M]
  ------------------
10156|  33.6k|      has_upper = true;
10157|  33.6k|    }
10158|  1.80M|  }
10159|   134k|  const size_t host_end = i;
10160|   134k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (10160:7): [True: 13, False: 134k]
  ------------------
10161|     13|    return false;
10162|     13|  }
10163|   134k|  const size_t host_len = host_end - host_start;
10164|   134k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (10164:7): [True: 72, False: 134k]
  ------------------
10165|     72|    return false;
10166|     72|  }
10167|   134k|  {
10168|   134k|    std::string_view hv(input.data() + host_start, host_len);
10169|   134k|    char host_buf[256];
10170|   134k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (10170:9): [True: 3.74k, False: 130k]
  ------------------
10171|  3.74k|      std::memcpy(host_buf, input.data() + host_start, host_len);
10172|  3.74k|      unicode::to_lower_ascii(host_buf, host_len);
10173|  3.74k|      hv = std::string_view(host_buf, host_len);
10174|  3.74k|    }
10175|   134k|    if (checkers::is_ipv4(hv)) [[unlikely]] {
  ------------------
  |  Branch (10175:9): [True: 17, False: 134k]
  ------------------
10176|     17|      return false;
10177|     17|    }
10178|   134k|    static constexpr std::string_view xn{"xn-", 3};
10179|   134k|    if (hv.find(xn) != std::string_view::npos) [[unlikely]] {
  ------------------
  |  Branch (10179:9): [True: 22.6k, False: 111k]
  ------------------
10180|  22.6k|      return false;
10181|  22.6k|    }
10182|   134k|  }
10183|       |
10184|   111k|  size_t path_start = host_end;
10185|   111k|  size_t path_end = host_end;
10186|   111k|  size_t query_start = std::string_view::npos;
10187|   111k|  size_t hash_start = std::string_view::npos;
10188|   111k|  bool has_path = false;
10189|   111k|  bool path_has_dot = false;
10190|       |
10191|   111k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (10191:7): [True: 108k, False: 3.73k]
  |  Branch (10191:18): [True: 100k, False: 7.39k]
  ------------------
10192|   100k|    has_path = true;
10193|   100k|    path_start = i;
10194|   100k|    ++i;
10195|   475k|    for (; i < len; ++i) {
  ------------------
  |  Branch (10195:12): [True: 416k, False: 58.5k]
  ------------------
10196|   416k|      const uint8_t c = b[i];
10197|   416k|      const uint8_t cls = k_rest[c];
10198|   416k|      if (cls == 0) {
  ------------------
  |  Branch (10198:11): [True: 374k, False: 42.0k]
  ------------------
10199|   374k|        path_has_dot |= (c == '.');
10200|   374k|        continue;
10201|   374k|      }
10202|  42.0k|      if (cls == 1) {
  ------------------
  |  Branch (10202:11): [True: 37.6k, False: 4.39k]
  ------------------
10203|  37.6k|        path_end = i;
10204|  37.6k|        if (c == '?') {
  ------------------
  |  Branch (10204:13): [True: 30.0k, False: 7.59k]
  ------------------
10205|  30.0k|          query_start = i;
10206|  30.0k|          ++i;
10207|  30.0k|          goto scan_query;
10208|  30.0k|        }
10209|  7.59k|        hash_start = i;
10210|  7.59k|        ++i;
10211|  7.59k|        goto scan_hash;
10212|  37.6k|      }
10213|  4.39k|      return false;
10214|  42.0k|    }
10215|  58.5k|    path_end = i;
10216|  58.5k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (10216:14): [True: 7.39k, False: 3.73k]
  |  Branch (10216:25): [True: 3.73k, False: 3.66k]
  ------------------
10217|  3.73k|    query_start = i;
10218|  3.73k|    ++i;
10219|  3.73k|    goto scan_query;
10220|  7.40k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (10220:14): [True: 3.66k, False: 3.73k]
  |  Branch (10220:25): [True: 3.66k, False: 0]
  ------------------
10221|  3.66k|    hash_start = i;
10222|  3.66k|    ++i;
10223|  3.66k|    goto scan_hash;
10224|  3.66k|  }
10225|  62.3k|  goto after_rest;
10226|       |
10227|  62.3k|scan_query:
10228|   276k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10228:10): [True: 254k, False: 22.0k]
  ------------------
10229|   254k|    const uint8_t c = b[i];
10230|   254k|    if (c == '#') {
  ------------------
  |  Branch (10230:9): [True: 11.6k, False: 243k]
  ------------------
10231|  11.6k|      hash_start = i;
10232|  11.6k|      ++i;
10233|  11.6k|      goto scan_hash;
10234|  11.6k|    }
10235|   243k|    if (c == '?' || c == '%') {
  ------------------
  |  Branch (10235:9): [True: 432, False: 242k]
  |  Branch (10235:21): [True: 9.99k, False: 232k]
  ------------------
10236|  10.4k|      continue;
10237|  10.4k|    }
10238|   232k|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10238:9): [True: 86, False: 232k]
  ------------------
10239|     86|      return false;
10240|     86|    }
10241|   232k|  }
10242|  22.0k|  goto after_rest;
10243|       |
10244|  22.9k|scan_hash:
10245|   129k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10245:10): [True: 106k, False: 22.8k]
  ------------------
10246|   106k|    const uint8_t c = b[i];
10247|   106k|    if (c == '?' || c == '#' || c == '%') {
  ------------------
  |  Branch (10247:9): [True: 304, False: 105k]
  |  Branch (10247:21): [True: 370, False: 105k]
  |  Branch (10247:33): [True: 4.81k, False: 100k]
  ------------------
10248|  5.48k|      continue;
10249|  5.48k|    }
10250|   100k|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10250:9): [True: 59, False: 100k]
  ------------------
10251|     59|      return false;
10252|     59|    }
10253|   100k|  }
10254|       |
10255|   107k|after_rest:
10256|   107k|  if (path_has_dot) [[unlikely]] {
  ------------------
  |  Branch (10256:7): [True: 25.6k, False: 81.5k]
  ------------------
10257|  25.6k|    const std::string_view path_body(input.data() + path_start,
10258|  25.6k|                                     path_end - path_start);
10259|  25.6k|    if (path_body.size() >= 2 && path_body[1] == '.') {
  ------------------
  |  Branch (10259:9): [True: 25.6k, False: 0]
  |  Branch (10259:34): [True: 175, False: 25.5k]
  ------------------
10260|    175|      if (path_body.size() == 2 || path_body[2] == '/' ||
  ------------------
  |  Branch (10260:11): [True: 1, False: 174]
  |  Branch (10260:36): [True: 22, False: 152]
  ------------------
10261|    152|          (path_body.size() >= 3 && path_body[2] == '.' &&
  ------------------
  |  Branch (10261:12): [True: 152, False: 0]
  |  Branch (10261:37): [True: 78, False: 74]
  ------------------
10262|     78|           (path_body.size() == 3 || path_body[3] == '/'))) {
  ------------------
  |  Branch (10262:13): [True: 2, False: 76]
  |  Branch (10262:38): [True: 22, False: 54]
  ------------------
10263|     47|        return false;
10264|     47|      }
10265|    175|    }
10266|  25.6k|    static constexpr std::string_view slash_dot{"/.", 2};
10267|  25.6k|    size_t p = 1;
10268|  27.5k|    while ((p = path_body.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (10268:12): [True: 5.56k, False: 21.9k]
  ------------------
10269|  5.56k|      const size_t after = p + 2;
10270|  5.56k|      if (after == path_body.size() || path_body[after] == '/' ||
  ------------------
  |  Branch (10270:11): [True: 9, False: 5.55k]
  |  Branch (10270:40): [True: 3.63k, False: 1.92k]
  ------------------
10271|  1.92k|          (after + 1 <= path_body.size() && path_body[after] == '.' &&
  ------------------
  |  Branch (10271:12): [True: 1.92k, False: 0]
  |  Branch (10271:45): [True: 844, False: 1.07k]
  ------------------
10272|  3.67k|           (after + 1 == path_body.size() || path_body[after + 1] == '/'))) {
  ------------------
  |  Branch (10272:13): [True: 6, False: 838]
  |  Branch (10272:46): [True: 20, False: 818]
  ------------------
10273|  3.67k|        return false;
10274|  3.67k|      }
10275|  1.89k|      p = after;
10276|  1.89k|    }
10277|  25.6k|  }
10278|       |
10279|   103k|  const bool need_slash = !has_path;
10280|   103k|  out.type = scheme_type;
10281|   103k|  out.is_valid = true;
10282|   103k|  out.has_opaque_path = false;
10283|   103k|  out.host_type = DEFAULT;
10284|       |
10285|       |  if constexpr (is_aggregator) {
10286|       |    if (!need_slash) {
10287|       |      out.buffer.resize(len);
10288|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10289|       |      std::memcpy(out.buffer.data(), input.data(), len);
10290|       |      if (has_upper) {
10291|       |        unicode::to_lower_ascii(out.buffer.data() + host_start,
10292|       |                                host_end - host_start);
10293|       |      }
10294|       |      out.components.protocol_end = protocol_end;
10295|       |      out.components.username_end = protocol_end + 2;
10296|       |      out.components.host_start = protocol_end + 2;
10297|       |      out.components.host_end = static_cast<uint32_t>(host_end);
10298|       |      out.components.port = url_components::omitted;
10299|       |      out.components.pathname_start = static_cast<uint32_t>(path_start);
10300|       |      out.components.search_start = (query_start != std::string_view::npos)
10301|       |                                        ? static_cast<uint32_t>(query_start)
10302|       |                                        : url_components::omitted;
10303|       |      out.components.hash_start = (hash_start != std::string_view::npos)
10304|       |                                      ? static_cast<uint32_t>(hash_start)
10305|       |                                      : url_components::omitted;
10306|       |    } else {
10307|       |      out.buffer.resize(len + 1);
10308|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10309|       |      std::memcpy(out.buffer.data(), input.data(), host_end);
10310|       |      out.buffer[host_end] = '/';
10311|       |      if (host_end < len) {
10312|       |        std::memcpy(out.buffer.data() + host_end + 1, input.data() + host_end,
10313|       |                    len - host_end);
10314|       |      }
10315|       |      if (has_upper) {
10316|       |        unicode::to_lower_ascii(out.buffer.data() + host_start,
10317|       |                                host_end - host_start);
10318|       |      }
10319|       |      out.components.protocol_end = protocol_end;
10320|       |      out.components.username_end = protocol_end + 2;
10321|       |      out.components.host_start = protocol_end + 2;
10322|       |      out.components.host_end = static_cast<uint32_t>(host_end);
10323|       |      out.components.port = url_components::omitted;
10324|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
10325|       |      out.components.search_start = (query_start != std::string_view::npos)
10326|       |                                        ? static_cast<uint32_t>(query_start + 1)
10327|       |                                        : url_components::omitted;
10328|       |      out.components.hash_start = (hash_start != std::string_view::npos)
10329|       |                                      ? static_cast<uint32_t>(hash_start + 1)
10330|       |                                      : url_components::omitted;
10331|       |    }
10332|   103k|  } else {
10333|   103k|    std::string host_str(input.substr(host_start, host_end - host_start));
10334|   103k|    if (has_upper) {
  ------------------
  |  Branch (10334:9): [True: 3.65k, False: 99.8k]
  ------------------
10335|  3.65k|      unicode::to_lower_ascii(host_str.data(), host_str.size());
10336|  3.65k|    }
10337|   103k|    out.host = std::move(host_str);
10338|   103k|    if (need_slash) {
  ------------------
  |  Branch (10338:9): [True: 11.0k, False: 92.4k]
  ------------------
10339|  11.0k|      out.path = "/";
10340|  92.4k|    } else {
10341|  92.4k|      out.path.assign(input.data() + path_start, path_end - path_start);
10342|  92.4k|    }
10343|   103k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (10343:9): [True: 33.6k, False: 69.8k]
  ------------------
10344|  33.6k|      const size_t q_end =
10345|  33.6k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (10345:11): [True: 11.6k, False: 22.0k]
  ------------------
10346|  33.6k|      out.query.emplace(input.data() + query_start + 1,
10347|  33.6k|                        q_end - query_start - 1);
10348|  33.6k|    }
10349|   103k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (10349:9): [True: 22.8k, False: 80.7k]
  ------------------
10350|  22.8k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
10351|  22.8k|    }
10352|   103k|  }
10353|   103k|  return true;
10354|   107k|}
_ZN3ada3url12parse_schemeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
 9389|  84.2k|ada_really_inline bool url::parse_scheme(const std::string_view input) {
 9390|  84.2k|  auto parsed_type = ada::scheme::get_scheme_type(input);
 9391|  84.2k|  bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
 9392|       |  /**
 9393|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
 9394|       |   *http, https), in which case, we can go really fast.
 9395|       |   **/
 9396|  84.2k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (9396:7): [True: 82.0k, False: 2.24k]
  ------------------
 9397|       |    if constexpr (has_state_override) {
 9398|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
 9399|       |      // then return.
 9400|       |      if (is_special() != is_input_special) {
 9401|       |        return false;
 9402|       |      }
 9403|       |
 9404|       |      // If url includes credentials or has a non-null port, and buffer is
 9405|       |      // "file", then return.
 9406|       |      if ((has_credentials() || port.has_value()) &&
 9407|       |          parsed_type == ada::scheme::type::FILE) {
 9408|       |        return false;
 9409|       |      }
 9410|       |
 9411|       |      // If url's scheme is "file" and its host is an empty host, then return.
 9412|       |      // An empty host is the empty string.
 9413|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
 9414|       |          host->empty()) {
 9415|       |        return false;
 9416|       |      }
 9417|       |    }
 9418|       |
 9419|  82.0k|    type = parsed_type;
 9420|       |
 9421|       |    if constexpr (has_state_override) {
 9422|       |      // This is uncommon.
 9423|       |      uint16_t urls_scheme_port = get_special_port();
 9424|       |
 9425|       |      if (urls_scheme_port) {
 9426|       |        // If url's port is url's scheme's default port, then set url's port to
 9427|       |        // null.
 9428|       |        if (port.has_value() && *port == urls_scheme_port) {
 9429|       |          port = std::nullopt;
 9430|       |        }
 9431|       |      }
 9432|       |    }
 9433|  82.0k|  } else {  // slow path
 9434|  2.24k|    std::string _buffer(input);
 9435|       |    // Next function is only valid if the input is ASCII and returns false
 9436|       |    // otherwise, but it seems that we always have ascii content so we do not
 9437|       |    // need to check the return value.
 9438|       |    // bool is_ascii =
 9439|  2.24k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
 9440|       |
 9441|       |    if constexpr (has_state_override) {
 9442|       |      // The state-override validation errors below ("return" in the WHATWG URL
 9443|       |      // parser) leave the URL unchanged. The setter contract is
 9444|       |      // "true on success, false if the scheme is invalid" -- the fast path
 9445|       |      // above already returns false here, so the slow path must agree.
 9446|       |
 9447|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
 9448|       |      // then return. If url's scheme is not a special scheme and buffer is a
 9449|       |      // special scheme, then return.
 9450|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
 9451|       |        return false;
 9452|       |      }
 9453|       |
 9454|       |      // If url includes credentials or has a non-null port, and buffer is
 9455|       |      // "file", then return.
 9456|       |      if ((has_credentials() || port.has_value()) && _buffer == "file") {
 9457|       |        return false;
 9458|       |      }
 9459|       |
 9460|       |      // If url's scheme is "file" and its host is an empty host, then return.
 9461|       |      // An empty host is the empty string.
 9462|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
 9463|       |          host->empty()) {
 9464|       |        return false;
 9465|       |      }
 9466|       |    }
 9467|       |
 9468|  2.24k|    set_scheme(std::move(_buffer));
 9469|       |
 9470|       |    if constexpr (has_state_override) {
 9471|       |      // This is uncommon.
 9472|       |      uint16_t urls_scheme_port = get_special_port();
 9473|       |
 9474|       |      if (urls_scheme_port) {
 9475|       |        // If url's port is url's scheme's default port, then set url's port to
 9476|       |        // null.
 9477|       |        if (port.has_value() && *port == urls_scheme_port) {
 9478|       |          port = std::nullopt;
 9479|       |        }
 9480|       |      }
 9481|       |    }
 9482|  2.24k|  }
 9483|       |
 9484|  84.2k|  return true;
 9485|  84.2k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
10103|   162k|                                                result_type& out) {
10104|   162k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
10105|   162k|  constexpr bool is_aggregator =
10106|   162k|      std::is_same_v<result_type, ada::url_aggregator>;
10107|   162k|  static_assert(is_ada_url || is_aggregator);
10108|       |
10109|   162k|  const size_t len = input.size();
10110|   162k|  if (len < 8) [[unlikely]] {
  ------------------
  |  Branch (10110:7): [True: 26, False: 162k]
  ------------------
10111|     26|    return false;
10112|     26|  }
10113|   162k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
10114|       |
10115|   162k|  size_t pos;
10116|   162k|  ada::scheme::type scheme_type;
10117|   162k|  uint32_t protocol_end;
10118|   162k|  if (b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p') {
  ------------------
  |  Branch (10118:7): [True: 160k, False: 1.90k]
  |  Branch (10118:22): [True: 160k, False: 74]
  |  Branch (10118:37): [True: 160k, False: 274]
  |  Branch (10118:52): [True: 160k, False: 44]
  ------------------
10119|   160k|    if (b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (10119:9): [True: 26.5k, False: 133k]
  |  Branch (10119:24): [True: 26.3k, False: 272]
  |  Branch (10119:39): [True: 26.2k, False: 44]
  ------------------
10120|  26.2k|      pos = 7;
10121|  26.2k|      scheme_type = ada::scheme::type::HTTP;
10122|  26.2k|      protocol_end = 5;
10123|   133k|    } else if (len >= 8 && b[4] == 's' && b[5] == ':' && b[6] == '/' &&
  ------------------
  |  Branch (10123:16): [True: 133k, False: 0]
  |  Branch (10123:28): [True: 133k, False: 356]
  |  Branch (10123:43): [True: 133k, False: 20]
  |  Branch (10123:58): [True: 133k, False: 286]
  ------------------
10124|   133k|               b[7] == '/') {
  ------------------
  |  Branch (10124:16): [True: 133k, False: 9]
  ------------------
10125|   133k|      pos = 8;
10126|   133k|      scheme_type = ada::scheme::type::HTTPS;
10127|   133k|      protocol_end = 6;
10128|   133k|    } else {
10129|    671|      return false;
10130|    671|    }
10131|   160k|  } else {
10132|  2.29k|    return false;
10133|  2.29k|  }
10134|   159k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (10134:7): [True: 159k, False: 1]
  |  Branch (10134:21): [True: 94, False: 159k]
  |  Branch (10134:38): [True: 27, False: 159k]
  ------------------
10135|    121|    return false;
10136|    121|  }
10137|       |
10138|       |  // Digit-led hosts are IPv4/numeric; skip before scanning.
10139|   159k|  if (pos < len && b[pos] >= '0' && b[pos] <= '9') {
  ------------------
  |  Branch (10139:7): [True: 159k, False: 1]
  |  Branch (10139:20): [True: 158k, False: 1.20k]
  |  Branch (10139:37): [True: 0, False: 158k]
  ------------------
10140|      0|    return false;
10141|      0|  }
10142|       |
10143|   159k|  const size_t host_start = pos;
10144|   159k|  bool has_upper = false;
10145|   159k|  size_t i = pos;
10146|  1.96M|  for (; i < len; ++i) {
  ------------------
  |  Branch (10146:10): [True: 1.95M, False: 3.77k]
  ------------------
10147|  1.95M|    const uint8_t c = b[i];
10148|  1.95M|    const uint8_t cls = k_host_class[c];
10149|  1.95M|    if (cls == 1) {
  ------------------
  |  Branch (10149:9): [True: 130k, False: 1.82M]
  ------------------
10150|   130k|      break;
10151|   130k|    }
10152|  1.82M|    if (cls == 2) [[unlikely]] {
  ------------------
  |  Branch (10152:9): [True: 24.9k, False: 1.80M]
  ------------------
10153|  24.9k|      return false;
10154|  24.9k|    }
10155|  1.80M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (10155:9): [True: 1.56M, False: 239k]
  |  Branch (10155:21): [True: 33.6k, False: 1.52M]
  ------------------
10156|  33.6k|      has_upper = true;
10157|  33.6k|    }
10158|  1.80M|  }
10159|   134k|  const size_t host_end = i;
10160|   134k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (10160:7): [True: 13, False: 134k]
  ------------------
10161|     13|    return false;
10162|     13|  }
10163|   134k|  const size_t host_len = host_end - host_start;
10164|   134k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (10164:7): [True: 72, False: 134k]
  ------------------
10165|     72|    return false;
10166|     72|  }
10167|   134k|  {
10168|   134k|    std::string_view hv(input.data() + host_start, host_len);
10169|   134k|    char host_buf[256];
10170|   134k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (10170:9): [True: 3.74k, False: 130k]
  ------------------
10171|  3.74k|      std::memcpy(host_buf, input.data() + host_start, host_len);
10172|  3.74k|      unicode::to_lower_ascii(host_buf, host_len);
10173|  3.74k|      hv = std::string_view(host_buf, host_len);
10174|  3.74k|    }
10175|   134k|    if (checkers::is_ipv4(hv)) [[unlikely]] {
  ------------------
  |  Branch (10175:9): [True: 17, False: 134k]
  ------------------
10176|     17|      return false;
10177|     17|    }
10178|   134k|    static constexpr std::string_view xn{"xn-", 3};
10179|   134k|    if (hv.find(xn) != std::string_view::npos) [[unlikely]] {
  ------------------
  |  Branch (10179:9): [True: 22.6k, False: 111k]
  ------------------
10180|  22.6k|      return false;
10181|  22.6k|    }
10182|   134k|  }
10183|       |
10184|   111k|  size_t path_start = host_end;
10185|   111k|  size_t path_end = host_end;
10186|   111k|  size_t query_start = std::string_view::npos;
10187|   111k|  size_t hash_start = std::string_view::npos;
10188|   111k|  bool has_path = false;
10189|   111k|  bool path_has_dot = false;
10190|       |
10191|   111k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (10191:7): [True: 108k, False: 3.73k]
  |  Branch (10191:18): [True: 100k, False: 7.39k]
  ------------------
10192|   100k|    has_path = true;
10193|   100k|    path_start = i;
10194|   100k|    ++i;
10195|   475k|    for (; i < len; ++i) {
  ------------------
  |  Branch (10195:12): [True: 416k, False: 58.5k]
  ------------------
10196|   416k|      const uint8_t c = b[i];
10197|   416k|      const uint8_t cls = k_rest[c];
10198|   416k|      if (cls == 0) {
  ------------------
  |  Branch (10198:11): [True: 374k, False: 42.0k]
  ------------------
10199|   374k|        path_has_dot |= (c == '.');
10200|   374k|        continue;
10201|   374k|      }
10202|  42.0k|      if (cls == 1) {
  ------------------
  |  Branch (10202:11): [True: 37.6k, False: 4.39k]
  ------------------
10203|  37.6k|        path_end = i;
10204|  37.6k|        if (c == '?') {
  ------------------
  |  Branch (10204:13): [True: 30.0k, False: 7.59k]
  ------------------
10205|  30.0k|          query_start = i;
10206|  30.0k|          ++i;
10207|  30.0k|          goto scan_query;
10208|  30.0k|        }
10209|  7.59k|        hash_start = i;
10210|  7.59k|        ++i;
10211|  7.59k|        goto scan_hash;
10212|  37.6k|      }
10213|  4.39k|      return false;
10214|  42.0k|    }
10215|  58.5k|    path_end = i;
10216|  58.5k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (10216:14): [True: 7.39k, False: 3.73k]
  |  Branch (10216:25): [True: 3.73k, False: 3.66k]
  ------------------
10217|  3.73k|    query_start = i;
10218|  3.73k|    ++i;
10219|  3.73k|    goto scan_query;
10220|  7.40k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (10220:14): [True: 3.66k, False: 3.73k]
  |  Branch (10220:25): [True: 3.66k, False: 0]
  ------------------
10221|  3.66k|    hash_start = i;
10222|  3.66k|    ++i;
10223|  3.66k|    goto scan_hash;
10224|  3.66k|  }
10225|  62.3k|  goto after_rest;
10226|       |
10227|  62.3k|scan_query:
10228|   276k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10228:10): [True: 254k, False: 22.0k]
  ------------------
10229|   254k|    const uint8_t c = b[i];
10230|   254k|    if (c == '#') {
  ------------------
  |  Branch (10230:9): [True: 11.6k, False: 243k]
  ------------------
10231|  11.6k|      hash_start = i;
10232|  11.6k|      ++i;
10233|  11.6k|      goto scan_hash;
10234|  11.6k|    }
10235|   243k|    if (c == '?' || c == '%') {
  ------------------
  |  Branch (10235:9): [True: 432, False: 242k]
  |  Branch (10235:21): [True: 9.99k, False: 232k]
  ------------------
10236|  10.4k|      continue;
10237|  10.4k|    }
10238|   232k|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10238:9): [True: 86, False: 232k]
  ------------------
10239|     86|      return false;
10240|     86|    }
10241|   232k|  }
10242|  22.0k|  goto after_rest;
10243|       |
10244|  22.9k|scan_hash:
10245|   129k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10245:10): [True: 106k, False: 22.8k]
  ------------------
10246|   106k|    const uint8_t c = b[i];
10247|   106k|    if (c == '?' || c == '#' || c == '%') {
  ------------------
  |  Branch (10247:9): [True: 304, False: 105k]
  |  Branch (10247:21): [True: 370, False: 105k]
  |  Branch (10247:33): [True: 4.81k, False: 100k]
  ------------------
10248|  5.48k|      continue;
10249|  5.48k|    }
10250|   100k|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10250:9): [True: 59, False: 100k]
  ------------------
10251|     59|      return false;
10252|     59|    }
10253|   100k|  }
10254|       |
10255|   107k|after_rest:
10256|   107k|  if (path_has_dot) [[unlikely]] {
  ------------------
  |  Branch (10256:7): [True: 25.6k, False: 81.5k]
  ------------------
10257|  25.6k|    const std::string_view path_body(input.data() + path_start,
10258|  25.6k|                                     path_end - path_start);
10259|  25.6k|    if (path_body.size() >= 2 && path_body[1] == '.') {
  ------------------
  |  Branch (10259:9): [True: 25.6k, False: 0]
  |  Branch (10259:34): [True: 175, False: 25.5k]
  ------------------
10260|    175|      if (path_body.size() == 2 || path_body[2] == '/' ||
  ------------------
  |  Branch (10260:11): [True: 1, False: 174]
  |  Branch (10260:36): [True: 22, False: 152]
  ------------------
10261|    152|          (path_body.size() >= 3 && path_body[2] == '.' &&
  ------------------
  |  Branch (10261:12): [True: 152, False: 0]
  |  Branch (10261:37): [True: 78, False: 74]
  ------------------
10262|     78|           (path_body.size() == 3 || path_body[3] == '/'))) {
  ------------------
  |  Branch (10262:13): [True: 2, False: 76]
  |  Branch (10262:38): [True: 22, False: 54]
  ------------------
10263|     47|        return false;
10264|     47|      }
10265|    175|    }
10266|  25.6k|    static constexpr std::string_view slash_dot{"/.", 2};
10267|  25.6k|    size_t p = 1;
10268|  27.5k|    while ((p = path_body.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (10268:12): [True: 5.56k, False: 21.9k]
  ------------------
10269|  5.56k|      const size_t after = p + 2;
10270|  5.56k|      if (after == path_body.size() || path_body[after] == '/' ||
  ------------------
  |  Branch (10270:11): [True: 9, False: 5.55k]
  |  Branch (10270:40): [True: 3.63k, False: 1.92k]
  ------------------
10271|  1.92k|          (after + 1 <= path_body.size() && path_body[after] == '.' &&
  ------------------
  |  Branch (10271:12): [True: 1.92k, False: 0]
  |  Branch (10271:45): [True: 844, False: 1.07k]
  ------------------
10272|  3.67k|           (after + 1 == path_body.size() || path_body[after + 1] == '/'))) {
  ------------------
  |  Branch (10272:13): [True: 6, False: 838]
  |  Branch (10272:46): [True: 20, False: 818]
  ------------------
10273|  3.67k|        return false;
10274|  3.67k|      }
10275|  1.89k|      p = after;
10276|  1.89k|    }
10277|  25.6k|  }
10278|       |
10279|   103k|  const bool need_slash = !has_path;
10280|   103k|  out.type = scheme_type;
10281|   103k|  out.is_valid = true;
10282|   103k|  out.has_opaque_path = false;
10283|   103k|  out.host_type = DEFAULT;
10284|       |
10285|   103k|  if constexpr (is_aggregator) {
10286|   103k|    if (!need_slash) {
  ------------------
  |  Branch (10286:9): [True: 92.4k, False: 11.0k]
  ------------------
10287|  92.4k|      out.buffer.resize(len);
10288|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10289|  92.4k|      std::memcpy(out.buffer.data(), input.data(), len);
10290|  92.4k|      if (has_upper) {
  ------------------
  |  Branch (10290:11): [True: 3.62k, False: 88.8k]
  ------------------
10291|  3.62k|        unicode::to_lower_ascii(out.buffer.data() + host_start,
10292|  3.62k|                                host_end - host_start);
10293|  3.62k|      }
10294|  92.4k|      out.components.protocol_end = protocol_end;
10295|  92.4k|      out.components.username_end = protocol_end + 2;
10296|  92.4k|      out.components.host_start = protocol_end + 2;
10297|  92.4k|      out.components.host_end = static_cast<uint32_t>(host_end);
10298|  92.4k|      out.components.port = url_components::omitted;
10299|  92.4k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
10300|  92.4k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (10300:37): [True: 29.9k, False: 62.5k]
  ------------------
10301|  92.4k|                                        ? static_cast<uint32_t>(query_start)
10302|  92.4k|                                        : url_components::omitted;
10303|  92.4k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (10303:35): [True: 19.1k, False: 73.3k]
  ------------------
10304|  92.4k|                                      ? static_cast<uint32_t>(hash_start)
10305|  92.4k|                                      : url_components::omitted;
10306|  92.4k|    } else {
10307|  11.0k|      out.buffer.resize(len + 1);
10308|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10309|  11.0k|      std::memcpy(out.buffer.data(), input.data(), host_end);
10310|  11.0k|      out.buffer[host_end] = '/';
10311|  11.0k|      if (host_end < len) {
  ------------------
  |  Branch (10311:11): [True: 7.31k, False: 3.73k]
  ------------------
10312|  7.31k|        std::memcpy(out.buffer.data() + host_end + 1, input.data() + host_end,
10313|  7.31k|                    len - host_end);
10314|  7.31k|      }
10315|  11.0k|      if (has_upper) {
  ------------------
  |  Branch (10315:11): [True: 36, False: 11.0k]
  ------------------
10316|     36|        unicode::to_lower_ascii(out.buffer.data() + host_start,
10317|     36|                                host_end - host_start);
10318|     36|      }
10319|  11.0k|      out.components.protocol_end = protocol_end;
10320|  11.0k|      out.components.username_end = protocol_end + 2;
10321|  11.0k|      out.components.host_start = protocol_end + 2;
10322|  11.0k|      out.components.host_end = static_cast<uint32_t>(host_end);
10323|  11.0k|      out.components.port = url_components::omitted;
10324|  11.0k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
10325|  11.0k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (10325:37): [True: 3.67k, False: 7.37k]
  ------------------
10326|  11.0k|                                        ? static_cast<uint32_t>(query_start + 1)
10327|  11.0k|                                        : url_components::omitted;
10328|  11.0k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (10328:35): [True: 3.68k, False: 7.37k]
  ------------------
10329|  11.0k|                                      ? static_cast<uint32_t>(hash_start + 1)
10330|  11.0k|                                      : url_components::omitted;
10331|  11.0k|    }
10332|       |  } else {
10333|       |    std::string host_str(input.substr(host_start, host_end - host_start));
10334|       |    if (has_upper) {
10335|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
10336|       |    }
10337|       |    out.host = std::move(host_str);
10338|       |    if (need_slash) {
10339|       |      out.path = "/";
10340|       |    } else {
10341|       |      out.path.assign(input.data() + path_start, path_end - path_start);
10342|       |    }
10343|       |    if (query_start != std::string_view::npos) {
10344|       |      const size_t q_end =
10345|       |          (hash_start != std::string_view::npos) ? hash_start : len;
10346|       |      out.query.emplace(input.data() + query_start + 1,
10347|       |                        q_end - query_start - 1);
10348|       |    }
10349|       |    if (hash_start != std::string_view::npos) {
10350|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
10351|       |    }
10352|       |  }
10353|   103k|  return true;
10354|   107k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11445|  84.2k|    const std::string_view input_with_colon) {
11446|  84.2k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
11447|  84.2k|  ADA_ASSERT_TRUE(validate());
11448|  84.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
11449|  84.2k|  std::string_view input{input_with_colon};
11450|  84.2k|  input.remove_suffix(1);
11451|  84.2k|  auto parsed_type = ada::scheme::get_scheme_type(input);
11452|  84.2k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
11453|       |  /**
11454|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
11455|       |   *http, https), in which case, we can go really fast.
11456|       |   **/
11457|  84.2k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (11457:7): [True: 82.0k, False: 2.24k]
  ------------------
11458|       |    if constexpr (has_state_override) {
11459|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
11460|       |      // then return.
11461|       |      if (is_special() != is_input_special) {
11462|       |        return false;
11463|       |      }
11464|       |
11465|       |      // If url includes credentials or has a non-null port, and buffer is
11466|       |      // "file", then return.
11467|       |      if ((has_credentials() || components.port != url_components::omitted) &&
11468|       |          parsed_type == ada::scheme::type::FILE) {
11469|       |        return false;
11470|       |      }
11471|       |
11472|       |      // If url's scheme is "file" and its host is an empty host, then return.
11473|       |      // An empty host is the empty string.
11474|       |      if (type == ada::scheme::type::FILE &&
11475|       |          components.host_start == components.host_end) {
11476|       |        return false;
11477|       |      }
11478|       |    }
11479|       |
11480|  82.0k|    type = parsed_type;
11481|  82.0k|    set_scheme_from_view_with_colon(input_with_colon);
11482|       |
11483|       |    if constexpr (has_state_override) {
11484|       |      // This is uncommon.
11485|       |      uint16_t urls_scheme_port = get_special_port();
11486|       |
11487|       |      if (urls_scheme_port) {
11488|       |        // If url's port is url's scheme's default port, then set url's port to
11489|       |        // null.
11490|       |        if (components.port == urls_scheme_port) {
11491|       |          clear_port();
11492|       |        }
11493|       |      }
11494|       |    }
11495|  82.0k|  } else {  // slow path
11496|  2.24k|    std::string _buffer(input);
11497|       |    // Next function is only valid if the input is ASCII and returns false
11498|       |    // otherwise, but it seems that we always have ascii content so we do not
11499|       |    // need to check the return value.
11500|  2.24k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
11501|       |
11502|       |    if constexpr (has_state_override) {
11503|       |      // The state-override validation errors below ("return" in the WHATWG URL
11504|       |      // parser) leave the URL unchanged. The setter contract is
11505|       |      // "true on success, false if the scheme is invalid" -- the fast path
11506|       |      // above already returns false here, so the slow path must agree.
11507|       |
11508|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
11509|       |      // then return. If url's scheme is not a special scheme and buffer is a
11510|       |      // special scheme, then return.
11511|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
11512|       |        return false;
11513|       |      }
11514|       |
11515|       |      // If url includes credentials or has a non-null port, and buffer is
11516|       |      // "file", then return.
11517|       |      if ((has_credentials() || components.port != url_components::omitted) &&
11518|       |          _buffer == "file") {
11519|       |        return false;
11520|       |      }
11521|       |
11522|       |      // If url's scheme is "file" and its host is an empty host, then return.
11523|       |      // An empty host is the empty string.
11524|       |      if (type == ada::scheme::type::FILE &&
11525|       |          components.host_start == components.host_end) {
11526|       |        return false;
11527|       |      }
11528|       |    }
11529|       |
11530|  2.24k|    set_scheme(_buffer);
11531|       |
11532|       |    if constexpr (has_state_override) {
11533|       |      // This is uncommon.
11534|       |      uint16_t urls_scheme_port = get_special_port();
11535|       |
11536|       |      if (urls_scheme_port) {
11537|       |        // If url's port is url's scheme's default port, then set url's port to
11538|       |        // null.
11539|       |        if (components.port == urls_scheme_port) {
11540|       |          clear_port();
11541|       |        }
11542|       |      }
11543|       |    }
11544|  2.24k|  }
11545|  84.2k|  ADA_ASSERT_TRUE(validate());
11546|  84.2k|  return true;
11547|  84.2k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11571|  82.0k|    std::string_view new_scheme_with_colon) {
11572|  82.0k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
11573|  82.0k|          new_scheme_with_colon);
11574|  82.0k|  ADA_ASSERT_TRUE(validate());
11575|  82.0k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
11576|  82.0k|                  new_scheme_with_colon.back() == ':');
11577|       |  // next line could overflow but unsigned arithmetic has well-defined
11578|       |  // overflows.
11579|  82.0k|  uint32_t new_difference =
11580|  82.0k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
11581|       |
11582|  82.0k|  if (buffer.empty()) {
  ------------------
  |  Branch (11582:7): [True: 82.0k, False: 0]
  ------------------
11583|  82.0k|    buffer.append(new_scheme_with_colon);
11584|  82.0k|  } else {
11585|      0|    buffer.erase(0, components.protocol_end);
11586|      0|    buffer.insert(0, new_scheme_with_colon);
11587|      0|  }
11588|  82.0k|  components.protocol_end += new_difference;
11589|       |
11590|  82.0k|  apply_shifted_non_scheme_offsets(components, new_difference);
11591|  82.0k|  ADA_ASSERT_TRUE(validate());
11592|  82.0k|}
_ZN3ada14url_aggregator10set_schemeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11594|  2.24k|inline void url_aggregator::set_scheme(std::string_view new_scheme) {
11595|  2.24k|  ada_log("url_aggregator::set_scheme ", new_scheme);
11596|  2.24k|  ADA_ASSERT_TRUE(validate());
11597|  2.24k|  ADA_ASSERT_TRUE(new_scheme.empty() || new_scheme.back() != ':');
11598|       |  // next line could overflow but unsigned arithmetic has well-defined
11599|       |  // overflows.
11600|  2.24k|  uint32_t new_difference =
11601|  2.24k|      uint32_t(new_scheme.size()) - components.protocol_end + 1;
11602|       |
11603|  2.24k|  type = ada::scheme::get_scheme_type(new_scheme);
11604|  2.24k|  if (buffer.empty()) {
  ------------------
  |  Branch (11604:7): [True: 2.24k, False: 0]
  ------------------
11605|  2.24k|    buffer.append(helpers::concat(new_scheme, ":"));
11606|  2.24k|  } else {
11607|      0|    buffer.erase(0, components.protocol_end);
11608|      0|    buffer.insert(0, helpers::concat(new_scheme, ":"));
11609|      0|  }
11610|  2.24k|  components.protocol_end = uint32_t(new_scheme.size() + 1);
11611|       |
11612|  2.24k|  apply_shifted_non_scheme_offsets(components, new_difference);
11613|  2.24k|  ADA_ASSERT_TRUE(validate());
11614|  2.24k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5678|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1074|   728k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1075|   728k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1076|   728k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2145|  7.22k|  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:
 3631|  1.80k|      : impl_base(unexpect, std::move(e.value())),
 3632|  1.80k|        ctor_base(detail::default_constructor_tag{}) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2159|  3.61k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2617|  1.80k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada3urlENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3235|   187k|  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_:
 3717|   186k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3590|   186k|      : impl_base(in_place, std::forward<Args>(args)...),
 3591|   186k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2605|   186k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada3urlC2EOS0_:
 4986|   186k|  url(url&& u) noexcept = default;
_ZN3ada8url_baseD2Ev:
 1649|   748k|  virtual ~url_base() = default;
_ZN3ada3urlD2Ev:
 4989|   374k|  ~url() override = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3631|  1.80k|      : impl_base(unexpect, std::move(e.value())),
 3632|  1.80k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2617|  1.80k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3235|   187k|  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_:
 3717|   186k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3590|   186k|      : impl_base(in_place, std::forward<Args>(args)...),
 3591|   186k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2605|   186k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7691|   186k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7694|   374k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6709|   173k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6710|   173k|  if (scheme.empty()) {
  ------------------
  |  Branch (6710:7): [True: 0, False: 173k]
  ------------------
 6711|      0|    return ada::scheme::NOT_SPECIAL;
 6712|      0|  }
 6713|   173k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6714|   173k|  const std::string_view target = details::is_special_list[hash_value];
 6715|   173k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6715:7): [True: 170k, False: 2.88k]
  ------------------
 6716|   170k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6716:7): [True: 166k, False: 3.59k]
  ------------------
 6717|   170k|          details::scheme_keys[hash_value]) {
 6718|   166k|    return ada::scheme::type(hash_value);
 6719|   166k|  } else {
 6720|  6.47k|    return ada::scheme::NOT_SPECIAL;
 6721|  6.47k|  }
 6722|   173k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6650|   170k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6651|   170k|  uint64_t input = (uint8_t)p[0];
 6652|   170k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6653|   170k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6654|   170k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6655|   170k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6656|   170k|  return input;
 6657|   170k|}
_ZN3ada14url_aggregatorC2Ev:
 7689|   187k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4895|   187k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1402|   174k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1403|   174k|  const size_t len = input.size();
 1404|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1405|   174k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1405:7): [True: 44.1k, False: 130k]
  |  Branch (1405:18): [True: 2.86k, False: 127k]
  ------------------
 1406|  47.0k|    return ipv4_fast_fail;
 1407|  47.0k|  }
 1408|   127k|  const char* data = input.data();
 1409|       |
 1410|       |#if defined(ADA_AVX512)
 1411|       |  return detail::try_parse_ipv4_avx512(data, len);
 1412|       |#else
 1413|   127k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1414|   174k|#endif
 1415|   174k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1277|   127k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1278|   127k|  uint32_t ipv4 = 0;
 1279|   288k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1279:19): [True: 248k, False: 40.1k]
  ------------------
 1280|   248k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1280:9): [True: 4, False: 248k]
  ------------------
 1281|      4|      return ipv4_fast_fail;
 1282|      4|    }
 1283|   248k|    uint32_t val;
 1284|   248k|    char c = *p;
 1285|   248k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1285:9): [True: 247k, False: 468]
  |  Branch (1285:21): [True: 162k, False: 85.2k]
  ------------------
 1286|   162k|      val = static_cast<uint32_t>(c - '0');
 1287|   162k|      ++p;
 1288|   162k|    } else {
 1289|  85.7k|      return ipv4_fast_fail;
 1290|  85.7k|    }
 1291|   162k|    if (p < pend) {
  ------------------
  |  Branch (1291:9): [True: 123k, False: 39.5k]
  ------------------
 1292|   123k|      c = *p;
 1293|   123k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1293:11): [True: 64.1k, False: 58.8k]
  |  Branch (1293:23): [True: 63.5k, False: 590]
  ------------------
 1294|  63.5k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1294:13): [True: 282, False: 63.3k]
  ------------------
 1295|    282|          return ipv4_fast_fail;
 1296|    282|        }
 1297|  63.3k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1298|  63.3k|        ++p;
 1299|  63.3k|        if (p < pend) {
  ------------------
  |  Branch (1299:13): [True: 63.0k, False: 236]
  ------------------
 1300|  63.0k|          c = *p;
 1301|  63.0k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1301:15): [True: 62.6k, False: 378]
  |  Branch (1301:27): [True: 62.6k, False: 28]
  ------------------
 1302|  62.6k|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1303|  62.6k|            ++p;
 1304|  62.6k|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1304:17): [True: 534, False: 62.1k]
  ------------------
 1305|    534|              return ipv4_fast_fail;
 1306|    534|            }
 1307|  62.6k|          }
 1308|  63.0k|        }
 1309|  63.3k|      }
 1310|   123k|    }
 1311|   161k|    ipv4 = (ipv4 << 8) | val;
 1312|   161k|    if (i < 3) {
  ------------------
  |  Branch (1312:9): [True: 121k, False: 40.1k]
  ------------------
 1313|   121k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1313:11): [True: 12, False: 121k]
  |  Branch (1313:24): [True: 716, False: 120k]
  ------------------
 1314|    728|        return ipv4_fast_fail;
 1315|    728|      }
 1316|   120k|      ++p;
 1317|   120k|    }
 1318|   161k|  }
 1319|  40.1k|  if (p != pend) {
  ------------------
  |  Branch (1319:7): [True: 160, False: 40.0k]
  ------------------
 1320|    160|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1320:9): [True: 72, False: 88]
  |  Branch (1320:26): [True: 6, False: 66]
  ------------------
 1321|      6|      return ipv4;
 1322|      6|    }
 1323|    154|    return ipv4_fast_fail;
 1324|    160|  }
 1325|  40.0k|  return ipv4;
 1326|  40.1k|}
_ZNK3ada3url15has_credentialsEv:
 7227|   480k|[[nodiscard]] ada_really_inline bool url::has_credentials() const noexcept {
 7228|   480k|  return !username.empty() || !password.empty();
  ------------------
  |  Branch (7228:10): [True: 79.2k, False: 401k]
  |  Branch (7228:31): [True: 275, False: 400k]
  ------------------
 7229|   480k|}
_ZNK3ada8url_base10is_specialEv:
 7192|  1.88M|    const noexcept {
 7193|  1.88M|  return type != ada::scheme::NOT_SPECIAL;
 7194|  1.88M|}
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEEcvbEv:
 4030|   187k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEptEv:
 3999|   310k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4000|   310k|    TL_ASSERT(has_value());
  ------------------
  |  | 2052|   310k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4000:5): [True: 310k, False: 0]
  ------------------
 4001|   310k|    return valptr();
 4002|   310k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE6valptrEv:
 3295|   310k|  T* valptr() { return std::addressof(this->m_val); }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EED2Ev:
 2627|   187k|  ~expected_storage_base() {
 2628|   187k|    if (m_has_val) {
  ------------------
  |  Branch (2628:9): [True: 186k, False: 1.80k]
  ------------------
 2629|   186k|      m_val.~T();
 2630|   186k|    }
 2631|   187k|  }
_ZNK3ada3url13get_href_sizeEv:
 7482|   424k|[[nodiscard]] inline size_t url::get_href_size() const noexcept {
 7483|   424k|  size_t size = 0;
 7484|   424k|  if (is_special()) {
  ------------------
  |  Branch (7484:7): [True: 421k, False: 3.42k]
  ------------------
 7485|   421k|    size += ada::scheme::details::is_special_list[type].size() + 1;
 7486|   421k|  } else {
 7487|  3.42k|    size += non_special_scheme.size() + 1;
 7488|  3.42k|  }
 7489|   424k|  if (host.has_value()) {
  ------------------
  |  Branch (7489:7): [True: 422k, False: 1.71k]
  ------------------
 7490|   422k|    size += host->size();
 7491|   422k|    size += 2;
 7492|   422k|    if (has_credentials()) {
  ------------------
  |  Branch (7492:9): [True: 51.3k, False: 371k]
  ------------------
 7493|  51.3k|      size += username.size();
 7494|  51.3k|      if (!password.empty()) {
  ------------------
  |  Branch (7494:11): [True: 49.6k, False: 1.70k]
  ------------------
 7495|  49.6k|        size += 1 + password.size();
 7496|  49.6k|      }
 7497|  51.3k|      size += 1;
 7498|  51.3k|    }
 7499|   422k|    if (port.has_value()) {
  ------------------
  |  Branch (7499:9): [True: 52.5k, False: 370k]
  ------------------
 7500|  52.5k|      size += 1;
 7501|  52.5k|      uint16_t p = *port;
 7502|  52.5k|      size += (p >= 10000)  ? 5
  ------------------
  |  Branch (7502:15): [True: 1.90k, False: 50.6k]
  ------------------
 7503|  52.5k|              : (p >= 1000) ? 4
  ------------------
  |  Branch (7503:17): [True: 48.1k, False: 2.47k]
  ------------------
 7504|  50.6k|              : (p >= 100)  ? 3
  ------------------
  |  Branch (7504:17): [True: 201, False: 2.27k]
  ------------------
 7505|  2.47k|              : (p >= 10)   ? 2
  ------------------
  |  Branch (7505:17): [True: 80, False: 2.19k]
  ------------------
 7506|  2.27k|                            : 1;
 7507|  52.5k|    }
 7508|   422k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7508:14): [True: 531, False: 1.18k]
  |  Branch (7508:34): [True: 49, False: 482]
  ------------------
 7509|     49|    size += 2;
 7510|     49|  }
 7511|   424k|  size += path.size();
 7512|   424k|  if (query.has_value()) {
  ------------------
  |  Branch (7512:7): [True: 77.3k, False: 347k]
  ------------------
 7513|  77.3k|    size += 1 + query->size();
 7514|  77.3k|  }
 7515|   424k|  if (hash.has_value()) {
  ------------------
  |  Branch (7515:7): [True: 57.1k, False: 367k]
  ------------------
 7516|  57.1k|    size += 1 + hash->size();
 7517|  57.1k|  }
 7518|   424k|  return size;
 7519|   424k|}
_ZN3ada8checkers8is_alphaEc:
 1257|   171k|constexpr bool is_alpha(char x) noexcept {
 1258|   171k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1258:10): [True: 169k, False: 1.13k]
  |  Branch (1258:34): [True: 169k, False: 46]
  ------------------
 1259|   171k|}
_ZN3ada8checkers8to_lowerEc:
 1255|   341k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZNR2tl8expectedIN3ada3urlENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4012|   310k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4013|   310k|    TL_ASSERT(has_value());
  ------------------
  |  | 2052|   310k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4013:5): [True: 310k, False: 0]
  ------------------
 4014|   310k|    return val();
 4015|   310k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3304|   310k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3305|   310k|    return this->m_val;
 3306|   310k|  }
_ZN3ada3urlaSERKS0_:
 4988|  62.0k|  url& operator=(const url& u) = default;
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEE9has_valueEv:
 4029|   746k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN3ada3urlC2Ev:
 4984|   187k|  url() = default;
_ZN3ada3url26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7332|  5.45k|inline void url::update_unencoded_base_hash(std::string_view input) {
 7333|       |  // We do the percent encoding
 7334|  5.45k|  hash = unicode::percent_encode(input,
 7335|  5.45k|                                 ada::character_sets::FRAGMENT_PERCENT_ENCODE);
 7336|  5.45k|}
_ZN3ada3url18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7339|  5.24k|                                    const uint8_t query_percent_encode_set[]) {
 7340|  5.24k|  query = ada::unicode::percent_encode(input, query_percent_encode_set);
 7341|  5.24k|}
_ZN3ada3url20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7330|     33|inline void url::update_base_hostname(std::string_view input) { host = input; }
_ZN3ada3url20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7347|  1.29k|inline void url::update_base_pathname(const std::string_view input) {
 7348|  1.29k|  path = input;
 7349|  1.29k|}
_ZN3ada3url10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 7522|  12.6k|                                         bool check_trailing_content) noexcept {
 7523|  12.6k|  ada_log("parse_port('", view, "') ", view.size());
 7524|  12.6k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (7524:7): [True: 12.5k, False: 71]
  |  Branch (7524:24): [True: 4, False: 12.5k]
  ------------------
 7525|      4|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 7526|      4|    is_valid = false;
 7527|      4|    return 0;
 7528|      4|  }
 7529|  12.6k|  uint16_t parsed_port{};
 7530|  12.6k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 7531|  12.6k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (7531:7): [True: 27, False: 12.6k]
  ------------------
 7532|     27|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 7533|     27|    is_valid = false;
 7534|     27|    return 0;
 7535|     27|  }
 7536|  12.6k|  ada_log("parse_port: ", parsed_port);
 7537|  12.6k|  const auto consumed = size_t(r.ptr - view.data());
 7538|  12.6k|  ada_log("parse_port: consumed ", consumed);
 7539|  12.6k|  if (check_trailing_content) {
  ------------------
  |  Branch (7539:7): [True: 12.6k, False: 0]
  ------------------
 7540|  12.6k|    is_valid &=
 7541|  12.6k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (7541:10): [True: 243, False: 12.3k]
  |  Branch (7541:37): [True: 12.1k, False: 207]
  ------------------
 7542|    207|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (7542:10): [True: 59, False: 148]
  |  Branch (7542:36): [True: 137, False: 11]
  |  Branch (7542:52): [True: 35, False: 102]
  ------------------
 7543|  12.6k|  }
 7544|  12.6k|  ada_log("parse_port: is_valid = ", is_valid);
 7545|  12.6k|  if (is_valid) {
  ------------------
  |  Branch (7545:7): [True: 12.5k, False: 113]
  ------------------
 7546|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 7547|  12.5k|    auto default_port = scheme_default_port();
 7548|  12.5k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (7548:27): [True: 124, False: 12.3k]
  |  Branch (7548:48): [True: 40, False: 84]
  ------------------
 7549|  12.4k|                         (default_port != parsed_port);
  ------------------
  |  Branch (7549:26): [True: 12.4k, False: 4]
  ------------------
 7550|  12.5k|    port = (r.ec == std::errc() && is_port_valid) ? std::optional(parsed_port)
  ------------------
  |  Branch (7550:13): [True: 12.3k, False: 172]
  |  Branch (7550:36): [True: 12.3k, False: 4]
  ------------------
 7551|  12.5k|                                                  : std::nullopt;
 7552|  12.5k|  }
 7553|  12.6k|  return consumed;
 7554|  12.6k|}
_ZNK3ada8url_base19scheme_default_portEv:
 7201|  25.0k|url_base::scheme_default_port() const noexcept {
 7202|  25.0k|  return scheme::get_special_port(type);
 7203|  25.0k|}
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6706|  25.0k|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6707|  25.0k|  return details::special_ports[int(type)];
 6708|  25.0k|}
_ZNK3ada3url12get_pathnameEv:
 7253|  62.0k|[[nodiscard]] constexpr std::string_view url::get_pathname() const noexcept {
 7254|  62.0k|  return path;
 7255|  62.0k|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1261|  3.07k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1262|  3.07k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1262:10): [True: 2.34k, False: 736]
  ------------------
 1263|  2.34k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1263:11): [True: 1.23k, False: 1.10k]
  |  Branch (1263:34): [True: 268, False: 966]
  |  Branch (1263:55): [True: 76, False: 890]
  ------------------
 1264|    344|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1264:11): [True: 92, False: 252]
  |  Branch (1264:35): [True: 58, False: 194]
  |  Branch (1264:54): [True: 6, False: 188]
  ------------------
 1265|    188|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1265:35): [True: 0, False: 188]
  |  Branch (1265:54): [True: 0, False: 188]
  ------------------
 1266|  3.07k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1269|     92|    std::string_view input) noexcept {
 1270|     92|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1270:10): [True: 34, False: 58]
  |  Branch (1270:32): [True: 28, False: 6]
  |  Branch (1270:54): [True: 20, False: 8]
  ------------------
 1271|     92|}
_ZN3ada3url20set_protocol_as_fileEv:
 7375|    671|constexpr void url::set_protocol_as_file() { type = ada::scheme::type::FILE; }
_ZN3ada7helpers14leading_zeroesEj:
 1934|  88.4k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1935|       |#if ADA_REGULAR_VISUAL_STUDIO
 1936|       |  unsigned long leading_zero(0);
 1937|       |  unsigned long in(input_num);
 1938|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1939|       |#else
 1940|  88.4k|  return __builtin_clz(input_num);
 1941|  88.4k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1942|  88.4k|}
_ZN3ada14url_aggregator7reserveEj:
 8901|  84.3k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 8902|  84.3k|  buffer.reserve(capacity);
 8903|  84.3k|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8391|  12.3k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8392|  12.3k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8393|  12.3k|          " bytes] \n", to_diagram());
 8394|  12.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8395|  12.3k|  ADA_ASSERT_TRUE(validate());
 8396|       |
 8397|  12.3k|  const bool begins_with_dashdash = input.starts_with("//");
 8398|  12.3k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8398:7): [True: 11.9k, False: 359]
  |  Branch (8398:32): [True: 0, False: 11.9k]
  ------------------
 8399|       |    // We must delete the ./
 8400|      0|    delete_dash_dot();
 8401|      0|  }
 8402|       |
 8403|  12.3k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8403:7): [True: 359, False: 11.9k]
  |  Branch (8403:31): [True: 359, False: 0]
  |  Branch (8403:51): [True: 12, False: 347]
  ------------------
 8404|     12|      !has_dash_dot()) {
  ------------------
  |  Branch (8404:7): [True: 12, False: 0]
  ------------------
 8405|       |    // If url's host is null, url does not have an opaque path, url's path's
 8406|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8407|       |    // output.
 8408|     12|    buffer.insert(components.pathname_start, "/.");
 8409|     12|    components.pathname_start += 2;
 8410|     12|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8410:9): [True: 0, False: 12]
  ------------------
 8411|      0|      components.search_start += 2;
 8412|      0|    }
 8413|     12|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8413:9): [True: 0, False: 12]
  ------------------
 8414|      0|      components.hash_start += 2;
 8415|      0|    }
 8416|     12|  }
 8417|       |
 8418|  12.3k|  uint32_t difference = replace_and_resize(
 8419|  12.3k|      components.pathname_start,
 8420|  12.3k|      components.pathname_start + get_pathname_length(), input);
 8421|  12.3k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8421:7): [True: 0, False: 12.3k]
  ------------------
 8422|      0|    components.search_start += difference;
 8423|      0|  }
 8424|  12.3k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8424:7): [True: 0, False: 12.3k]
  ------------------
 8425|      0|    components.hash_start += difference;
 8426|      0|  }
 8427|  12.3k|  ADA_ASSERT_TRUE(validate());
 8428|  12.3k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8234|  99.7k|    uint32_t start, uint32_t end, std::string_view input) {
 8235|  99.7k|  uint32_t current_length = end - start;
 8236|  99.7k|  uint32_t input_size = uint32_t(input.size());
 8237|  99.7k|  uint32_t new_difference = input_size - current_length;
 8238|       |
 8239|  99.7k|  if (current_length == 0) {
  ------------------
  |  Branch (8239:7): [True: 83.2k, False: 16.4k]
  ------------------
 8240|  83.2k|    buffer.insert(start, input);
 8241|  83.2k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8241:14): [True: 196, False: 16.2k]
  ------------------
 8242|    196|    buffer.replace(start, input_size, input);
 8243|  16.2k|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8243:14): [True: 26, False: 16.2k]
  ------------------
 8244|     26|    buffer.erase(start, current_length - input_size);
 8245|     26|    buffer.replace(start, input_size, input);
 8246|  16.2k|  } else {
 8247|  16.2k|    buffer.replace(start, current_length, input.substr(0, current_length));
 8248|  16.2k|    buffer.insert(start + current_length, input.substr(current_length));
 8249|  16.2k|  }
 8250|       |
 8251|  99.7k|  return new_difference;
 8252|  99.7k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8283|  12.3k|url_aggregator::get_pathname_length() const noexcept {
 8284|  12.3k|  ada_log("url_aggregator::get_pathname_length");
 8285|  12.3k|  uint32_t ending_index = uint32_t(buffer.size());
 8286|  12.3k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8286:7): [True: 0, False: 12.3k]
  ------------------
 8287|      0|    ending_index = components.search_start;
 8288|  12.3k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8288:14): [True: 0, False: 12.3k]
  ------------------
 8289|      0|    ending_index = components.hash_start;
 8290|      0|  }
 8291|  12.3k|  return ending_index - components.pathname_start;
 8292|  12.3k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9228|  73.0k|    ada_lifetime_bound {
 9229|  73.0k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9230|  73.0k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9231|  73.0k|          " components.search_start = ", components.search_start,
 9232|  73.0k|          " components.hash_start = ", components.hash_start);
 9233|  73.0k|  auto ending_index = uint32_t(buffer.size());
 9234|  73.0k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9234:7): [True: 12.9k, False: 60.1k]
  ------------------
 9235|  12.9k|    ending_index = components.search_start;
 9236|  60.1k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9236:14): [True: 4.29k, False: 55.8k]
  ------------------
 9237|  4.29k|    ending_index = components.hash_start;
 9238|  4.29k|  }
 9239|  73.0k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9240|  73.0k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8210|  5.45k|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8211|  5.45k|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8212|  5.45k|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8213|  5.45k|          " bytes] components.hash_start = ", components.hash_start);
 8214|  5.45k|  ADA_ASSERT_TRUE(validate());
 8215|  5.45k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8216|  5.45k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8216:7): [True: 0, False: 5.45k]
  ------------------
 8217|      0|    buffer.resize(components.hash_start);
 8218|      0|  }
 8219|  5.45k|  components.hash_start = uint32_t(buffer.size());
 8220|  5.45k|  buffer += "#";
 8221|  5.45k|  bool encoding_required = unicode::percent_encode<true>(
 8222|  5.45k|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8223|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8224|       |  // encoding was not deemed required.
 8225|  5.45k|  if (!encoding_required) {
  ------------------
  |  Branch (8225:7): [True: 5.34k, False: 112]
  ------------------
 8226|  5.34k|    buffer.append(input);
 8227|  5.34k|  }
 8228|  5.45k|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8229|  5.45k|          buffer, "' [", buffer.size(), " bytes]");
 8230|  5.45k|  ADA_ASSERT_TRUE(validate());
 8231|  5.45k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8619|  19.0k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8620|  19.0k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8621|  19.0k|          "\n", to_diagram());
 8622|  19.0k|  ADA_ASSERT_TRUE(validate());
 8623|  19.0k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8624|       |#if ADA_DEVELOPMENT_CHECKS
 8625|       |  // computing the expected password.
 8626|       |  std::string password_expected = std::string(get_password());
 8627|       |  password_expected.append(input);
 8628|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8629|  19.0k|  add_authority_slashes_if_needed();
 8630|       |
 8631|       |  // If input is empty, do nothing.
 8632|  19.0k|  if (input.empty()) {
  ------------------
  |  Branch (8632:7): [True: 2.44k, False: 16.6k]
  ------------------
 8633|  2.44k|    return;
 8634|  2.44k|  }
 8635|       |
 8636|  16.6k|  uint32_t difference = uint32_t(input.size());
 8637|  16.6k|  if (has_password()) {
  ------------------
  |  Branch (8637:7): [True: 4.96k, False: 11.6k]
  ------------------
 8638|  4.96k|    buffer.insert(components.host_start, input);
 8639|  11.6k|  } else {
 8640|  11.6k|    difference++;  // Increment for ":"
 8641|  11.6k|    buffer.insert(components.username_end, ":");
 8642|  11.6k|    buffer.insert(components.username_end + 1, input);
 8643|  11.6k|  }
 8644|  16.6k|  components.host_start += difference;
 8645|       |
 8646|       |  // The following line is required to add "@" to hostname. When updating
 8647|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8648|       |  // responsibility to set it.
 8649|  16.6k|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8649:7): [True: 59, False: 16.5k]
  ------------------
 8650|     59|    buffer.insert(components.host_start, "@");
 8651|     59|    difference++;
 8652|     59|  }
 8653|       |
 8654|  16.6k|  components.host_end += difference;
 8655|  16.6k|  components.pathname_start += difference;
 8656|  16.6k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8656:7): [True: 0, False: 16.6k]
  ------------------
 8657|      0|    components.search_start += difference;
 8658|      0|  }
 8659|  16.6k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8659:7): [True: 0, False: 16.6k]
  ------------------
 8660|      0|    components.hash_start += difference;
 8661|      0|  }
 8662|       |#if ADA_DEVELOPMENT_CHECKS
 8663|       |  std::string password_after(get_password());
 8664|       |  ADA_ASSERT_EQUAL(
 8665|       |      password_expected, password_after,
 8666|       |      "append_base_password problem after inserting " + std::string(input));
 8667|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8668|  16.6k|  ADA_ASSERT_TRUE(validate());
 8669|  16.6k|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 8875|   126k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 8876|   126k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 8877|   126k|  ADA_ASSERT_TRUE(validate());
 8878|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 8879|       |  // to insert
 8880|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 8881|   126k|  if (has_authority()) {
  ------------------
  |  Branch (8881:7): [True: 43.7k, False: 82.6k]
  ------------------
 8882|  43.7k|    return;
 8883|  43.7k|  }
 8884|       |  // Performance: the common case is components.protocol_end == buffer.size()
 8885|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 8886|       |  // the insert could be fused with another insert.
 8887|  82.6k|  buffer.insert(components.protocol_end, "//");
 8888|  82.6k|  components.username_end += 2;
 8889|  82.6k|  components.host_start += 2;
 8890|  82.6k|  components.host_end += 2;
 8891|  82.6k|  components.pathname_start += 2;
 8892|  82.6k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8892:7): [True: 0, False: 82.6k]
  ------------------
 8893|      0|    components.search_start += 2;
 8894|      0|  }
 8895|  82.6k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8895:7): [True: 0, False: 82.6k]
  ------------------
 8896|      0|    components.hash_start += 2;
 8897|      0|  }
 8898|  82.6k|  ADA_ASSERT_TRUE(validate());
 8899|  82.6k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8501|  19.8k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8502|  19.8k|  ada_log("url_aggregator::append_base_username ", input);
 8503|  19.8k|  ADA_ASSERT_TRUE(validate());
 8504|  19.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8505|       |#if ADA_DEVELOPMENT_CHECKS
 8506|       |  // computing the expected password.
 8507|       |  std::string username_expected(get_username());
 8508|       |  username_expected.append(input);
 8509|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8510|  19.8k|  add_authority_slashes_if_needed();
 8511|       |
 8512|       |  // If input is empty, do nothing.
 8513|  19.8k|  if (input.empty()) {
  ------------------
  |  Branch (8513:7): [True: 2.87k, False: 17.0k]
  ------------------
 8514|  2.87k|    return;
 8515|  2.87k|  }
 8516|       |
 8517|  17.0k|  uint32_t difference = uint32_t(input.size());
 8518|  17.0k|  buffer.insert(components.username_end, input);
 8519|  17.0k|  components.username_end += difference;
 8520|  17.0k|  components.host_start += difference;
 8521|       |
 8522|  17.0k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8522:7): [True: 12.1k, False: 4.85k]
  ------------------
 8523|  12.1k|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8523:7): [True: 12.1k, False: 0]
  ------------------
 8524|  12.1k|    buffer.insert(components.host_start, "@");
 8525|  12.1k|    difference++;
 8526|  12.1k|  }
 8527|       |
 8528|  17.0k|  components.host_end += difference;
 8529|  17.0k|  components.pathname_start += difference;
 8530|  17.0k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8530:7): [True: 0, False: 17.0k]
  ------------------
 8531|      0|    components.search_start += difference;
 8532|      0|  }
 8533|  17.0k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8533:7): [True: 0, False: 17.0k]
  ------------------
 8534|      0|    components.hash_start += difference;
 8535|      0|  }
 8536|       |#if ADA_DEVELOPMENT_CHECKS
 8537|       |  std::string username_after(get_username());
 8538|       |  ADA_ASSERT_EQUAL(
 8539|       |      username_expected, username_after,
 8540|       |      "append_base_username problem after inserting " + std::string(input));
 8541|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8542|  17.0k|  ADA_ASSERT_TRUE(validate());
 8543|  17.0k|}
_ZNK3ada14url_aggregator8get_hrefEv:
 8979|   372k|    const noexcept ada_lifetime_bound {
 8980|   372k|  ada_log("url_aggregator::get_href");
 8981|   372k|  return buffer;
 8982|   372k|}
_ZN3ada14url_aggregator16update_base_portEj:
 8671|  12.3k|inline void url_aggregator::update_base_port(uint32_t input) {
 8672|  12.3k|  ada_log("url_aggregator::update_base_port");
 8673|  12.3k|  ADA_ASSERT_TRUE(validate());
 8674|  12.3k|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8674:7): [True: 0, False: 12.3k]
  ------------------
 8675|      0|    clear_port();
 8676|      0|    return;
 8677|      0|  }
 8678|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8679|       |  // value is probably already available as a string.
 8680|  12.3k|  std::string value = helpers::concat(":", std::to_string(input));
 8681|  12.3k|  uint32_t difference = uint32_t(value.size());
 8682|       |
 8683|  12.3k|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8683:7): [True: 0, False: 12.3k]
  ------------------
 8684|      0|    difference -= components.pathname_start - components.host_end;
 8685|      0|    buffer.erase(components.host_end,
 8686|      0|                 components.pathname_start - components.host_end);
 8687|      0|  }
 8688|       |
 8689|  12.3k|  buffer.insert(components.host_end, value);
 8690|  12.3k|  components.pathname_start += difference;
 8691|  12.3k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8691:7): [True: 0, False: 12.3k]
  ------------------
 8692|      0|    components.search_start += difference;
 8693|      0|  }
 8694|  12.3k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8694:7): [True: 0, False: 12.3k]
  ------------------
 8695|      0|    components.hash_start += difference;
 8696|      0|  }
 8697|  12.3k|  components.port = input;
 8698|  12.3k|  ADA_ASSERT_TRUE(validate());
 8699|  12.3k|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1924|  12.3k|std::string concat(Args... args) {
 1925|  12.3k|  std::string answer;
 1926|  12.3k|  inner_concat(answer, args...);
 1927|  12.3k|  return answer;
 1928|  12.3k|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1913|  12.3k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1914|  12.3k|  buffer.append(t);
 1915|  12.3k|  return inner_concat(buffer, args...);
 1916|  12.3k|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1905|  12.3k|inline void inner_concat(std::string& buffer, T t) {
 1906|  12.3k|  buffer.append(t);
 1907|  12.3k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8339|  5.24k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8340|  5.24k|  ada_log("url_aggregator::update_base_search ", input,
 8341|  5.24k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8342|  5.24k|  ADA_ASSERT_TRUE(validate());
 8343|  5.24k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8344|       |
 8345|  5.24k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8345:7): [True: 5.24k, False: 0]
  ------------------
 8346|  5.24k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8346:9): [True: 5.24k, False: 0]
  ------------------
 8347|  5.24k|      components.search_start = uint32_t(buffer.size());
 8348|  5.24k|      buffer += "?";
 8349|  5.24k|    } else {
 8350|      0|      buffer.resize(components.search_start + 1);
 8351|      0|    }
 8352|       |
 8353|  5.24k|    bool encoding_required =
 8354|  5.24k|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8355|       |    // When encoding_required is false, then buffer is left unchanged, and
 8356|       |    // percent encoding was not deemed required.
 8357|  5.24k|    if (!encoding_required) {
  ------------------
  |  Branch (8357:9): [True: 5.06k, False: 173]
  ------------------
 8358|  5.06k|      buffer.append(input);
 8359|  5.06k|    }
 8360|  5.24k|  } else {
 8361|      0|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8361:9): [True: 0, False: 0]
  ------------------
 8362|      0|      components.search_start = components.hash_start;
 8363|      0|    } else {
 8364|      0|      buffer.erase(components.search_start,
 8365|      0|                   components.hash_start - components.search_start);
 8366|      0|      components.hash_start = components.search_start;
 8367|      0|    }
 8368|       |
 8369|      0|    buffer.insert(components.search_start, "?");
 8370|      0|    size_t idx =
 8371|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8372|      0|    if (idx == input.size()) {
  ------------------
  |  Branch (8372:9): [True: 0, False: 0]
  ------------------
 8373|      0|      buffer.insert(components.search_start + 1, input);
 8374|      0|      components.hash_start += uint32_t(input.size() + 1);  // Do not forget `?`
 8375|      0|    } else {
 8376|      0|      buffer.insert(components.search_start + 1, input, 0, idx);
 8377|      0|      input.remove_prefix(idx);
 8378|       |      // We only create a temporary string if we need percent encoding and
 8379|       |      // we attempt to create as small a temporary string as we can.
 8380|      0|      std::string encoded =
 8381|      0|          ada::unicode::percent_encode(input, query_percent_encode_set);
 8382|      0|      buffer.insert(components.search_start + idx + 1, encoded);
 8383|      0|      components.hash_start +=
 8384|      0|          uint32_t(encoded.size() + idx + 1);  // Do not forget `?`
 8385|      0|    }
 8386|      0|  }
 8387|       |
 8388|  5.24k|  ADA_ASSERT_TRUE(validate());
 8389|  5.24k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8254|  87.3k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8255|  87.3k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8256|  87.3k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8257|  87.3k|  ADA_ASSERT_TRUE(validate());
 8258|  87.3k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8259|       |
 8260|       |  // This next line is required for when parsing a URL like `foo://`
 8261|  87.3k|  add_authority_slashes_if_needed();
 8262|       |
 8263|  87.3k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8264|  87.3k|  uint32_t new_difference =
 8265|  87.3k|      replace_and_resize(components.host_start, components.host_end, input);
 8266|       |
 8267|  87.3k|  if (has_credentials) {
  ------------------
  |  Branch (8267:7): [True: 12.0k, False: 75.2k]
  ------------------
 8268|  12.0k|    buffer.insert(components.host_start, "@");
 8269|  12.0k|    new_difference++;
 8270|  12.0k|  }
 8271|  87.3k|  components.host_end += new_difference;
 8272|  87.3k|  components.pathname_start += new_difference;
 8273|  87.3k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8273:7): [True: 0, False: 87.3k]
  ------------------
 8274|      0|    components.search_start += new_difference;
 8275|      0|  }
 8276|  87.3k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8276:7): [True: 0, False: 87.3k]
  ------------------
 8277|      0|    components.hash_start += new_difference;
 8278|      0|  }
 8279|  87.3k|  ADA_ASSERT_TRUE(validate());
 8280|  87.3k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 8989|  12.6k|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 8990|  12.6k|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 8991|  12.6k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (8991:7): [True: 12.5k, False: 71]
  |  Branch (8991:24): [True: 4, False: 12.5k]
  ------------------
 8992|      4|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 8993|      4|    is_valid = false;
 8994|      4|    return 0;
 8995|      4|  }
 8996|  12.6k|  uint16_t parsed_port{};
 8997|  12.6k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 8998|  12.6k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (8998:7): [True: 27, False: 12.6k]
  ------------------
 8999|     27|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9000|     27|    is_valid = false;
 9001|     27|    return 0;
 9002|     27|  }
 9003|  12.6k|  ada_log("parse_port: ", parsed_port);
 9004|  12.6k|  const size_t consumed = size_t(r.ptr - view.data());
 9005|  12.6k|  ada_log("parse_port: consumed ", consumed);
 9006|  12.6k|  if (check_trailing_content) {
  ------------------
  |  Branch (9006:7): [True: 12.6k, False: 0]
  ------------------
 9007|  12.6k|    is_valid &=
 9008|  12.6k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9008:10): [True: 243, False: 12.3k]
  |  Branch (9008:37): [True: 12.1k, False: 207]
  ------------------
 9009|    207|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9009:10): [True: 59, False: 148]
  |  Branch (9009:36): [True: 137, False: 11]
  |  Branch (9009:52): [True: 35, False: 102]
  ------------------
 9010|  12.6k|  }
 9011|  12.6k|  ada_log("parse_port: is_valid = ", is_valid);
 9012|  12.6k|  if (is_valid) {
  ------------------
  |  Branch (9012:7): [True: 12.5k, False: 113]
  ------------------
 9013|  12.5k|    ada_log("parse_port", r.ec == std::errc());
 9014|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9015|  12.5k|    auto default_port = scheme_default_port();
 9016|  12.5k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9016:27): [True: 124, False: 12.3k]
  |  Branch (9016:48): [True: 40, False: 84]
  ------------------
 9017|  12.4k|                         (default_port != parsed_port);
  ------------------
  |  Branch (9017:26): [True: 12.4k, False: 4]
  ------------------
 9018|  12.5k|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9018:9): [True: 12.3k, False: 172]
  |  Branch (9018:32): [True: 12.3k, False: 4]
  ------------------
 9019|  12.3k|      update_base_port(parsed_port);
 9020|  12.3k|    } else {
 9021|    176|      clear_port();
 9022|    176|    }
 9023|  12.5k|  }
 9024|  12.6k|  return consumed;
 9025|  12.6k|}
_ZN3ada14url_aggregator20set_protocol_as_fileEv:
 9027|    671|constexpr void url_aggregator::set_protocol_as_file() {
 9028|    671|  ada_log("url_aggregator::set_protocol_as_file ");
 9029|    671|  ADA_ASSERT_TRUE(validate());
 9030|    671|  type = ada::scheme::type::FILE;
 9031|       |  // next line could overflow but unsigned arithmetic has well-defined
 9032|       |  // overflows.
 9033|    671|  uint32_t new_difference = 5 - components.protocol_end;
 9034|       |
 9035|    671|  if (buffer.empty()) {
  ------------------
  |  Branch (9035:7): [True: 0, False: 671]
  ------------------
 9036|      0|    buffer.append("file:");
 9037|    671|  } else {
 9038|    671|    buffer.erase(0, components.protocol_end);
 9039|    671|    buffer.insert(0, "file:");
 9040|    671|  }
 9041|    671|  components.protocol_end = 5;
 9042|       |
 9043|       |  // Update the rest of the components.
 9044|    671|  components.username_end += new_difference;
 9045|    671|  components.host_start += new_difference;
 9046|    671|  components.host_end += new_difference;
 9047|    671|  components.pathname_start += new_difference;
 9048|    671|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9048:7): [True: 0, False: 671]
  ------------------
 9049|      0|    components.search_start += new_difference;
 9050|      0|  }
 9051|    671|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9051:7): [True: 0, False: 671]
  ------------------
 9052|      0|    components.hash_start += new_difference;
 9053|      0|  }
 9054|    671|  ADA_ASSERT_TRUE(validate());
 9055|    671|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8112|    420|                                              const uint8_t character_set[]) {
 8113|    420|  const char* data = input.data();
 8114|    420|  const size_t size = input.size();
 8115|       |
 8116|       |  // Process 8 bytes at a time using unrolled loop
 8117|    420|  size_t i = 0;
 8118|    910|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8118:10): [True: 519, False: 391]
  ------------------
 8119|    519|    unsigned char chunk[8];
 8120|    519|    std::memcpy(&chunk, data + i,
 8121|    519|                8);  // entices compiler to unconditionally process 8 characters
 8122|       |
 8123|       |    // Check 8 characters at once
 8124|  4.52k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8124:24): [True: 4.03k, False: 490]
  ------------------
 8125|  4.03k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8125:11): [True: 29, False: 4.00k]
  ------------------
 8126|     29|        return i + j;
 8127|     29|      }
 8128|  4.03k|    }
 8129|    519|  }
 8130|       |
 8131|       |  // Handle remaining bytes
 8132|  1.56k|  for (; i < size; i++) {
  ------------------
  |  Branch (8132:10): [True: 1.18k, False: 381]
  ------------------
 8133|  1.18k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8133:9): [True: 10, False: 1.17k]
  ------------------
 8134|     10|      return i;
 8135|     10|    }
 8136|  1.18k|  }
 8137|       |
 8138|    381|  return size;
 8139|    391|}
_ZN3ada14url_aggregator10clear_portEv:
 8701|    176|inline void url_aggregator::clear_port() {
 8702|    176|  ada_log("url_aggregator::clear_port");
 8703|    176|  ADA_ASSERT_TRUE(validate());
 8704|    176|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8704:7): [True: 176, False: 0]
  ------------------
 8705|    176|    return;
 8706|    176|  }
 8707|      0|  uint32_t length = components.pathname_start - components.host_end;
 8708|      0|  buffer.erase(components.host_end, length);
 8709|      0|  components.pathname_start -= length;
 8710|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8710:7): [True: 0, False: 0]
  ------------------
 8711|      0|    components.search_start -= length;
 8712|      0|  }
 8713|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8713:7): [True: 0, False: 0]
  ------------------
 8714|      0|    components.hash_start -= length;
 8715|      0|  }
 8716|      0|  components.port = url_components::omitted;
 8717|      0|  ADA_ASSERT_TRUE(validate());
 8718|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 8866|   126k|    const noexcept {
 8867|   126k|  ada_log("url_aggregator::has_authority");
 8868|       |  // Performance: instead of doing this potentially expensive check, we could
 8869|       |  // have a boolean in the struct.
 8870|   126k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (8870:10): [True: 44.0k, False: 82.6k]
  ------------------
 8871|  44.0k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (8871:10): [True: 44.0k, False: 0]
  ------------------
 8872|  44.0k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (8872:10): [True: 44.0k, False: 0]
  ------------------
 8873|   126k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 8946|  11.9k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 8947|       |  // If url's host is null, url does not have an opaque path, url's path's size
 8948|       |  // is greater than 1, and url's path[0] is the empty string, then append
 8949|       |  // U+002F (/) followed by U+002E (.) to output.
 8950|  11.9k|  ada_log("url_aggregator::has_dash_dot");
 8951|       |#if ADA_DEVELOPMENT_CHECKS
 8952|       |  // If pathname_start and host_end are exactly two characters apart, then we
 8953|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 8954|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 8955|       |  if (components.pathname_start == components.host_end + 2) {
 8956|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 8957|       |                     buffer[components.host_end + 1] == '.') ||
 8958|       |                    (buffer[components.host_end] == ':' &&
 8959|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 8960|       |  }
 8961|       |  if (components.pathname_start == components.host_end + 2 &&
 8962|       |      buffer[components.host_end] == '/' &&
 8963|       |      buffer[components.host_end + 1] == '.') {
 8964|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 8965|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 8966|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 8967|       |  }
 8968|       |#endif
 8969|       |  // Performance: it should be uncommon for components.pathname_start ==
 8970|       |  // components.host_end + 2 to be true. So we put this check first in the
 8971|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 8972|       |  // more expensive, but should be uncommon.
 8973|  11.9k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (8973:10): [True: 207, False: 11.7k]
  ------------------
 8974|    207|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (8974:10): [True: 207, False: 0]
  |  Branch (8974:30): [True: 0, False: 207]
  ------------------
 8975|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (8975:10): [True: 0, False: 0]
  ------------------
 8976|  11.9k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4030|   124k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 3999|   310k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4000|   310k|    TL_ASSERT(has_value());
  ------------------
  |  | 2052|   310k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4000:5): [True: 310k, False: 0]
  ------------------
 4001|   310k|    return valptr();
 4002|   310k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3295|   310k|  T* valptr() { return std::addressof(this->m_val); }
_ZNR2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4012|   310k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4013|   310k|    TL_ASSERT(has_value());
  ------------------
  |  | 2052|   310k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4013:5): [True: 310k, False: 0]
  ------------------
 4014|   310k|    return val();
 4015|   310k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3304|   310k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3305|   310k|    return this->m_val;
 3306|   310k|  }
_ZN3ada14url_aggregatoraSERKS0_:
 7693|  62.0k|  url_aggregator& operator=(const url_aggregator& u) = default;
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4029|   746k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2627|   187k|  ~expected_storage_base() {
 2628|   187k|    if (m_has_val) {
  ------------------
  |  Branch (2628:9): [True: 186k, False: 1.80k]
  ------------------
 2629|   186k|      m_val.~T();
 2630|   186k|    }
 2631|   187k|  }
_ZNK3ada14url_aggregator22has_non_empty_usernameEv:
 8905|  62.0k|constexpr bool url_aggregator::has_non_empty_username() const noexcept {
 8906|  62.0k|  ada_log("url_aggregator::has_non_empty_username");
 8907|  62.0k|  return components.protocol_end + 2 < components.username_end;
 8908|  62.0k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1846|   351k|                                                       size_t pos2) {
 1847|       |#if ADA_DEVELOPMENT_CHECKS
 1848|       |  if (pos2 < pos1) {
 1849|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1850|       |              << std::endl;
 1851|       |    abort();
 1852|       |  }
 1853|       |#endif
 1854|   351k|  return input.substr(pos1, pos2 - pos1);
 1855|   351k|}
_ZNK3ada14url_aggregator22has_non_empty_passwordEv:
 8910|  62.0k|constexpr bool url_aggregator::has_non_empty_password() const noexcept {
 8911|  62.0k|  ada_log("url_aggregator::has_non_empty_password");
 8912|  62.0k|  return components.host_start > components.username_end;
 8913|  62.0k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8295|  70.0k|    const noexcept {
 8296|  70.0k|  return buffer.size() == components.pathname_start;
 8297|  70.0k|}
_ZN3ada8checkers8is_digitEc:
 1253|  72.5k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZNK3ada14url_aggregator12has_passwordEv:
 8915|  16.6k|constexpr bool url_aggregator::has_password() const noexcept {
 8916|  16.6k|  ada_log("url_aggregator::has_password");
 8917|       |  // This function does not care about the length of the password
 8918|  16.6k|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (8918:10): [True: 4.96k, False: 11.6k]
  ------------------
 8919|  4.96k|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (8919:10): [True: 4.96k, False: 0]
  ------------------
 8920|  16.6k|}
_ZNK3ada14url_aggregator13get_href_sizeEv:
 8984|   124k|[[nodiscard]] constexpr size_t url_aggregator::get_href_size() const noexcept {
 8985|   124k|  return buffer.size();
 8986|   124k|}
_ZNK3ada3url8get_hrefEv:
 7395|   434k|[[nodiscard]] ada_really_inline std::string url::get_href() const {
 7396|   434k|  if (is_special() && host.has_value() && username.empty() &&
  ------------------
  |  Branch (7396:7): [True: 432k, False: 2.18k]
  |  Branch (7396:23): [True: 432k, False: 0]
  |  Branch (7396:43): [True: 404k, False: 27.8k]
  ------------------
 7397|   404k|      password.empty() && !port.has_value()) [[likely]] {
  ------------------
  |  Branch (7397:7): [True: 404k, False: 98]
  |  Branch (7397:27): [True: 375k, False: 28.4k]
  ------------------
 7398|   375k|    const std::string_view scheme = ada::scheme::details::is_special_list[type];
 7399|   375k|    const size_t host_size = host->size();
 7400|   375k|    const size_t path_size = path.size();
 7401|   375k|    const size_t query_size = query.has_value() ? query->size() : 0;
  ------------------
  |  Branch (7401:31): [True: 86.0k, False: 289k]
  ------------------
 7402|   375k|    const size_t hash_size = hash.has_value() ? hash->size() : 0;
  ------------------
  |  Branch (7402:30): [True: 61.3k, False: 314k]
  ------------------
 7403|   375k|    const size_t total = scheme.size() + 3 + host_size + path_size +
 7404|   375k|                         (query.has_value() ? query_size + 1 : 0) +
  ------------------
  |  Branch (7404:27): [True: 86.0k, False: 289k]
  ------------------
 7405|   375k|                         (hash.has_value() ? hash_size + 1 : 0);
  ------------------
  |  Branch (7405:27): [True: 61.3k, False: 314k]
  ------------------
 7406|   375k|    std::string output(total, '\0');
 7407|   375k|    char* p = output.data();
 7408|   375k|    std::memcpy(p, scheme.data(), scheme.size());
 7409|   375k|    p += scheme.size();
 7410|   375k|    p[0] = ':';
 7411|   375k|    p[1] = '/';
 7412|   375k|    p[2] = '/';
 7413|   375k|    p += 3;
 7414|       |    // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7415|   375k|    std::memcpy(p, host->data(), host_size);
 7416|   375k|    p += host_size;
 7417|   375k|    std::memcpy(p, path.data(), path_size);
 7418|   375k|    p += path_size;
 7419|   375k|    if (query.has_value()) {
  ------------------
  |  Branch (7419:9): [True: 86.0k, False: 289k]
  ------------------
 7420|  86.0k|      *p++ = '?';
 7421|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7422|  86.0k|      std::memcpy(p, query->data(), query_size);
 7423|  86.0k|      p += query_size;
 7424|  86.0k|    }
 7425|   375k|    if (hash.has_value()) {
  ------------------
  |  Branch (7425:9): [True: 61.3k, False: 314k]
  ------------------
 7426|  61.3k|      *p++ = '#';
 7427|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7428|  61.3k|      std::memcpy(p, hash->data(), hash_size);
 7429|  61.3k|    }
 7430|   375k|    return output;
 7431|   375k|  }
 7432|       |
 7433|  58.6k|  std::string output;
 7434|  58.6k|  output.reserve(get_href_size());
 7435|       |
 7436|  58.6k|  if (is_special()) {
  ------------------
  |  Branch (7436:7): [True: 56.4k, False: 2.18k]
  ------------------
 7437|  56.4k|    output.append(ada::scheme::details::is_special_list[type]);
 7438|  56.4k|    output += ':';
 7439|  56.4k|  } else {
 7440|  2.18k|    output.append(non_special_scheme);
 7441|  2.18k|    output += ':';
 7442|  2.18k|  }
 7443|       |
 7444|  58.6k|  if (host.has_value()) {
  ------------------
  |  Branch (7444:7): [True: 57.5k, False: 1.08k]
  ------------------
 7445|  57.5k|    output += '/';
 7446|  57.5k|    output += '/';
 7447|  57.5k|    if (has_credentials()) {
  ------------------
  |  Branch (7447:9): [True: 28.0k, False: 29.4k]
  ------------------
 7448|  28.0k|      output.append(username);
 7449|  28.0k|      if (!password.empty()) {
  ------------------
  |  Branch (7449:11): [True: 27.0k, False: 1.03k]
  ------------------
 7450|  27.0k|        output += ':';
 7451|  27.0k|        output.append(password);
 7452|  27.0k|      }
 7453|  28.0k|      output += '@';
 7454|  28.0k|    }
 7455|  57.5k|    output.append(*host);
 7456|  57.5k|    if (port.has_value()) {
  ------------------
  |  Branch (7456:9): [True: 28.8k, False: 28.7k]
  ------------------
 7457|  28.8k|      output += ':';
 7458|  28.8k|      char port_buf[5];
 7459|  28.8k|      auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, *port);
 7460|  28.8k|      (void)ec;
 7461|  28.8k|      output.append(port_buf, static_cast<size_t>(ptr - port_buf));
 7462|  28.8k|    }
 7463|  57.5k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7463:14): [True: 336, False: 749]
  |  Branch (7463:34): [True: 28, False: 308]
  ------------------
 7464|       |    // If url's host is null, url does not have an opaque path, url's path's
 7465|       |    // size is greater than 1, and url's path[0] is the empty string, then
 7466|       |    // append U+002F (/) followed by U+002E (.) to output.
 7467|     28|    output += '/';
 7468|     28|    output += '.';
 7469|     28|  }
 7470|  58.6k|  output.append(path);
 7471|  58.6k|  if (query.has_value()) {
  ------------------
  |  Branch (7471:7): [True: 4.71k, False: 53.9k]
  ------------------
 7472|  4.71k|    output += '?';
 7473|  4.71k|    output.append(*query);
 7474|  4.71k|  }
 7475|  58.6k|  if (hash.has_value()) {
  ------------------
  |  Branch (7475:7): [True: 4.62k, False: 53.9k]
  ------------------
 7476|  4.62k|    output += '#';
 7477|  4.62k|    output.append(*hash);
 7478|  4.62k|  }
 7479|  58.6k|  return output;
 7480|   434k|}
_ZNK3ada14url_aggregator8validateEv:
 9057|  62.0k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9058|  62.0k|  if (!is_valid) {
  ------------------
  |  Branch (9058:7): [True: 0, False: 62.0k]
  ------------------
 9059|      0|    return true;
 9060|      0|  }
 9061|  62.0k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9061:7): [True: 0, False: 62.0k]
  ------------------
 9062|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9063|      0|            to_diagram());
 9064|      0|    return false;
 9065|      0|  }
 9066|       |  // We have a credible components struct, but let us investivate more
 9067|       |  // carefully:
 9068|       |  /**
 9069|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9070|       |   *       |     |    |          | ^^^^|       |   |
 9071|       |   *       |     |    |          | |   |       |   `----- hash_start
 9072|       |   *       |     |    |          | |   |       `--------- search_start
 9073|       |   *       |     |    |          | |   `----------------- pathname_start
 9074|       |   *       |     |    |          | `--------------------- port
 9075|       |   *       |     |    |          `----------------------- host_end
 9076|       |   *       |     |    `---------------------------------- host_start
 9077|       |   *       |     `--------------------------------------- username_end
 9078|       |   *       `--------------------------------------------- protocol_end
 9079|       |   */
 9080|  62.0k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9080:7): [True: 0, False: 62.0k]
  ------------------
 9081|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9082|      0|    return false;
 9083|      0|  }
 9084|  62.0k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9084:7): [True: 0, False: 62.0k]
  ------------------
 9085|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9086|      0|    return false;
 9087|      0|  }
 9088|  62.0k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9088:7): [True: 0, False: 62.0k]
  ------------------
 9089|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9090|      0|    return false;
 9091|      0|  }
 9092|  62.0k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9092:7): [True: 0, False: 62.0k]
  ------------------
 9093|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9094|      0|    return false;
 9095|      0|  }
 9096|  62.0k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9096:7): [True: 0, False: 62.0k]
  ------------------
 9097|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9098|      0|    return false;
 9099|      0|  }
 9100|       |
 9101|  62.0k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9101:7): [True: 0, False: 62.0k]
  ------------------
 9102|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9103|      0|    return false;
 9104|      0|  }
 9105|  62.0k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9105:7): [True: 0, False: 62.0k]
  ------------------
 9106|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9107|      0|    return false;
 9108|      0|  }
 9109|  62.0k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9109:7): [True: 0, False: 62.0k]
  ------------------
 9110|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9111|      0|    return false;
 9112|      0|  }
 9113|  62.0k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9113:7): [True: 0, False: 62.0k]
  ------------------
 9114|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9115|      0|    return false;
 9116|      0|  }
 9117|  62.0k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9117:7): [True: 0, False: 62.0k]
  ------------------
 9118|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9119|      0|            to_diagram());
 9120|      0|    return false;
 9121|      0|  }
 9122|       |
 9123|  62.0k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9123:7): [True: 62.0k, False: 0]
  ------------------
 9124|  62.0k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9124:9): [True: 0, False: 62.0k]
  ------------------
 9125|      0|      ada_log(
 9126|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9127|      0|          to_diagram());
 9128|      0|      return false;
 9129|      0|    }
 9130|  62.0k|  }
 9131|       |
 9132|  62.0k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9132:7): [True: 62.0k, False: 1]
  ------------------
 9133|  62.0k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9133:7): [True: 3.99k, False: 58.0k]
  ------------------
 9134|  3.99k|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9134:9): [True: 148, False: 3.85k]
  ------------------
 9135|    148|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9135:9): [True: 0, False: 148]
  ------------------
 9136|      0|      ada_log(
 9137|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9138|      0|          "\n",
 9139|      0|          to_diagram());
 9140|      0|      return false;
 9141|      0|    }
 9142|  3.99k|  }
 9143|       |
 9144|  62.0k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9144:7): [True: 62.0k, False: 1]
  ------------------
 9145|  62.0k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9145:9): [True: 3.86k, False: 58.1k]
  ------------------
 9146|  3.86k|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9146:11): [True: 0, False: 3.86k]
  ------------------
 9147|      0|        ada_log(
 9148|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9149|      0|            to_diagram());
 9150|      0|        return false;
 9151|      0|      }
 9152|  58.1k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9152:16): [True: 58.1k, False: 0]
  ------------------
 9153|  58.1k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9153:16): [True: 57.9k, False: 266]
  ------------------
 9154|  57.9k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9154:11): [True: 57.7k, False: 148]
  ------------------
 9155|  57.7k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9155:13): [True: 0, False: 57.7k]
  ------------------
 9156|  57.7k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9156:13): [True: 0, False: 57.7k]
  ------------------
 9157|      0|          ada_log(
 9158|      0|              "url_aggregator::validate missing // between protocol and host "
 9159|      0|              "\n",
 9160|      0|              to_diagram());
 9161|      0|          return false;
 9162|      0|        }
 9163|  57.7k|      } else {
 9164|    148|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9164:13): [True: 148, False: 0]
  ------------------
 9165|    148|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9165:13): [True: 0, False: 148]
  ------------------
 9166|      0|          ada_log(
 9167|      0|              "url_aggregator::validate missing @ at the end of the username "
 9168|      0|              "\n",
 9169|      0|              to_diagram());
 9170|      0|          return false;
 9171|      0|        }
 9172|    148|      }
 9173|  57.9k|    } else {
 9174|    266|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9174:11): [True: 0, False: 266]
  ------------------
 9175|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9176|      0|                to_diagram());
 9177|      0|        return false;
 9178|      0|      }
 9179|    266|    }
 9180|  62.0k|  }
 9181|  62.0k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9181:7): [True: 62.0k, False: 9]
  ------------------
 9182|  62.0k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9182:7): [True: 4.11k, False: 57.9k]
  ------------------
 9183|  4.11k|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9183:9): [True: 195, False: 3.92k]
  ------------------
 9184|    195|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9184:9): [True: 4, False: 191]
  ------------------
 9185|      4|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9185:9): [True: 4, False: 0]
  ------------------
 9186|      4|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9186:11): [True: 0, False: 4]
  ------------------
 9187|      4|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9187:11): [True: 0, False: 4]
  ------------------
 9188|      4|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9188:11): [True: 0, False: 4]
  ------------------
 9189|      0|        ada_log(
 9190|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9191|      0|            to_diagram());
 9192|      0|        return false;
 9193|      0|      }
 9194|  4.11k|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9194:16): [True: 0, False: 4.11k]
  ------------------
 9195|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9196|      0|              to_diagram());
 9197|      0|      return false;
 9198|      0|    }
 9199|  4.11k|  }
 9200|  62.0k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9200:7): [True: 62.0k, False: 14]
  ------------------
 9201|  62.0k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9201:7): [True: 61.9k, False: 28]
  ------------------
 9202|  61.9k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9202:7): [True: 61.9k, False: 21]
  |  Branch (9202:60): [True: 61.8k, False: 100]
  ------------------
 9203|  61.8k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9203:9): [True: 0, False: 61.8k]
  ------------------
 9204|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9205|      0|              to_diagram());
 9206|      0|      return false;
 9207|      0|    }
 9208|  61.8k|  }
 9209|  62.0k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9209:7): [True: 12.9k, False: 49.0k]
  ------------------
 9210|  12.9k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9210:9): [True: 0, False: 12.9k]
  ------------------
 9211|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9212|      0|              to_diagram());
 9213|      0|      return false;
 9214|      0|    }
 9215|  12.9k|  }
 9216|  62.0k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9216:7): [True: 9.42k, False: 52.6k]
  ------------------
 9217|  9.42k|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9217:9): [True: 0, False: 9.42k]
  ------------------
 9218|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9219|      0|              to_diagram());
 9220|      0|      return false;
 9221|      0|    }
 9222|  9.42k|  }
 9223|       |
 9224|  62.0k|  return true;
 9225|  62.0k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7572|  62.0k|    const noexcept {
 7573|       |  /**
 7574|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7575|       |   *       |     |    |          | ^^^^|       |   |
 7576|       |   *       |     |    |          | |   |       |   `----- hash_start
 7577|       |   *       |     |    |          | |   |       `--------- search_start
 7578|       |   *       |     |    |          | |   `----------------- pathname_start
 7579|       |   *       |     |    |          | `--------------------- port
 7580|       |   *       |     |    |          `----------------------- host_end
 7581|       |   *       |     |    `---------------------------------- host_start
 7582|       |   *       |     `--------------------------------------- username_end
 7583|       |   *       `--------------------------------------------- protocol_end
 7584|       |   */
 7585|       |  // These conditions can be made more strict.
 7586|  62.0k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7586:7): [True: 0, False: 62.0k]
  ------------------
 7587|      0|    return false;
 7588|      0|  }
 7589|  62.0k|  uint32_t index = protocol_end;
 7590|       |
 7591|  62.0k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7591:7): [True: 0, False: 62.0k]
  ------------------
 7592|      0|    return false;
 7593|      0|  }
 7594|  62.0k|  if (username_end < index) {
  ------------------
  |  Branch (7594:7): [True: 0, False: 62.0k]
  ------------------
 7595|      0|    return false;
 7596|      0|  }
 7597|  62.0k|  index = username_end;
 7598|       |
 7599|  62.0k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7599:7): [True: 0, False: 62.0k]
  ------------------
 7600|      0|    return false;
 7601|      0|  }
 7602|  62.0k|  if (host_start < index) {
  ------------------
  |  Branch (7602:7): [True: 0, False: 62.0k]
  ------------------
 7603|      0|    return false;
 7604|      0|  }
 7605|  62.0k|  index = host_start;
 7606|       |
 7607|  62.0k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7607:7): [True: 4.11k, False: 57.9k]
  ------------------
 7608|  4.11k|    if (port > 0xffff) {
  ------------------
  |  Branch (7608:9): [True: 0, False: 4.11k]
  ------------------
 7609|      0|      return false;
 7610|      0|    }
 7611|  4.11k|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7612|  4.11k|    if (index + port_length < index) {
  ------------------
  |  Branch (7612:9): [True: 0, False: 4.11k]
  ------------------
 7613|      0|      return false;
 7614|      0|    }
 7615|  4.11k|    index += port_length;
 7616|  4.11k|  }
 7617|       |
 7618|  62.0k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7618:7): [True: 0, False: 62.0k]
  ------------------
 7619|      0|    return false;
 7620|      0|  }
 7621|  62.0k|  if (pathname_start < index) {
  ------------------
  |  Branch (7621:7): [True: 0, False: 62.0k]
  ------------------
 7622|      0|    return false;
 7623|      0|  }
 7624|  62.0k|  index = pathname_start;
 7625|       |
 7626|  62.0k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7626:7): [True: 12.9k, False: 49.0k]
  ------------------
 7627|  12.9k|    if (search_start < index) {
  ------------------
  |  Branch (7627:9): [True: 0, False: 12.9k]
  ------------------
 7628|      0|      return false;
 7629|      0|    }
 7630|  12.9k|    index = search_start;
 7631|  12.9k|  }
 7632|       |
 7633|  62.0k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7633:7): [True: 9.42k, False: 52.6k]
  ------------------
 7634|  9.42k|    if (hash_start < index) {
  ------------------
  |  Branch (7634:9): [True: 0, False: 9.42k]
  ------------------
 7635|      0|      return false;
 7636|      0|    }
 7637|  9.42k|  }
 7638|       |
 7639|  62.0k|  return true;
 7640|  62.0k|}
_ZN3ada7helpers16fast_digit_countEj:
 1950|  4.11k|inline int fast_digit_count(uint32_t x) noexcept {
 1951|  4.11k|  auto int_log2 = [](uint32_t z) -> int {
 1952|  4.11k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1953|  4.11k|  };
 1954|       |  // Compiles to very few instructions. Note that the
 1955|       |  // table is static and thus effectively a constant.
 1956|       |  // We leave it inside the function because it is meaningless
 1957|       |  // outside of it (this comes at no performance cost).
 1958|  4.11k|  const static uint64_t table[] = {
 1959|  4.11k|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 1960|  4.11k|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 1961|  4.11k|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 1962|  4.11k|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 1963|  4.11k|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 1964|  4.11k|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 1965|  4.11k|      42949672960, 42949672960};
 1966|  4.11k|  return int((x + table[int_log2(x)]) >> 32);
 1967|  4.11k|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 1951|  4.11k|  auto int_log2 = [](uint32_t z) -> int {
 1952|  4.11k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1953|  4.11k|  };
_ZN3ada7helpers6concatIJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKcEEENS2_12basic_stringIcS5_NS2_9allocatorIcEEEEDpT_:
 1924|  63.9k|std::string concat(Args... args) {
 1925|  63.9k|  std::string answer;
 1926|  63.9k|  inner_concat(answer, args...);
 1927|  63.9k|  return answer;
 1928|  63.9k|}
_ZN3ada7helpers12inner_concatINSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEJPKcEEEvRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEET_DpT0_:
 1913|  63.9k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1914|  63.9k|  buffer.append(t);
 1915|  63.9k|  return inner_concat(buffer, args...);
 1916|  63.9k|}
_ZN3ada7helpers12inner_concatIPKcJEEEvRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEET_:
 1905|  64.2k|inline void inner_concat(std::string& buffer, T t) {
 1906|  64.2k|  buffer.append(t);
 1907|  64.2k|}
_ZN3ada7helpers6concatIJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcEEES8_DpT_:
 1924|    312|std::string concat(Args... args) {
 1925|    312|  std::string answer;
 1926|    312|  inner_concat(answer, args...);
 1927|    312|  return answer;
 1928|    312|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJPKcEEEvRS8_T_DpT0_:
 1913|    312|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1914|    312|  buffer.append(t);
 1915|    312|  return inner_concat(buffer, args...);
 1916|    312|}
_ZN3ada3url10set_schemeEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7377|  2.24k|inline void url::set_scheme(std::string&& new_scheme) noexcept {
 7378|  2.24k|  type = ada::scheme::get_scheme_type(new_scheme);
 7379|       |  // We only move the 'scheme' if it is non-special.
 7380|  2.24k|  if (!is_special()) {
  ------------------
  |  Branch (7380:7): [True: 990, False: 1.25k]
  ------------------
 7381|    990|    non_special_scheme = std::move(new_scheme);
 7382|    990|  }
 7383|  2.24k|}

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

