_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  160|  5.29k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  161|  5.29k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  162|  5.29k|  size_t pos = 0;
  163|  5.29k|  const char32_t* start{utf32_output};
  164|   103k|  while (pos < len) {
  ------------------
  |  Branch (164:10): [True: 98.8k, False: 4.84k]
  ------------------
  165|       |    // try to convert the next block of 16 ASCII bytes
  166|  98.8k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (166:9): [True: 69.1k, False: 29.6k]
  ------------------
  167|       |                            // bytes, check that they are ascii
  168|  69.1k|      uint64_t v1;
  169|  69.1k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  170|  69.1k|      uint64_t v2;
  171|  69.1k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  172|  69.1k|      uint64_t v{v1 | v2};
  173|  69.1k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (173:11): [True: 3.90k, False: 65.2k]
  ------------------
  174|  3.90k|        size_t final_pos = pos + 16;
  175|  66.3k|        while (pos < final_pos) {
  ------------------
  |  Branch (175:16): [True: 62.4k, False: 3.90k]
  ------------------
  176|  62.4k|          *utf32_output++ = char32_t(buf[pos]);
  177|  62.4k|          pos++;
  178|  62.4k|        }
  179|  3.90k|        continue;
  180|  3.90k|      }
  181|  69.1k|    }
  182|  94.9k|    uint8_t leading_byte = data[pos];  // leading byte
  183|  94.9k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (183:9): [True: 53.3k, False: 41.5k]
  ------------------
  184|       |      // converting one ASCII byte !!!
  185|  53.3k|      *utf32_output++ = char32_t(leading_byte);
  186|  53.3k|      pos++;
  187|  53.3k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (187:16): [True: 7.95k, False: 33.6k]
  ------------------
  188|       |      // We have a two-byte UTF-8
  189|  7.95k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (189:11): [True: 52, False: 7.90k]
  ------------------
  190|     52|        return 0;
  191|     52|      }  // minimal bound checking
  192|  7.90k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (192:11): [True: 88, False: 7.81k]
  ------------------
  193|     88|        return 0;
  194|     88|      }
  195|       |      // range check
  196|  7.81k|      uint32_t code_point =
  197|  7.81k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  198|  7.81k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (198:11): [True: 8, False: 7.80k]
  |  Branch (198:32): [True: 0, False: 7.80k]
  ------------------
  199|      8|        return 0;
  200|      8|      }
  201|  7.80k|      *utf32_output++ = char32_t(code_point);
  202|  7.80k|      pos += 2;
  203|  33.6k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (203:16): [True: 32.4k, False: 1.19k]
  ------------------
  204|       |      // We have a three-byte UTF-8
  205|  32.4k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (205:11): [True: 22, False: 32.4k]
  ------------------
  206|     22|        return 0;
  207|     22|      }  // minimal bound checking
  208|       |
  209|  32.4k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (209:11): [True: 28, False: 32.3k]
  ------------------
  210|     28|        return 0;
  211|     28|      }
  212|  32.3k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (212:11): [True: 8, False: 32.3k]
  ------------------
  213|      8|        return 0;
  214|      8|      }
  215|       |      // range check
  216|  32.3k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  217|  32.3k|                            (data[pos + 1] & 0b00111111) << 6 |
  218|  32.3k|                            (data[pos + 2] & 0b00111111);
  219|  32.3k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (219:11): [True: 8, False: 32.3k]
  |  Branch (219:33): [True: 0, False: 32.3k]
  ------------------
  220|  32.3k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (220:12): [True: 7.93k, False: 24.4k]
  |  Branch (220:35): [True: 6, False: 7.92k]
  ------------------
  221|     14|        return 0;
  222|     14|      }
  223|  32.3k|      *utf32_output++ = char32_t(code_point);
  224|  32.3k|      pos += 3;
  225|  32.3k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (225:16): [True: 1.04k, False: 158]
  ------------------
  226|       |      // we have a 4-byte UTF-8 word.
  227|  1.04k|      if (pos + 3 >= len) {
  ------------------
  |  Branch (227:11): [True: 18, False: 1.02k]
  ------------------
  228|     18|        return 0;
  229|     18|      }  // minimal bound checking
  230|  1.02k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (230:11): [True: 16, False: 1.00k]
  ------------------
  231|     16|        return 0;
  232|     16|      }
  233|  1.00k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (233:11): [True: 6, False: 1.00k]
  ------------------
  234|      6|        return 0;
  235|      6|      }
  236|  1.00k|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (236:11): [True: 12, False: 988]
  ------------------
  237|     12|        return 0;
  238|     12|      }
  239|       |
  240|       |      // range check
  241|    988|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  242|    988|                            (data[pos + 1] & 0b00111111) << 12 |
  243|    988|                            (data[pos + 2] & 0b00111111) << 6 |
  244|    988|                            (data[pos + 3] & 0b00111111);
  245|    988|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (245:11): [True: 14, False: 974]
  |  Branch (245:35): [True: 12, False: 962]
  ------------------
  246|     26|        return 0;
  247|     26|      }
  248|    962|      *utf32_output++ = char32_t(code_point);
  249|    962|      pos += 4;
  250|    962|    } else {
  251|    158|      return 0;
  252|    158|    }
  253|  94.9k|  }
  254|  4.84k|  return utf32_output - start;
  255|  5.29k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  270|  5.34k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  271|  5.34k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  272|  5.34k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  273|       |    // -65 is 0b10111111, anything larger in two-complement's
  274|       |    // should start a new code point.
  275|  5.34k|    return c > -65;
  276|  5.34k|  });
  277|  5.34k|}
_ZN3ada4idna7deflate9BitReader3getEi:
  405|   457k|  uint32_t get(int n) {
  406|   457k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (406:9): [True: 0, False: 457k]
  ------------------
  407|   457k|    uint32_t v = acc & ((1u << n) - 1);
  408|   457k|    acc >>= n;
  409|   457k|    bits -= n;
  410|   457k|    return v;
  411|   457k|  }
_ZN3ada4idna9ascii_mapEPcm:
 5126|   120k|void ascii_map(char* input, size_t length) {
 5127|   120k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|   120k|    return 0x101010101010101ull * v;
 5129|   120k|  };
 5130|   120k|  uint64_t broadcast_80 = broadcast(0x80);
 5131|   120k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5132|   120k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5133|   120k|  size_t i = 0;
 5134|       |
 5135|   322k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5135:10): [True: 201k, False: 120k]
  ------------------
 5136|   201k|    uint64_t word{};
 5137|   201k|    std::memcpy(&word, input + i, sizeof(word));
 5138|   201k|    word ^=
 5139|   201k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5140|   201k|    std::memcpy(input + i, &word, sizeof(word));
 5141|   201k|  }
 5142|   120k|  if (i < length) {
  ------------------
  |  Branch (5142:7): [True: 62.7k, False: 57.5k]
  ------------------
 5143|  62.7k|    uint64_t word{};
 5144|  62.7k|    std::memcpy(&word, input + i, length - i);
 5145|  62.7k|    word ^=
 5146|  62.7k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|  62.7k|    std::memcpy(input + i, &word, length - i);
 5148|  62.7k|  }
 5149|   120k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5153|  7.54k|bool map(std::u32string_view input, std::u32string& out) {
 5154|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5155|  7.54k|  out.clear();
 5156|  7.54k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5156:7): [True: 0, False: 7.54k]
  ------------------
 5157|      0|    return false;
 5158|      0|  }
 5159|       |
 5160|       |  // Pass 1: validate and compute exact output length.
 5161|  7.54k|  size_t out_size = 0;
 5162|   179k|  for (char32_t x : input) {
  ------------------
  |  Branch (5162:19): [True: 179k, False: 7.16k]
  ------------------
 5163|   179k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5164|   179k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5164:9): [True: 384, False: 178k]
  ------------------
 5165|    384|      return false;
 5166|    384|    }
 5167|   178k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5167:9): [True: 123k, False: 55.5k]
  ------------------
 5168|   123k|      ++out_size;
 5169|   123k|      continue;
 5170|   123k|    }
 5171|  55.5k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5171:9): [True: 0, False: 55.5k]
  ------------------
 5172|      0|      return false;
 5173|      0|    }
 5174|  55.5k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5175|  55.5k|  }
 5176|       |
 5177|       |  // Pass 2: write into a single allocation.
 5178|  7.16k|  out.resize(out_size);
 5179|  7.16k|  size_t w = 0;
 5180|   176k|  for (char32_t x : input) {
  ------------------
  |  Branch (5180:19): [True: 176k, False: 7.16k]
  ------------------
 5181|   176k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5182|   176k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5182:9): [True: 121k, False: 55.4k]
  ------------------
 5183|   121k|      out[w++] = x;
 5184|   121k|      continue;
 5185|   121k|    }
 5186|       |    // IGNORED or mapped (status already validated in pass 1).
 5187|  55.4k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5188|   344k|    while (*ptr != 0) {
  ------------------
  |  Branch (5188:12): [True: 289k, False: 55.4k]
  ------------------
 5189|   289k|      out[w++] = utf8_next(ptr);
 5190|   289k|    }
 5191|  55.4k|  }
 5192|  7.16k|  return true;
 5193|  7.54k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5286|  1.38k|    const std::u32string_view input) noexcept {
 5287|  1.38k|  bool decomposition_needed{false};
 5288|  1.38k|  size_t additional_elements{0};
 5289|  56.3k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5289:35): [True: 56.3k, False: 1.38k]
  ------------------
 5290|  56.3k|    size_t decomposition_length{0};
 5291|       |
 5292|  56.3k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5292:9): [True: 3.04k, False: 53.3k]
  ------------------
 5293|  3.04k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5293:9): [True: 2.01k, False: 1.03k]
  ------------------
 5294|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5295|  2.01k|      decomposition_length = 2;
 5296|  2.01k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5296:11): [True: 1.37k, False: 634]
  ------------------
 5297|  1.37k|        decomposition_length = 3;
 5298|  1.37k|      }
 5299|  54.3k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5299:16): [True: 54.3k, False: 0]
  ------------------
 5300|  54.3k|      const uint8_t di = decomposition_index[current_character >> 8];
 5301|  54.3k|      const uint16_t* const decomposition =
 5302|  54.3k|          decomposition_block_row(di) + (current_character % 256);
 5303|  54.3k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5304|  54.3k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5304:11): [True: 864, False: 53.4k]
  |  Branch (5304:41): [True: 0, False: 864]
  ------------------
 5305|      0|        decomposition_length = 0;
 5306|      0|      }
 5307|  54.3k|    }
 5308|  56.3k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5308:9): [True: 2.87k, False: 53.4k]
  ------------------
 5309|  2.87k|      decomposition_needed = true;
 5310|  2.87k|      additional_elements += decomposition_length - 1;
 5311|  2.87k|    }
 5312|  56.3k|  }
 5313|  1.38k|  return {decomposition_needed, additional_elements};
 5314|  1.38k|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5316|    794|void decompose(std::u32string& input, size_t additional_elements) {
 5317|    794|  input.resize(input.size() + additional_elements);
 5318|    794|  for (size_t descending_idx = input.size(),
 5319|    794|              input_count = descending_idx - additional_elements;
 5320|  37.6k|       input_count--;) {
  ------------------
  |  Branch (5320:8): [True: 36.8k, False: 794]
  ------------------
 5321|  36.8k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5321:9): [True: 2.49k, False: 34.3k]
  ------------------
 5322|  2.49k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5322:9): [True: 2.01k, False: 482]
  ------------------
 5323|       |      // Hangul decomposition.
 5324|  2.01k|      char32_t s_index = input[input_count] - hangul_sbase;
 5325|  2.01k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5325:11): [True: 1.37k, False: 634]
  ------------------
 5326|  1.37k|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5327|  1.37k|      }
 5328|  2.01k|      input[--descending_idx] =
 5329|  2.01k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5330|  2.01k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5331|  34.8k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5331:16): [True: 34.8k, False: 0]
  ------------------
 5332|  34.8k|      const uint16_t* decomposition =
 5333|  34.8k|          decomposition_block_row(
 5334|  34.8k|              decomposition_index[input[input_count] >> 8]) +
 5335|  34.8k|          (input[input_count] % 256);
 5336|  34.8k|      uint16_t decomposition_length =
 5337|  34.8k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5338|  34.8k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5338:11): [True: 864, False: 33.9k]
  |  Branch (5338:39): [True: 0, False: 864]
  ------------------
 5339|      0|        decomposition_length = 0;
 5340|      0|      }
 5341|  34.8k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5341:11): [True: 864, False: 33.9k]
  ------------------
 5342|    864|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5343|    864|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5343:13): [True: 0, False: 864]
  ------------------
 5344|      0|          input[--descending_idx] = input[input_count];
 5345|    864|        } else {
 5346|  2.80k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5346:18): [True: 1.94k, False: 864]
  ------------------
 5347|  1.94k|            input[--descending_idx] =
 5348|  1.94k|                decomposition_data[base + decomposition_length];
 5349|  1.94k|          }
 5350|    864|        }
 5351|  33.9k|      } else {
 5352|  33.9k|        input[--descending_idx] = input[input_count];
 5353|  33.9k|      }
 5354|  34.8k|    } else {
 5355|      0|      input[--descending_idx] = input[input_count];
 5356|      0|    }
 5357|  36.8k|  }
 5358|    794|}
_ZN3ada4idna7get_cccEDi:
 5360|  1.22M|uint8_t get_ccc(char32_t c) noexcept {
 5361|  1.22M|  if (c >= 0x110000) {
  ------------------
  |  Branch (5361:7): [True: 0, False: 1.22M]
  ------------------
 5362|      0|    return 0;
 5363|      0|  }
 5364|  1.22M|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5365|  1.22M|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5367|  1.38k|void sort_marks(std::u32string& input) {
 5368|  60.8k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5368:24): [True: 59.4k, False: 1.38k]
  ------------------
 5369|  59.4k|    uint8_t ccc = get_ccc(input[idx]);
 5370|  59.4k|    if (ccc == 0) {
  ------------------
  |  Branch (5370:9): [True: 55.6k, False: 3.80k]
  ------------------
 5371|  55.6k|      continue;
 5372|  55.6k|    }
 5373|  3.80k|    auto current_character = input[idx];
 5374|  3.80k|    size_t back_idx = idx;
 5375|  5.65k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5375:12): [True: 5.50k, False: 154]
  |  Branch (5375:29): [True: 1.84k, False: 3.65k]
  ------------------
 5376|  1.84k|      input[back_idx] = input[back_idx - 1];
 5377|  1.84k|      back_idx--;
 5378|  1.84k|    }
 5379|  3.80k|    input[back_idx] = current_character;
 5380|  3.80k|  }
 5381|  1.38k|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5383|  1.38k|void decompose_nfc(std::u32string& input) {
 5384|       |  /**
 5385|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5386|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5387|       |   */
 5388|  1.38k|  auto [decomposition_needed, additional_elements] =
 5389|  1.38k|      compute_decomposition_length(input);
 5390|  1.38k|  if (decomposition_needed) {
  ------------------
  |  Branch (5390:7): [True: 794, False: 590]
  ------------------
 5391|    794|    decompose(input, additional_elements);
 5392|    794|  }
 5393|  1.38k|  sort_marks(input);
 5394|  1.38k|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5477|  7.80k|bool is_already_nfc(std::u32string_view input) noexcept {
 5478|  7.80k|  if (input.empty()) {
  ------------------
  |  Branch (5478:7): [True: 0, False: 7.80k]
  ------------------
 5479|      0|    return true;
 5480|      0|  }
 5481|  7.80k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5481:7): [True: 0, False: 7.80k]
  |  Branch (5481:30): [True: 0, False: 0]
  ------------------
 5482|      0|    return false;
 5483|      0|  }
 5484|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5485|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5486|   397k|  for (char32_t c : input) {
  ------------------
  |  Branch (5486:19): [True: 397k, False: 7.80k]
  ------------------
 5487|   397k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5487:9): [True: 0, False: 397k]
  ------------------
 5488|      0|      return false;
 5489|      0|    }
 5490|   397k|  }
 5491|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5492|       |  //    trailing class of the previous character's canonical decomposition so a
 5493|       |  //    composite starter followed by a lower-class mark is caught.
 5494|  7.80k|  uint8_t prev_ccc = 0;
 5495|   394k|  for (char32_t c : input) {
  ------------------
  |  Branch (5495:19): [True: 394k, False: 7.33k]
  ------------------
 5496|   394k|    uint8_t ccc = get_ccc(c);
 5497|   394k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5497:9): [True: 6.20k, False: 388k]
  |  Branch (5497:21): [True: 464, False: 5.73k]
  ------------------
 5498|    464|      return false;
 5499|    464|    }
 5500|   393k|    prev_ccc = trailing_ccc(c);
 5501|   393k|  }
 5502|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5503|  7.33k|  return !would_compose(input);
 5504|  7.80k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5506|  1.38k|void compose(std::u32string& input) {
 5507|       |  /**
 5508|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5509|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5510|       |   */
 5511|  1.38k|  size_t input_count{0};
 5512|  1.38k|  size_t composition_count{0};
 5513|  54.9k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5513:10): [True: 53.5k, False: 1.38k]
  ------------------
 5514|  53.5k|    input[composition_count] = input[input_count];
 5515|  53.5k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5515:9): [True: 6.59k, False: 46.9k]
  ------------------
 5516|  6.59k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5516:9): [True: 3.13k, False: 3.46k]
  ------------------
 5517|  3.13k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5517:11): [True: 3.05k, False: 78]
  ------------------
 5518|  3.05k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5518:11): [True: 2.46k, False: 588]
  ------------------
 5519|  2.46k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5519:11): [True: 2.10k, False: 364]
  ------------------
 5520|  2.10k|        input[composition_count] =
 5521|  2.10k|            hangul_sbase +
 5522|  2.10k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5523|  2.10k|             input[input_count + 1] - hangul_vbase) *
 5524|  2.10k|                hangul_tcount;
 5525|  2.10k|        input_count++;
 5526|  2.10k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5526:13): [True: 2.00k, False: 98]
  ------------------
 5527|  2.00k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5527:13): [True: 1.59k, False: 410]
  ------------------
 5528|  1.59k|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5528:13): [True: 1.37k, False: 220]
  ------------------
 5529|  1.37k|          input[composition_count] += input[++input_count] - hangul_tbase;
 5530|  1.37k|        }
 5531|  2.10k|      }
 5532|  50.4k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5532:16): [True: 776, False: 49.6k]
  ------------------
 5533|    776|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5533:16): [True: 0, False: 776]
  ------------------
 5534|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5534:11): [True: 0, False: 0]
  ------------------
 5535|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5535:11): [True: 0, False: 0]
  ------------------
 5536|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5536:11): [True: 0, False: 0]
  ------------------
 5537|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5537:11): [True: 0, False: 0]
  ------------------
 5538|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5539|      0|      }
 5540|  50.4k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5540:16): [True: 50.4k, False: 0]
  ------------------
 5541|  50.4k|      const uint16_t* composition =
 5542|  50.4k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5543|  50.4k|          (input[input_count] % 256);
 5544|  50.4k|      size_t initial_composition_count = composition_count;
 5545|  54.1k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5545:39): [True: 53.0k, False: 1.18k]
  ------------------
 5546|  53.0k|           input_count++) {
 5547|  53.0k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5548|       |
 5549|  53.0k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5549:13): [True: 13.4k, False: 39.5k]
  |  Branch (5549:49): [True: 12.9k, False: 506]
  ------------------
 5550|  12.9k|          int left = composition[0];
 5551|  12.9k|          int right = composition[1];
 5552|  12.9k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5552:15): [True: 0, False: 12.9k]
  |  Branch (5552:27): [True: 0, False: 12.9k]
  ------------------
 5553|  12.9k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5553:15): [True: 0, False: 12.9k]
  ------------------
 5554|      0|            break;
 5555|      0|          }
 5556|  28.0k|          while (left + 2 < right) {
  ------------------
  |  Branch (5556:18): [True: 15.0k, False: 12.9k]
  ------------------
 5557|  15.0k|            int middle = left + (((right - left) >> 1) & ~1);
 5558|  15.0k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5558:17): [True: 2.97k, False: 12.0k]
  ------------------
 5559|  15.0k|                input[input_count + 1]) {
 5560|  2.97k|              left = middle;
 5561|  2.97k|            }
 5562|  15.0k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5562:17): [True: 13.2k, False: 1.87k]
  ------------------
 5563|  15.0k|                input[input_count + 1]) {
 5564|  13.2k|              right = middle;
 5565|  13.2k|            }
 5566|  15.0k|          }
 5567|  12.9k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5567:15): [True: 12.9k, False: 0]
  ------------------
 5568|  12.9k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5568:15): [True: 1.69k, False: 11.2k]
  ------------------
 5569|  12.9k|                  input[input_count + 1]) {
 5570|  1.69k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5571|  1.69k|            input[initial_composition_count] = composed;
 5572|  1.69k|            composition =
 5573|  1.69k|                composition_block_row(composition_index[composed >> 8]) +
 5574|  1.69k|                (composed % 256);
 5575|  1.69k|            continue;
 5576|  1.69k|          }
 5577|  12.9k|        }
 5578|       |
 5579|  51.3k|        if (ccc == 0) {
  ------------------
  |  Branch (5579:13): [True: 49.2k, False: 2.07k]
  ------------------
 5580|  49.2k|          break;
 5581|  49.2k|        }
 5582|  2.07k|        previous_ccc = ccc;
 5583|  2.07k|        input[++composition_count] = input[input_count + 1];
 5584|  2.07k|      }
 5585|  50.4k|    }
 5586|  53.5k|  }
 5587|       |
 5588|  1.38k|  if (composition_count < input_count) {
  ------------------
  |  Branch (5588:7): [True: 1.23k, False: 146]
  ------------------
 5589|  1.23k|    input.resize(composition_count);
 5590|  1.23k|  }
 5591|  1.38k|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5593|  1.38k|bool normalize(std::u32string& input) {
 5594|       |  /**
 5595|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5596|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5597|       |   */
 5598|  1.38k|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5598:7): [True: 0, False: 1.38k]
  |  Branch (5598:27): [True: 0, False: 1.38k]
  ------------------
 5599|  1.38k|      composition_index == nullptr) {
  ------------------
  |  Branch (5599:7): [True: 0, False: 1.38k]
  ------------------
 5600|      0|    return false;
 5601|      0|  }
 5602|  1.38k|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5602:7): [True: 0, False: 1.38k]
  ------------------
 5603|      0|    return true;
 5604|      0|  }
 5605|  1.38k|  decompose_nfc(input);
 5606|  1.38k|  compose(input);
 5607|  1.38k|  return true;
 5608|  1.38k|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5668|  2.93k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5669|  2.93k|  int32_t written_out{0};
 5670|  2.93k|  out.reserve(out.size() + input.size());
 5671|  2.93k|  uint32_t n = initial_n;
 5672|  2.93k|  int32_t i = 0;
 5673|  2.93k|  int32_t bias = initial_bias;
 5674|       |  // grab ascii content
 5675|  2.93k|  size_t end_of_ascii = input.find_last_of('-');
 5676|  2.93k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5676:7): [True: 930, False: 2.00k]
  ------------------
 5677|  11.7k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5677:20): [True: 11.7k, False: 930]
  ------------------
 5678|  11.7k|      if (c >= 0x80) {
  ------------------
  |  Branch (5678:11): [True: 0, False: 11.7k]
  ------------------
 5679|      0|        return false;
 5680|      0|      }
 5681|  11.7k|      out.push_back(c);
 5682|  11.7k|      written_out++;
 5683|  11.7k|    }
 5684|    930|    input.remove_prefix(end_of_ascii + 1);
 5685|    930|  }
 5686|  25.5k|  while (!input.empty()) {
  ------------------
  |  Branch (5686:10): [True: 22.7k, False: 2.80k]
  ------------------
 5687|  22.7k|    int32_t oldi = i;
 5688|  22.7k|    int32_t w = 1;
 5689|  35.8k|    for (int32_t k = base;; k += base) {
 5690|  35.8k|      if (input.empty()) {
  ------------------
  |  Branch (5690:11): [True: 32, False: 35.8k]
  ------------------
 5691|     32|        return false;
 5692|     32|      }
 5693|  35.8k|      uint8_t code_point = input.front();
 5694|  35.8k|      input.remove_prefix(1);
 5695|  35.8k|      int32_t digit = char_to_digit_value(code_point);
 5696|  35.8k|      if (digit < 0) {
  ------------------
  |  Branch (5696:11): [True: 32, False: 35.8k]
  ------------------
 5697|     32|        return false;
 5698|     32|      }
 5699|  35.8k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5699:11): [True: 8, False: 35.8k]
  ------------------
 5700|      8|        return false;
 5701|      8|      }
 5702|  35.8k|      i = i + digit * w;
 5703|  35.8k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5703:19): [True: 7.66k, False: 28.1k]
  |  Branch (5703:38): [True: 25.8k, False: 2.32k]
  ------------------
 5704|  35.8k|      if (digit < t) {
  ------------------
  |  Branch (5704:11): [True: 22.6k, False: 13.1k]
  ------------------
 5705|  22.6k|        break;
 5706|  22.6k|      }
 5707|  13.1k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5707:11): [True: 0, False: 13.1k]
  ------------------
 5708|      0|        return false;
 5709|      0|      }
 5710|  13.1k|      w = w * (base - t);
 5711|  13.1k|    }
 5712|  22.6k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5713|  22.6k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5713:9): [True: 52, False: 22.6k]
  ------------------
 5714|     52|      return false;
 5715|     52|    }
 5716|  22.6k|    n = n + i / (written_out + 1);
 5717|  22.6k|    i = i % (written_out + 1);
 5718|  22.6k|    if (n < 0x80) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 22.6k]
  ------------------
 5719|      0|      return false;
 5720|      0|    }
 5721|  22.6k|    out.insert(out.begin() + i, n);
 5722|  22.6k|    written_out++;
 5723|  22.6k|    ++i;
 5724|  22.6k|  }
 5725|       |  // See https://github.com/whatwg/url/issues/803
 5726|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5727|  2.80k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5727:7): [True: 1.41k, False: 1.39k]
  |  Branch (5727:26): [True: 292, False: 1.11k]
  |  Branch (5727:44): [True: 228, False: 64]
  |  Branch (5727:62): [True: 120, False: 108]
  ------------------
 5728|    120|      out[3] == U'-') {
  ------------------
  |  Branch (5728:7): [True: 8, False: 112]
  ------------------
 5729|      8|    return false;
 5730|      8|  }
 5731|  2.79k|  return true;
 5732|  2.80k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5812|  24.4k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5813|  24.4k|  out.reserve(input.size() + out.size());
 5814|  24.4k|  uint32_t n = initial_n;
 5815|  24.4k|  int32_t d = 0;
 5816|  24.4k|  int32_t bias = initial_bias;
 5817|  24.4k|  size_t h = 0;
 5818|       |  // first push the ascii content
 5819|   204k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5819:19): [True: 204k, False: 24.4k]
  ------------------
 5820|   204k|    if (c < 0x80) {
  ------------------
  |  Branch (5820:9): [True: 65.0k, False: 139k]
  ------------------
 5821|  65.0k|      ++h;
 5822|  65.0k|      out.push_back(char(c));
 5823|  65.0k|    }
 5824|   204k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5824:9): [True: 0, False: 204k]
  |  Branch (5824:26): [True: 830, False: 203k]
  |  Branch (5824:41): [True: 0, False: 830]
  ------------------
 5825|      0|      return false;
 5826|      0|    }
 5827|   204k|  }
 5828|  24.4k|  size_t b = h;
 5829|  24.4k|  if (b > 0) {
  ------------------
  |  Branch (5829:7): [True: 20.5k, False: 3.96k]
  ------------------
 5830|  20.5k|    out.push_back('-');
 5831|  20.5k|  }
 5832|  72.8k|  while (h < input.size()) {
  ------------------
  |  Branch (5832:10): [True: 48.4k, False: 24.4k]
  ------------------
 5833|  48.4k|    uint32_t m = 0x10FFFF;
 5834|  1.67M|    for (auto code_point : input) {
  ------------------
  |  Branch (5834:26): [True: 1.67M, False: 48.4k]
  ------------------
 5835|  1.67M|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5835:11): [True: 645k, False: 1.03M]
  |  Branch (5835:30): [True: 52.9k, False: 592k]
  ------------------
 5836|  1.67M|    }
 5837|       |
 5838|  48.4k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5838:9): [True: 0, False: 48.4k]
  ------------------
 5839|      0|      return false;
 5840|      0|    }
 5841|  48.4k|    d = d + int32_t((m - n) * (h + 1));
 5842|  48.4k|    n = m;
 5843|  1.67M|    for (auto c : input) {
  ------------------
  |  Branch (5843:17): [True: 1.67M, False: 48.4k]
  ------------------
 5844|  1.67M|      if (c < n) {
  ------------------
  |  Branch (5844:11): [True: 1.03M, False: 645k]
  ------------------
 5845|  1.03M|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5845:13): [True: 0, False: 1.03M]
  ------------------
 5846|      0|          return false;
 5847|      0|        }
 5848|  1.03M|        ++d;
 5849|  1.03M|      }
 5850|  1.67M|      if (c == n) {
  ------------------
  |  Branch (5850:11): [True: 139k, False: 1.53M]
  ------------------
 5851|   139k|        int32_t q = d;
 5852|   276k|        for (int32_t k = base;; k += base) {
 5853|   276k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5853:23): [True: 51.6k, False: 224k]
  |  Branch (5853:42): [True: 203k, False: 21.0k]
  ------------------
 5854|       |
 5855|   276k|          if (q < t) {
  ------------------
  |  Branch (5855:15): [True: 139k, False: 137k]
  ------------------
 5856|   139k|            break;
 5857|   139k|          }
 5858|   137k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5859|   137k|          q = (q - t) / (base - t);
 5860|   137k|        }
 5861|   139k|        out.push_back(digit_to_char(q));
 5862|   139k|        bias = adapt(d, int32_t(h + 1), h == b);
 5863|   139k|        d = 0;
 5864|   139k|        ++h;
 5865|   139k|      }
 5866|  1.67M|    }
 5867|  48.4k|    ++d;
 5868|  48.4k|    ++n;
 5869|  48.4k|  }
 5870|  24.4k|  return true;
 5871|  24.4k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5955|  27.3k|bool is_label_valid(const std::u32string_view label) {
 5956|  27.3k|  if (label.empty()) {
  ------------------
  |  Branch (5956:7): [True: 0, False: 27.3k]
  ------------------
 5957|      0|    return true;
 5958|      0|  }
 5959|  27.3k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5959:7): [True: 0, False: 27.3k]
  |  Branch (5959:27): [True: 0, False: 27.3k]
  |  Branch (5959:58): [True: 0, False: 27.3k]
  ------------------
 5960|  27.3k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5960:7): [True: 0, False: 27.3k]
  |  Branch (5960:31): [True: 0, False: 27.3k]
  ------------------
 5961|      0|    return false;
 5962|      0|  }
 5963|       |
 5964|       |  ///////////////
 5965|       |  // We have a normalization step which ensures that we are in NFC.
 5966|       |  // If we receive punycode, we normalize and check that the normalized
 5967|       |  // version matches the original.
 5968|       |  // --------------------------------------
 5969|       |  // The label must be in Unicode Normalization Form NFC.
 5970|       |
 5971|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5972|       |  // ---------------------------------------
 5973|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5974|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5975|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5976|       |
 5977|       |  // This is not necessary because we segment the
 5978|       |  // labels by '.'.
 5979|       |  // ---------------------------------------
 5980|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5981|       |  // if (label.find('.') != std::string_view::npos) return false;
 5982|       |
 5983|       |  // The label must not begin with a combining mark.
 5984|       |  // Range membership via lower_bound on range end.
 5985|  27.3k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5986|  27.3k|                                               combining_range_count};
 5987|  27.3k|  const auto comb_it = std::ranges::lower_bound(
 5988|  27.3k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5989|  27.3k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5989:7): [True: 27.3k, False: 0]
  |  Branch (5989:7): [True: 104, False: 27.2k]
  |  Branch (5989:37): [True: 104, False: 27.2k]
  ------------------
 5990|    104|    return false;
 5991|    104|  }
 5992|       |  // We verify this next step as part of the mapping:
 5993|       |  // ---------------------------------------------
 5994|       |  // Each code point in the label must only have certain status values
 5995|       |  // according to Section 5, IDNA Mapping Table:
 5996|       |  // - For Transitional Processing, each value must be valid.
 5997|       |  // - For Nontransitional Processing, each value must be either valid or
 5998|       |  // deviation.
 5999|       |
 6000|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6001|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6002|       |  // Applications (IDNA) [IDNA2008].
 6003|  27.2k|  constexpr static uint32_t virama[] = {
 6004|  27.2k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 6005|  27.2k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 6006|  27.2k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 6007|  27.2k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 6008|  27.2k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 6009|  27.2k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 6010|  27.2k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6011|  27.2k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6012|  27.2k|  constexpr static uint32_t R[] = {
 6013|  27.2k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6014|  27.2k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6015|  27.2k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6016|  27.2k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6017|  27.2k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6018|  27.2k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6019|  27.2k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6020|  27.2k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6021|  27.2k|  constexpr static uint32_t L[] = {0xa872};
 6022|  27.2k|  constexpr static uint32_t D[] = {
 6023|  27.2k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6024|  27.2k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6025|  27.2k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6026|  27.2k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6027|  27.2k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6028|  27.2k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6029|  27.2k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6030|  27.2k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6031|  27.2k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6032|  27.2k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6033|  27.2k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6034|  27.2k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6035|  27.2k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6036|  27.2k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6037|  27.2k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6038|  27.2k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6039|  27.2k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6040|  27.2k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6041|  27.2k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6042|  27.2k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6043|  27.2k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6044|  27.2k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6045|  27.2k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6046|  27.2k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6047|  27.2k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6048|  27.2k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6049|  27.2k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6050|  27.2k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6051|  27.2k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6052|  27.2k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6053|  27.2k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6054|  27.2k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6055|  27.2k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6056|  27.2k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6057|  27.2k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6058|  27.2k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6059|  27.2k|      0xa870, 0xa871};
 6060|       |
 6061|   193k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6061:22): [True: 168k, False: 25.6k]
  ------------------
 6062|   168k|    uint32_t c = label[i];
 6063|   168k|    if (c == 0x200c) {
  ------------------
  |  Branch (6063:9): [True: 1.30k, False: 166k]
  ------------------
 6064|  1.30k|      if (i > 0) {
  ------------------
  |  Branch (6064:11): [True: 1.29k, False: 6]
  ------------------
 6065|  1.29k|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6065:13): [True: 216, False: 1.08k]
  ------------------
 6066|    216|          return true;
 6067|    216|        }
 6068|  1.29k|      }
 6069|  1.08k|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6069:11): [True: 6, False: 1.08k]
  |  Branch (6069:23): [True: 70, False: 1.01k]
  ------------------
 6070|     76|        return false;
 6071|     76|      }
 6072|       |      // we go backward looking for L or D
 6073|  1.01k|      auto is_l_or_d = [](uint32_t code) {
 6074|  1.01k|        return std::ranges::binary_search(L, code) ||
 6075|  1.01k|               std::ranges::binary_search(D, code);
 6076|  1.01k|      };
 6077|  1.01k|      auto is_r_or_d = [](uint32_t code) {
 6078|  1.01k|        return std::ranges::binary_search(R, code) ||
 6079|  1.01k|               std::ranges::binary_search(D, code);
 6080|  1.01k|      };
 6081|  1.01k|      std::u32string_view before = label.substr(0, i);
 6082|  1.01k|      std::u32string_view after = label.substr(i + 1);
 6083|  1.01k|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6083:14): [True: 940, False: 72]
  ------------------
 6084|  1.01k|              before.end()) &&
 6085|    940|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6085:14): [True: 824, False: 116]
  ------------------
 6086|    940|              after.end());
 6087|   166k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6087:16): [True: 372, False: 166k]
  ------------------
 6088|    372|      if (i > 0) {
  ------------------
  |  Branch (6088:11): [True: 366, False: 6]
  ------------------
 6089|    366|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6089:13): [True: 314, False: 52]
  ------------------
 6090|    314|          return true;
 6091|    314|        }
 6092|    366|      }
 6093|     58|      return false;
 6094|    372|    }
 6095|   168k|  }
 6096|       |
 6097|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6098|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6099|       |  // Section 2.
 6100|       |
 6101|       |  // The following rule, consisting of six conditions, applies to labels
 6102|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6103|       |  // described in Section 3.  All of the conditions must be satisfied for
 6104|       |  // the rule to be satisfied.
 6105|       |  //
 6106|       |  //  1.  The first character must be a character with Bidi property L, R,
 6107|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6108|       |  //     has the L property, it is an LTR label.
 6109|       |  //
 6110|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6111|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6112|       |  //
 6113|       |  //   3.  In an RTL label, the end of the label must be a character with
 6114|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6115|       |  //       characters with Bidi property NSM.
 6116|       |  //
 6117|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6118|       |  //       vice versa.
 6119|       |  //
 6120|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6121|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6122|       |  //
 6123|       |  //   6.  In an LTR label, the end of the label must be a character with
 6124|       |  //       Bidi property L or EN, followed by zero or more characters with
 6125|       |  //       Bidi property NSM.
 6126|       |
 6127|  25.6k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6128|  25.6k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6128:7): [True: 0, False: 25.6k]
  ------------------
 6129|      0|    return false;
 6130|      0|  }
 6131|       |
 6132|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6133|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6134|       |  // domain names.
 6135|  25.6k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6135:7): [True: 1.65k, False: 23.9k]
  ------------------
 6136|       |    // The first character must be a character with Bidi property L, R,
 6137|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6138|       |    // has the L property, it is an LTR label.
 6139|       |
 6140|  1.65k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6140:9): [True: 218, False: 1.43k]
  ------------------
 6141|       |      // Eval as LTR
 6142|       |
 6143|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6144|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6145|  2.50k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6145:26): [True: 2.50k, False: 0]
  ------------------
 6146|  2.50k|        const direction d = find_direction(label[i]);
 6147|  2.50k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6147:15): [True: 724, False: 1.77k]
  |  Branch (6147:36): [True: 214, False: 1.56k]
  |  Branch (6147:58): [True: 194, False: 1.37k]
  ------------------
 6148|  1.37k|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6148:15): [True: 210, False: 1.16k]
  |  Branch (6148:37): [True: 330, False: 830]
  |  Branch (6148:59): [True: 214, False: 616]
  ------------------
 6149|    616|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6149:15): [True: 206, False: 410]
  |  Branch (6149:37): [True: 192, False: 218]
  ------------------
 6150|    218|          return false;
 6151|    218|        }
 6152|  2.50k|      }
 6153|       |
 6154|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6155|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6155:13): [True: 0, False: 0]
  |  Branch (6155:41): [True: 0, False: 0]
  ------------------
 6156|      0|        return false;
 6157|      0|      }
 6158|       |
 6159|      0|      return true;
 6160|       |
 6161|  1.43k|    } else {
 6162|       |      // Eval as RTL
 6163|       |
 6164|       |      // The first character must be R or AL; a leading AN (or any other
 6165|       |      // direction) does not start a valid RTL label.
 6166|  1.43k|      const direction first_dir = find_direction(label[0]);
 6167|  1.43k|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6167:11): [True: 628, False: 806]
  |  Branch (6167:40): [True: 40, False: 588]
  ------------------
 6168|     40|        return false;
 6169|     40|      }
 6170|       |
 6171|  1.39k|      bool has_an = false;
 6172|  1.39k|      bool has_en = false;
 6173|  5.63k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6173:26): [True: 4.40k, False: 1.23k]
  ------------------
 6174|  4.40k|        const direction d = find_direction(label[i]);
 6175|       |
 6176|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6177|       |        // versa.
 6178|  4.40k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6178:14): [True: 558, False: 3.84k]
  |  Branch (6178:37): [True: 558, False: 0]
  |  Branch (6178:56): [True: 6, False: 552]
  ------------------
 6179|  4.39k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6179:14): [True: 394, False: 4.00k]
  |  Branch (6179:37): [True: 394, False: 0]
  |  Branch (6179:56): [True: 6, False: 388]
  ------------------
 6180|     12|          return false;
 6181|     12|        }
 6182|       |
 6183|  4.39k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6183:15): [True: 1.03k, False: 3.35k]
  |  Branch (6183:36): [True: 922, False: 2.43k]
  |  Branch (6183:58): [True: 388, False: 2.04k]
  ------------------
 6184|  2.04k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6184:15): [True: 552, False: 1.49k]
  |  Branch (6184:37): [True: 190, False: 1.30k]
  |  Branch (6184:59): [True: 246, False: 1.05k]
  ------------------
 6185|  1.05k|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6185:15): [True: 194, False: 862]
  |  Branch (6185:37): [True: 280, False: 582]
  |  Branch (6185:59): [True: 318, False: 264]
  ------------------
 6186|    264|              d == direction::NSM)) {
  ------------------
  |  Branch (6186:15): [True: 192, False: 72]
  ------------------
 6187|     72|          return false;
 6188|     72|        }
 6189|       |
 6190|  4.31k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6190:13): [True: 1.31k, False: 3.00k]
  ------------------
 6191|  1.31k|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6191:15): [True: 396, False: 914]
  |  Branch (6191:36): [True: 434, False: 480]
  |  Branch (6191:58): [True: 200, False: 280]
  ------------------
 6192|    280|              d == direction::EN)) {
  ------------------
  |  Branch (6192:15): [True: 206, False: 74]
  ------------------
 6193|     74|          return false;
 6194|     74|        }
 6195|  4.31k|      }
 6196|       |
 6197|  1.23k|      return true;
 6198|  1.39k|    }
 6199|  1.65k|  }
 6200|       |
 6201|  23.9k|  return true;
 6202|  25.6k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6359|   125k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6360|   125k|  out.clear();
 6361|   125k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6361:7): [True: 0, False: 125k]
  ------------------
 6362|      0|    return false;
 6363|      0|  }
 6364|   125k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6364:7): [True: 120k, False: 5.34k]
  ------------------
 6365|   120k|    from_ascii_to_ascii(ut8_string, out);
 6366|   120k|    return true;
 6367|   120k|  }
 6368|       |
 6369|       |#ifdef ADA_USE_SIMDUTF
 6370|       |  size_t utf32_length =
 6371|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6372|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6373|       |    return false;
 6374|       |  }
 6375|       |  std::u32string working(utf32_length, U'\0');
 6376|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6377|       |      ut8_string.data(), ut8_string.size(), working.data());
 6378|       |#else
 6379|  5.34k|  size_t utf32_length =
 6380|  5.34k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6381|  5.34k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6381:7): [True: 42, False: 5.29k]
  |  Branch (6381:28): [True: 42, False: 0]
  ------------------
 6382|     42|    return false;
 6383|     42|  }
 6384|  5.29k|  std::u32string working(utf32_length, U'\0');
 6385|  5.29k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6386|  5.29k|      ut8_string.data(), ut8_string.size(), working.data());
 6387|  5.29k|#endif
 6388|  5.29k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6388:7): [True: 456, False: 4.84k]
  |  Branch (6388:35): [True: 0, False: 4.84k]
  ------------------
 6389|    456|    return false;
 6390|    456|  }
 6391|  4.84k|  working.resize(actual_utf32_length);
 6392|       |
 6393|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6394|  4.84k|  std::u32string mapped;
 6395|  4.84k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6395:7): [True: 72, False: 4.77k]
  ------------------
 6396|     72|    return false;
 6397|     72|  }
 6398|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6399|  4.77k|  working.clear();
 6400|       |
 6401|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6402|  4.77k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6402:7): [True: 4.14k, False: 630]
  |  Branch (6402:28): [True: 756, False: 3.38k]
  ------------------
 6403|    756|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6403:9): [True: 0, False: 756]
  ------------------
 6404|      0|      return false;
 6405|      0|    }
 6406|    756|  }
 6407|       |
 6408|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6409|  4.77k|  out.reserve(mapped.size() + 8);
 6410|       |
 6411|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6412|  4.77k|  const char32_t* p = mapped.data();
 6413|  4.77k|  const char32_t* const end = p + mapped.size();
 6414|  4.77k|  std::u32string post_map;
 6415|       |
 6416|  33.9k|  while (p < end) {
  ------------------
  |  Branch (6416:10): [True: 30.8k, False: 3.08k]
  ------------------
 6417|  30.8k|    const char32_t* label_begin = p;
 6418|   341k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6418:12): [True: 337k, False: 4.10k]
  |  Branch (6418:23): [True: 310k, False: 26.7k]
  ------------------
 6419|   310k|      ++p;
 6420|   310k|    }
 6421|  30.8k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6422|  30.8k|    std::u32string_view label_view(label_begin, label_size);
 6423|  30.8k|    const bool is_last_label = (p == end);
 6424|  30.8k|    if (p < end) {
  ------------------
  |  Branch (6424:9): [True: 26.7k, False: 4.10k]
  ------------------
 6425|  26.7k|      ++p;  // skip dot
 6426|  26.7k|    }
 6427|       |
 6428|  30.8k|    if (label_size == 0) {
  ------------------
  |  Branch (6428:9): [True: 612, False: 30.2k]
  ------------------
 6429|       |      // empty label
 6430|  30.2k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6430:16): [True: 2.95k, False: 27.3k]
  ------------------
 6431|  61.1k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6431:23): [True: 61.1k, False: 2.93k]
  ------------------
 6432|  61.1k|        if (c >= 0x80) {
  ------------------
  |  Branch (6432:13): [True: 28, False: 61.1k]
  ------------------
 6433|     28|          out.clear();
 6434|     28|          return false;
 6435|     28|        }
 6436|  61.1k|      }
 6437|  2.93k|      append_ascii_label(out, label_view);
 6438|  2.93k|      std::string_view puny_segment_ascii(
 6439|  2.93k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6440|  2.93k|      working.clear();
 6441|  2.93k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6441:11): [True: 132, False: 2.79k]
  ------------------
 6442|    132|        out.clear();
 6443|    132|        return false;
 6444|    132|      }
 6445|  2.79k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6445:11): [True: 92, False: 2.70k]
  ------------------
 6446|     92|        out.clear();
 6447|     92|        return false;
 6448|     92|      }
 6449|  2.70k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6449:11): [True: 312, False: 2.39k]
  |  Branch (6449:49): [True: 116, False: 2.27k]
  ------------------
 6450|    428|        out.clear();
 6451|    428|        return false;
 6452|    428|      }
 6453|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6454|  2.27k|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6454:11): [True: 2.27k, False: 0]
  |  Branch (6454:34): [True: 628, False: 1.65k]
  ------------------
 6455|    628|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6455:13): [True: 0, False: 628]
  |  Branch (6455:37): [True: 168, False: 460]
  ------------------
 6456|    168|          out.clear();
 6457|    168|          return false;
 6458|    168|        }
 6459|    628|      }
 6460|  2.11k|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6460:11): [True: 0, False: 2.11k]
  |  Branch (6460:31): [True: 36, False: 2.07k]
  ------------------
 6461|     36|        out.clear();
 6462|     36|        return false;
 6463|     36|      }
 6464|  27.3k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6464:16): [True: 2.02k, False: 25.2k]
  ------------------
 6465|  2.02k|      append_ascii_label(out, label_view);
 6466|  25.2k|    } else {
 6467|  25.2k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6467:11): [True: 806, False: 24.4k]
  ------------------
 6468|    806|        out.clear();
 6469|    806|        return false;
 6470|    806|      }
 6471|  24.4k|      out.append("xn--");
 6472|  24.4k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6472:11): [True: 0, False: 24.4k]
  ------------------
 6473|      0|        out.clear();
 6474|      0|        return false;
 6475|      0|      }
 6476|  24.4k|    }
 6477|  29.1k|    if (!is_last_label) {
  ------------------
  |  Branch (6477:9): [True: 26.2k, False: 2.88k]
  ------------------
 6478|  26.2k|      out.push_back('.');
 6479|  26.2k|    }
 6480|  29.1k|  }
 6481|  3.08k|  return true;
 6482|  4.77k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6484|   125k|std::string to_ascii(std::string_view ut8_string) {
 6485|   125k|  std::string out;
 6486|   125k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6486:7): [True: 2.26k, False: 123k]
  ------------------
 6487|  2.26k|    return {};
 6488|  2.26k|  }
 6489|   123k|  return out;
 6490|   125k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7349|  24.1k|                    std::string& out) {
 7350|  24.1k|  ada_log("percent_encode ", input, " to output string while ",
 7351|  24.1k|          append ? "appending" : "overwriting");
 7352|  24.1k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  24.1k|    return character_sets::bit_at(character_set, c);
 7354|  24.1k|  });
 7355|  24.1k|  ada_log("percent_encode done checking, moved to ",
 7356|  24.1k|          std::distance(input.begin(), pointer));
 7357|       |
 7358|       |  // Optimization: Don't iterate if percent encode is not required
 7359|  24.1k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7359:7): [True: 23.6k, False: 554]
  ------------------
 7360|  23.6k|    ada_log("percent_encode encoding not needed.");
 7361|  23.6k|    return false;
 7362|  23.6k|  }
 7363|       |  if constexpr (!append) {
 7364|       |    out.clear();
 7365|       |  }
 7366|    554|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7367|    554|          " bytes");
 7368|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7369|    554|  out.append(input.data(), std::distance(input.begin(), pointer));
 7370|    554|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7371|    554|          " bytes");
 7372|  34.9k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7372:10): [True: 34.4k, False: 554]
  ------------------
 7373|  34.4k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7373:9): [True: 21.7k, False: 12.7k]
  ------------------
 7374|  21.7k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7375|  21.7k|    } else {
 7376|  12.7k|      out += *pointer;
 7377|  12.7k|    }
 7378|  34.4k|  }
 7379|    554|  return true;
 7380|  24.1k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7349|  26.9k|                    std::string& out) {
 7350|  26.9k|  ada_log("percent_encode ", input, " to output string while ",
 7351|  26.9k|          append ? "appending" : "overwriting");
 7352|  26.9k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  26.9k|    return character_sets::bit_at(character_set, c);
 7354|  26.9k|  });
 7355|  26.9k|  ada_log("percent_encode done checking, moved to ",
 7356|  26.9k|          std::distance(input.begin(), pointer));
 7357|       |
 7358|       |  // Optimization: Don't iterate if percent encode is not required
 7359|  26.9k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7359:7): [True: 17.7k, False: 9.13k]
  ------------------
 7360|  17.7k|    ada_log("percent_encode encoding not needed.");
 7361|  17.7k|    return false;
 7362|  17.7k|  }
 7363|  9.13k|  if constexpr (!append) {
 7364|  9.13k|    out.clear();
 7365|  9.13k|  }
 7366|  9.13k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7367|  9.13k|          " bytes");
 7368|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7369|  9.13k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7370|  9.13k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7371|  9.13k|          " bytes");
 7372|   101k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7372:10): [True: 92.1k, False: 9.13k]
  ------------------
 7373|  92.1k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7373:9): [True: 77.3k, False: 14.8k]
  ------------------
 7374|  77.3k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7375|  77.3k|    } else {
 7376|  14.8k|      out += *pointer;
 7377|  14.8k|    }
 7378|  92.1k|  }
 7379|  9.13k|  return true;
 7380|  26.9k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7180|  39.1k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7181|       |  // next line is for safety only, we expect users to avoid calling
 7182|       |  // percent_decode when first_percent is outside the range.
 7183|  39.1k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7183:7): [True: 0, False: 39.1k]
  ------------------
 7184|      0|    return std::string(input);
 7185|      0|  }
 7186|       |
 7187|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7188|  39.1k|  const char* const src = input.data();
 7189|  39.1k|  const char* const end = src + input.size();
 7190|       |
 7191|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7192|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7193|       |  // byte-at-a-time appends of the naive version.
 7194|  39.1k|  std::string out(input.size(), '\0');
 7195|  39.1k|  char* d = out.data();
 7196|  39.1k|  char* const d0 = d;
 7197|       |
 7198|  39.1k|  std::memcpy(d, src, first_percent);
 7199|  39.1k|  d += first_percent;
 7200|       |
 7201|  39.1k|  const char* p = src + first_percent;
 7202|   126k|  while (p < end) {
  ------------------
  |  Branch (7202:10): [True: 87.1k, False: 39.1k]
  ------------------
 7203|  87.1k|    if (*p == '%') {
  ------------------
  |  Branch (7203:9): [True: 45.5k, False: 41.5k]
  ------------------
 7204|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7205|  87.9k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7205:14): [True: 86.5k, False: 1.35k]
  |  Branch (7205:29): [True: 47.8k, False: 38.7k]
  ------------------
 7206|  47.8k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7206:13): [True: 3.79k, False: 44.0k]
  |  Branch (7206:42): [True: 1.72k, False: 42.3k]
  ------------------
 7207|  5.51k|          break;
 7208|  5.51k|        }
 7209|  42.3k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7210|  42.3k|                                 convert_hex_to_binary(p[2]));
 7211|  42.3k|        p += 3;
 7212|  42.3k|      }
 7213|  45.5k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7213:11): [True: 44.7k, False: 834]
  |  Branch (7213:22): [True: 5.82k, False: 38.9k]
  ------------------
 7214|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7215|       |        // literally and keep scanning after it.
 7216|  5.82k|        *d++ = *p++;
 7217|  5.82k|      }
 7218|  45.5k|    } else {
 7219|  41.5k|      const char* q = static_cast<const char*>(
 7220|  41.5k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7221|  41.5k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7221:29): [True: 3.43k, False: 38.0k]
  ------------------
 7222|  41.5k|      const size_t n = static_cast<size_t>(run_end - p);
 7223|  41.5k|      std::memcpy(d, p, n);
 7224|  41.5k|      d += n;
 7225|  41.5k|      p = run_end;
 7226|  41.5k|    }
 7227|  87.1k|  }
 7228|       |
 7229|  39.1k|  out.resize(static_cast<size_t>(d - d0));
 7230|  39.1k|  return out;
 7231|  39.1k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7319|   190k|                           const uint8_t character_set[]) {
 7320|   190k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7321|   190k|    return character_sets::bit_at(character_set, c);
 7322|   190k|  });
 7323|       |  // Optimization: Don't iterate if percent encode is not required
 7324|   190k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7324:7): [True: 187k, False: 3.53k]
  ------------------
 7325|   187k|    return std::string(input);
 7326|   187k|  }
 7327|       |
 7328|  3.53k|  std::string result;
 7329|  3.53k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7330|       |                                   // produce 3 characters.
 7331|  3.53k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7332|  3.53k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7332:7): [True: 776, False: 2.76k]
  ------------------
 7333|    776|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7334|    776|                          result);
 7335|  2.76k|  } else {
 7336|  20.6k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7336:12): [True: 17.8k, False: 2.76k]
  ------------------
 7337|  17.8k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7337:11): [True: 12.1k, False: 5.66k]
  ------------------
 7338|  12.1k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7339|  12.1k|      } else {
 7340|  5.66k|        result += *pointer;
 7341|  5.66k|      }
 7342|  17.8k|    }
 7343|  2.76k|  }
 7344|  3.53k|  return result;
 7345|   190k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7390|   125k|              size_t first_percent) {
 7391|   125k|  std::string percent_decoded_buffer;
 7392|   125k|  std::string_view input = plain;
 7393|   125k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7393:7): [True: 766, False: 124k]
  ------------------
 7394|    766|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7395|    766|    input = percent_decoded_buffer;
 7396|    766|  }
 7397|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7398|   125k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7399|   125k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7399:7): [True: 2.27k, False: 123k]
  |  Branch (7399:29): [True: 896, False: 122k]
  ------------------
 7400|   123k|                                idna_ascii.data(), idna_ascii.size())) {
 7401|  3.17k|    return false;
 7402|  3.17k|  }
 7403|   122k|  out = std::move(idna_ascii);
 7404|   122k|  return true;
 7405|   125k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7408|     42|                           const uint8_t character_set[], size_t index) {
 7409|     42|  std::string out;
 7410|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7411|     42|  out.append(input.data(), index);
 7412|     42|  auto pointer = input.begin() + index;
 7413|     42|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7413:7): [True: 2, False: 40]
  ------------------
 7414|      2|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7415|      2|                          out);
 7416|     40|  } else {
 7417|    559|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7417:12): [True: 519, False: 40]
  ------------------
 7418|    519|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7418:11): [True: 184, False: 335]
  ------------------
 7419|    184|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7420|    335|      } else {
 7421|    335|        out += *pointer;
 7422|    335|      }
 7423|    519|    }
 7424|     40|  }
 7425|     42|  return out;
 7426|     42|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7720|    778|                           const uint8_t character_set[], std::string& out) {
 7721|    778|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7722|    778|  if (static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (7722:7): [True: 778, False: 0]
  ------------------
 7723|    778|    percent_encode_to_wide(p, end, character_set, out);
 7724|    778|    return;
 7725|    778|  }
 7726|      0|#endif
 7727|      0|  percent_encode_to_scalar(p, end, character_set, out);
 7728|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7793|    826|    size_t& compress_length) noexcept {
 7794|    826|  compress = 0;
 7795|    826|  compress_length = 0;
 7796|    826|  size_t i = 0;
 7797|  3.10k|  while (i < 8) {
  ------------------
  |  Branch (7797:10): [True: 2.28k, False: 826]
  ------------------
 7798|  2.28k|    if (address[i] != 0) {
  ------------------
  |  Branch (7798:9): [True: 1.25k, False: 1.02k]
  ------------------
 7799|  1.25k|      ++i;
 7800|  1.25k|      continue;
 7801|  1.25k|    }
 7802|  1.02k|    size_t next = i + 1;
 7803|  5.35k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7803:12): [True: 4.82k, False: 530]
  |  Branch (7803:24): [True: 4.32k, False: 498]
  ------------------
 7804|  4.32k|      ++next;
 7805|  4.32k|    }
 7806|  1.02k|    const size_t count = next - i;
 7807|  1.02k|    if (count > compress_length) {
  ------------------
  |  Branch (7807:9): [True: 874, False: 154]
  ------------------
 7808|    874|      compress_length = count;
 7809|    874|      compress = i;
 7810|    874|    }
 7811|  1.02k|    i = next;
 7812|  1.02k|  }
 7813|    826|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7815|    826|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7816|    826|  size_t compress = 0;
 7817|    826|  size_t compress_length = 0;
 7818|    826|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7819|       |
 7820|       |  // Skip compression when the longest zero run is a single piece.
 7821|    826|  if (compress_length <= 1) {
  ------------------
  |  Branch (7821:7): [True: 44, False: 782]
  ------------------
 7822|     44|    compress = compress_length = 8;
 7823|     44|  }
 7824|       |
 7825|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7826|    826|  std::string output(4 * 8 + 7 + 2, '\0');
 7827|    826|  char* point = output.data();
 7828|    826|  *point++ = '[';
 7829|    826|  size_t piece_index = 0;
 7830|  1.97k|  while (true) {
  ------------------
  |  Branch (7830:10): [True: 1.97k, Folded]
  ------------------
 7831|  1.97k|    if (piece_index == compress) {
  ------------------
  |  Branch (7831:9): [True: 782, False: 1.19k]
  ------------------
 7832|    782|      *point++ = ':';
 7833|       |      // If we skip a value initially, we need to write '::'.
 7834|    782|      if (piece_index == 0) {
  ------------------
  |  Branch (7834:11): [True: 532, False: 250]
  ------------------
 7835|    532|        *point++ = ':';
 7836|    532|      }
 7837|    782|      piece_index += compress_length;
 7838|    782|      if (piece_index == 8) {
  ------------------
  |  Branch (7838:11): [True: 456, False: 326]
  ------------------
 7839|    456|        break;
 7840|    456|      }
 7841|    782|    }
 7842|  1.51k|    point = write_hex_u16(point, address[piece_index]);
 7843|  1.51k|    ++piece_index;
 7844|  1.51k|    if (piece_index == 8) {
  ------------------
  |  Branch (7844:9): [True: 370, False: 1.14k]
  ------------------
 7845|    370|      break;
 7846|    370|    }
 7847|  1.14k|    *point++ = ':';
 7848|  1.14k|  }
 7849|    826|  *point++ = ']';
 7850|    826|  output.resize(static_cast<size_t>(point - output.data()));
 7851|    826|  return output;
 7852|    826|}
_ZN3ada11serializers4ipv4Em:
 7854|  40.3k|std::string ipv4(const uint64_t address) {
 7855|  40.3k|  std::string output(15, '\0');
 7856|  40.3k|  char* point = output.data();
 7857|  40.3k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7858|  40.3k|  *point++ = '.';
 7859|  40.3k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7860|  40.3k|  *point++ = '.';
 7861|  40.3k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7862|  40.3k|  *point++ = '.';
 7863|  40.3k|  point = write_u8(point, static_cast<uint8_t>(address));
 7864|  40.3k|  output.resize(static_cast<size_t>(point - output.data()));
 7865|  40.3k|  return output;
 7866|  40.3k|}
_ZN3ada5parseINS_3urlEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8268|   608k|    std::string_view input, const result_type* base_url) {
 8269|   608k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8270|   608k|  if (!u.is_valid) {
  ------------------
  |  Branch (8270:7): [True: 21.4k, False: 587k]
  ------------------
 8271|  21.4k|    return tl::unexpected(errors::type_error);
 8272|  21.4k|  }
 8273|   587k|  return u;
 8274|   608k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8268|   608k|    std::string_view input, const result_type* base_url) {
 8269|   608k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8270|   608k|  if (!u.is_valid) {
  ------------------
  |  Branch (8270:7): [True: 21.4k, False: 587k]
  ------------------
 8271|  21.4k|    return tl::unexpected(errors::type_error);
 8272|  21.4k|  }
 8273|   587k|  return u;
 8274|   608k|}
_ZN3ada20get_max_input_lengthEv:
 7889|  1.60M|uint32_t get_max_input_length() {
 7890|  1.60M|  return max_input_length_.load(std::memory_order_relaxed);
 7891|  1.60M|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9243|   526k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9244|   527k|  while (!input.empty() &&
  ------------------
  |  Branch (9244:10): [True: 527k, False: 0]
  ------------------
 9245|   527k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9245:10): [True: 452, False: 526k]
  ------------------
 9246|    452|    input.remove_prefix(1);
 9247|    452|  }
 9248|   530k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9248:10): [True: 530k, False: 0]
  |  Branch (9248:28): [True: 3.24k, False: 526k]
  ------------------
 9249|  3.24k|    input.remove_suffix(1);
 9250|  3.24k|  }
 9251|   526k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9418|  18.4k|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9419|  18.4k|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9420|  18.4k|          input1.size(), " bytes] is part of string '", input2, "' [",
 9421|  18.4k|          input2.size(), " bytes]");
 9422|  18.4k|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9422:10): [True: 18.4k, False: 0]
  |  Branch (9422:29): [True: 18.4k, False: 0]
  |  Branch (9422:48): [True: 18.4k, False: 2]
  ------------------
 9423|  18.4k|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9423:10): [True: 0, False: 18.4k]
  ------------------
 9424|  18.4k|}
_ZN3ada3url17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9799|    662|bool url::parse_opaque_host(std::string_view input) {
 9800|    662|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
 9801|    662|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (9801:7): [True: 31, False: 631]
  ------------------
 9802|     31|    return is_valid = false;
 9803|     31|  }
 9804|       |
 9805|       |  // Return the result of running UTF-8 percent-encode on input using the C0
 9806|       |  // control percent-encode set.
 9807|    631|  host = ada::unicode::percent_encode(
 9808|    631|      input, ada::character_sets::C0_CONTROL_PERCENT_ENCODE);
 9809|    631|  return true;
 9810|    662|}
_ZN3ada3url10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9812|  57.4k|bool url::parse_ipv4(std::string_view input) {
 9813|  57.4k|  ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
 9814|  57.4k|  if (input.empty()) {
  ------------------
  |  Branch (9814:7): [True: 0, False: 57.4k]
  ------------------
 9815|      0|    return is_valid = false;
 9816|      0|  }
 9817|  57.4k|  std::string_view original_input = input;
 9818|  57.4k|  if (original_input.back() == '.') {
  ------------------
  |  Branch (9818:7): [True: 27.6k, False: 29.7k]
  ------------------
 9819|  27.6k|    original_input.remove_suffix(1);
 9820|  27.6k|  }
 9821|  57.4k|  if (input.back() == '.') {
  ------------------
  |  Branch (9821:7): [True: 27.6k, False: 29.7k]
  ------------------
 9822|  27.6k|    input.remove_suffix(1);
 9823|  27.6k|    if (input.empty()) {
  ------------------
  |  Branch (9823:9): [True: 0, False: 27.6k]
  ------------------
 9824|      0|      return is_valid = false;
 9825|      0|    }
 9826|  27.6k|  }
 9827|       |
 9828|  57.4k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
 9829|  57.4k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (9829:7): [True: 18.4k, False: 38.9k]
  ------------------
 9830|  18.4k|    host = original_input;
 9831|  18.4k|    host_type = IPV4;
 9832|  18.4k|    return true;
 9833|  18.4k|  }
 9834|       |
 9835|  38.9k|  const char* p = input.data();
 9836|  38.9k|  const char* end = p + input.size();
 9837|  38.9k|  uint64_t ipv4 = 0;
 9838|  38.9k|  int digit_count = 0;
 9839|  38.9k|  int pure_decimal_count = 0;
 9840|       |
 9841|  49.1k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (9841:10): [True: 49.1k, False: 15]
  |  Branch (9841:29): [True: 49.1k, False: 0]
  ------------------
 9842|  49.1k|    uint64_t segment = 0;
 9843|  49.1k|    bool pure = false;
 9844|  49.1k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (9844:9): [True: 18.7k, False: 30.3k]
  ------------------
 9845|  18.7k|      return is_valid = false;
 9846|  18.7k|    }
 9847|  30.3k|    if (pure) {
  ------------------
  |  Branch (9847:9): [True: 11.3k, False: 19.0k]
  ------------------
 9848|  11.3k|      ++pure_decimal_count;
 9849|  11.3k|    }
 9850|  30.3k|    if (p >= end) {
  ------------------
  |  Branch (9850:9): [True: 20.1k, False: 10.1k]
  ------------------
 9851|  20.1k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
 9852|  20.1k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (9852:11): [True: 24, False: 20.1k]
  ------------------
 9853|     24|        return is_valid = false;
 9854|     24|      }
 9855|  20.1k|      ipv4 = (ipv4 << shift) | segment;
 9856|  20.1k|      host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9856:14): [True: 0, False: 20.1k]
  ------------------
 9857|  20.1k|                                       : ada::serializers::ipv4(ipv4);
 9858|  20.1k|      host_type = IPV4;
 9859|  20.1k|      return true;
 9860|  20.1k|    }
 9861|  10.1k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (9861:9): [True: 47, False: 10.1k]
  |  Branch (9861:26): [True: 0, False: 10.1k]
  ------------------
 9862|     47|      return is_valid = false;
 9863|     47|    }
 9864|  10.1k|    ipv4 = (ipv4 << 8) | segment;
 9865|  10.1k|    ++p;
 9866|  10.1k|  }
 9867|     15|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (9867:7): [True: 0, False: 15]
  |  Branch (9867:27): [True: 15, False: 0]
  ------------------
 9868|     15|    return is_valid = false;
 9869|     15|  }
 9870|      0|  host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9870:10): [True: 0, False: 0]
  ------------------
 9871|      0|                                   : ada::serializers::ipv4(ipv4);
 9872|      0|  host_type = IPV4;
 9873|      0|  return true;
 9874|     15|}
_ZN3ada3url10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9876|    588|bool url::parse_ipv6(std::string_view input) {
 9877|    588|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
 9878|    588|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (9878:7): [True: 22, False: 566]
  |  Branch (9878:24): [True: 13, False: 553]
  ------------------
 9879|     35|    return is_valid = false;
 9880|     35|  }
 9881|    553|  std::array<uint16_t, 8> address{};
 9882|       |#if defined(ADA_AVX512_IPV6)
 9883|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
 9884|       |                                                     address, simd_valid)) {
 9885|       |    if (!simd_valid) [[unlikely]] {
 9886|       |      return is_valid = false;
 9887|       |    }
 9888|       |    host = ada::serializers::ipv6(address);
 9889|       |    host_type = IPV6;
 9890|       |    return true;
 9891|       |  }
 9892|       |  address = {};
 9893|       |#endif
 9894|    553|  const char* pointer = input.data();
 9895|    553|  const char* const end = pointer + input.size();
 9896|    553|  int piece_index = 0;
 9897|    553|  int compress = -1;
 9898|       |
 9899|    553|  if (*pointer == ':') {
  ------------------
  |  Branch (9899:7): [True: 277, False: 276]
  ------------------
 9900|    277|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (9900:9): [True: 3, False: 274]
  |  Branch (9900:30): [True: 7, False: 267]
  ------------------
 9901|     10|      return is_valid = false;
 9902|     10|    }
 9903|    267|    pointer += 2;
 9904|    267|    compress = ++piece_index;
 9905|    267|  }
 9906|       |
 9907|  1.52k|  while (pointer != end) {
  ------------------
  |  Branch (9907:10): [True: 1.09k, False: 433]
  ------------------
 9908|  1.09k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (9908:9): [True: 3, False: 1.08k]
  ------------------
 9909|      3|      return is_valid = false;
 9910|      3|    }
 9911|  1.08k|    if (*pointer == ':') {
  ------------------
  |  Branch (9911:9): [True: 143, False: 944]
  ------------------
 9912|    143|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (9912:11): [True: 3, False: 140]
  ------------------
 9913|      3|        return is_valid = false;
 9914|      3|      }
 9915|    140|      ++pointer;
 9916|    140|      compress = ++piece_index;
 9917|    140|      continue;
 9918|    143|    }
 9919|       |
 9920|    944|    uint16_t value = 0;
 9921|    944|    const int length = detail::parse_hex_piece(pointer, end, value);
 9922|       |
 9923|    944|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (9923:9): [True: 733, False: 211]
  |  Branch (9923:27): [True: 80, False: 653]
  ------------------
 9924|     80|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9924:11): [True: 3, False: 77]
  ------------------
 9925|      3|        return is_valid = false;
 9926|      3|      }
 9927|     77|      pointer -= length;
 9928|     77|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (9928:11): [True: 3, False: 74]
  ------------------
 9929|      3|        return is_valid = false;
 9930|      3|      }
 9931|       |
 9932|     74|      int numbers_seen = 0;
 9933|    211|      while (pointer != end) {
  ------------------
  |  Branch (9933:14): [True: 193, False: 18]
  ------------------
 9934|    193|        int ipv4_piece = -1;
 9935|    193|        if (numbers_seen > 0) {
  ------------------
  |  Branch (9935:13): [True: 119, False: 74]
  ------------------
 9936|    119|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (9936:15): [True: 104, False: 15]
  |  Branch (9936:34): [True: 98, False: 6]
  ------------------
 9937|     98|            ++pointer;
 9938|     98|          } else {
 9939|     21|            return is_valid = false;
 9940|     21|          }
 9941|    119|        }
 9942|    172|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (9942:13): [True: 13, False: 159]
  |  Branch (9942:31): [True: 11, False: 148]
  |  Branch (9942:49): [True: 3, False: 145]
  ------------------
 9943|     27|          return is_valid = false;
 9944|     27|        }
 9945|    145|        ipv4_piece = *pointer - '0';
 9946|    145|        ++pointer;
 9947|    145|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9947:13): [True: 135, False: 10]
  |  Branch (9947:31): [True: 57, False: 78]
  |  Branch (9947:50): [True: 54, False: 3]
  ------------------
 9948|     54|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (9948:15): [True: 3, False: 51]
  ------------------
 9949|      3|            return is_valid = false;
 9950|      3|          }
 9951|     51|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9952|     51|          ++pointer;
 9953|     51|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9953:15): [True: 48, False: 3]
  |  Branch (9953:33): [True: 29, False: 19]
  |  Branch (9953:52): [True: 25, False: 4]
  ------------------
 9954|     25|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9955|     25|            ++pointer;
 9956|     25|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (9956:17): [True: 5, False: 20]
  ------------------
 9957|      5|              return is_valid = false;
 9958|      5|            }
 9959|     25|          }
 9960|     51|        }
 9961|    137|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
 9962|    137|            address[static_cast<size_t>(piece_index)] * 0x100 +
 9963|    137|            static_cast<uint16_t>(ipv4_piece));
 9964|    137|        ++numbers_seen;
 9965|    137|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (9965:13): [True: 40, False: 97]
  |  Branch (9965:34): [True: 13, False: 84]
  ------------------
 9966|     53|          ++piece_index;
 9967|     53|        }
 9968|    137|      }
 9969|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (9969:11): [True: 12, False: 6]
  ------------------
 9970|     12|        return is_valid = false;
 9971|     12|      }
 9972|      6|      break;
 9973|     18|    }
 9974|       |
 9975|    864|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9975:9): [True: 16, False: 848]
  ------------------
 9976|     16|      return is_valid = false;
 9977|     16|    }
 9978|       |
 9979|    848|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (9979:9): [True: 637, False: 211]
  |  Branch (9979:27): [True: 633, False: 4]
  ------------------
 9980|    633|      ++pointer;
 9981|    633|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (9981:11): [True: 4, False: 629]
  ------------------
 9982|      4|        return is_valid = false;
 9983|      4|      }
 9984|    633|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (9984:16): [True: 4, False: 211]
  ------------------
 9985|      4|      return is_valid = false;
 9986|      4|    }
 9987|       |
 9988|    840|    address[static_cast<size_t>(piece_index)] = value;
 9989|    840|    ++piece_index;
 9990|    840|  }
 9991|       |
 9992|    439|  if (compress != -1) {
  ------------------
  |  Branch (9992:7): [True: 397, False: 42]
  ------------------
 9993|    397|    const int right = piece_index - compress;
 9994|    397|    if (right > 0) {
  ------------------
  |  Branch (9994:9): [True: 175, False: 222]
  ------------------
 9995|    175|      const size_t dest = static_cast<size_t>(8 - right);
 9996|    175|      const size_t src = static_cast<size_t>(compress);
 9997|    175|      if (dest != src) {
  ------------------
  |  Branch (9997:11): [True: 166, False: 9]
  ------------------
 9998|    453|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (9998:53): [True: 287, False: 166]
  ------------------
 9999|    287|          address[dest + i] = address[src + i];
10000|    287|          address[src + i] = 0;
10001|    287|        }
10002|    166|      }
10003|    175|    }
10004|    397|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (10004:14): [True: 26, False: 16]
  ------------------
10005|     26|    return is_valid = false;
10006|     26|  }
10007|       |
10008|    413|  host = ada::serializers::ipv6(address);
10009|    413|  ada_log("parse_ipv6 ", *host);
10010|    413|  host_type = IPV6;
10011|    413|  return true;
10012|    439|}
_ZNK3ada3url12get_protocolEv:
10341|   195k|[[nodiscard]] std::string url::get_protocol() const {
10342|   195k|  if (is_special()) {
  ------------------
  |  Branch (10342:7): [True: 195k, False: 623]
  ------------------
10343|   195k|    return helpers::concat(ada::scheme::details::is_special_list[type], ":");
10344|   195k|  }
10345|       |  // We only move the 'scheme' if it is non-special.
10346|    623|  return helpers::concat(non_special_scheme, ":");
10347|   195k|}
_ZNK3ada3url8get_hostEv:
10349|   195k|[[nodiscard]] std::string url::get_host() const {
10350|       |  // If url's host is null, then return the empty string.
10351|       |  // If url's port is null, return url's host, serialized.
10352|       |  // Return url's host, serialized, followed by U+003A (:) and url's port,
10353|       |  // serialized.
10354|   195k|  if (!host.has_value()) {
  ------------------
  |  Branch (10354:7): [True: 390, False: 195k]
  ------------------
10355|    390|    return "";
10356|    390|  }
10357|   195k|  if (port.has_value()) {
  ------------------
  |  Branch (10357:7): [True: 20.1k, False: 175k]
  ------------------
10358|  20.1k|    return host.value() + ":" + get_port();
10359|  20.1k|  }
10360|   175k|  return host.value();
10361|   195k|}
_ZNK3ada3url12get_hostnameEv:
10363|   195k|[[nodiscard]] std::string url::get_hostname() const {
10364|   195k|  return host.value_or("");
10365|   195k|}
_ZNK3ada3url10get_searchEv:
10367|   195k|[[nodiscard]] std::string url::get_search() const {
10368|       |  // If this's URL's query is either null or the empty string, then return the
10369|       |  // empty string. Return U+003F (?), followed by this's URL's query.
10370|   195k|  return (!query.has_value() || (query->empty())) ? "" : "?" + query.value();
  ------------------
  |  Branch (10370:11): [True: 162k, False: 33.2k]
  |  Branch (10370:33): [True: 1.09k, False: 32.1k]
  ------------------
10371|   195k|}
_ZNK3ada3url12get_usernameEv:
10373|   195k|[[nodiscard]] const std::string& url::get_username() const noexcept {
10374|   195k|  return username;
10375|   195k|}
_ZNK3ada3url12get_passwordEv:
10377|   195k|[[nodiscard]] const std::string& url::get_password() const noexcept {
10378|   195k|  return password;
10379|   195k|}
_ZNK3ada3url8get_portEv:
10381|   215k|[[nodiscard]] std::string url::get_port() const {
10382|   215k|  return port.has_value() ? std::to_string(port.value()) : "";
  ------------------
  |  Branch (10382:10): [True: 40.2k, False: 175k]
  ------------------
10383|   215k|}
_ZNK3ada3url8get_hashEv:
10385|   195k|[[nodiscard]] std::string url::get_hash() const {
10386|       |  // If this's URL's fragment is either null or the empty string, then return
10387|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
10388|   195k|  return (!hash.has_value() || (hash->empty())) ? "" : "#" + hash.value();
  ------------------
  |  Branch (10388:11): [True: 171k, False: 23.9k]
  |  Branch (10388:32): [True: 1.47k, False: 22.4k]
  ------------------
10389|   195k|}
_ZN3ada3url8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10679|   195k|bool url::set_href(const std::string_view input) {
10680|   195k|  ada::result<ada::url> out = ada::parse<ada::url>(input);
10681|       |
10682|   195k|  if (out) {
  ------------------
  |  Branch (10682:7): [True: 195k, False: 0]
  ------------------
10683|       |    // The parser enforces get_max_input_length() on both the input and the
10684|       |    // normalized result. This is a defense-in-depth check.
10685|   195k|    if (out->get_href_size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (10685:9): [True: 0, False: 195k]
  ------------------
10686|      0|      return false;
10687|      0|    }
10688|   195k|    *this = *out;
10689|   195k|  }
10690|       |
10691|   195k|  return out.has_value();
10692|   195k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11946|   432k|                                                result_type& out) {
11947|   432k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11948|   432k|  constexpr bool is_aggregator =
11949|   432k|      std::is_same_v<result_type, ada::url_aggregator>;
11950|   432k|  static_assert(is_ada_url || is_aggregator);
11951|       |
11952|   432k|  const size_t len = input.size();
11953|       |  // Shortest accepted form is "ws://x" (6).
11954|   432k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11954:7): [True: 10, False: 432k]
  ------------------
11955|     10|    return false;
11956|     10|  }
11957|   432k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11958|       |
11959|   432k|  size_t pos = 0;
11960|   432k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11961|   432k|  uint32_t protocol_end = 0;
11962|   432k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11963|   432k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11964|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11965|       |  // Masked compares cover the shorter special schemes without extra loads.
11966|   432k|  if (len >= 8) {
  ------------------
  |  Branch (11966:7): [True: 432k, False: 162]
  ------------------
11967|   432k|    uint64_t first8 = 0;
11968|   432k|    std::memcpy(&first8, b, 8);
11969|   432k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11969:9): [True: 339k, False: 92.7k]
  ------------------
11970|   339k|      pos = 8;
11971|   339k|      scheme_type = ada::scheme::type::HTTPS;
11972|   339k|      protocol_end = 6;
11973|   339k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11973:16): [True: 86.1k, False: 6.55k]
  ------------------
11974|  92.7k|               0x002f2f3a70747468ull) {  // "http://"
11975|  86.1k|      pos = 7;
11976|  86.1k|      scheme_type = ada::scheme::type::HTTP;
11977|  86.1k|      protocol_end = 5;
11978|  86.1k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11978:16): [True: 13, False: 6.54k]
  ------------------
11979|  6.55k|               0x00002f2f3a737377ull) {  // "wss://"
11980|     13|      pos = 6;
11981|     13|      scheme_type = ada::scheme::type::WSS;
11982|     13|      protocol_end = 4;
11983|  6.54k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11983:16): [True: 56, False: 6.48k]
  ------------------
11984|  6.54k|               0x00002f2f3a707466ull) {  // "ftp://"
11985|     56|      pos = 6;
11986|     56|      scheme_type = ada::scheme::type::FTP;
11987|     56|      protocol_end = 4;
11988|  6.48k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11988:16): [True: 170, False: 6.31k]
  ------------------
11989|  6.48k|               0x0000002f2f3a7377ull) {  // "ws://"
11990|    170|      pos = 5;
11991|    170|      scheme_type = ada::scheme::type::WS;
11992|    170|      protocol_end = 3;
11993|  6.31k|    } else {
11994|  6.31k|      return false;
11995|  6.31k|    }
11996|   432k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (11996:14): [True: 25, False: 137]
  |  Branch (11996:29): [True: 11, False: 14]
  ------------------
11997|     11|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (11997:9): [True: 2, False: 9]
  |  Branch (11997:24): [True: 2, False: 0]
  |  Branch (11997:39): [True: 2, False: 0]
  ------------------
11998|      2|      pos = 5;
11999|      2|      scheme_type = ada::scheme::type::WS;
12000|      2|      protocol_end = 3;
12001|      9|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12001:16): [True: 2, False: 7]
  |  Branch (12001:31): [True: 0, False: 2]
  |  Branch (12001:46): [True: 0, False: 0]
  |  Branch (12001:61): [True: 0, False: 0]
  ------------------
12002|      0|      pos = 6;
12003|      0|      scheme_type = ada::scheme::type::WSS;
12004|      0|      protocol_end = 4;
12005|      9|    } else {
12006|      9|      return false;
12007|      9|    }
12008|    151|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12008:14): [True: 36, False: 115]
  |  Branch (12008:29): [True: 20, False: 16]
  |  Branch (12008:44): [True: 6, False: 14]
  |  Branch (12008:59): [True: 0, False: 6]
  ------------------
12009|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12009:14): [True: 0, False: 0]
  |  Branch (12009:29): [True: 0, False: 0]
  ------------------
12010|      0|    pos = 6;
12011|      0|    scheme_type = ada::scheme::type::FTP;
12012|      0|    protocol_end = 4;
12013|    151|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12013:14): [True: 121, False: 30]
  |  Branch (12013:26): [True: 68, False: 53]
  |  Branch (12013:41): [True: 57, False: 11]
  |  Branch (12013:56): [True: 42, False: 15]
  ------------------
12014|     42|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12014:14): [True: 31, False: 11]
  |  Branch (12014:29): [True: 18, False: 13]
  |  Branch (12014:44): [True: 12, False: 6]
  |  Branch (12014:59): [True: 2, False: 10]
  ------------------
12015|      2|    pos = 7;
12016|      2|    scheme_type = ada::scheme::type::HTTP;
12017|      2|    protocol_end = 5;
12018|    149|  } else {
12019|    149|    return false;
12020|    149|  }
12021|       |#else
12022|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12023|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12024|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12025|       |    pos = 8;
12026|       |    scheme_type = ada::scheme::type::HTTPS;
12027|       |    protocol_end = 6;
12028|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12029|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12030|       |    pos = 7;
12031|       |    scheme_type = ada::scheme::type::HTTP;
12032|       |    protocol_end = 5;
12033|       |  } else if (b[0] == 'w' && b[1] == 's') {
12034|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12035|       |      pos = 5;
12036|       |      scheme_type = ada::scheme::type::WS;
12037|       |      protocol_end = 3;
12038|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12039|       |               b[5] == '/') {
12040|       |      pos = 6;
12041|       |      scheme_type = ada::scheme::type::WSS;
12042|       |      protocol_end = 4;
12043|       |    } else {
12044|       |      return false;
12045|       |    }
12046|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12047|       |             b[4] == '/' && b[5] == '/') {
12048|       |    pos = 6;
12049|       |    scheme_type = ada::scheme::type::FTP;
12050|       |    protocol_end = 4;
12051|       |  } else {
12052|       |    return false;
12053|       |  }
12054|       |#endif
12055|   426k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12055:7): [True: 426k, False: 2]
  |  Branch (12055:21): [True: 120, False: 426k]
  |  Branch (12055:38): [True: 14, False: 426k]
  ------------------
12056|    134|    return false;
12057|    134|  }
12058|       |
12059|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12060|   426k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12060:7): [True: 426k, False: 2]
  |  Branch (12060:22): [True: 424k, False: 2.24k]
  |  Branch (12060:39): [True: 18, False: 424k]
  |  Branch (12060:57): [True: 6, False: 426k]
  ------------------
12061|     24|    return false;
12062|     24|  }
12063|       |
12064|   426k|  const size_t host_start = pos;
12065|   426k|  bool has_upper = false;
12066|   426k|  bool has_x = false;
12067|   426k|  size_t host_end = pos;
12068|   426k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12068:7): [True: 2.96k, False: 423k]
  ------------------
12069|  2.96k|    return false;
12070|  2.96k|  }
12071|   423k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12071:7): [True: 104, False: 423k]
  ------------------
12072|    104|    return false;
12073|    104|  }
12074|   423k|  const size_t host_len = host_end - host_start;
12075|   423k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12075:7): [True: 279, False: 422k]
  ------------------
12076|    279|    return false;
12077|    279|  }
12078|   422k|  {
12079|   422k|    std::string_view hv(input.data() + host_start, host_len);
12080|   422k|    char host_buf[256];
12081|   422k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12081:9): [True: 9.86k, False: 413k]
  ------------------
12082|  9.86k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12083|  9.86k|      unicode::to_lower_ascii(host_buf, host_len);
12084|  9.86k|      hv = std::string_view(host_buf, host_len);
12085|  9.86k|    }
12086|   422k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12086:9): [True: 18.6k, False: 404k]
  ------------------
12087|  18.6k|      return false;
12088|  18.6k|    }
12089|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12090|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12091|   404k|    static constexpr std::string_view xn{"xn-", 3};
12092|   404k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12092:10): [True: 369k, False: 35.0k]
  |  Branch (12092:19): [True: 416, False: 34.5k]
  |  Branch (12092:33): [True: 58.7k, False: 310k]
  ------------------
12093|  58.7k|        [[unlikely]] {
12094|  58.7k|      return false;
12095|  58.7k|    }
12096|   404k|  }
12097|       |
12098|   345k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12098:7): [True: 336k, False: 9.41k]
  |  Branch (12098:25): [True: 59.2k, False: 276k]
  ------------------
12099|  59.2k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12100|  59.2k|                                            protocol_end, host_start, host_end,
12101|  59.2k|                                            host_len, has_upper);
12102|  59.2k|  }
12103|       |
12104|   286k|  size_t i = host_end;
12105|   286k|  size_t path_start = host_end;
12106|   286k|  size_t path_end = host_end;
12107|   286k|  size_t query_start = std::string_view::npos;
12108|   286k|  size_t hash_start = std::string_view::npos;
12109|   286k|  bool has_path = false;
12110|   286k|  bool maybe_dot_segment = false;
12111|   286k|  bool rest_simple = true;
12112|       |
12113|   286k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12113:7): [True: 276k, False: 9.41k]
  |  Branch (12113:18): [True: 258k, False: 18.8k]
  ------------------
12114|   258k|    has_path = true;
12115|   258k|    path_start = i;
12116|   258k|    ++i;
12117|   258k|    scan_path_run(b, i, len, maybe_dot_segment);
12118|   258k|    if (i < len) {
  ------------------
  |  Branch (12118:9): [True: 108k, False: 149k]
  ------------------
12119|   108k|      const uint8_t cls = k_path[b[i]];
12120|   108k|      if (cls == 1) {
  ------------------
  |  Branch (12120:11): [True: 96.2k, False: 11.7k]
  ------------------
12121|  96.2k|        path_end = i;
12122|  96.2k|        if (b[i] == '?') {
  ------------------
  |  Branch (12122:13): [True: 76.9k, False: 19.2k]
  ------------------
12123|  76.9k|          query_start = i;
12124|  76.9k|          ++i;
12125|  76.9k|          goto scan_query;
12126|  76.9k|        }
12127|  19.2k|        hash_start = i;
12128|  19.2k|        ++i;
12129|  19.2k|        goto scan_hash;
12130|  96.2k|      }
12131|  11.7k|      rest_simple = false;
12132|   264k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12132:14): [True: 253k, False: 10.6k]
  ------------------
12133|   253k|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 895, False: 252k]
  ------------------
12134|    895|          path_end = i;
12135|    895|          query_start = i;
12136|    895|          ++i;
12137|    895|          goto scan_query_boundary;
12138|    895|        }
12139|   252k|        if (b[i] == '#') {
  ------------------
  |  Branch (12139:13): [True: 226, False: 252k]
  ------------------
12140|    226|          path_end = i;
12141|    226|          hash_start = i;
12142|    226|          ++i;
12143|    226|          goto after_rest;
12144|    226|        }
12145|   252k|      }
12146|  10.6k|      path_end = i;
12147|  10.6k|      goto after_rest;
12148|  11.7k|    }
12149|   149k|    path_end = i;
12150|   149k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12150:14): [True: 18.8k, False: 9.41k]
  |  Branch (12150:25): [True: 9.52k, False: 9.34k]
  ------------------
12151|  9.52k|    query_start = i;
12152|  9.52k|    ++i;
12153|  9.52k|    goto scan_query;
12154|  18.7k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12154:14): [True: 9.34k, False: 9.41k]
  |  Branch (12154:25): [True: 9.34k, False: 0]
  ------------------
12155|  9.34k|    hash_start = i;
12156|  9.34k|    ++i;
12157|  9.34k|    goto scan_hash;
12158|  9.34k|  }
12159|   159k|  goto after_rest;
12160|       |
12161|   159k|scan_query:
12162|  86.4k|  scan_query_run(b, i, len);
12163|  86.4k|  if (i < len) {
  ------------------
  |  Branch (12163:7): [True: 30.1k, False: 56.3k]
  ------------------
12164|  30.1k|    if (b[i] == '#') {
  ------------------
  |  Branch (12164:9): [True: 29.9k, False: 150]
  ------------------
12165|  29.9k|      hash_start = i;
12166|  29.9k|      ++i;
12167|  29.9k|      goto scan_hash;
12168|  29.9k|    }
12169|    150|    rest_simple = false;
12170|    150|    goto scan_query_boundary;
12171|  30.1k|  }
12172|  56.3k|  goto after_rest;
12173|       |
12174|  56.3k|scan_query_boundary:
12175|  25.5k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12175:10): [True: 25.2k, False: 317]
  ------------------
12176|  25.2k|    if (b[i] == '#') {
  ------------------
  |  Branch (12176:9): [True: 728, False: 24.5k]
  ------------------
12177|    728|      hash_start = i;
12178|    728|      ++i;
12179|    728|      goto after_rest;
12180|    728|    }
12181|  25.2k|  }
12182|    317|  goto after_rest;
12183|       |
12184|  58.6k|scan_hash:
12185|  58.6k|  scan_hash_run(b, i, len);
12186|  58.6k|  if (i < len) {
  ------------------
  |  Branch (12186:7): [True: 90, False: 58.5k]
  ------------------
12187|     90|    rest_simple = false;
12188|     90|  }
12189|       |
12190|   286k|after_rest:
12191|   286k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12191:7): [True: 274k, False: 12.0k]
  |  Branch (12191:22): [True: 9.93k, False: 264k]
  ------------------
12192|  9.93k|    const std::string_view path_body(input.data() + path_start,
12193|  9.93k|                                     path_end - path_start);
12194|  9.93k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12194:9): [True: 9.56k, False: 368]
  ------------------
12195|  9.56k|      rest_simple = false;
12196|  9.56k|    }
12197|  9.93k|  }
12198|       |
12199|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12200|       |  // trailing C0 control or space; this fast path does neither. A query or
12201|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12202|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12203|       |  // inputs back to the slow path.
12204|   286k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12204:7): [True: 21.5k, False: 264k]
  |  Branch (12204:24): [True: 32, False: 21.5k]
  ------------------
12205|  21.5k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12205:24): [True: 78, False: 21.4k]
  ------------------
12206|    110|    return false;
12207|    110|  }
12208|       |
12209|   286k|  out.type = scheme_type;
12210|   286k|  out.is_valid = true;
12211|   286k|  out.has_opaque_path = false;
12212|   286k|  out.host_type = DEFAULT;
12213|       |
12214|   286k|  if (!rest_simple) {
  ------------------
  |  Branch (12214:7): [True: 21.4k, False: 264k]
  ------------------
12215|       |    // Host is a plain domain. Finish path/query/hash with
12216|       |    // the regular helpers
12217|       |    // so percent-encoding and dot segments do not re-parse the authority.
12218|  21.4k|    const std::string_view path_view =
12219|  21.4k|        has_path
  ------------------
  |  Branch (12219:9): [True: 21.3k, False: 158]
  ------------------
12220|  21.4k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12221|  21.4k|            : std::string_view{};
12222|  21.4k|    auto apply_query_and_hash = [&]() {
12223|  21.4k|      if (query_start != std::string_view::npos) {
12224|  21.4k|        const size_t q_end =
12225|  21.4k|            (hash_start != std::string_view::npos) ? hash_start : len;
12226|  21.4k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|  21.4k|                                                q_end - query_start - 1),
12228|  21.4k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|  21.4k|      }
12230|  21.4k|      if (hash_start != std::string_view::npos) {
12231|  21.4k|        out.update_unencoded_base_hash(std::string_view(
12232|  21.4k|            input.data() + hash_start + 1, len - hash_start - 1));
12233|  21.4k|      }
12234|  21.4k|    };
12235|       |    if constexpr (is_aggregator) {
12236|       |      out.buffer.assign(input.substr(0, host_end));
12237|       |      if (has_upper) {
12238|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12239|       |      }
12240|       |      out.components.protocol_end = protocol_end;
12241|       |      out.components.username_end = protocol_end + 2;
12242|       |      out.components.host_start = protocol_end + 2;
12243|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12244|       |      out.components.port = url_components::omitted;
12245|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12246|       |      out.components.search_start = url_components::omitted;
12247|       |      out.components.hash_start = url_components::omitted;
12248|       |      out.parse_path(path_view);
12249|       |      apply_query_and_hash();
12250|  21.4k|    } else {
12251|  21.4k|      std::string host_str(input.substr(host_start, host_len));
12252|  21.4k|      if (has_upper) {
  ------------------
  |  Branch (12252:11): [True: 169, False: 21.3k]
  ------------------
12253|    169|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12254|    169|      }
12255|  21.4k|      out.host = std::move(host_str);
12256|  21.4k|      out.parse_path(path_view);
12257|  21.4k|      apply_query_and_hash();
12258|  21.4k|    }
12259|  21.4k|    return true;
12260|  21.4k|  }
12261|       |
12262|   264k|  const bool need_slash = !has_path;
12263|       |  if constexpr (is_aggregator) {
12264|       |    if (!need_slash) {
12265|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12266|       |      out.buffer.assign(input);
12267|       |      if (has_upper) {
12268|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12269|       |      }
12270|       |      out.components.protocol_end = protocol_end;
12271|       |      out.components.username_end = protocol_end + 2;
12272|       |      out.components.host_start = protocol_end + 2;
12273|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12274|       |      out.components.port = url_components::omitted;
12275|       |      out.components.pathname_start = static_cast<uint32_t>(path_start);
12276|       |      out.components.search_start = (query_start != std::string_view::npos)
12277|       |                                        ? static_cast<uint32_t>(query_start)
12278|       |                                        : url_components::omitted;
12279|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12280|       |                                      ? static_cast<uint32_t>(hash_start)
12281|       |                                      : url_components::omitted;
12282|       |    } else {
12283|       |      out.buffer.clear();
12284|       |      out.buffer.reserve(len + 1);
12285|       |      out.buffer.append(input.substr(0, host_end));
12286|       |      out.buffer.push_back('/');
12287|       |      if (host_end < len) {
12288|       |        out.buffer.append(input.substr(host_end));
12289|       |      }
12290|       |      if (has_upper) {
12291|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12292|       |      }
12293|       |      out.components.protocol_end = protocol_end;
12294|       |      out.components.username_end = protocol_end + 2;
12295|       |      out.components.host_start = protocol_end + 2;
12296|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12297|       |      out.components.port = url_components::omitted;
12298|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12299|       |      out.components.search_start = (query_start != std::string_view::npos)
12300|       |                                        ? static_cast<uint32_t>(query_start + 1)
12301|       |                                        : url_components::omitted;
12302|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12303|       |                                      ? static_cast<uint32_t>(hash_start + 1)
12304|       |                                      : url_components::omitted;
12305|       |    }
12306|   264k|  } else {
12307|   264k|    std::string host_str(input.substr(host_start, host_len));
12308|   264k|    if (has_upper) {
  ------------------
  |  Branch (12308:9): [True: 9.34k, False: 255k]
  ------------------
12309|  9.34k|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12310|  9.34k|    }
12311|   264k|    out.host = std::move(host_str);
12312|   264k|    if (need_slash) {
  ------------------
  |  Branch (12312:9): [True: 28.0k, False: 236k]
  ------------------
12313|  28.0k|      out.path = "/";
12314|   236k|    } else {
12315|   236k|      out.path.assign(input.data() + path_start, path_end - path_start);
12316|   236k|    }
12317|   264k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12317:9): [True: 86.1k, False: 178k]
  ------------------
12318|  86.1k|      const size_t q_end =
12319|  86.1k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12319:11): [True: 29.8k, False: 56.3k]
  ------------------
12320|  86.1k|      out.query.emplace(input.data() + query_start + 1,
12321|  86.1k|                        q_end - query_start - 1);
12322|  86.1k|    }
12323|   264k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12323:9): [True: 58.3k, False: 206k]
  ------------------
12324|  58.3k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12325|  58.3k|    }
12326|   264k|  }
12327|   264k|  return true;
12328|   286k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11946|   432k|                                                result_type& out) {
11947|   432k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11948|   432k|  constexpr bool is_aggregator =
11949|   432k|      std::is_same_v<result_type, ada::url_aggregator>;
11950|   432k|  static_assert(is_ada_url || is_aggregator);
11951|       |
11952|   432k|  const size_t len = input.size();
11953|       |  // Shortest accepted form is "ws://x" (6).
11954|   432k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11954:7): [True: 10, False: 432k]
  ------------------
11955|     10|    return false;
11956|     10|  }
11957|   432k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11958|       |
11959|   432k|  size_t pos = 0;
11960|   432k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11961|   432k|  uint32_t protocol_end = 0;
11962|   432k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11963|   432k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11964|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11965|       |  // Masked compares cover the shorter special schemes without extra loads.
11966|   432k|  if (len >= 8) {
  ------------------
  |  Branch (11966:7): [True: 432k, False: 162]
  ------------------
11967|   432k|    uint64_t first8 = 0;
11968|   432k|    std::memcpy(&first8, b, 8);
11969|   432k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11969:9): [True: 339k, False: 92.7k]
  ------------------
11970|   339k|      pos = 8;
11971|   339k|      scheme_type = ada::scheme::type::HTTPS;
11972|   339k|      protocol_end = 6;
11973|   339k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11973:16): [True: 86.1k, False: 6.55k]
  ------------------
11974|  92.7k|               0x002f2f3a70747468ull) {  // "http://"
11975|  86.1k|      pos = 7;
11976|  86.1k|      scheme_type = ada::scheme::type::HTTP;
11977|  86.1k|      protocol_end = 5;
11978|  86.1k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11978:16): [True: 13, False: 6.54k]
  ------------------
11979|  6.55k|               0x00002f2f3a737377ull) {  // "wss://"
11980|     13|      pos = 6;
11981|     13|      scheme_type = ada::scheme::type::WSS;
11982|     13|      protocol_end = 4;
11983|  6.54k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11983:16): [True: 56, False: 6.48k]
  ------------------
11984|  6.54k|               0x00002f2f3a707466ull) {  // "ftp://"
11985|     56|      pos = 6;
11986|     56|      scheme_type = ada::scheme::type::FTP;
11987|     56|      protocol_end = 4;
11988|  6.48k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11988:16): [True: 170, False: 6.31k]
  ------------------
11989|  6.48k|               0x0000002f2f3a7377ull) {  // "ws://"
11990|    170|      pos = 5;
11991|    170|      scheme_type = ada::scheme::type::WS;
11992|    170|      protocol_end = 3;
11993|  6.31k|    } else {
11994|  6.31k|      return false;
11995|  6.31k|    }
11996|   432k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (11996:14): [True: 25, False: 137]
  |  Branch (11996:29): [True: 11, False: 14]
  ------------------
11997|     11|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (11997:9): [True: 2, False: 9]
  |  Branch (11997:24): [True: 2, False: 0]
  |  Branch (11997:39): [True: 2, False: 0]
  ------------------
11998|      2|      pos = 5;
11999|      2|      scheme_type = ada::scheme::type::WS;
12000|      2|      protocol_end = 3;
12001|      9|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12001:16): [True: 2, False: 7]
  |  Branch (12001:31): [True: 0, False: 2]
  |  Branch (12001:46): [True: 0, False: 0]
  |  Branch (12001:61): [True: 0, False: 0]
  ------------------
12002|      0|      pos = 6;
12003|      0|      scheme_type = ada::scheme::type::WSS;
12004|      0|      protocol_end = 4;
12005|      9|    } else {
12006|      9|      return false;
12007|      9|    }
12008|    151|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12008:14): [True: 36, False: 115]
  |  Branch (12008:29): [True: 20, False: 16]
  |  Branch (12008:44): [True: 6, False: 14]
  |  Branch (12008:59): [True: 0, False: 6]
  ------------------
12009|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12009:14): [True: 0, False: 0]
  |  Branch (12009:29): [True: 0, False: 0]
  ------------------
12010|      0|    pos = 6;
12011|      0|    scheme_type = ada::scheme::type::FTP;
12012|      0|    protocol_end = 4;
12013|    151|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12013:14): [True: 121, False: 30]
  |  Branch (12013:26): [True: 68, False: 53]
  |  Branch (12013:41): [True: 57, False: 11]
  |  Branch (12013:56): [True: 42, False: 15]
  ------------------
12014|     42|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12014:14): [True: 31, False: 11]
  |  Branch (12014:29): [True: 18, False: 13]
  |  Branch (12014:44): [True: 12, False: 6]
  |  Branch (12014:59): [True: 2, False: 10]
  ------------------
12015|      2|    pos = 7;
12016|      2|    scheme_type = ada::scheme::type::HTTP;
12017|      2|    protocol_end = 5;
12018|    149|  } else {
12019|    149|    return false;
12020|    149|  }
12021|       |#else
12022|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12023|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12024|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12025|       |    pos = 8;
12026|       |    scheme_type = ada::scheme::type::HTTPS;
12027|       |    protocol_end = 6;
12028|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12029|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12030|       |    pos = 7;
12031|       |    scheme_type = ada::scheme::type::HTTP;
12032|       |    protocol_end = 5;
12033|       |  } else if (b[0] == 'w' && b[1] == 's') {
12034|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12035|       |      pos = 5;
12036|       |      scheme_type = ada::scheme::type::WS;
12037|       |      protocol_end = 3;
12038|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12039|       |               b[5] == '/') {
12040|       |      pos = 6;
12041|       |      scheme_type = ada::scheme::type::WSS;
12042|       |      protocol_end = 4;
12043|       |    } else {
12044|       |      return false;
12045|       |    }
12046|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12047|       |             b[4] == '/' && b[5] == '/') {
12048|       |    pos = 6;
12049|       |    scheme_type = ada::scheme::type::FTP;
12050|       |    protocol_end = 4;
12051|       |  } else {
12052|       |    return false;
12053|       |  }
12054|       |#endif
12055|   426k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12055:7): [True: 426k, False: 2]
  |  Branch (12055:21): [True: 120, False: 426k]
  |  Branch (12055:38): [True: 14, False: 426k]
  ------------------
12056|    134|    return false;
12057|    134|  }
12058|       |
12059|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12060|   426k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12060:7): [True: 426k, False: 2]
  |  Branch (12060:22): [True: 424k, False: 2.24k]
  |  Branch (12060:39): [True: 18, False: 424k]
  |  Branch (12060:57): [True: 6, False: 426k]
  ------------------
12061|     24|    return false;
12062|     24|  }
12063|       |
12064|   426k|  const size_t host_start = pos;
12065|   426k|  bool has_upper = false;
12066|   426k|  bool has_x = false;
12067|   426k|  size_t host_end = pos;
12068|   426k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12068:7): [True: 2.96k, False: 423k]
  ------------------
12069|  2.96k|    return false;
12070|  2.96k|  }
12071|   423k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12071:7): [True: 104, False: 423k]
  ------------------
12072|    104|    return false;
12073|    104|  }
12074|   423k|  const size_t host_len = host_end - host_start;
12075|   423k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12075:7): [True: 279, False: 422k]
  ------------------
12076|    279|    return false;
12077|    279|  }
12078|   422k|  {
12079|   422k|    std::string_view hv(input.data() + host_start, host_len);
12080|   422k|    char host_buf[256];
12081|   422k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12081:9): [True: 9.86k, False: 413k]
  ------------------
12082|  9.86k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12083|  9.86k|      unicode::to_lower_ascii(host_buf, host_len);
12084|  9.86k|      hv = std::string_view(host_buf, host_len);
12085|  9.86k|    }
12086|   422k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12086:9): [True: 18.6k, False: 404k]
  ------------------
12087|  18.6k|      return false;
12088|  18.6k|    }
12089|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12090|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12091|   404k|    static constexpr std::string_view xn{"xn-", 3};
12092|   404k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12092:10): [True: 369k, False: 35.0k]
  |  Branch (12092:19): [True: 416, False: 34.5k]
  |  Branch (12092:33): [True: 58.7k, False: 310k]
  ------------------
12093|  58.7k|        [[unlikely]] {
12094|  58.7k|      return false;
12095|  58.7k|    }
12096|   404k|  }
12097|       |
12098|   345k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12098:7): [True: 336k, False: 9.41k]
  |  Branch (12098:25): [True: 59.2k, False: 276k]
  ------------------
12099|  59.2k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12100|  59.2k|                                            protocol_end, host_start, host_end,
12101|  59.2k|                                            host_len, has_upper);
12102|  59.2k|  }
12103|       |
12104|   286k|  size_t i = host_end;
12105|   286k|  size_t path_start = host_end;
12106|   286k|  size_t path_end = host_end;
12107|   286k|  size_t query_start = std::string_view::npos;
12108|   286k|  size_t hash_start = std::string_view::npos;
12109|   286k|  bool has_path = false;
12110|   286k|  bool maybe_dot_segment = false;
12111|   286k|  bool rest_simple = true;
12112|       |
12113|   286k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12113:7): [True: 276k, False: 9.41k]
  |  Branch (12113:18): [True: 258k, False: 18.8k]
  ------------------
12114|   258k|    has_path = true;
12115|   258k|    path_start = i;
12116|   258k|    ++i;
12117|   258k|    scan_path_run(b, i, len, maybe_dot_segment);
12118|   258k|    if (i < len) {
  ------------------
  |  Branch (12118:9): [True: 108k, False: 149k]
  ------------------
12119|   108k|      const uint8_t cls = k_path[b[i]];
12120|   108k|      if (cls == 1) {
  ------------------
  |  Branch (12120:11): [True: 96.2k, False: 11.7k]
  ------------------
12121|  96.2k|        path_end = i;
12122|  96.2k|        if (b[i] == '?') {
  ------------------
  |  Branch (12122:13): [True: 76.9k, False: 19.2k]
  ------------------
12123|  76.9k|          query_start = i;
12124|  76.9k|          ++i;
12125|  76.9k|          goto scan_query;
12126|  76.9k|        }
12127|  19.2k|        hash_start = i;
12128|  19.2k|        ++i;
12129|  19.2k|        goto scan_hash;
12130|  96.2k|      }
12131|  11.7k|      rest_simple = false;
12132|   264k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12132:14): [True: 253k, False: 10.6k]
  ------------------
12133|   253k|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 895, False: 252k]
  ------------------
12134|    895|          path_end = i;
12135|    895|          query_start = i;
12136|    895|          ++i;
12137|    895|          goto scan_query_boundary;
12138|    895|        }
12139|   252k|        if (b[i] == '#') {
  ------------------
  |  Branch (12139:13): [True: 226, False: 252k]
  ------------------
12140|    226|          path_end = i;
12141|    226|          hash_start = i;
12142|    226|          ++i;
12143|    226|          goto after_rest;
12144|    226|        }
12145|   252k|      }
12146|  10.6k|      path_end = i;
12147|  10.6k|      goto after_rest;
12148|  11.7k|    }
12149|   149k|    path_end = i;
12150|   149k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12150:14): [True: 18.8k, False: 9.41k]
  |  Branch (12150:25): [True: 9.52k, False: 9.34k]
  ------------------
12151|  9.52k|    query_start = i;
12152|  9.52k|    ++i;
12153|  9.52k|    goto scan_query;
12154|  18.7k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12154:14): [True: 9.34k, False: 9.41k]
  |  Branch (12154:25): [True: 9.34k, False: 0]
  ------------------
12155|  9.34k|    hash_start = i;
12156|  9.34k|    ++i;
12157|  9.34k|    goto scan_hash;
12158|  9.34k|  }
12159|   159k|  goto after_rest;
12160|       |
12161|   159k|scan_query:
12162|  86.4k|  scan_query_run(b, i, len);
12163|  86.4k|  if (i < len) {
  ------------------
  |  Branch (12163:7): [True: 30.1k, False: 56.3k]
  ------------------
12164|  30.1k|    if (b[i] == '#') {
  ------------------
  |  Branch (12164:9): [True: 29.9k, False: 150]
  ------------------
12165|  29.9k|      hash_start = i;
12166|  29.9k|      ++i;
12167|  29.9k|      goto scan_hash;
12168|  29.9k|    }
12169|    150|    rest_simple = false;
12170|    150|    goto scan_query_boundary;
12171|  30.1k|  }
12172|  56.3k|  goto after_rest;
12173|       |
12174|  56.3k|scan_query_boundary:
12175|  25.5k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12175:10): [True: 25.2k, False: 317]
  ------------------
12176|  25.2k|    if (b[i] == '#') {
  ------------------
  |  Branch (12176:9): [True: 728, False: 24.5k]
  ------------------
12177|    728|      hash_start = i;
12178|    728|      ++i;
12179|    728|      goto after_rest;
12180|    728|    }
12181|  25.2k|  }
12182|    317|  goto after_rest;
12183|       |
12184|  58.6k|scan_hash:
12185|  58.6k|  scan_hash_run(b, i, len);
12186|  58.6k|  if (i < len) {
  ------------------
  |  Branch (12186:7): [True: 90, False: 58.5k]
  ------------------
12187|     90|    rest_simple = false;
12188|     90|  }
12189|       |
12190|   286k|after_rest:
12191|   286k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12191:7): [True: 274k, False: 12.0k]
  |  Branch (12191:22): [True: 9.93k, False: 264k]
  ------------------
12192|  9.93k|    const std::string_view path_body(input.data() + path_start,
12193|  9.93k|                                     path_end - path_start);
12194|  9.93k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12194:9): [True: 9.56k, False: 368]
  ------------------
12195|  9.56k|      rest_simple = false;
12196|  9.56k|    }
12197|  9.93k|  }
12198|       |
12199|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12200|       |  // trailing C0 control or space; this fast path does neither. A query or
12201|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12202|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12203|       |  // inputs back to the slow path.
12204|   286k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12204:7): [True: 21.5k, False: 264k]
  |  Branch (12204:24): [True: 32, False: 21.5k]
  ------------------
12205|  21.5k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12205:24): [True: 78, False: 21.4k]
  ------------------
12206|    110|    return false;
12207|    110|  }
12208|       |
12209|   286k|  out.type = scheme_type;
12210|   286k|  out.is_valid = true;
12211|   286k|  out.has_opaque_path = false;
12212|   286k|  out.host_type = DEFAULT;
12213|       |
12214|   286k|  if (!rest_simple) {
  ------------------
  |  Branch (12214:7): [True: 21.4k, False: 264k]
  ------------------
12215|       |    // Host is a plain domain. Finish path/query/hash with
12216|       |    // the regular helpers
12217|       |    // so percent-encoding and dot segments do not re-parse the authority.
12218|  21.4k|    const std::string_view path_view =
12219|  21.4k|        has_path
  ------------------
  |  Branch (12219:9): [True: 21.3k, False: 158]
  ------------------
12220|  21.4k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12221|  21.4k|            : std::string_view{};
12222|  21.4k|    auto apply_query_and_hash = [&]() {
12223|  21.4k|      if (query_start != std::string_view::npos) {
12224|  21.4k|        const size_t q_end =
12225|  21.4k|            (hash_start != std::string_view::npos) ? hash_start : len;
12226|  21.4k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|  21.4k|                                                q_end - query_start - 1),
12228|  21.4k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|  21.4k|      }
12230|  21.4k|      if (hash_start != std::string_view::npos) {
12231|  21.4k|        out.update_unencoded_base_hash(std::string_view(
12232|  21.4k|            input.data() + hash_start + 1, len - hash_start - 1));
12233|  21.4k|      }
12234|  21.4k|    };
12235|  21.4k|    if constexpr (is_aggregator) {
12236|  21.4k|      out.buffer.assign(input.substr(0, host_end));
12237|  21.4k|      if (has_upper) {
  ------------------
  |  Branch (12237:11): [True: 169, False: 21.3k]
  ------------------
12238|    169|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12239|    169|      }
12240|  21.4k|      out.components.protocol_end = protocol_end;
12241|  21.4k|      out.components.username_end = protocol_end + 2;
12242|  21.4k|      out.components.host_start = protocol_end + 2;
12243|  21.4k|      out.components.host_end = static_cast<uint32_t>(host_end);
12244|  21.4k|      out.components.port = url_components::omitted;
12245|  21.4k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12246|  21.4k|      out.components.search_start = url_components::omitted;
12247|  21.4k|      out.components.hash_start = url_components::omitted;
12248|  21.4k|      out.parse_path(path_view);
12249|  21.4k|      apply_query_and_hash();
12250|       |    } else {
12251|       |      std::string host_str(input.substr(host_start, host_len));
12252|       |      if (has_upper) {
12253|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12254|       |      }
12255|       |      out.host = std::move(host_str);
12256|       |      out.parse_path(path_view);
12257|       |      apply_query_and_hash();
12258|       |    }
12259|  21.4k|    return true;
12260|  21.4k|  }
12261|       |
12262|   264k|  const bool need_slash = !has_path;
12263|   264k|  if constexpr (is_aggregator) {
12264|   264k|    if (!need_slash) {
  ------------------
  |  Branch (12264:9): [True: 236k, False: 28.0k]
  ------------------
12265|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12266|   236k|      out.buffer.assign(input);
12267|   236k|      if (has_upper) {
  ------------------
  |  Branch (12267:11): [True: 9.25k, False: 227k]
  ------------------
12268|  9.25k|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12269|  9.25k|      }
12270|   236k|      out.components.protocol_end = protocol_end;
12271|   236k|      out.components.username_end = protocol_end + 2;
12272|   236k|      out.components.host_start = protocol_end + 2;
12273|   236k|      out.components.host_end = static_cast<uint32_t>(host_end);
12274|   236k|      out.components.port = url_components::omitted;
12275|   236k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12276|   236k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12276:37): [True: 76.7k, False: 159k]
  ------------------
12277|   236k|                                        ? static_cast<uint32_t>(query_start)
12278|   236k|                                        : url_components::omitted;
12279|   236k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12279:35): [True: 48.9k, False: 187k]
  ------------------
12280|   236k|                                      ? static_cast<uint32_t>(hash_start)
12281|   236k|                                      : url_components::omitted;
12282|   236k|    } else {
12283|  28.0k|      out.buffer.clear();
12284|  28.0k|      out.buffer.reserve(len + 1);
12285|  28.0k|      out.buffer.append(input.substr(0, host_end));
12286|  28.0k|      out.buffer.push_back('/');
12287|  28.0k|      if (host_end < len) {
  ------------------
  |  Branch (12287:11): [True: 18.6k, False: 9.41k]
  ------------------
12288|  18.6k|        out.buffer.append(input.substr(host_end));
12289|  18.6k|      }
12290|  28.0k|      if (has_upper) {
  ------------------
  |  Branch (12290:11): [True: 86, False: 28.0k]
  ------------------
12291|     86|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12292|     86|      }
12293|  28.0k|      out.components.protocol_end = protocol_end;
12294|  28.0k|      out.components.username_end = protocol_end + 2;
12295|  28.0k|      out.components.host_start = protocol_end + 2;
12296|  28.0k|      out.components.host_end = static_cast<uint32_t>(host_end);
12297|  28.0k|      out.components.port = url_components::omitted;
12298|  28.0k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12299|  28.0k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12299:37): [True: 9.39k, False: 18.6k]
  ------------------
12300|  28.0k|                                        ? static_cast<uint32_t>(query_start + 1)
12301|  28.0k|                                        : url_components::omitted;
12302|  28.0k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12302:35): [True: 9.39k, False: 18.6k]
  ------------------
12303|  28.0k|                                      ? static_cast<uint32_t>(hash_start + 1)
12304|  28.0k|                                      : url_components::omitted;
12305|  28.0k|    }
12306|       |  } else {
12307|       |    std::string host_str(input.substr(host_start, host_len));
12308|       |    if (has_upper) {
12309|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12310|       |    }
12311|       |    out.host = std::move(host_str);
12312|       |    if (need_slash) {
12313|       |      out.path = "/";
12314|       |    } else {
12315|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12316|       |    }
12317|       |    if (query_start != std::string_view::npos) {
12318|       |      const size_t q_end =
12319|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12320|       |      out.query.emplace(input.data() + query_start + 1,
12321|       |                        q_end - query_start - 1);
12322|       |    }
12323|       |    if (hash_start != std::string_view::npos) {
12324|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12325|       |    }
12326|       |  }
12327|   264k|  return true;
12328|   286k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11674|  59.2k|    bool has_upper) {
11675|  59.2k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11676|  59.2k|  constexpr bool is_aggregator =
11677|  59.2k|      std::is_same_v<result_type, ada::url_aggregator>;
11678|  59.2k|  static_assert(is_ada_url || is_aggregator);
11679|       |
11680|  59.2k|  const size_t len = input.size();
11681|  59.2k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11682|  59.2k|  size_t p = host_end + 1;
11683|  59.2k|  uint32_t port_value = 0;
11684|  59.2k|  bool any_digit = false;
11685|   256k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11685:10): [True: 256k, False: 50]
  |  Branch (11685:21): [True: 197k, False: 58.9k]
  |  Branch (11685:36): [True: 197k, False: 254]
  ------------------
11686|   197k|    any_digit = true;
11687|   197k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11688|   197k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11688:9): [True: 17, False: 197k]
  ------------------
11689|     17|      return false;
11690|     17|    }
11691|   197k|    ++p;
11692|   197k|  }
11693|  59.2k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11693:7): [True: 59.2k, False: 50]
  |  Branch (11693:18): [True: 353, False: 58.8k]
  |  Branch (11693:33): [True: 269, False: 84]
  |  Branch (11693:48): [True: 218, False: 51]
  ------------------
11694|    218|    return false;
11695|    218|  }
11696|  59.0k|  uint32_t parsed_port = url_components::omitted;
11697|  59.0k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11698|  59.0k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11698:7): [True: 58.6k, False: 413]
  |  Branch (11698:20): [True: 58.6k, False: 4]
  ------------------
11699|  58.6k|    parsed_port = port_value;
11700|  58.6k|  }
11701|  59.0k|  const size_t authority_end = p;
11702|       |
11703|  59.0k|  size_t i = authority_end;
11704|  59.0k|  size_t path_start = host_end;
11705|  59.0k|  size_t path_end = host_end;
11706|  59.0k|  size_t query_start = std::string_view::npos;
11707|  59.0k|  size_t hash_start = std::string_view::npos;
11708|  59.0k|  bool has_path = false;
11709|  59.0k|  bool maybe_dot_segment = false;
11710|  59.0k|  bool rest_simple = true;
11711|       |
11712|  59.0k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11712:7): [True: 59.0k, False: 50]
  |  Branch (11712:18): [True: 58.8k, False: 135]
  ------------------
11713|  58.8k|    has_path = true;
11714|  58.8k|    path_start = i;
11715|  58.8k|    ++i;
11716|  58.8k|    scan_path_run(b, i, len, maybe_dot_segment);
11717|  58.8k|    if (i < len) {
  ------------------
  |  Branch (11717:9): [True: 3.13k, False: 55.7k]
  ------------------
11718|  3.13k|      const uint8_t cls = k_path[b[i]];
11719|  3.13k|      if (cls == 1) {
  ------------------
  |  Branch (11719:11): [True: 1.86k, False: 1.26k]
  ------------------
11720|  1.86k|        path_end = i;
11721|  1.86k|        if (b[i] == '?') {
  ------------------
  |  Branch (11721:13): [True: 1.48k, False: 376]
  ------------------
11722|  1.48k|          query_start = i;
11723|  1.48k|          ++i;
11724|  1.48k|          goto scan_query;
11725|  1.48k|        }
11726|    376|        hash_start = i;
11727|    376|        ++i;
11728|    376|        goto scan_hash;
11729|  1.86k|      }
11730|  1.26k|      rest_simple = false;
11731|  75.8k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11731:14): [True: 75.3k, False: 545]
  ------------------
11732|  75.3k|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 561, False: 74.7k]
  ------------------
11733|    561|          path_end = i;
11734|    561|          query_start = i;
11735|    561|          ++i;
11736|    561|          goto scan_query_boundary;
11737|    561|        }
11738|  74.7k|        if (b[i] == '#') {
  ------------------
  |  Branch (11738:13): [True: 159, False: 74.6k]
  ------------------
11739|    159|          path_end = i;
11740|    159|          hash_start = i;
11741|    159|          ++i;
11742|    159|          goto after_rest;
11743|    159|        }
11744|  74.7k|      }
11745|    545|      path_end = i;
11746|    545|      goto after_rest;
11747|  1.26k|    }
11748|  55.7k|    path_end = i;
11749|  55.7k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11749:14): [True: 135, False: 50]
  |  Branch (11749:25): [True: 84, False: 51]
  ------------------
11750|     84|    query_start = i;
11751|     84|    ++i;
11752|     84|    goto scan_query;
11753|    101|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11753:14): [True: 51, False: 50]
  |  Branch (11753:25): [True: 51, False: 0]
  ------------------
11754|     51|    hash_start = i;
11755|     51|    ++i;
11756|     51|    goto scan_hash;
11757|     51|  }
11758|  55.7k|  goto after_rest;
11759|       |
11760|  55.7k|scan_query:
11761|  1.57k|  scan_query_run(b, i, len);
11762|  1.57k|  if (i < len) {
  ------------------
  |  Branch (11762:7): [True: 1.24k, False: 326]
  ------------------
11763|  1.24k|    if (b[i] == '#') {
  ------------------
  |  Branch (11763:9): [True: 1.19k, False: 56]
  ------------------
11764|  1.19k|      hash_start = i;
11765|  1.19k|      ++i;
11766|  1.19k|      goto scan_hash;
11767|  1.19k|    }
11768|     56|    rest_simple = false;
11769|     56|    goto scan_query_boundary;
11770|  1.24k|  }
11771|    326|  goto after_rest;
11772|       |
11773|    617|scan_query_boundary:
11774|  10.8k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11774:10): [True: 10.6k, False: 228]
  ------------------
11775|  10.6k|    if (b[i] == '#') {
  ------------------
  |  Branch (11775:9): [True: 389, False: 10.2k]
  ------------------
11776|    389|      hash_start = i;
11777|    389|      ++i;
11778|    389|      goto after_rest;
11779|    389|    }
11780|  10.6k|  }
11781|    228|  goto after_rest;
11782|       |
11783|  1.61k|scan_hash:
11784|  1.61k|  scan_hash_run(b, i, len);
11785|  1.61k|  if (i < len) {
  ------------------
  |  Branch (11785:7): [True: 37, False: 1.58k]
  ------------------
11786|     37|    rest_simple = false;
11787|     37|  }
11788|       |
11789|  59.0k|after_rest:
11790|  59.0k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11790:7): [True: 57.6k, False: 1.35k]
  |  Branch (11790:22): [True: 354, False: 57.3k]
  ------------------
11791|    354|    const std::string_view path_body(input.data() + path_start,
11792|    354|                                     path_end - path_start);
11793|    354|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11793:9): [True: 313, False: 41]
  ------------------
11794|    313|      rest_simple = false;
11795|    313|    }
11796|    354|  }
11797|       |
11798|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11799|       |  // trailing C0 control or space; this fast path does neither. A query or
11800|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11801|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11802|       |  // inputs back to the slow path.
11803|  59.0k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11803:7): [True: 1.67k, False: 57.3k]
  |  Branch (11803:24): [True: 17, False: 1.65k]
  ------------------
11804|  1.65k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11804:24): [True: 36, False: 1.61k]
  ------------------
11805|     53|    return false;
11806|     53|  }
11807|       |
11808|  59.0k|  out.type = scheme_type;
11809|  59.0k|  out.is_valid = true;
11810|  59.0k|  out.has_opaque_path = false;
11811|  59.0k|  out.host_type = DEFAULT;
11812|       |
11813|  59.0k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11813:31): [True: 58.6k, False: 397]
  ------------------
11814|  59.0k|                                  ? (1 + port_decimal_digit_count(parsed_port))
11815|  59.0k|                                  : 0;
11816|       |
11817|  59.0k|  if (!rest_simple) {
  ------------------
  |  Branch (11817:7): [True: 1.61k, False: 57.3k]
  ------------------
11818|  1.61k|    const std::string_view path_view =
11819|  1.61k|        has_path
  ------------------
  |  Branch (11819:9): [True: 1.58k, False: 29]
  ------------------
11820|  1.61k|            ? std::string_view(input.data() + path_start, path_end - path_start)
11821|  1.61k|            : std::string_view{};
11822|  1.61k|    auto apply_query_and_hash = [&]() {
11823|  1.61k|      if (query_start != std::string_view::npos) {
11824|  1.61k|        const size_t q_end =
11825|  1.61k|            (hash_start != std::string_view::npos) ? hash_start : len;
11826|  1.61k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|  1.61k|                                                q_end - query_start - 1),
11828|  1.61k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|  1.61k|      }
11830|  1.61k|      if (hash_start != std::string_view::npos) {
11831|  1.61k|        out.update_unencoded_base_hash(std::string_view(
11832|  1.61k|            input.data() + hash_start + 1, len - hash_start - 1));
11833|  1.61k|      }
11834|  1.61k|    };
11835|       |    if constexpr (is_aggregator) {
11836|       |      out.buffer.assign(input.substr(0, host_end));
11837|       |      if (parsed_port != url_components::omitted) {
11838|       |        append_canonical_port(out.buffer, parsed_port);
11839|       |      }
11840|       |      if (has_upper) {
11841|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11842|       |      }
11843|       |      out.components.protocol_end = protocol_end;
11844|       |      out.components.username_end = protocol_end + 2;
11845|       |      out.components.host_start = protocol_end + 2;
11846|       |      out.components.host_end = static_cast<uint32_t>(host_end);
11847|       |      out.components.port = parsed_port;
11848|       |      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11849|       |      out.components.search_start = url_components::omitted;
11850|       |      out.components.hash_start = url_components::omitted;
11851|       |      out.parse_path(path_view);
11852|       |      apply_query_and_hash();
11853|  1.61k|    } else {
11854|  1.61k|      std::string host_str(input.substr(host_start, host_len));
11855|  1.61k|      if (has_upper) {
  ------------------
  |  Branch (11855:11): [True: 89, False: 1.52k]
  ------------------
11856|     89|        unicode::to_lower_ascii(host_str.data(), host_str.size());
11857|     89|      }
11858|  1.61k|      out.host = std::move(host_str);
11859|  1.61k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11859:11): [True: 1.27k, False: 342]
  ------------------
11860|  1.27k|        out.port = static_cast<uint16_t>(parsed_port);
11861|  1.27k|      }
11862|  1.61k|      out.parse_path(path_view);
11863|  1.61k|      apply_query_and_hash();
11864|  1.61k|    }
11865|  1.61k|    return true;
11866|  1.61k|  }
11867|       |
11868|  57.3k|  const bool insert_slash = !has_path;
11869|       |  if constexpr (is_aggregator) {
11870|       |    const size_t out_len =
11871|       |        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
11872|       |    const bool omit_port_bytes = parsed_port == url_components::omitted;
11873|       |    if (out_len == len && !insert_slash && !omit_port_bytes) {
11874|       |      out.buffer.assign(input);
11875|       |    } else {
11876|       |      out.buffer.clear();
11877|       |      out.buffer.reserve(out_len);
11878|       |      out.buffer.append(input.substr(0, host_end));
11879|       |      if (parsed_port != url_components::omitted) {
11880|       |        append_canonical_port(out.buffer, parsed_port);
11881|       |      }
11882|       |      if (insert_slash) {
11883|       |        out.buffer.push_back('/');
11884|       |      }
11885|       |      if (authority_end < len) {
11886|       |        out.buffer.append(input.substr(authority_end));
11887|       |      }
11888|       |    }
11889|       |    if (has_upper) {
11890|       |      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11891|       |    }
11892|       |    const uint32_t pathname_start =
11893|       |        static_cast<uint32_t>(host_end) + port_bytes;
11894|       |    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11895|       |                               (insert_slash ? 1 : 0) -
11896|       |                               static_cast<int32_t>(authority_end);
11897|       |    out.components.protocol_end = protocol_end;
11898|       |    out.components.username_end = protocol_end + 2;
11899|       |    out.components.host_start = protocol_end + 2;
11900|       |    out.components.host_end = static_cast<uint32_t>(host_end);
11901|       |    out.components.port = parsed_port;
11902|       |    out.components.pathname_start = pathname_start;
11903|       |    out.components.search_start =
11904|       |        (query_start != std::string_view::npos)
11905|       |            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11906|       |                                    tail_delta)
11907|       |            : url_components::omitted;
11908|       |    out.components.hash_start =
11909|       |        (hash_start != std::string_view::npos)
11910|       |            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11911|       |                                    tail_delta)
11912|       |            : url_components::omitted;
11913|  57.3k|  } else {
11914|  57.3k|    std::string host_str(input.substr(host_start, host_len));
11915|  57.3k|    if (has_upper) {
  ------------------
  |  Branch (11915:9): [True: 42, False: 57.3k]
  ------------------
11916|     42|      unicode::to_lower_ascii(host_str.data(), host_str.size());
11917|     42|    }
11918|  57.3k|    out.host = std::move(host_str);
11919|  57.3k|    if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11919:9): [True: 57.3k, False: 55]
  ------------------
11920|  57.3k|      out.port = static_cast<uint16_t>(parsed_port);
11921|  57.3k|    }
11922|  57.3k|    if (insert_slash) {
  ------------------
  |  Branch (11922:9): [True: 151, False: 57.2k]
  ------------------
11923|    151|      out.path = "/";
11924|  57.2k|    } else {
11925|  57.2k|      out.path.assign(input.data() + path_start, path_end - path_start);
11926|  57.2k|    }
11927|  57.3k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11927:9): [True: 1.38k, False: 56.0k]
  ------------------
11928|  1.38k|      const size_t q_end =
11929|  1.38k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11929:11): [True: 1.08k, False: 302]
  ------------------
11930|  1.38k|      out.query.emplace(input.data() + query_start + 1,
11931|  1.38k|                        q_end - query_start - 1);
11932|  1.38k|    }
11933|  57.3k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11933:9): [True: 1.44k, False: 55.9k]
  ------------------
11934|  1.44k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11935|  1.44k|    }
11936|  57.3k|  }
11937|  57.3k|  return true;
11938|  59.0k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11674|  59.2k|    bool has_upper) {
11675|  59.2k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11676|  59.2k|  constexpr bool is_aggregator =
11677|  59.2k|      std::is_same_v<result_type, ada::url_aggregator>;
11678|  59.2k|  static_assert(is_ada_url || is_aggregator);
11679|       |
11680|  59.2k|  const size_t len = input.size();
11681|  59.2k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11682|  59.2k|  size_t p = host_end + 1;
11683|  59.2k|  uint32_t port_value = 0;
11684|  59.2k|  bool any_digit = false;
11685|   256k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11685:10): [True: 256k, False: 50]
  |  Branch (11685:21): [True: 197k, False: 58.9k]
  |  Branch (11685:36): [True: 197k, False: 254]
  ------------------
11686|   197k|    any_digit = true;
11687|   197k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11688|   197k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11688:9): [True: 17, False: 197k]
  ------------------
11689|     17|      return false;
11690|     17|    }
11691|   197k|    ++p;
11692|   197k|  }
11693|  59.2k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11693:7): [True: 59.2k, False: 50]
  |  Branch (11693:18): [True: 353, False: 58.8k]
  |  Branch (11693:33): [True: 269, False: 84]
  |  Branch (11693:48): [True: 218, False: 51]
  ------------------
11694|    218|    return false;
11695|    218|  }
11696|  59.0k|  uint32_t parsed_port = url_components::omitted;
11697|  59.0k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11698|  59.0k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11698:7): [True: 58.6k, False: 413]
  |  Branch (11698:20): [True: 58.6k, False: 4]
  ------------------
11699|  58.6k|    parsed_port = port_value;
11700|  58.6k|  }
11701|  59.0k|  const size_t authority_end = p;
11702|       |
11703|  59.0k|  size_t i = authority_end;
11704|  59.0k|  size_t path_start = host_end;
11705|  59.0k|  size_t path_end = host_end;
11706|  59.0k|  size_t query_start = std::string_view::npos;
11707|  59.0k|  size_t hash_start = std::string_view::npos;
11708|  59.0k|  bool has_path = false;
11709|  59.0k|  bool maybe_dot_segment = false;
11710|  59.0k|  bool rest_simple = true;
11711|       |
11712|  59.0k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11712:7): [True: 59.0k, False: 50]
  |  Branch (11712:18): [True: 58.8k, False: 135]
  ------------------
11713|  58.8k|    has_path = true;
11714|  58.8k|    path_start = i;
11715|  58.8k|    ++i;
11716|  58.8k|    scan_path_run(b, i, len, maybe_dot_segment);
11717|  58.8k|    if (i < len) {
  ------------------
  |  Branch (11717:9): [True: 3.13k, False: 55.7k]
  ------------------
11718|  3.13k|      const uint8_t cls = k_path[b[i]];
11719|  3.13k|      if (cls == 1) {
  ------------------
  |  Branch (11719:11): [True: 1.86k, False: 1.26k]
  ------------------
11720|  1.86k|        path_end = i;
11721|  1.86k|        if (b[i] == '?') {
  ------------------
  |  Branch (11721:13): [True: 1.48k, False: 376]
  ------------------
11722|  1.48k|          query_start = i;
11723|  1.48k|          ++i;
11724|  1.48k|          goto scan_query;
11725|  1.48k|        }
11726|    376|        hash_start = i;
11727|    376|        ++i;
11728|    376|        goto scan_hash;
11729|  1.86k|      }
11730|  1.26k|      rest_simple = false;
11731|  75.8k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11731:14): [True: 75.3k, False: 545]
  ------------------
11732|  75.3k|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 561, False: 74.7k]
  ------------------
11733|    561|          path_end = i;
11734|    561|          query_start = i;
11735|    561|          ++i;
11736|    561|          goto scan_query_boundary;
11737|    561|        }
11738|  74.7k|        if (b[i] == '#') {
  ------------------
  |  Branch (11738:13): [True: 159, False: 74.6k]
  ------------------
11739|    159|          path_end = i;
11740|    159|          hash_start = i;
11741|    159|          ++i;
11742|    159|          goto after_rest;
11743|    159|        }
11744|  74.7k|      }
11745|    545|      path_end = i;
11746|    545|      goto after_rest;
11747|  1.26k|    }
11748|  55.7k|    path_end = i;
11749|  55.7k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11749:14): [True: 135, False: 50]
  |  Branch (11749:25): [True: 84, False: 51]
  ------------------
11750|     84|    query_start = i;
11751|     84|    ++i;
11752|     84|    goto scan_query;
11753|    101|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11753:14): [True: 51, False: 50]
  |  Branch (11753:25): [True: 51, False: 0]
  ------------------
11754|     51|    hash_start = i;
11755|     51|    ++i;
11756|     51|    goto scan_hash;
11757|     51|  }
11758|  55.7k|  goto after_rest;
11759|       |
11760|  55.7k|scan_query:
11761|  1.57k|  scan_query_run(b, i, len);
11762|  1.57k|  if (i < len) {
  ------------------
  |  Branch (11762:7): [True: 1.24k, False: 326]
  ------------------
11763|  1.24k|    if (b[i] == '#') {
  ------------------
  |  Branch (11763:9): [True: 1.19k, False: 56]
  ------------------
11764|  1.19k|      hash_start = i;
11765|  1.19k|      ++i;
11766|  1.19k|      goto scan_hash;
11767|  1.19k|    }
11768|     56|    rest_simple = false;
11769|     56|    goto scan_query_boundary;
11770|  1.24k|  }
11771|    326|  goto after_rest;
11772|       |
11773|    617|scan_query_boundary:
11774|  10.8k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11774:10): [True: 10.6k, False: 228]
  ------------------
11775|  10.6k|    if (b[i] == '#') {
  ------------------
  |  Branch (11775:9): [True: 389, False: 10.2k]
  ------------------
11776|    389|      hash_start = i;
11777|    389|      ++i;
11778|    389|      goto after_rest;
11779|    389|    }
11780|  10.6k|  }
11781|    228|  goto after_rest;
11782|       |
11783|  1.61k|scan_hash:
11784|  1.61k|  scan_hash_run(b, i, len);
11785|  1.61k|  if (i < len) {
  ------------------
  |  Branch (11785:7): [True: 37, False: 1.58k]
  ------------------
11786|     37|    rest_simple = false;
11787|     37|  }
11788|       |
11789|  59.0k|after_rest:
11790|  59.0k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11790:7): [True: 57.6k, False: 1.35k]
  |  Branch (11790:22): [True: 354, False: 57.3k]
  ------------------
11791|    354|    const std::string_view path_body(input.data() + path_start,
11792|    354|                                     path_end - path_start);
11793|    354|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11793:9): [True: 313, False: 41]
  ------------------
11794|    313|      rest_simple = false;
11795|    313|    }
11796|    354|  }
11797|       |
11798|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11799|       |  // trailing C0 control or space; this fast path does neither. A query or
11800|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11801|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11802|       |  // inputs back to the slow path.
11803|  59.0k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11803:7): [True: 1.67k, False: 57.3k]
  |  Branch (11803:24): [True: 17, False: 1.65k]
  ------------------
11804|  1.65k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11804:24): [True: 36, False: 1.61k]
  ------------------
11805|     53|    return false;
11806|     53|  }
11807|       |
11808|  59.0k|  out.type = scheme_type;
11809|  59.0k|  out.is_valid = true;
11810|  59.0k|  out.has_opaque_path = false;
11811|  59.0k|  out.host_type = DEFAULT;
11812|       |
11813|  59.0k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11813:31): [True: 58.6k, False: 397]
  ------------------
11814|  59.0k|                                  ? (1 + port_decimal_digit_count(parsed_port))
11815|  59.0k|                                  : 0;
11816|       |
11817|  59.0k|  if (!rest_simple) {
  ------------------
  |  Branch (11817:7): [True: 1.61k, False: 57.3k]
  ------------------
11818|  1.61k|    const std::string_view path_view =
11819|  1.61k|        has_path
  ------------------
  |  Branch (11819:9): [True: 1.58k, False: 29]
  ------------------
11820|  1.61k|            ? std::string_view(input.data() + path_start, path_end - path_start)
11821|  1.61k|            : std::string_view{};
11822|  1.61k|    auto apply_query_and_hash = [&]() {
11823|  1.61k|      if (query_start != std::string_view::npos) {
11824|  1.61k|        const size_t q_end =
11825|  1.61k|            (hash_start != std::string_view::npos) ? hash_start : len;
11826|  1.61k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|  1.61k|                                                q_end - query_start - 1),
11828|  1.61k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|  1.61k|      }
11830|  1.61k|      if (hash_start != std::string_view::npos) {
11831|  1.61k|        out.update_unencoded_base_hash(std::string_view(
11832|  1.61k|            input.data() + hash_start + 1, len - hash_start - 1));
11833|  1.61k|      }
11834|  1.61k|    };
11835|  1.61k|    if constexpr (is_aggregator) {
11836|  1.61k|      out.buffer.assign(input.substr(0, host_end));
11837|  1.61k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11837:11): [True: 1.27k, False: 342]
  ------------------
11838|  1.27k|        append_canonical_port(out.buffer, parsed_port);
11839|  1.27k|      }
11840|  1.61k|      if (has_upper) {
  ------------------
  |  Branch (11840:11): [True: 89, False: 1.52k]
  ------------------
11841|     89|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11842|     89|      }
11843|  1.61k|      out.components.protocol_end = protocol_end;
11844|  1.61k|      out.components.username_end = protocol_end + 2;
11845|  1.61k|      out.components.host_start = protocol_end + 2;
11846|  1.61k|      out.components.host_end = static_cast<uint32_t>(host_end);
11847|  1.61k|      out.components.port = parsed_port;
11848|  1.61k|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11849|  1.61k|      out.components.search_start = url_components::omitted;
11850|  1.61k|      out.components.hash_start = url_components::omitted;
11851|  1.61k|      out.parse_path(path_view);
11852|  1.61k|      apply_query_and_hash();
11853|       |    } else {
11854|       |      std::string host_str(input.substr(host_start, host_len));
11855|       |      if (has_upper) {
11856|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
11857|       |      }
11858|       |      out.host = std::move(host_str);
11859|       |      if (parsed_port != url_components::omitted) {
11860|       |        out.port = static_cast<uint16_t>(parsed_port);
11861|       |      }
11862|       |      out.parse_path(path_view);
11863|       |      apply_query_and_hash();
11864|       |    }
11865|  1.61k|    return true;
11866|  1.61k|  }
11867|       |
11868|  57.3k|  const bool insert_slash = !has_path;
11869|  57.3k|  if constexpr (is_aggregator) {
11870|  57.3k|    const size_t out_len =
11871|  57.3k|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (11871:34): [True: 151, False: 57.2k]
  ------------------
11872|  57.3k|    const bool omit_port_bytes = parsed_port == url_components::omitted;
11873|  57.3k|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (11873:9): [True: 48.0k, False: 9.35k]
  |  Branch (11873:27): [True: 47.9k, False: 31]
  |  Branch (11873:44): [True: 47.9k, False: 0]
  ------------------
11874|  47.9k|      out.buffer.assign(input);
11875|  47.9k|    } else {
11876|  9.38k|      out.buffer.clear();
11877|  9.38k|      out.buffer.reserve(out_len);
11878|  9.38k|      out.buffer.append(input.substr(0, host_end));
11879|  9.38k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11879:11): [True: 9.33k, False: 55]
  ------------------
11880|  9.33k|        append_canonical_port(out.buffer, parsed_port);
11881|  9.33k|      }
11882|  9.38k|      if (insert_slash) {
  ------------------
  |  Branch (11882:11): [True: 151, False: 9.23k]
  ------------------
11883|    151|        out.buffer.push_back('/');
11884|    151|      }
11885|  9.38k|      if (authority_end < len) {
  ------------------
  |  Branch (11885:11): [True: 9.33k, False: 50]
  ------------------
11886|  9.33k|        out.buffer.append(input.substr(authority_end));
11887|  9.33k|      }
11888|  9.38k|    }
11889|  57.3k|    if (has_upper) {
  ------------------
  |  Branch (11889:9): [True: 42, False: 57.3k]
  ------------------
11890|     42|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11891|     42|    }
11892|  57.3k|    const uint32_t pathname_start =
11893|  57.3k|        static_cast<uint32_t>(host_end) + port_bytes;
11894|  57.3k|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11895|  57.3k|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (11895:33): [True: 151, False: 57.2k]
  ------------------
11896|  57.3k|                               static_cast<int32_t>(authority_end);
11897|  57.3k|    out.components.protocol_end = protocol_end;
11898|  57.3k|    out.components.username_end = protocol_end + 2;
11899|  57.3k|    out.components.host_start = protocol_end + 2;
11900|  57.3k|    out.components.host_end = static_cast<uint32_t>(host_end);
11901|  57.3k|    out.components.port = parsed_port;
11902|  57.3k|    out.components.pathname_start = pathname_start;
11903|  57.3k|    out.components.search_start =
11904|  57.3k|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (11904:9): [True: 1.38k, False: 56.0k]
  ------------------
11905|  57.3k|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11906|  1.38k|                                    tail_delta)
11907|  57.3k|            : url_components::omitted;
11908|  57.3k|    out.components.hash_start =
11909|  57.3k|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (11909:9): [True: 1.44k, False: 55.9k]
  ------------------
11910|  57.3k|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11911|  1.44k|                                    tail_delta)
11912|  57.3k|            : url_components::omitted;
11913|       |  } else {
11914|       |    std::string host_str(input.substr(host_start, host_len));
11915|       |    if (has_upper) {
11916|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
11917|       |    }
11918|       |    out.host = std::move(host_str);
11919|       |    if (parsed_port != url_components::omitted) {
11920|       |      out.port = static_cast<uint16_t>(parsed_port);
11921|       |    }
11922|       |    if (insert_slash) {
11923|       |      out.path = "/";
11924|       |    } else {
11925|       |      out.path.assign(input.data() + path_start, path_end - path_start);
11926|       |    }
11927|       |    if (query_start != std::string_view::npos) {
11928|       |      const size_t q_end =
11929|       |          (hash_start != std::string_view::npos) ? hash_start : len;
11930|       |      out.query.emplace(input.data() + query_start + 1,
11931|       |                        q_end - query_start - 1);
11932|       |    }
11933|       |    if (hash_start != std::string_view::npos) {
11934|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11935|       |    }
11936|       |  }
11937|  57.3k|  return true;
11938|  59.0k|}
_ZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12517|   608k|                           const result_type* base_url) {
12518|       |  // We can specialize the implementation per type.
12519|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12520|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12521|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12522|       |  // and ada::url **do not have to support the exact same API**.
12523|   608k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12524|   608k|  constexpr bool result_type_is_ada_url_aggregator =
12525|   608k|      std::is_same_v<url_aggregator, result_type>;
12526|   608k|  static_assert(result_type_is_ada_url ||
12527|   608k|                result_type_is_ada_url_aggregator);  // We don't support
12528|       |                                                     // anything else for now.
12529|       |
12530|   608k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12531|   608k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12532|   608k|          ")");
12533|       |
12534|   608k|  result_type url{};
12535|       |
12536|   608k|  const uint32_t max_input_length = ada::get_max_input_length();
12537|       |
12538|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12539|       |  // max_input_length even when the input fit under it. The check at the end of
12540|       |  // the state machine covers URLs that run to completion, but several states
12541|       |  // return early after appending a query or fragment, so run the same check on
12542|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12543|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12544|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12545|   608k|  const auto enforce_max_input_length = [&]() {
12546|   608k|    if constexpr (store_values) {
12547|   608k|      if (url.is_valid) {
12548|   608k|        if constexpr (result_type_is_ada_url_aggregator) {
12549|   608k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12550|   608k|            url.is_valid = false;
12551|   608k|          }
12552|   608k|        } else {
12553|   608k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12554|   608k|            url.is_valid = false;
12555|   608k|          }
12556|   608k|        }
12557|   608k|      }
12558|   608k|    }
12559|   608k|  };
12560|       |
12561|       |  // We refuse to parse URL strings that exceed the maximum input length.
12562|       |  // By default, this is 4GB but can be configured via
12563|       |  // ada::set_max_input_length().
12564|   608k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12564:7): [True: 0, False: 608k]
  ------------------
12565|      0|    url.is_valid = false;
12566|      0|  }
12567|       |  // Going forward, user_input.size() is in [0,
12568|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12569|       |  // base, or the optional_url was invalid, we must return.
12570|   608k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12570:7): [True: 0, False: 608k]
  ------------------
12571|      0|    url.is_valid &= base_url->is_valid;
12572|      0|  }
12573|   608k|  if (!url.is_valid) {
  ------------------
  |  Branch (12573:7): [True: 0, False: 608k]
  ------------------
12574|      0|    return url;
12575|      0|  }
12576|       |
12577|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12578|   608k|  if constexpr (store_values) {
12579|   608k|    bool hit_fast_path = false;
12580|   608k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12580:9): [True: 608k, False: 0]
  ------------------
12581|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12582|       |      // call so those URLs (including SetHref) do not pay for a miss.
12583|   608k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12584|   608k|      const size_t n = user_input.size();
12585|   608k|      size_t host_start = 0;
12586|   608k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12586:11): [True: 608k, False: 172]
  |  Branch (12586:21): [True: 233k, False: 374k]
  |  Branch (12586:36): [True: 232k, False: 856]
  |  Branch (12586:51): [True: 232k, False: 147]
  ------------------
12587|   232k|        host_start = 7;
12588|   376k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12588:18): [True: 375k, False: 179]
  |  Branch (12588:28): [True: 373k, False: 2.66k]
  |  Branch (12588:43): [True: 372k, False: 841]
  |  Branch (12588:58): [True: 372k, False: 106]
  ------------------
12589|   372k|        host_start = 8;
12590|   372k|      }
12591|   608k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12591:34): [True: 604k, False: 3.78k]
  ------------------
12592|   608k|      const bool skip_ip =
12593|   608k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12593:11): [True: 528, False: 608k]
  |  Branch (12593:33): [True: 601k, False: 6.87k]
  |  Branch (12593:54): [True: 136k, False: 464k]
  ------------------
12594|   608k|      const bool skip_userinfo =
12595|   608k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12595:11): [True: 604k, False: 3.78k]
  |  Branch (12595:30): [True: 38.7k, False: 566k]
  ------------------
12596|   608k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12596:23): [True: 471k, False: 136k]
  |  Branch (12596:35): [True: 432k, False: 38.7k]
  ------------------
12597|   432k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12597:23): [True: 345k, False: 87.7k]
  ------------------
12598|   608k|    } else {
12599|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12600|      0|    }
12601|   608k|    if (hit_fast_path) {
  ------------------
  |  Branch (12601:9): [True: 345k, False: 263k]
  ------------------
12602|       |      if constexpr (result_type_is_ada_url_aggregator) {
12603|       |        if (url.buffer.size() > max_input_length) [[unlikely]] {
12604|       |          url.is_valid = false;
12605|       |        }
12606|   345k|      } else {
12607|       |        // For a small absolute input, even worst-case normalization cannot
12608|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12609|       |        // most 4.5x. Avoid traversing every stored component on the common
12610|       |        // default-limit path.
12611|   345k|        if ((base_url != nullptr ||
  ------------------
  |  Branch (12611:14): [True: 0, False: 345k]
  ------------------
12612|   345k|             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
  ------------------
  |  Branch (12612:14): [True: 0, False: 345k]
  ------------------
12613|      0|            url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12613:13): [True: 0, False: 0]
  ------------------
12614|      0|          url.is_valid = false;
12615|      0|        }
12616|   345k|      }
12617|   345k|      return url;
12618|   345k|    }
12619|   608k|  }
12620|       |
12621|   263k|  state state = state::SCHEME_START;
12622|       |
12623|   608k|  std::string tmp_buffer;
12624|   608k|  std::string_view url_data;
12625|   608k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12625:7): [True: 481, False: 608k]
  ------------------
12626|    481|    tmp_buffer = user_input;
12627|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12628|       |    // just directly build the string from user_input.
12629|    481|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12630|    481|    url_data = tmp_buffer;
12631|   608k|  } else [[likely]] {
12632|   608k|    url_data = user_input;
12633|   608k|  }
12634|       |
12635|       |  // Leading and trailing control characters are uncommon and easy to deal with
12636|       |  // (no performance concern).
12637|   608k|  helpers::trim_c0_whitespace(url_data);
12638|       |
12639|       |  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12640|       |    // Most of the time, we just need user_input.size().
12641|       |    // In some instances, we may need a bit more.
12642|       |    ///////////////////////////
12643|       |    // This is *very* important. This line should *not* be removed
12644|       |    // hastily. There are principled reasons why reserve is important
12645|       |    // for performance. If you have a benchmark with small inputs,
12646|       |    // it may not matter, but in other instances, it could.
12647|       |    ////
12648|       |    // This rounds up to the next power of two.
12649|       |    // We know that user_input.size() is in [0,
12650|       |    // std::numeric_limits<uint32_t>::max).
12651|       |    uint32_t reserve_capacity =
12652|       |        (0xFFFFFFFF >>
12653|       |         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12654|       |        1;
12655|       |    url.reserve(reserve_capacity);
12656|       |  }
12657|       |
12658|       |  // Optimization opportunity. Most websites do not have fragment.
12659|   608k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12660|       |  // We add it last so that an implementation like ada::url_aggregator
12661|       |  // can append it last to its internal buffer, thus improving performance.
12662|       |
12663|       |  // Here url_data no longer has its fragment.
12664|       |  // We are going to access the data from url_data (it is immutable).
12665|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12666|       |  // The input_position variable should range from 0 to input_size.
12667|       |  // It is illegal to access url_data at input_size.
12668|   608k|  size_t input_position = 0;
12669|   608k|  const size_t input_size = url_data.size();
12670|       |  // Keep running the following state machine by switching on state.
12671|       |  // If after a run pointer points to the EOF code point, go to the next step.
12672|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12673|       |  // We never decrement input_position.
12674|  2.32M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12674:10): [True: 1.77M, False: 546k]
  ------------------
12675|  1.77M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12676|  1.77M|            " in state ", ada::to_string(state));
12677|  1.77M|    switch (state) {
12678|   263k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12678:7): [True: 263k, False: 1.51M]
  ------------------
12679|   263k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12680|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12681|       |        // state to scheme state.
12682|   263k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12682:13): [True: 263k, False: 1]
  ------------------
12683|   263k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12683:13): [True: 263k, False: 127]
  ------------------
12684|   263k|          state = state::SCHEME;
12685|   263k|          input_position++;
12686|   263k|        } else {
12687|       |          // Otherwise, if state override is not given, set state to no scheme
12688|       |          // state and decrease pointer by 1.
12689|    128|          state = state::NO_SCHEME;
12690|    128|        }
12691|   263k|        break;
12692|      0|      }
12693|   263k|      case state::SCHEME: {
  ------------------
  |  Branch (12693:7): [True: 263k, False: 1.51M]
  ------------------
12694|   263k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12695|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12696|       |        // append c, lowercased, to buffer.
12697|  1.14M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12697:16): [True: 1.14M, False: 5]
  ------------------
12698|  1.14M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12698:16): [True: 879k, False: 263k]
  ------------------
12699|   879k|          input_position++;
12700|   879k|        }
12701|       |        // Otherwise, if c is U+003A (:), then:
12702|   263k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12702:13): [True: 263k, False: 5]
  ------------------
12703|   263k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12703:13): [True: 263k, False: 84]
  ------------------
12704|   263k|          ada_log("SCHEME the scheme should be ",
12705|   263k|                  url_data.substr(0, input_position));
12706|   263k|          if constexpr (result_type_is_ada_url) {
12707|   263k|            if (!url.parse_scheme(url_data.substr(0, input_position))) {
  ------------------
  |  Branch (12707:17): [True: 0, False: 263k]
  ------------------
12708|      0|              return url;
12709|      0|            }
12710|       |          } else {
12711|       |            // we pass the colon along instead of painfully adding it back.
12712|       |            if (!url.parse_scheme_with_colon(
12713|       |                    url_data.substr(0, input_position + 1))) {
12714|       |              return url;
12715|       |            }
12716|       |          }
12717|   263k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12718|       |
12719|       |          // If url's scheme is "file", then:
12720|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12721|   263k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12721:15): [True: 1.50k, False: 261k]
  ------------------
12722|       |            // Set state to file state.
12723|  1.50k|            state = state::FILE;
12724|  1.50k|          }
12725|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12726|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12727|       |          // != nullptr is false.
12728|   261k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12728:20): [True: 259k, False: 1.94k]
  |  Branch (12728:40): [True: 0, False: 259k]
  ------------------
12729|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12729:20): [True: 0, False: 0]
  ------------------
12730|       |            // Set state to special relative or authority state.
12731|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12732|      0|          }
12733|       |          // Otherwise, if url is special, set state to special authority
12734|       |          // slashes state.
12735|   261k|          else if (url.is_special()) {
  ------------------
  |  Branch (12735:20): [True: 259k, False: 1.94k]
  ------------------
12736|   259k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12737|   259k|          }
12738|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12739|       |          // path or authority state and increase pointer by 1.
12740|  1.94k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12740:20): [True: 1.76k, False: 180]
  ------------------
12741|  1.76k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12741:20): [True: 1.14k, False: 612]
  ------------------
12742|  1.14k|            state = state::PATH_OR_AUTHORITY;
12743|  1.14k|            input_position++;
12744|  1.14k|          }
12745|       |          // Otherwise, set url's path to the empty string and set state to
12746|       |          // opaque path state.
12747|    792|          else {
12748|    792|            state = state::OPAQUE_PATH;
12749|    792|          }
12750|   263k|        }
12751|       |        // Otherwise, if state override is not given, set buffer to the empty
12752|       |        // string, state to no scheme state, and start over (from the first code
12753|       |        // point in input).
12754|     89|        else {
12755|     89|          state = state::NO_SCHEME;
12756|     89|          input_position = 0;
12757|     89|          break;
12758|     89|        }
12759|   263k|        input_position++;
12760|   263k|        break;
12761|   263k|      }
12762|    217|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12762:7): [True: 217, False: 1.77M]
  ------------------
12763|    217|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12764|       |        // The fragment was pruned from url_data before the state machine ran,
12765|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12766|       |        // nothing else remains in front of it.
12767|    217|        const bool c_is_hash =
12768|    217|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12768:13): [True: 146, False: 71]
  |  Branch (12768:37): [True: 1, False: 145]
  ------------------
12769|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12770|       |        // validation error, return failure.
12771|    217|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12771:13): [True: 217, False: 0]
  |  Branch (12771:37): [True: 0, False: 0]
  |  Branch (12771:66): [True: 0, False: 0]
  ------------------
12772|    217|          ada_log("NO_SCHEME validation error");
12773|    217|          url.is_valid = false;
12774|    217|          return url;
12775|    217|        }
12776|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12777|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12778|       |        // query to base's query, and set state to fragment state.
12779|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12779:18): [True: 0, False: 0]
  |  Branch (12779:47): [True: 0, False: 0]
  ------------------
12780|      0|          ada_log("NO_SCHEME opaque base with fragment");
12781|      0|          url.copy_scheme(*base_url);
12782|      0|          url.has_opaque_path = base_url->has_opaque_path;
12783|       |
12784|      0|          if constexpr (result_type_is_ada_url) {
12785|      0|            url.path = base_url->path;
12786|      0|            url.query = base_url->query;
12787|       |          } else {
12788|       |            url.update_base_pathname(base_url->get_pathname());
12789|       |            if (base_url->has_search()) {
12790|       |              // get_search() returns "" for an empty query string (URL ends
12791|       |              // with '?'). update_base_search("") would incorrectly clear the
12792|       |              // query, so pass "?" to preserve the empty query distinction.
12793|       |              auto s = base_url->get_search();
12794|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
12795|       |            }
12796|       |          }
12797|      0|          url.update_unencoded_base_hash(*fragment);
12798|      0|          enforce_max_input_length();
12799|      0|          return url;
12800|      0|        }
12801|       |        // Otherwise, if base's scheme is not "file", set state to relative
12802|       |        // state and decrease pointer by 1.
12803|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12804|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12804:18): [True: 0, False: 0]
  ------------------
12805|      0|          ada_log("NO_SCHEME non-file relative path");
12806|      0|          state = state::RELATIVE_SCHEME;
12807|      0|        }
12808|       |        // Otherwise, set state to file state and decrease pointer by 1.
12809|      0|        else {
12810|      0|          ada_log("NO_SCHEME file base type");
12811|      0|          state = state::FILE;
12812|      0|        }
12813|      0|        break;
12814|    217|      }
12815|   260k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12815:7): [True: 260k, False: 1.51M]
  ------------------
12816|   260k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12817|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12818|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12819|       |        // worry about AUTHORITY.
12820|       |        // TODO: Instead of just collecting a bool, collect the location of the
12821|       |        // '@' and do something useful with it.
12822|       |        // TODO: We could do various processing early on, using a single pass
12823|       |        // over the string to collect information about it, e.g., telling us
12824|       |        // whether there is a @ and if so, where (or how many).
12825|       |
12826|       |        // Check if url data contains an @.
12827|   260k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12827:13): [True: 220k, False: 39.9k]
  ------------------
12828|   220k|          state = state::HOST;
12829|   220k|          break;
12830|   220k|        }
12831|  39.9k|        bool at_sign_seen{false};
12832|  39.9k|        bool password_token_seen{false};
12833|       |        /**
12834|       |         * We expect something of the sort...
12835|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12836|       |         * --------^
12837|       |         */
12838|  92.9k|        do {
12839|  92.9k|          std::string_view view = url_data.substr(input_position);
12840|       |          // The delimiters are @, /, ? \\.
12841|  92.9k|          size_t location =
12842|  92.9k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12842:15): [True: 92.8k, False: 161]
  ------------------
12843|  92.9k|                               : helpers::find_authority_delimiter(view);
12844|  92.9k|          std::string_view authority_view = view.substr(0, location);
12845|  92.9k|          size_t end_of_authority = input_position + authority_view.size();
12846|       |          // If c is U+0040 (@), then:
12847|  92.9k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12847:15): [True: 83.2k, False: 9.73k]
  ------------------
12848|  83.2k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12848:15): [True: 53.0k, False: 30.2k]
  ------------------
12849|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12850|  53.0k|            if (at_sign_seen) {
  ------------------
  |  Branch (12850:17): [True: 13.3k, False: 39.6k]
  ------------------
12851|  13.3k|              if (password_token_seen) {
  ------------------
  |  Branch (12851:19): [True: 3.92k, False: 9.43k]
  ------------------
12852|  3.92k|                if constexpr (result_type_is_ada_url) {
12853|  3.92k|                  url.password += "%40";
12854|       |                } else {
12855|       |                  url.append_base_password("%40");
12856|       |                }
12857|  9.43k|              } else {
12858|  9.43k|                if constexpr (result_type_is_ada_url) {
12859|  9.43k|                  url.username += "%40";
12860|       |                } else {
12861|       |                  url.append_base_username("%40");
12862|       |                }
12863|  9.43k|              }
12864|  13.3k|            }
12865|       |
12866|  53.0k|            at_sign_seen = true;
12867|       |
12868|  53.0k|            if (!password_token_seen) {
  ------------------
  |  Branch (12868:17): [True: 49.1k, False: 3.92k]
  ------------------
12869|  49.1k|              size_t password_token_location = authority_view.find(':');
12870|  49.1k|              password_token_seen =
12871|  49.1k|                  password_token_location != std::string_view::npos;
12872|       |
12873|  49.1k|              if constexpr (store_values) {
12874|  49.1k|                if (!password_token_seen) {
  ------------------
  |  Branch (12874:21): [True: 19.9k, False: 29.1k]
  ------------------
12875|  19.9k|                  if constexpr (result_type_is_ada_url) {
12876|  19.9k|                    url.username += unicode::percent_encode(
12877|  19.9k|                        authority_view,
12878|  19.9k|                        character_sets::USERINFO_PERCENT_ENCODE);
12879|       |                  } else {
12880|       |                    url.append_base_username(unicode::percent_encode(
12881|       |                        authority_view,
12882|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12883|       |                  }
12884|  29.1k|                } else {
12885|  29.1k|                  if constexpr (result_type_is_ada_url) {
12886|  29.1k|                    url.username += unicode::percent_encode(
12887|  29.1k|                        authority_view.substr(0, password_token_location),
12888|  29.1k|                        character_sets::USERINFO_PERCENT_ENCODE);
12889|  29.1k|                    url.password += unicode::percent_encode(
12890|  29.1k|                        authority_view.substr(password_token_location + 1),
12891|  29.1k|                        character_sets::USERINFO_PERCENT_ENCODE);
12892|       |                  } else {
12893|       |                    url.append_base_username(unicode::percent_encode(
12894|       |                        authority_view.substr(0, password_token_location),
12895|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12896|       |                    url.append_base_password(unicode::percent_encode(
12897|       |                        authority_view.substr(password_token_location + 1),
12898|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12899|       |                  }
12900|  29.1k|                }
12901|  49.1k|              }
12902|  49.1k|            } else if constexpr (store_values) {
12903|  3.92k|              if constexpr (result_type_is_ada_url) {
12904|  3.92k|                url.password += unicode::percent_encode(
12905|  3.92k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12906|       |              } else {
12907|       |                url.append_base_password(unicode::percent_encode(
12908|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12909|       |              }
12910|  3.92k|            }
12911|  53.0k|          }
12912|       |          // Otherwise, if one of the following is true:
12913|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12914|       |          // - url is special and c is U+005C (\)
12915|  39.9k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12915:20): [True: 9.73k, False: 30.2k]
  ------------------
12916|  30.2k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12916:20): [True: 30.0k, False: 162]
  ------------------
12917|    162|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12917:20): [True: 130, False: 32]
  ------------------
12918|  39.9k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12918:21): [True: 32, False: 0]
  |  Branch (12918:41): [True: 32, False: 0]
  ------------------
12919|       |            // If atSignSeen is true and authority_view is the empty string,
12920|       |            // validation error, return failure.
12921|  39.9k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12921:17): [True: 39.6k, False: 261]
  |  Branch (12921:33): [True: 224, False: 39.4k]
  ------------------
12922|    224|              url.is_valid = false;
12923|    224|              return url;
12924|    224|            }
12925|  39.7k|            state = state::HOST;
12926|  39.7k|            break;
12927|  39.9k|          }
12928|  53.0k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12928:15): [True: 0, False: 53.0k]
  ------------------
12929|      0|            if constexpr (store_values) {
12930|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12930:19): [True: 0, False: 0]
  ------------------
12931|      0|                url.update_unencoded_base_hash(*fragment);
12932|      0|              }
12933|      0|            }
12934|      0|            enforce_max_input_length();
12935|      0|            return url;
12936|      0|          }
12937|  53.0k|          input_position = end_of_authority + 1;
12938|  53.0k|        } while (true);
  ------------------
  |  Branch (12938:18): [True: 53.0k, Folded]
  ------------------
12939|       |
12940|  39.7k|        break;
12941|  39.9k|      }
12942|  39.7k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12942:7): [True: 0, False: 1.77M]
  ------------------
12943|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12944|      0|                helpers::substring(url_data, input_position));
12945|       |
12946|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12947|       |        // then set state to special authority ignore slashes state and increase
12948|       |        // pointer by 1.
12949|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12949:13): [True: 0, False: 0]
  ------------------
12950|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12951|      0|          input_position += 2;
12952|      0|        } else {
12953|       |          // Otherwise, validation error, set state to relative state and
12954|       |          // decrease pointer by 1.
12955|      0|          state = state::RELATIVE_SCHEME;
12956|      0|        }
12957|       |
12958|      0|        break;
12959|  39.9k|      }
12960|  1.14k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12960:7): [True: 1.14k, False: 1.77M]
  ------------------
12961|  1.14k|        ada_log("PATH_OR_AUTHORITY ",
12962|  1.14k|                helpers::substring(url_data, input_position));
12963|       |
12964|       |        // If c is U+002F (/), then set state to authority state.
12965|  1.14k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12965:13): [True: 1.10k, False: 41]
  ------------------
12966|  1.10k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12966:13): [True: 770, False: 337]
  ------------------
12967|    770|          state = state::AUTHORITY;
12968|    770|          input_position++;
12969|    770|        } else {
12970|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12971|    378|          state = state::PATH;
12972|    378|        }
12973|       |
12974|  1.14k|        break;
12975|  39.9k|      }
12976|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12976:7): [True: 0, False: 1.77M]
  ------------------
12977|      0|        ada_log("RELATIVE_SCHEME ",
12978|      0|                helpers::substring(url_data, input_position));
12979|       |
12980|       |        // Set url's scheme to base's scheme.
12981|      0|        url.copy_scheme(*base_url);
12982|       |
12983|       |        // If c is U+002F (/), then set state to relative slash state.
12984|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12984:13): [True: 0, False: 0]
  ------------------
12985|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12986|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12986:13): [True: 0, False: 0]
  ------------------
12987|      0|          ada_log(
12988|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
12989|      0|              "slash state");
12990|      0|          state = state::RELATIVE_SLASH;
12991|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (12991:20): [True: 0, False: 0]
  |  Branch (12991:40): [True: 0, False: 0]
  ------------------
12992|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (12992:20): [True: 0, False: 0]
  ------------------
12993|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
12994|       |          // set state to relative slash state.
12995|      0|          ada_log(
12996|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
12997|      0|              "error, set state to relative slash state");
12998|      0|          state = state::RELATIVE_SLASH;
12999|      0|        } else {
13000|      0|          ada_log("RELATIVE_SCHEME otherwise");
13001|       |          // Set url's username to base's username, url's password to base's
13002|       |          // password, url's host to base's host, url's port to base's port,
13003|       |          // url's path to a clone of base's path, and url's query to base's
13004|       |          // query.
13005|      0|          if constexpr (result_type_is_ada_url) {
13006|      0|            url.username = base_url->username;
13007|      0|            url.password = base_url->password;
13008|      0|            url.host = base_url->host;
13009|      0|            url.port = base_url->port;
13010|       |            // cloning the base path includes cloning the has_opaque_path flag
13011|      0|            url.has_opaque_path = base_url->has_opaque_path;
13012|      0|            url.path = base_url->path;
13013|      0|            url.query = base_url->query;
13014|       |          } else {
13015|       |            url.update_base_authority(base_url->get_href(),
13016|       |                                      base_url->get_components());
13017|       |            url.update_host_to_base_host(base_url->get_hostname());
13018|       |            url.update_base_port(base_url->retrieve_base_port());
13019|       |            // cloning the base path includes cloning the has_opaque_path flag
13020|       |            url.has_opaque_path = base_url->has_opaque_path;
13021|       |            url.update_base_pathname(base_url->get_pathname());
13022|       |            if (base_url->has_search()) {
13023|       |              // get_search() returns "" for an empty query string (URL ends
13024|       |              // with '?'). update_base_search("") would incorrectly clear the
13025|       |              // query, so pass "?" to preserve the empty query distinction.
13026|       |              auto s = base_url->get_search();
13027|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13028|       |            }
13029|       |          }
13030|       |
13031|      0|          url.has_opaque_path = base_url->has_opaque_path;
13032|       |
13033|       |          // If c is U+003F (?), then set url's query to the empty string, and
13034|       |          // state to query state.
13035|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13035:15): [True: 0, False: 0]
  ------------------
13036|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13036:15): [True: 0, False: 0]
  ------------------
13037|      0|            state = state::QUERY;
13038|      0|          }
13039|       |          // Otherwise, if c is not the EOF code point:
13040|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13040:20): [True: 0, False: 0]
  ------------------
13041|       |            // Set url's query to null.
13042|      0|            url.clear_search();
13043|      0|            if constexpr (result_type_is_ada_url) {
13044|       |              // Shorten url's path.
13045|      0|              helpers::shorten_path(url.path, url.type);
13046|       |            } else {
13047|       |              std::string_view path = url.get_pathname();
13048|       |              if (helpers::shorten_path(path, url.type)) {
13049|       |                url.update_base_pathname(std::move(std::string(path)));
13050|       |              }
13051|       |            }
13052|       |            // Set state to path state and decrease pointer by 1.
13053|      0|            state = state::PATH;
13054|      0|            break;
13055|      0|          }
13056|      0|        }
13057|      0|        input_position++;
13058|      0|        break;
13059|      0|      }
13060|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13060:7): [True: 0, False: 1.77M]
  ------------------
13061|      0|        ada_log("RELATIVE_SLASH ",
13062|      0|                helpers::substring(url_data, input_position));
13063|       |
13064|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13065|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13066|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13066:13): [True: 0, False: 0]
  |  Branch (13066:33): [True: 0, False: 0]
  ------------------
13067|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13067:14): [True: 0, False: 0]
  ------------------
13068|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13068:14): [True: 0, False: 0]
  ------------------
13069|       |          // Set state to special authority ignore slashes state.
13070|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13071|      0|        }
13072|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13073|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:18): [True: 0, False: 0]
  ------------------
13074|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13074:18): [True: 0, False: 0]
  ------------------
13075|      0|          state = state::AUTHORITY;
13076|      0|        }
13077|       |        // Otherwise, set
13078|       |        // - url's username to base's username,
13079|       |        // - url's password to base's password,
13080|       |        // - url's host to base's host,
13081|       |        // - url's port to base's port,
13082|       |        // - state to path state, and then, decrease pointer by 1.
13083|      0|        else {
13084|      0|          if constexpr (result_type_is_ada_url) {
13085|      0|            url.username = base_url->username;
13086|      0|            url.password = base_url->password;
13087|      0|            url.host = base_url->host;
13088|      0|            url.port = base_url->port;
13089|       |          } else {
13090|       |            url.update_base_authority(base_url->get_href(),
13091|       |                                      base_url->get_components());
13092|       |            url.update_host_to_base_host(base_url->get_hostname());
13093|       |            url.update_base_port(base_url->retrieve_base_port());
13094|       |          }
13095|      0|          state = state::PATH;
13096|      0|          break;
13097|      0|        }
13098|       |
13099|      0|        input_position++;
13100|      0|        break;
13101|      0|      }
13102|   259k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13102:7): [True: 259k, False: 1.51M]
  ------------------
13103|   259k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13104|   259k|                helpers::substring(url_data, input_position));
13105|       |
13106|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13107|       |        // then set state to special authority ignore slashes state and increase
13108|       |        // pointer by 1.
13109|   259k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13109:13): [True: 258k, False: 1.67k]
  ------------------
13110|   258k|          input_position += 2;
13111|   258k|        }
13112|       |
13113|   259k|        [[fallthrough]];
13114|   259k|      }
13115|   259k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13115:7): [True: 0, False: 1.77M]
  ------------------
13116|   259k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13117|   259k|                helpers::substring(url_data, input_position));
13118|       |
13119|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13120|       |        // authority state and decrease pointer by 1.
13121|   261k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13121:16): [True: 261k, False: 66]
  ------------------
13122|   261k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13122:17): [True: 651, False: 260k]
  ------------------
13123|   260k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13123:17): [True: 1.25k, False: 259k]
  ------------------
13124|  1.90k|          input_position++;
13125|  1.90k|        }
13126|   259k|        state = state::AUTHORITY;
13127|       |
13128|   259k|        break;
13129|   259k|      }
13130|  10.2k|      case state::QUERY: {
  ------------------
  |  Branch (13130:7): [True: 10.2k, False: 1.76M]
  ------------------
13131|  10.2k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13132|  10.2k|        if constexpr (store_values) {
13133|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13134|       |          // if url is special; otherwise the query percent-encode set.
13135|  10.2k|          const uint8_t* query_percent_encode_set =
13136|  10.2k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13136:15): [True: 9.06k, False: 1.18k]
  ------------------
13137|  10.2k|                               : character_sets::QUERY_PERCENT_ENCODE;
13138|       |
13139|       |          // Percent-encode after encoding, with encoding, buffer, and
13140|       |          // queryPercentEncodeSet, and append the result to url's query.
13141|  10.2k|          url.update_base_search(url_data.substr(input_position),
13142|  10.2k|                                 query_percent_encode_set);
13143|  10.2k|          ada_log("QUERY update_base_search completed ");
13144|  10.2k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13144:15): [True: 7.52k, False: 2.72k]
  ------------------
13145|  7.52k|            url.update_unencoded_base_hash(*fragment);
13146|  7.52k|          }
13147|  10.2k|        }
13148|  10.2k|        enforce_max_input_length();
13149|  10.2k|        return url;
13150|   259k|      }
13151|   260k|      case state::HOST: {
  ------------------
  |  Branch (13151:7): [True: 260k, False: 1.51M]
  ------------------
13152|   260k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13153|       |
13154|   260k|        std::string_view host_view = url_data.substr(input_position);
13155|   260k|        auto [location, found_colon] =
13156|   260k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13157|   260k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13157:26): [True: 260k, False: 0]
  ------------------
13158|   260k|                             ? input_position + location
13159|   260k|                             : input_size;
13160|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13161|       |        // Note: the 'found_colon' value is true if and only if a colon was
13162|       |        // encountered while not inside brackets.
13163|   260k|        if (found_colon) {
  ------------------
  |  Branch (13163:13): [True: 2.49k, False: 257k]
  ------------------
13164|       |          // If buffer is the empty string, validation error, return failure.
13165|       |          // Let host be the result of host parsing buffer with url is not
13166|       |          // special.
13167|  2.49k|          ada_log("HOST parsing ", host_view);
13168|  2.49k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13168:15): [True: 181, False: 2.31k]
  ------------------
13169|    181|            return url;
13170|    181|          }
13171|  2.31k|          ada_log("HOST parsing results in ", url.get_hostname());
13172|       |          // Set url's host to host, buffer to the empty string, and state to
13173|       |          // port state.
13174|  2.31k|          state = state::PORT;
13175|  2.31k|          input_position++;
13176|  2.31k|        }
13177|       |        // Otherwise, if one of the following is true:
13178|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13179|       |        // - url is special and c is U+005C (\)
13180|       |        // The get_host_delimiter_location function either brings us to
13181|       |        // the colon outside of the bracket, or to one of those characters.
13182|   257k|        else {
13183|       |          // If url is special and host_view is the empty string, validation
13184|       |          // error, return failure.
13185|   257k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13185:15): [True: 176, False: 257k]
  |  Branch (13185:36): [True: 107, False: 69]
  ------------------
13186|    107|            url.is_valid = false;
13187|    107|            return url;
13188|    107|          }
13189|   257k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13190|       |          // Let host be the result of host parsing host_view with url is not
13191|       |          // special.
13192|   257k|          if (host_view.empty()) {
  ------------------
  |  Branch (13192:15): [True: 69, False: 257k]
  ------------------
13193|     69|            url.update_base_hostname("");
13194|   257k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13194:22): [True: 20.4k, False: 237k]
  ------------------
13195|  20.4k|            return url;
13196|  20.4k|          }
13197|   237k|          ada_log("HOST parsing results in ", url.get_hostname(),
13198|   237k|                  " href=", url.get_href());
13199|       |
13200|       |          // Set url's host to host, and state to path start state.
13201|   237k|          state = state::PATH_START;
13202|   237k|        }
13203|       |
13204|   239k|        break;
13205|   260k|      }
13206|   239k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13206:7): [True: 792, False: 1.77M]
  ------------------
13207|    792|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13208|       |        // Opaque path, query, and fragment are structurally always valid:
13209|       |        // the parser would just percent-encode whatever is there. When we
13210|       |        // are not storing values (can_parse), we can return immediately.
13211|       |        // We must set has_opaque_path = true before returning so that when
13212|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13213|       |        // correctly rejects relative inputs against an opaque-path base
13214|       |        // (e.g. can_parse("", &"W:") must return false).
13215|       |        if constexpr (!store_values) {
13216|       |          url.has_opaque_path = true;
13217|       |          return url;
13218|       |        }
13219|    792|        std::string_view view = url_data.substr(input_position);
13220|       |        // If c is U+003F (?), then set url's query to the empty string and
13221|       |        // state to query state.
13222|    792|        size_t location = view.find('?');
13223|    792|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13223:13): [True: 477, False: 315]
  ------------------
13224|    477|          view.remove_suffix(view.size() - location);
13225|    477|          state = state::QUERY;
13226|    477|          input_position += location + 1;
13227|    477|        } else {
13228|    315|          input_position = input_size + 1;
13229|    315|        }
13230|    792|        url.has_opaque_path = true;
13231|       |
13232|       |        // This is a really unlikely scenario in real world. We should not seek
13233|       |        // to optimize it.
13234|    792|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13234:13): [True: 8, False: 784]
  ------------------
13235|      8|          std::string modified_view =
13236|      8|              std::string(view.substr(0, view.size() - 1)) + "%20";
13237|      8|          url.update_base_pathname(unicode::percent_encode(
13238|      8|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13239|    784|        } else {
13240|    784|          url.update_base_pathname(unicode::percent_encode(
13241|    784|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13242|    784|        }
13243|    792|        break;
13244|   260k|      }
13245|  2.31k|      case state::PORT: {
  ------------------
  |  Branch (13245:7): [True: 2.31k, False: 1.77M]
  ------------------
13246|  2.31k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13247|  2.31k|        std::string_view port_view = url_data.substr(input_position);
13248|  2.31k|        input_position += url.parse_port(port_view, true);
13249|  2.31k|        if (!url.is_valid) {
  ------------------
  |  Branch (13249:13): [True: 229, False: 2.08k]
  ------------------
13250|    229|          return url;
13251|    229|        }
13252|  2.08k|        state = state::PATH_START;
13253|  2.08k|        [[fallthrough]];
13254|  2.08k|      }
13255|   240k|      case state::PATH_START: {
  ------------------
  |  Branch (13255:7): [True: 238k, False: 1.53M]
  ------------------
13256|   240k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13257|       |        // Path, query, and fragment are structurally always valid: the
13258|       |        // parser would just percent-encode whatever is there. When we are
13259|       |        // not storing values (can_parse), we can return immediately since
13260|       |        // no subsequent state can invalidate the URL.
13261|       |        if constexpr (!store_values) {
13262|       |          return url;
13263|       |        }
13264|       |
13265|       |        // If url is special, then:
13266|   240k|        if (url.is_special()) {
  ------------------
  |  Branch (13266:13): [True: 239k, False: 699]
  ------------------
13267|       |          // Set state to path state.
13268|   239k|          state = state::PATH;
13269|       |
13270|       |          // Optimization: Avoiding going into PATH state improves the
13271|       |          // performance of urls ending with /.
13272|   239k|          if (input_position == input_size) {
  ------------------
  |  Branch (13272:15): [True: 30.0k, False: 209k]
  ------------------
13273|  30.0k|            if constexpr (store_values) {
13274|  30.0k|              url.update_base_pathname("/");
13275|  30.0k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13275:19): [True: 286, False: 29.7k]
  ------------------
13276|    286|                url.update_unencoded_base_hash(*fragment);
13277|    286|              }
13278|  30.0k|            }
13279|  30.0k|            enforce_max_input_length();
13280|  30.0k|            return url;
13281|  30.0k|          }
13282|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13283|       |          // by 1. We know that (input_position == input_size) is impossible
13284|       |          // here, because of the previous if-check.
13285|   209k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13285:15): [True: 1.08k, False: 208k]
  ------------------
13286|  1.08k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13286:15): [True: 651, False: 429]
  ------------------
13287|    651|            break;
13288|    651|          }
13289|   209k|        }
13290|       |        // Otherwise, if state override is not given and c is U+003F (?),
13291|       |        // set url's query to the empty string and state to query state.
13292|    699|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13292:18): [True: 555, False: 144]
  ------------------
13293|    555|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13293:18): [True: 87, False: 468]
  ------------------
13294|     87|          state = state::QUERY;
13295|     87|        }
13296|       |        // Otherwise, if c is not the EOF code point:
13297|    612|        else if (input_position != input_size) {
  ------------------
  |  Branch (13297:18): [True: 468, False: 144]
  ------------------
13298|       |          // Set state to path state.
13299|    468|          state = state::PATH;
13300|       |
13301|       |          // If c is not U+002F (/), then decrease pointer by 1.
13302|    468|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13302:15): [True: 0, False: 468]
  ------------------
13303|      0|            break;
13304|      0|          }
13305|    468|        }
13306|       |
13307|   209k|        input_position++;
13308|   209k|        break;
13309|   240k|      }
13310|   210k|      case state::PATH: {
  ------------------
  |  Branch (13310:7): [True: 210k, False: 1.56M]
  ------------------
13311|   210k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13312|       |        // Path, query, and fragment are structurally always valid: the
13313|       |        // parser would just percent-encode whatever is there. When we are
13314|       |        // not storing values (can_parse), we can return immediately since
13315|       |        // no subsequent state can invalidate the URL.
13316|       |        if constexpr (!store_values) {
13317|       |          return url;
13318|       |        }
13319|   210k|        std::string_view view = url_data.substr(input_position);
13320|       |
13321|       |        // Most time, we do not need percent encoding.
13322|       |        // Furthermore, we can immediately locate the '?'.
13323|   210k|        size_t locofquestionmark = view.find('?');
13324|   210k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13324:13): [True: 9.68k, False: 201k]
  ------------------
13325|  9.68k|          state = state::QUERY;
13326|  9.68k|          view.remove_suffix(view.size() - locofquestionmark);
13327|  9.68k|          input_position += locofquestionmark + 1;
13328|   201k|        } else {
13329|   201k|          input_position = input_size + 1;
13330|   201k|        }
13331|   210k|        if constexpr (store_values) {
13332|   210k|          if constexpr (result_type_is_ada_url) {
13333|   210k|            helpers::parse_prepared_path(view, url.type, url.path);
13334|       |          } else {
13335|       |            url.consume_prepared_path(view);
13336|       |            ADA_ASSERT_TRUE(url.validate());
13337|       |          }
13338|   210k|        }
13339|   210k|        break;
13340|   240k|      }
13341|  1.38k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13341:7): [True: 1.38k, False: 1.77M]
  ------------------
13342|  1.38k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13343|       |
13344|       |        // If c is U+002F (/) or U+005C (\), then:
13345|  1.38k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13345:13): [True: 1.38k, False: 1]
  ------------------
13346|  1.38k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13346:14): [True: 1.36k, False: 14]
  ------------------
13347|  1.37k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13347:14): [True: 2, False: 12]
  ------------------
13348|  1.37k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13349|       |          // Set state to file host state.
13350|  1.37k|          state = state::FILE_HOST;
13351|  1.37k|          input_position++;
13352|  1.37k|        } else {
13353|     13|          ada_log("FILE_SLASH otherwise");
13354|       |          // If base is non-null and base's scheme is "file", then:
13355|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13356|       |          // base_url_has_value() is true.
13357|     13|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13357:15): [True: 0, False: 13]
  |  Branch (13357:38): [True: 0, False: 0]
  ------------------
13358|       |            // Set url's host to base's host.
13359|      0|            if constexpr (result_type_is_ada_url) {
13360|      0|              url.host = base_url->host;
13361|       |            } else {
13362|       |              url.update_host_to_base_host(base_url->get_host());
13363|       |            }
13364|       |            // If the code point substring from pointer to the end of input does
13365|       |            // not start with a Windows drive letter and base's path[0] is a
13366|       |            // normalized Windows drive letter, then append base's path[0] to
13367|       |            // url's path.
13368|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13368:17): [True: 0, False: 0]
  ------------------
13369|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13369:19): [True: 0, False: 0]
  ------------------
13370|      0|                      url_data.substr(input_position))) {
13371|      0|                std::string_view first_base_url_path =
13372|      0|                    base_url->get_pathname().substr(1);
13373|      0|                size_t loc = first_base_url_path.find('/');
13374|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13374:21): [True: 0, False: 0]
  ------------------
13375|      0|                  helpers::resize(first_base_url_path, loc);
13376|      0|                }
13377|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13377:21): [True: 0, False: 0]
  ------------------
13378|      0|                        first_base_url_path)) {
13379|      0|                  if constexpr (result_type_is_ada_url) {
13380|      0|                    url.path += '/';
13381|      0|                    url.path += first_base_url_path;
13382|       |                  } else {
13383|       |                    url.append_base_pathname(
13384|       |                        helpers::concat("/", first_base_url_path));
13385|       |                  }
13386|      0|                }
13387|      0|              }
13388|      0|            }
13389|      0|          }
13390|       |
13391|       |          // Set state to path state, and decrease pointer by 1.
13392|     13|          state = state::PATH;
13393|     13|        }
13394|       |
13395|  1.38k|        break;
13396|   240k|      }
13397|  1.37k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13397:7): [True: 1.37k, False: 1.77M]
  ------------------
13398|  1.37k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13399|  1.37k|        std::string_view view = url_data.substr(input_position);
13400|       |
13401|  1.37k|        size_t location = view.find_first_of("/\\?");
13402|  1.37k|        std::string_view file_host_buffer = view.substr(
13403|  1.37k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13403:16): [True: 1.32k, False: 43]
  ------------------
13404|       |
13405|  1.37k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13405:13): [True: 1, False: 1.37k]
  ------------------
13406|      1|          state = state::PATH;
13407|  1.37k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13407:20): [True: 293, False: 1.07k]
  ------------------
13408|       |          // Set url's host to the empty string.
13409|    293|          if constexpr (result_type_is_ada_url) {
13410|    293|            url.host = "";
13411|       |          } else {
13412|       |            url.update_base_hostname("");
13413|       |          }
13414|       |          // Set state to path start state.
13415|    293|          state = state::PATH_START;
13416|  1.07k|        } else {
13417|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13418|  1.07k|          input_position += consumed_bytes;
13419|       |          // Let host be the result of host parsing buffer with url is not
13420|       |          // special.
13421|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13421:15): [True: 99, False: 978]
  ------------------
13422|     99|            return url;
13423|     99|          }
13424|       |
13425|    978|          if constexpr (result_type_is_ada_url) {
13426|       |            // If host is "localhost", then set host to the empty string.
13427|    978|            if (url.host.has_value() && url.host.value() == "localhost") {
  ------------------
  |  Branch (13427:17): [True: 978, False: 0]
  |  Branch (13427:41): [True: 3, False: 975]
  ------------------
13428|      3|              url.host = "";
13429|      3|            }
13430|       |          } else {
13431|       |            if (url.get_hostname() == "localhost") {
13432|       |              url.update_base_hostname("");
13433|       |            }
13434|       |          }
13435|       |
13436|       |          // Set buffer to the empty string and state to path start state.
13437|    978|          state = state::PATH_START;
13438|    978|        }
13439|       |
13440|  1.27k|        break;
13441|  1.37k|      }
13442|  1.50k|      case state::FILE: {
  ------------------
  |  Branch (13442:7): [True: 1.50k, False: 1.77M]
  ------------------
13443|  1.50k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13444|  1.50k|        std::string_view file_view = url_data.substr(input_position);
13445|       |
13446|  1.50k|        url.set_protocol_as_file();
13447|  1.50k|        if constexpr (result_type_is_ada_url) {
13448|       |          // Set url's host to the empty string.
13449|  1.50k|          url.host = "";
13450|       |        } else {
13451|       |          url.update_base_hostname("");
13452|       |        }
13453|       |        // If c is U+002F (/) or U+005C (\), then:
13454|  1.50k|        if (input_position != input_size &&
  ------------------
  |  Branch (13454:13): [True: 1.50k, False: 1]
  ------------------
13455|  1.50k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13455:14): [True: 1.38k, False: 124]
  ------------------
13456|  1.38k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13456:14): [True: 3, False: 121]
  ------------------
13457|  1.38k|          ada_log("FILE c is U+002F or U+005C");
13458|       |          // Set state to file slash state.
13459|  1.38k|          state = state::FILE_SLASH;
13460|  1.38k|        }
13461|       |        // Otherwise, if base is non-null and base's scheme is "file":
13462|    122|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13462:18): [True: 0, False: 122]
  |  Branch (13462:41): [True: 0, False: 0]
  ------------------
13463|       |          // Set url's host to base's host, url's path to a clone of base's
13464|       |          // path, and url's query to base's query.
13465|      0|          ada_log("FILE base non-null");
13466|      0|          if constexpr (result_type_is_ada_url) {
13467|      0|            url.host = base_url->host;
13468|      0|            url.path = base_url->path;
13469|      0|            url.query = base_url->query;
13470|       |          } else {
13471|       |            url.update_host_to_base_host(base_url->get_hostname());
13472|       |            url.update_base_pathname(base_url->get_pathname());
13473|       |            if (base_url->has_search()) {
13474|       |              // get_search() returns "" for an empty query string (URL ends
13475|       |              // with '?'). update_base_search("") would incorrectly clear the
13476|       |              // query, so pass "?" to preserve the empty query distinction.
13477|       |              auto s = base_url->get_search();
13478|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13479|       |            }
13480|       |          }
13481|      0|          url.has_opaque_path = base_url->has_opaque_path;
13482|       |
13483|       |          // If c is U+003F (?), then set url's query to the empty string and
13484|       |          // state to query state.
13485|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13485:15): [True: 0, False: 0]
  |  Branch (13485:47): [True: 0, False: 0]
  ------------------
13486|      0|            state = state::QUERY;
13487|      0|          }
13488|       |          // Otherwise, if c is not the EOF code point:
13489|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13489:20): [True: 0, False: 0]
  ------------------
13490|       |            // Set url's query to null.
13491|      0|            url.clear_search();
13492|       |            // If the code point substring from pointer to the end of input does
13493|       |            // not start with a Windows drive letter, then shorten url's path.
13494|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13494:17): [True: 0, False: 0]
  ------------------
13495|      0|              if constexpr (result_type_is_ada_url) {
13496|      0|                helpers::shorten_path(url.path, url.type);
13497|       |              } else {
13498|       |                std::string_view path = url.get_pathname();
13499|       |                if (helpers::shorten_path(path, url.type)) {
13500|       |                  url.update_base_pathname(std::move(std::string(path)));
13501|       |                }
13502|       |              }
13503|      0|            }
13504|       |            // Otherwise:
13505|      0|            else {
13506|       |              // Set url's path to an empty list.
13507|      0|              url.clear_pathname();
13508|      0|              url.has_opaque_path = true;
13509|      0|            }
13510|       |
13511|       |            // Set state to path state and decrease pointer by 1.
13512|      0|            state = state::PATH;
13513|      0|            break;
13514|      0|          }
13515|      0|        }
13516|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13517|    122|        else {
13518|    122|          ada_log("FILE go to path");
13519|    122|          state = state::PATH;
13520|    122|          break;
13521|    122|        }
13522|       |
13523|  1.38k|        input_position++;
13524|  1.38k|        break;
13525|  1.50k|      }
13526|      0|      default:
  ------------------
  |  Branch (13526:7): [True: 0, False: 1.77M]
  ------------------
13527|      0|        unreachable();
13528|  1.77M|    }
13529|  1.77M|  }
13530|   546k|  if constexpr (store_values) {
13531|   546k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13531:9): [True: 2.38k, False: 544k]
  ------------------
13532|  2.38k|      url.update_unencoded_base_hash(*fragment);
13533|  2.38k|    }
13534|   546k|  }
13535|   546k|  enforce_max_input_length();
13536|   546k|  return url;
13537|   608k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12517|   608k|                           const result_type* base_url) {
12518|       |  // We can specialize the implementation per type.
12519|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12520|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12521|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12522|       |  // and ada::url **do not have to support the exact same API**.
12523|   608k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12524|   608k|  constexpr bool result_type_is_ada_url_aggregator =
12525|   608k|      std::is_same_v<url_aggregator, result_type>;
12526|   608k|  static_assert(result_type_is_ada_url ||
12527|   608k|                result_type_is_ada_url_aggregator);  // We don't support
12528|       |                                                     // anything else for now.
12529|       |
12530|   608k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12531|   608k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12532|   608k|          ")");
12533|       |
12534|   608k|  result_type url{};
12535|       |
12536|   608k|  const uint32_t max_input_length = ada::get_max_input_length();
12537|       |
12538|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12539|       |  // max_input_length even when the input fit under it. The check at the end of
12540|       |  // the state machine covers URLs that run to completion, but several states
12541|       |  // return early after appending a query or fragment, so run the same check on
12542|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12543|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12544|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12545|   608k|  const auto enforce_max_input_length = [&]() {
12546|   608k|    if constexpr (store_values) {
12547|   608k|      if (url.is_valid) {
12548|   608k|        if constexpr (result_type_is_ada_url_aggregator) {
12549|   608k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12550|   608k|            url.is_valid = false;
12551|   608k|          }
12552|   608k|        } else {
12553|   608k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12554|   608k|            url.is_valid = false;
12555|   608k|          }
12556|   608k|        }
12557|   608k|      }
12558|   608k|    }
12559|   608k|  };
12560|       |
12561|       |  // We refuse to parse URL strings that exceed the maximum input length.
12562|       |  // By default, this is 4GB but can be configured via
12563|       |  // ada::set_max_input_length().
12564|   608k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12564:7): [True: 0, False: 608k]
  ------------------
12565|      0|    url.is_valid = false;
12566|      0|  }
12567|       |  // Going forward, user_input.size() is in [0,
12568|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12569|       |  // base, or the optional_url was invalid, we must return.
12570|   608k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12570:7): [True: 0, False: 608k]
  ------------------
12571|      0|    url.is_valid &= base_url->is_valid;
12572|      0|  }
12573|   608k|  if (!url.is_valid) {
  ------------------
  |  Branch (12573:7): [True: 0, False: 608k]
  ------------------
12574|      0|    return url;
12575|      0|  }
12576|       |
12577|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12578|   608k|  if constexpr (store_values) {
12579|   608k|    bool hit_fast_path = false;
12580|   608k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12580:9): [True: 608k, False: 0]
  ------------------
12581|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12582|       |      // call so those URLs (including SetHref) do not pay for a miss.
12583|   608k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12584|   608k|      const size_t n = user_input.size();
12585|   608k|      size_t host_start = 0;
12586|   608k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12586:11): [True: 608k, False: 172]
  |  Branch (12586:21): [True: 233k, False: 374k]
  |  Branch (12586:36): [True: 232k, False: 856]
  |  Branch (12586:51): [True: 232k, False: 147]
  ------------------
12587|   232k|        host_start = 7;
12588|   376k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12588:18): [True: 375k, False: 179]
  |  Branch (12588:28): [True: 373k, False: 2.66k]
  |  Branch (12588:43): [True: 372k, False: 841]
  |  Branch (12588:58): [True: 372k, False: 106]
  ------------------
12589|   372k|        host_start = 8;
12590|   372k|      }
12591|   608k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12591:34): [True: 604k, False: 3.78k]
  ------------------
12592|   608k|      const bool skip_ip =
12593|   608k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12593:11): [True: 528, False: 608k]
  |  Branch (12593:33): [True: 601k, False: 6.87k]
  |  Branch (12593:54): [True: 136k, False: 464k]
  ------------------
12594|   608k|      const bool skip_userinfo =
12595|   608k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12595:11): [True: 604k, False: 3.78k]
  |  Branch (12595:30): [True: 38.7k, False: 566k]
  ------------------
12596|   608k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12596:23): [True: 471k, False: 136k]
  |  Branch (12596:35): [True: 432k, False: 38.7k]
  ------------------
12597|   432k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12597:23): [True: 345k, False: 87.7k]
  ------------------
12598|   608k|    } else {
12599|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12600|      0|    }
12601|   608k|    if (hit_fast_path) {
  ------------------
  |  Branch (12601:9): [True: 345k, False: 263k]
  ------------------
12602|   345k|      if constexpr (result_type_is_ada_url_aggregator) {
12603|   345k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12603:13): [True: 0, False: 345k]
  ------------------
12604|      0|          url.is_valid = false;
12605|      0|        }
12606|       |      } else {
12607|       |        // For a small absolute input, even worst-case normalization cannot
12608|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12609|       |        // most 4.5x. Avoid traversing every stored component on the common
12610|       |        // default-limit path.
12611|       |        if ((base_url != nullptr ||
12612|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12613|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12614|       |          url.is_valid = false;
12615|       |        }
12616|       |      }
12617|   345k|      return url;
12618|   345k|    }
12619|   608k|  }
12620|       |
12621|   263k|  state state = state::SCHEME_START;
12622|       |
12623|   608k|  std::string tmp_buffer;
12624|   608k|  std::string_view url_data;
12625|   608k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12625:7): [True: 481, False: 608k]
  ------------------
12626|    481|    tmp_buffer = user_input;
12627|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12628|       |    // just directly build the string from user_input.
12629|    481|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12630|    481|    url_data = tmp_buffer;
12631|   608k|  } else [[likely]] {
12632|   608k|    url_data = user_input;
12633|   608k|  }
12634|       |
12635|       |  // Leading and trailing control characters are uncommon and easy to deal with
12636|       |  // (no performance concern).
12637|   608k|  helpers::trim_c0_whitespace(url_data);
12638|       |
12639|   608k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12640|       |    // Most of the time, we just need user_input.size().
12641|       |    // In some instances, we may need a bit more.
12642|       |    ///////////////////////////
12643|       |    // This is *very* important. This line should *not* be removed
12644|       |    // hastily. There are principled reasons why reserve is important
12645|       |    // for performance. If you have a benchmark with small inputs,
12646|       |    // it may not matter, but in other instances, it could.
12647|       |    ////
12648|       |    // This rounds up to the next power of two.
12649|       |    // We know that user_input.size() is in [0,
12650|       |    // std::numeric_limits<uint32_t>::max).
12651|   608k|    uint32_t reserve_capacity =
12652|   608k|        (0xFFFFFFFF >>
12653|   608k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12654|   608k|        1;
12655|   608k|    url.reserve(reserve_capacity);
12656|   608k|  }
12657|       |
12658|       |  // Optimization opportunity. Most websites do not have fragment.
12659|   608k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12660|       |  // We add it last so that an implementation like ada::url_aggregator
12661|       |  // can append it last to its internal buffer, thus improving performance.
12662|       |
12663|       |  // Here url_data no longer has its fragment.
12664|       |  // We are going to access the data from url_data (it is immutable).
12665|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12666|       |  // The input_position variable should range from 0 to input_size.
12667|       |  // It is illegal to access url_data at input_size.
12668|   608k|  size_t input_position = 0;
12669|   608k|  const size_t input_size = url_data.size();
12670|       |  // Keep running the following state machine by switching on state.
12671|       |  // If after a run pointer points to the EOF code point, go to the next step.
12672|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12673|       |  // We never decrement input_position.
12674|  2.32M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12674:10): [True: 1.77M, False: 546k]
  ------------------
12675|  1.77M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12676|  1.77M|            " in state ", ada::to_string(state));
12677|  1.77M|    switch (state) {
12678|   263k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12678:7): [True: 263k, False: 1.51M]
  ------------------
12679|   263k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12680|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12681|       |        // state to scheme state.
12682|   263k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12682:13): [True: 263k, False: 1]
  ------------------
12683|   263k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12683:13): [True: 263k, False: 127]
  ------------------
12684|   263k|          state = state::SCHEME;
12685|   263k|          input_position++;
12686|   263k|        } else {
12687|       |          // Otherwise, if state override is not given, set state to no scheme
12688|       |          // state and decrease pointer by 1.
12689|    128|          state = state::NO_SCHEME;
12690|    128|        }
12691|   263k|        break;
12692|      0|      }
12693|   263k|      case state::SCHEME: {
  ------------------
  |  Branch (12693:7): [True: 263k, False: 1.51M]
  ------------------
12694|   263k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12695|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12696|       |        // append c, lowercased, to buffer.
12697|  1.14M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12697:16): [True: 1.14M, False: 5]
  ------------------
12698|  1.14M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12698:16): [True: 879k, False: 263k]
  ------------------
12699|   879k|          input_position++;
12700|   879k|        }
12701|       |        // Otherwise, if c is U+003A (:), then:
12702|   263k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12702:13): [True: 263k, False: 5]
  ------------------
12703|   263k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12703:13): [True: 263k, False: 84]
  ------------------
12704|   263k|          ada_log("SCHEME the scheme should be ",
12705|   263k|                  url_data.substr(0, input_position));
12706|       |          if constexpr (result_type_is_ada_url) {
12707|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
12708|       |              return url;
12709|       |            }
12710|   263k|          } else {
12711|       |            // we pass the colon along instead of painfully adding it back.
12712|   263k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (12712:17): [True: 0, False: 263k]
  ------------------
12713|   263k|                    url_data.substr(0, input_position + 1))) {
12714|      0|              return url;
12715|      0|            }
12716|   263k|          }
12717|   263k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12718|       |
12719|       |          // If url's scheme is "file", then:
12720|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12721|   263k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12721:15): [True: 1.50k, False: 261k]
  ------------------
12722|       |            // Set state to file state.
12723|  1.50k|            state = state::FILE;
12724|  1.50k|          }
12725|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12726|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12727|       |          // != nullptr is false.
12728|   261k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12728:20): [True: 259k, False: 1.94k]
  |  Branch (12728:40): [True: 0, False: 259k]
  ------------------
12729|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12729:20): [True: 0, False: 0]
  ------------------
12730|       |            // Set state to special relative or authority state.
12731|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12732|      0|          }
12733|       |          // Otherwise, if url is special, set state to special authority
12734|       |          // slashes state.
12735|   261k|          else if (url.is_special()) {
  ------------------
  |  Branch (12735:20): [True: 259k, False: 1.94k]
  ------------------
12736|   259k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12737|   259k|          }
12738|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12739|       |          // path or authority state and increase pointer by 1.
12740|  1.94k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12740:20): [True: 1.76k, False: 180]
  ------------------
12741|  1.76k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12741:20): [True: 1.14k, False: 612]
  ------------------
12742|  1.14k|            state = state::PATH_OR_AUTHORITY;
12743|  1.14k|            input_position++;
12744|  1.14k|          }
12745|       |          // Otherwise, set url's path to the empty string and set state to
12746|       |          // opaque path state.
12747|    792|          else {
12748|    792|            state = state::OPAQUE_PATH;
12749|    792|          }
12750|   263k|        }
12751|       |        // Otherwise, if state override is not given, set buffer to the empty
12752|       |        // string, state to no scheme state, and start over (from the first code
12753|       |        // point in input).
12754|     89|        else {
12755|     89|          state = state::NO_SCHEME;
12756|     89|          input_position = 0;
12757|     89|          break;
12758|     89|        }
12759|   263k|        input_position++;
12760|   263k|        break;
12761|   263k|      }
12762|    217|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12762:7): [True: 217, False: 1.77M]
  ------------------
12763|    217|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12764|       |        // The fragment was pruned from url_data before the state machine ran,
12765|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12766|       |        // nothing else remains in front of it.
12767|    217|        const bool c_is_hash =
12768|    217|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12768:13): [True: 146, False: 71]
  |  Branch (12768:37): [True: 1, False: 145]
  ------------------
12769|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12770|       |        // validation error, return failure.
12771|    217|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12771:13): [True: 217, False: 0]
  |  Branch (12771:37): [True: 0, False: 0]
  |  Branch (12771:66): [True: 0, False: 0]
  ------------------
12772|    217|          ada_log("NO_SCHEME validation error");
12773|    217|          url.is_valid = false;
12774|    217|          return url;
12775|    217|        }
12776|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12777|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12778|       |        // query to base's query, and set state to fragment state.
12779|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12779:18): [True: 0, False: 0]
  |  Branch (12779:47): [True: 0, False: 0]
  ------------------
12780|      0|          ada_log("NO_SCHEME opaque base with fragment");
12781|      0|          url.copy_scheme(*base_url);
12782|      0|          url.has_opaque_path = base_url->has_opaque_path;
12783|       |
12784|       |          if constexpr (result_type_is_ada_url) {
12785|       |            url.path = base_url->path;
12786|       |            url.query = base_url->query;
12787|      0|          } else {
12788|      0|            url.update_base_pathname(base_url->get_pathname());
12789|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (12789:17): [True: 0, False: 0]
  ------------------
12790|       |              // get_search() returns "" for an empty query string (URL ends
12791|       |              // with '?'). update_base_search("") would incorrectly clear the
12792|       |              // query, so pass "?" to preserve the empty query distinction.
12793|      0|              auto s = base_url->get_search();
12794|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (12794:38): [True: 0, False: 0]
  ------------------
12795|      0|            }
12796|      0|          }
12797|      0|          url.update_unencoded_base_hash(*fragment);
12798|      0|          enforce_max_input_length();
12799|      0|          return url;
12800|      0|        }
12801|       |        // Otherwise, if base's scheme is not "file", set state to relative
12802|       |        // state and decrease pointer by 1.
12803|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12804|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12804:18): [True: 0, False: 0]
  ------------------
12805|      0|          ada_log("NO_SCHEME non-file relative path");
12806|      0|          state = state::RELATIVE_SCHEME;
12807|      0|        }
12808|       |        // Otherwise, set state to file state and decrease pointer by 1.
12809|      0|        else {
12810|      0|          ada_log("NO_SCHEME file base type");
12811|      0|          state = state::FILE;
12812|      0|        }
12813|      0|        break;
12814|    217|      }
12815|   260k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12815:7): [True: 260k, False: 1.51M]
  ------------------
12816|   260k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12817|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12818|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12819|       |        // worry about AUTHORITY.
12820|       |        // TODO: Instead of just collecting a bool, collect the location of the
12821|       |        // '@' and do something useful with it.
12822|       |        // TODO: We could do various processing early on, using a single pass
12823|       |        // over the string to collect information about it, e.g., telling us
12824|       |        // whether there is a @ and if so, where (or how many).
12825|       |
12826|       |        // Check if url data contains an @.
12827|   260k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12827:13): [True: 220k, False: 39.9k]
  ------------------
12828|   220k|          state = state::HOST;
12829|   220k|          break;
12830|   220k|        }
12831|  39.9k|        bool at_sign_seen{false};
12832|  39.9k|        bool password_token_seen{false};
12833|       |        /**
12834|       |         * We expect something of the sort...
12835|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12836|       |         * --------^
12837|       |         */
12838|  92.9k|        do {
12839|  92.9k|          std::string_view view = url_data.substr(input_position);
12840|       |          // The delimiters are @, /, ? \\.
12841|  92.9k|          size_t location =
12842|  92.9k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12842:15): [True: 92.8k, False: 161]
  ------------------
12843|  92.9k|                               : helpers::find_authority_delimiter(view);
12844|  92.9k|          std::string_view authority_view = view.substr(0, location);
12845|  92.9k|          size_t end_of_authority = input_position + authority_view.size();
12846|       |          // If c is U+0040 (@), then:
12847|  92.9k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12847:15): [True: 83.2k, False: 9.73k]
  ------------------
12848|  83.2k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12848:15): [True: 53.0k, False: 30.2k]
  ------------------
12849|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12850|  53.0k|            if (at_sign_seen) {
  ------------------
  |  Branch (12850:17): [True: 13.3k, False: 39.6k]
  ------------------
12851|  13.3k|              if (password_token_seen) {
  ------------------
  |  Branch (12851:19): [True: 3.92k, False: 9.43k]
  ------------------
12852|       |                if constexpr (result_type_is_ada_url) {
12853|       |                  url.password += "%40";
12854|  3.92k|                } else {
12855|  3.92k|                  url.append_base_password("%40");
12856|  3.92k|                }
12857|  9.43k|              } else {
12858|       |                if constexpr (result_type_is_ada_url) {
12859|       |                  url.username += "%40";
12860|  9.43k|                } else {
12861|  9.43k|                  url.append_base_username("%40");
12862|  9.43k|                }
12863|  9.43k|              }
12864|  13.3k|            }
12865|       |
12866|  53.0k|            at_sign_seen = true;
12867|       |
12868|  53.0k|            if (!password_token_seen) {
  ------------------
  |  Branch (12868:17): [True: 49.1k, False: 3.92k]
  ------------------
12869|  49.1k|              size_t password_token_location = authority_view.find(':');
12870|  49.1k|              password_token_seen =
12871|  49.1k|                  password_token_location != std::string_view::npos;
12872|       |
12873|  49.1k|              if constexpr (store_values) {
12874|  49.1k|                if (!password_token_seen) {
  ------------------
  |  Branch (12874:21): [True: 19.9k, False: 29.1k]
  ------------------
12875|       |                  if constexpr (result_type_is_ada_url) {
12876|       |                    url.username += unicode::percent_encode(
12877|       |                        authority_view,
12878|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12879|  19.9k|                  } else {
12880|  19.9k|                    url.append_base_username(unicode::percent_encode(
12881|  19.9k|                        authority_view,
12882|  19.9k|                        character_sets::USERINFO_PERCENT_ENCODE));
12883|  19.9k|                  }
12884|  29.1k|                } else {
12885|       |                  if constexpr (result_type_is_ada_url) {
12886|       |                    url.username += unicode::percent_encode(
12887|       |                        authority_view.substr(0, password_token_location),
12888|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12889|       |                    url.password += unicode::percent_encode(
12890|       |                        authority_view.substr(password_token_location + 1),
12891|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12892|  29.1k|                  } else {
12893|  29.1k|                    url.append_base_username(unicode::percent_encode(
12894|  29.1k|                        authority_view.substr(0, password_token_location),
12895|  29.1k|                        character_sets::USERINFO_PERCENT_ENCODE));
12896|  29.1k|                    url.append_base_password(unicode::percent_encode(
12897|  29.1k|                        authority_view.substr(password_token_location + 1),
12898|  29.1k|                        character_sets::USERINFO_PERCENT_ENCODE));
12899|  29.1k|                  }
12900|  29.1k|                }
12901|  49.1k|              }
12902|  49.1k|            } else if constexpr (store_values) {
12903|       |              if constexpr (result_type_is_ada_url) {
12904|       |                url.password += unicode::percent_encode(
12905|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12906|  3.92k|              } else {
12907|  3.92k|                url.append_base_password(unicode::percent_encode(
12908|  3.92k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12909|  3.92k|              }
12910|  3.92k|            }
12911|  53.0k|          }
12912|       |          // Otherwise, if one of the following is true:
12913|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12914|       |          // - url is special and c is U+005C (\)
12915|  39.9k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12915:20): [True: 9.73k, False: 30.2k]
  ------------------
12916|  30.2k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12916:20): [True: 30.0k, False: 162]
  ------------------
12917|    162|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12917:20): [True: 130, False: 32]
  ------------------
12918|  39.9k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12918:21): [True: 32, False: 0]
  |  Branch (12918:41): [True: 32, False: 0]
  ------------------
12919|       |            // If atSignSeen is true and authority_view is the empty string,
12920|       |            // validation error, return failure.
12921|  39.9k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12921:17): [True: 39.6k, False: 261]
  |  Branch (12921:33): [True: 224, False: 39.4k]
  ------------------
12922|    224|              url.is_valid = false;
12923|    224|              return url;
12924|    224|            }
12925|  39.7k|            state = state::HOST;
12926|  39.7k|            break;
12927|  39.9k|          }
12928|  53.0k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12928:15): [True: 0, False: 53.0k]
  ------------------
12929|      0|            if constexpr (store_values) {
12930|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12930:19): [True: 0, False: 0]
  ------------------
12931|      0|                url.update_unencoded_base_hash(*fragment);
12932|      0|              }
12933|      0|            }
12934|      0|            enforce_max_input_length();
12935|      0|            return url;
12936|      0|          }
12937|  53.0k|          input_position = end_of_authority + 1;
12938|  53.0k|        } while (true);
  ------------------
  |  Branch (12938:18): [True: 53.0k, Folded]
  ------------------
12939|       |
12940|  39.7k|        break;
12941|  39.9k|      }
12942|  39.7k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12942:7): [True: 0, False: 1.77M]
  ------------------
12943|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12944|      0|                helpers::substring(url_data, input_position));
12945|       |
12946|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12947|       |        // then set state to special authority ignore slashes state and increase
12948|       |        // pointer by 1.
12949|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12949:13): [True: 0, False: 0]
  ------------------
12950|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12951|      0|          input_position += 2;
12952|      0|        } else {
12953|       |          // Otherwise, validation error, set state to relative state and
12954|       |          // decrease pointer by 1.
12955|      0|          state = state::RELATIVE_SCHEME;
12956|      0|        }
12957|       |
12958|      0|        break;
12959|  39.9k|      }
12960|  1.14k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12960:7): [True: 1.14k, False: 1.77M]
  ------------------
12961|  1.14k|        ada_log("PATH_OR_AUTHORITY ",
12962|  1.14k|                helpers::substring(url_data, input_position));
12963|       |
12964|       |        // If c is U+002F (/), then set state to authority state.
12965|  1.14k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12965:13): [True: 1.10k, False: 41]
  ------------------
12966|  1.10k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12966:13): [True: 770, False: 337]
  ------------------
12967|    770|          state = state::AUTHORITY;
12968|    770|          input_position++;
12969|    770|        } else {
12970|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12971|    378|          state = state::PATH;
12972|    378|        }
12973|       |
12974|  1.14k|        break;
12975|  39.9k|      }
12976|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12976:7): [True: 0, False: 1.77M]
  ------------------
12977|      0|        ada_log("RELATIVE_SCHEME ",
12978|      0|                helpers::substring(url_data, input_position));
12979|       |
12980|       |        // Set url's scheme to base's scheme.
12981|      0|        url.copy_scheme(*base_url);
12982|       |
12983|       |        // If c is U+002F (/), then set state to relative slash state.
12984|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12984:13): [True: 0, False: 0]
  ------------------
12985|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12986|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12986:13): [True: 0, False: 0]
  ------------------
12987|      0|          ada_log(
12988|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
12989|      0|              "slash state");
12990|      0|          state = state::RELATIVE_SLASH;
12991|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (12991:20): [True: 0, False: 0]
  |  Branch (12991:40): [True: 0, False: 0]
  ------------------
12992|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (12992:20): [True: 0, False: 0]
  ------------------
12993|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
12994|       |          // set state to relative slash state.
12995|      0|          ada_log(
12996|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
12997|      0|              "error, set state to relative slash state");
12998|      0|          state = state::RELATIVE_SLASH;
12999|      0|        } else {
13000|      0|          ada_log("RELATIVE_SCHEME otherwise");
13001|       |          // Set url's username to base's username, url's password to base's
13002|       |          // password, url's host to base's host, url's port to base's port,
13003|       |          // url's path to a clone of base's path, and url's query to base's
13004|       |          // query.
13005|       |          if constexpr (result_type_is_ada_url) {
13006|       |            url.username = base_url->username;
13007|       |            url.password = base_url->password;
13008|       |            url.host = base_url->host;
13009|       |            url.port = base_url->port;
13010|       |            // cloning the base path includes cloning the has_opaque_path flag
13011|       |            url.has_opaque_path = base_url->has_opaque_path;
13012|       |            url.path = base_url->path;
13013|       |            url.query = base_url->query;
13014|      0|          } else {
13015|      0|            url.update_base_authority(base_url->get_href(),
13016|      0|                                      base_url->get_components());
13017|      0|            url.update_host_to_base_host(base_url->get_hostname());
13018|      0|            url.update_base_port(base_url->retrieve_base_port());
13019|       |            // cloning the base path includes cloning the has_opaque_path flag
13020|      0|            url.has_opaque_path = base_url->has_opaque_path;
13021|      0|            url.update_base_pathname(base_url->get_pathname());
13022|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13022:17): [True: 0, False: 0]
  ------------------
13023|       |              // get_search() returns "" for an empty query string (URL ends
13024|       |              // with '?'). update_base_search("") would incorrectly clear the
13025|       |              // query, so pass "?" to preserve the empty query distinction.
13026|      0|              auto s = base_url->get_search();
13027|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13027:38): [True: 0, False: 0]
  ------------------
13028|      0|            }
13029|      0|          }
13030|       |
13031|      0|          url.has_opaque_path = base_url->has_opaque_path;
13032|       |
13033|       |          // If c is U+003F (?), then set url's query to the empty string, and
13034|       |          // state to query state.
13035|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13035:15): [True: 0, False: 0]
  ------------------
13036|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13036:15): [True: 0, False: 0]
  ------------------
13037|      0|            state = state::QUERY;
13038|      0|          }
13039|       |          // Otherwise, if c is not the EOF code point:
13040|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13040:20): [True: 0, False: 0]
  ------------------
13041|       |            // Set url's query to null.
13042|      0|            url.clear_search();
13043|       |            if constexpr (result_type_is_ada_url) {
13044|       |              // Shorten url's path.
13045|       |              helpers::shorten_path(url.path, url.type);
13046|      0|            } else {
13047|      0|              std::string_view path = url.get_pathname();
13048|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13048:19): [True: 0, False: 0]
  ------------------
13049|      0|                url.update_base_pathname(std::move(std::string(path)));
13050|      0|              }
13051|      0|            }
13052|       |            // Set state to path state and decrease pointer by 1.
13053|      0|            state = state::PATH;
13054|      0|            break;
13055|      0|          }
13056|      0|        }
13057|      0|        input_position++;
13058|      0|        break;
13059|      0|      }
13060|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13060:7): [True: 0, False: 1.77M]
  ------------------
13061|      0|        ada_log("RELATIVE_SLASH ",
13062|      0|                helpers::substring(url_data, input_position));
13063|       |
13064|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13065|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13066|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13066:13): [True: 0, False: 0]
  |  Branch (13066:33): [True: 0, False: 0]
  ------------------
13067|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13067:14): [True: 0, False: 0]
  ------------------
13068|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13068:14): [True: 0, False: 0]
  ------------------
13069|       |          // Set state to special authority ignore slashes state.
13070|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13071|      0|        }
13072|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13073|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:18): [True: 0, False: 0]
  ------------------
13074|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13074:18): [True: 0, False: 0]
  ------------------
13075|      0|          state = state::AUTHORITY;
13076|      0|        }
13077|       |        // Otherwise, set
13078|       |        // - url's username to base's username,
13079|       |        // - url's password to base's password,
13080|       |        // - url's host to base's host,
13081|       |        // - url's port to base's port,
13082|       |        // - state to path state, and then, decrease pointer by 1.
13083|      0|        else {
13084|       |          if constexpr (result_type_is_ada_url) {
13085|       |            url.username = base_url->username;
13086|       |            url.password = base_url->password;
13087|       |            url.host = base_url->host;
13088|       |            url.port = base_url->port;
13089|      0|          } else {
13090|      0|            url.update_base_authority(base_url->get_href(),
13091|      0|                                      base_url->get_components());
13092|      0|            url.update_host_to_base_host(base_url->get_hostname());
13093|      0|            url.update_base_port(base_url->retrieve_base_port());
13094|      0|          }
13095|      0|          state = state::PATH;
13096|      0|          break;
13097|      0|        }
13098|       |
13099|      0|        input_position++;
13100|      0|        break;
13101|      0|      }
13102|   259k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13102:7): [True: 259k, False: 1.51M]
  ------------------
13103|   259k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13104|   259k|                helpers::substring(url_data, input_position));
13105|       |
13106|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13107|       |        // then set state to special authority ignore slashes state and increase
13108|       |        // pointer by 1.
13109|   259k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13109:13): [True: 258k, False: 1.67k]
  ------------------
13110|   258k|          input_position += 2;
13111|   258k|        }
13112|       |
13113|   259k|        [[fallthrough]];
13114|   259k|      }
13115|   259k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13115:7): [True: 0, False: 1.77M]
  ------------------
13116|   259k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13117|   259k|                helpers::substring(url_data, input_position));
13118|       |
13119|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13120|       |        // authority state and decrease pointer by 1.
13121|   261k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13121:16): [True: 261k, False: 66]
  ------------------
13122|   261k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13122:17): [True: 651, False: 260k]
  ------------------
13123|   260k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13123:17): [True: 1.25k, False: 259k]
  ------------------
13124|  1.90k|          input_position++;
13125|  1.90k|        }
13126|   259k|        state = state::AUTHORITY;
13127|       |
13128|   259k|        break;
13129|   259k|      }
13130|  10.2k|      case state::QUERY: {
  ------------------
  |  Branch (13130:7): [True: 10.2k, False: 1.76M]
  ------------------
13131|  10.2k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13132|  10.2k|        if constexpr (store_values) {
13133|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13134|       |          // if url is special; otherwise the query percent-encode set.
13135|  10.2k|          const uint8_t* query_percent_encode_set =
13136|  10.2k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13136:15): [True: 9.06k, False: 1.18k]
  ------------------
13137|  10.2k|                               : character_sets::QUERY_PERCENT_ENCODE;
13138|       |
13139|       |          // Percent-encode after encoding, with encoding, buffer, and
13140|       |          // queryPercentEncodeSet, and append the result to url's query.
13141|  10.2k|          url.update_base_search(url_data.substr(input_position),
13142|  10.2k|                                 query_percent_encode_set);
13143|  10.2k|          ada_log("QUERY update_base_search completed ");
13144|  10.2k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13144:15): [True: 7.52k, False: 2.72k]
  ------------------
13145|  7.52k|            url.update_unencoded_base_hash(*fragment);
13146|  7.52k|          }
13147|  10.2k|        }
13148|  10.2k|        enforce_max_input_length();
13149|  10.2k|        return url;
13150|   259k|      }
13151|   260k|      case state::HOST: {
  ------------------
  |  Branch (13151:7): [True: 260k, False: 1.51M]
  ------------------
13152|   260k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13153|       |
13154|   260k|        std::string_view host_view = url_data.substr(input_position);
13155|   260k|        auto [location, found_colon] =
13156|   260k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13157|   260k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13157:26): [True: 260k, False: 0]
  ------------------
13158|   260k|                             ? input_position + location
13159|   260k|                             : input_size;
13160|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13161|       |        // Note: the 'found_colon' value is true if and only if a colon was
13162|       |        // encountered while not inside brackets.
13163|   260k|        if (found_colon) {
  ------------------
  |  Branch (13163:13): [True: 2.49k, False: 257k]
  ------------------
13164|       |          // If buffer is the empty string, validation error, return failure.
13165|       |          // Let host be the result of host parsing buffer with url is not
13166|       |          // special.
13167|  2.49k|          ada_log("HOST parsing ", host_view);
13168|  2.49k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13168:15): [True: 181, False: 2.31k]
  ------------------
13169|    181|            return url;
13170|    181|          }
13171|  2.31k|          ada_log("HOST parsing results in ", url.get_hostname());
13172|       |          // Set url's host to host, buffer to the empty string, and state to
13173|       |          // port state.
13174|  2.31k|          state = state::PORT;
13175|  2.31k|          input_position++;
13176|  2.31k|        }
13177|       |        // Otherwise, if one of the following is true:
13178|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13179|       |        // - url is special and c is U+005C (\)
13180|       |        // The get_host_delimiter_location function either brings us to
13181|       |        // the colon outside of the bracket, or to one of those characters.
13182|   257k|        else {
13183|       |          // If url is special and host_view is the empty string, validation
13184|       |          // error, return failure.
13185|   257k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13185:15): [True: 176, False: 257k]
  |  Branch (13185:36): [True: 107, False: 69]
  ------------------
13186|    107|            url.is_valid = false;
13187|    107|            return url;
13188|    107|          }
13189|   257k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13190|       |          // Let host be the result of host parsing host_view with url is not
13191|       |          // special.
13192|   257k|          if (host_view.empty()) {
  ------------------
  |  Branch (13192:15): [True: 69, False: 257k]
  ------------------
13193|     69|            url.update_base_hostname("");
13194|   257k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13194:22): [True: 20.4k, False: 237k]
  ------------------
13195|  20.4k|            return url;
13196|  20.4k|          }
13197|   237k|          ada_log("HOST parsing results in ", url.get_hostname(),
13198|   237k|                  " href=", url.get_href());
13199|       |
13200|       |          // Set url's host to host, and state to path start state.
13201|   237k|          state = state::PATH_START;
13202|   237k|        }
13203|       |
13204|   239k|        break;
13205|   260k|      }
13206|   239k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13206:7): [True: 792, False: 1.77M]
  ------------------
13207|    792|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13208|       |        // Opaque path, query, and fragment are structurally always valid:
13209|       |        // the parser would just percent-encode whatever is there. When we
13210|       |        // are not storing values (can_parse), we can return immediately.
13211|       |        // We must set has_opaque_path = true before returning so that when
13212|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13213|       |        // correctly rejects relative inputs against an opaque-path base
13214|       |        // (e.g. can_parse("", &"W:") must return false).
13215|       |        if constexpr (!store_values) {
13216|       |          url.has_opaque_path = true;
13217|       |          return url;
13218|       |        }
13219|    792|        std::string_view view = url_data.substr(input_position);
13220|       |        // If c is U+003F (?), then set url's query to the empty string and
13221|       |        // state to query state.
13222|    792|        size_t location = view.find('?');
13223|    792|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13223:13): [True: 477, False: 315]
  ------------------
13224|    477|          view.remove_suffix(view.size() - location);
13225|    477|          state = state::QUERY;
13226|    477|          input_position += location + 1;
13227|    477|        } else {
13228|    315|          input_position = input_size + 1;
13229|    315|        }
13230|    792|        url.has_opaque_path = true;
13231|       |
13232|       |        // This is a really unlikely scenario in real world. We should not seek
13233|       |        // to optimize it.
13234|    792|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13234:13): [True: 8, False: 784]
  ------------------
13235|      8|          std::string modified_view =
13236|      8|              std::string(view.substr(0, view.size() - 1)) + "%20";
13237|      8|          url.update_base_pathname(unicode::percent_encode(
13238|      8|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13239|    784|        } else {
13240|    784|          url.update_base_pathname(unicode::percent_encode(
13241|    784|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13242|    784|        }
13243|    792|        break;
13244|   260k|      }
13245|  2.31k|      case state::PORT: {
  ------------------
  |  Branch (13245:7): [True: 2.31k, False: 1.77M]
  ------------------
13246|  2.31k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13247|  2.31k|        std::string_view port_view = url_data.substr(input_position);
13248|  2.31k|        input_position += url.parse_port(port_view, true);
13249|  2.31k|        if (!url.is_valid) {
  ------------------
  |  Branch (13249:13): [True: 229, False: 2.08k]
  ------------------
13250|    229|          return url;
13251|    229|        }
13252|  2.08k|        state = state::PATH_START;
13253|  2.08k|        [[fallthrough]];
13254|  2.08k|      }
13255|   240k|      case state::PATH_START: {
  ------------------
  |  Branch (13255:7): [True: 238k, False: 1.53M]
  ------------------
13256|   240k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13257|       |        // Path, query, and fragment are structurally always valid: the
13258|       |        // parser would just percent-encode whatever is there. When we are
13259|       |        // not storing values (can_parse), we can return immediately since
13260|       |        // no subsequent state can invalidate the URL.
13261|       |        if constexpr (!store_values) {
13262|       |          return url;
13263|       |        }
13264|       |
13265|       |        // If url is special, then:
13266|   240k|        if (url.is_special()) {
  ------------------
  |  Branch (13266:13): [True: 239k, False: 699]
  ------------------
13267|       |          // Set state to path state.
13268|   239k|          state = state::PATH;
13269|       |
13270|       |          // Optimization: Avoiding going into PATH state improves the
13271|       |          // performance of urls ending with /.
13272|   239k|          if (input_position == input_size) {
  ------------------
  |  Branch (13272:15): [True: 30.0k, False: 209k]
  ------------------
13273|  30.0k|            if constexpr (store_values) {
13274|  30.0k|              url.update_base_pathname("/");
13275|  30.0k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13275:19): [True: 286, False: 29.7k]
  ------------------
13276|    286|                url.update_unencoded_base_hash(*fragment);
13277|    286|              }
13278|  30.0k|            }
13279|  30.0k|            enforce_max_input_length();
13280|  30.0k|            return url;
13281|  30.0k|          }
13282|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13283|       |          // by 1. We know that (input_position == input_size) is impossible
13284|       |          // here, because of the previous if-check.
13285|   209k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13285:15): [True: 1.08k, False: 208k]
  ------------------
13286|  1.08k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13286:15): [True: 651, False: 429]
  ------------------
13287|    651|            break;
13288|    651|          }
13289|   209k|        }
13290|       |        // Otherwise, if state override is not given and c is U+003F (?),
13291|       |        // set url's query to the empty string and state to query state.
13292|    699|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13292:18): [True: 555, False: 144]
  ------------------
13293|    555|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13293:18): [True: 87, False: 468]
  ------------------
13294|     87|          state = state::QUERY;
13295|     87|        }
13296|       |        // Otherwise, if c is not the EOF code point:
13297|    612|        else if (input_position != input_size) {
  ------------------
  |  Branch (13297:18): [True: 468, False: 144]
  ------------------
13298|       |          // Set state to path state.
13299|    468|          state = state::PATH;
13300|       |
13301|       |          // If c is not U+002F (/), then decrease pointer by 1.
13302|    468|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13302:15): [True: 0, False: 468]
  ------------------
13303|      0|            break;
13304|      0|          }
13305|    468|        }
13306|       |
13307|   209k|        input_position++;
13308|   209k|        break;
13309|   240k|      }
13310|   210k|      case state::PATH: {
  ------------------
  |  Branch (13310:7): [True: 210k, False: 1.56M]
  ------------------
13311|   210k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13312|       |        // Path, query, and fragment are structurally always valid: the
13313|       |        // parser would just percent-encode whatever is there. When we are
13314|       |        // not storing values (can_parse), we can return immediately since
13315|       |        // no subsequent state can invalidate the URL.
13316|       |        if constexpr (!store_values) {
13317|       |          return url;
13318|       |        }
13319|   210k|        std::string_view view = url_data.substr(input_position);
13320|       |
13321|       |        // Most time, we do not need percent encoding.
13322|       |        // Furthermore, we can immediately locate the '?'.
13323|   210k|        size_t locofquestionmark = view.find('?');
13324|   210k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13324:13): [True: 9.68k, False: 201k]
  ------------------
13325|  9.68k|          state = state::QUERY;
13326|  9.68k|          view.remove_suffix(view.size() - locofquestionmark);
13327|  9.68k|          input_position += locofquestionmark + 1;
13328|   201k|        } else {
13329|   201k|          input_position = input_size + 1;
13330|   201k|        }
13331|   210k|        if constexpr (store_values) {
13332|       |          if constexpr (result_type_is_ada_url) {
13333|       |            helpers::parse_prepared_path(view, url.type, url.path);
13334|   210k|          } else {
13335|   210k|            url.consume_prepared_path(view);
13336|   210k|            ADA_ASSERT_TRUE(url.validate());
13337|   210k|          }
13338|   210k|        }
13339|   210k|        break;
13340|   240k|      }
13341|  1.38k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13341:7): [True: 1.38k, False: 1.77M]
  ------------------
13342|  1.38k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13343|       |
13344|       |        // If c is U+002F (/) or U+005C (\), then:
13345|  1.38k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13345:13): [True: 1.38k, False: 1]
  ------------------
13346|  1.38k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13346:14): [True: 1.36k, False: 14]
  ------------------
13347|  1.37k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13347:14): [True: 2, False: 12]
  ------------------
13348|  1.37k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13349|       |          // Set state to file host state.
13350|  1.37k|          state = state::FILE_HOST;
13351|  1.37k|          input_position++;
13352|  1.37k|        } else {
13353|     13|          ada_log("FILE_SLASH otherwise");
13354|       |          // If base is non-null and base's scheme is "file", then:
13355|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13356|       |          // base_url_has_value() is true.
13357|     13|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13357:15): [True: 0, False: 13]
  |  Branch (13357:38): [True: 0, False: 0]
  ------------------
13358|       |            // Set url's host to base's host.
13359|       |            if constexpr (result_type_is_ada_url) {
13360|       |              url.host = base_url->host;
13361|      0|            } else {
13362|      0|              url.update_host_to_base_host(base_url->get_host());
13363|      0|            }
13364|       |            // If the code point substring from pointer to the end of input does
13365|       |            // not start with a Windows drive letter and base's path[0] is a
13366|       |            // normalized Windows drive letter, then append base's path[0] to
13367|       |            // url's path.
13368|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13368:17): [True: 0, False: 0]
  ------------------
13369|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13369:19): [True: 0, False: 0]
  ------------------
13370|      0|                      url_data.substr(input_position))) {
13371|      0|                std::string_view first_base_url_path =
13372|      0|                    base_url->get_pathname().substr(1);
13373|      0|                size_t loc = first_base_url_path.find('/');
13374|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13374:21): [True: 0, False: 0]
  ------------------
13375|      0|                  helpers::resize(first_base_url_path, loc);
13376|      0|                }
13377|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13377:21): [True: 0, False: 0]
  ------------------
13378|      0|                        first_base_url_path)) {
13379|       |                  if constexpr (result_type_is_ada_url) {
13380|       |                    url.path += '/';
13381|       |                    url.path += first_base_url_path;
13382|      0|                  } else {
13383|      0|                    url.append_base_pathname(
13384|      0|                        helpers::concat("/", first_base_url_path));
13385|      0|                  }
13386|      0|                }
13387|      0|              }
13388|      0|            }
13389|      0|          }
13390|       |
13391|       |          // Set state to path state, and decrease pointer by 1.
13392|     13|          state = state::PATH;
13393|     13|        }
13394|       |
13395|  1.38k|        break;
13396|   240k|      }
13397|  1.37k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13397:7): [True: 1.37k, False: 1.77M]
  ------------------
13398|  1.37k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13399|  1.37k|        std::string_view view = url_data.substr(input_position);
13400|       |
13401|  1.37k|        size_t location = view.find_first_of("/\\?");
13402|  1.37k|        std::string_view file_host_buffer = view.substr(
13403|  1.37k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13403:16): [True: 1.32k, False: 43]
  ------------------
13404|       |
13405|  1.37k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13405:13): [True: 1, False: 1.37k]
  ------------------
13406|      1|          state = state::PATH;
13407|  1.37k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13407:20): [True: 293, False: 1.07k]
  ------------------
13408|       |          // Set url's host to the empty string.
13409|       |          if constexpr (result_type_is_ada_url) {
13410|       |            url.host = "";
13411|    293|          } else {
13412|    293|            url.update_base_hostname("");
13413|    293|          }
13414|       |          // Set state to path start state.
13415|    293|          state = state::PATH_START;
13416|  1.07k|        } else {
13417|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13418|  1.07k|          input_position += consumed_bytes;
13419|       |          // Let host be the result of host parsing buffer with url is not
13420|       |          // special.
13421|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13421:15): [True: 99, False: 978]
  ------------------
13422|     99|            return url;
13423|     99|          }
13424|       |
13425|       |          if constexpr (result_type_is_ada_url) {
13426|       |            // If host is "localhost", then set host to the empty string.
13427|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13428|       |              url.host = "";
13429|       |            }
13430|    978|          } else {
13431|    978|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13431:17): [True: 3, False: 975]
  ------------------
13432|      3|              url.update_base_hostname("");
13433|      3|            }
13434|    978|          }
13435|       |
13436|       |          // Set buffer to the empty string and state to path start state.
13437|    978|          state = state::PATH_START;
13438|    978|        }
13439|       |
13440|  1.27k|        break;
13441|  1.37k|      }
13442|  1.50k|      case state::FILE: {
  ------------------
  |  Branch (13442:7): [True: 1.50k, False: 1.77M]
  ------------------
13443|  1.50k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13444|  1.50k|        std::string_view file_view = url_data.substr(input_position);
13445|       |
13446|  1.50k|        url.set_protocol_as_file();
13447|       |        if constexpr (result_type_is_ada_url) {
13448|       |          // Set url's host to the empty string.
13449|       |          url.host = "";
13450|  1.50k|        } else {
13451|  1.50k|          url.update_base_hostname("");
13452|  1.50k|        }
13453|       |        // If c is U+002F (/) or U+005C (\), then:
13454|  1.50k|        if (input_position != input_size &&
  ------------------
  |  Branch (13454:13): [True: 1.50k, False: 1]
  ------------------
13455|  1.50k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13455:14): [True: 1.38k, False: 124]
  ------------------
13456|  1.38k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13456:14): [True: 3, False: 121]
  ------------------
13457|  1.38k|          ada_log("FILE c is U+002F or U+005C");
13458|       |          // Set state to file slash state.
13459|  1.38k|          state = state::FILE_SLASH;
13460|  1.38k|        }
13461|       |        // Otherwise, if base is non-null and base's scheme is "file":
13462|    122|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13462:18): [True: 0, False: 122]
  |  Branch (13462:41): [True: 0, False: 0]
  ------------------
13463|       |          // Set url's host to base's host, url's path to a clone of base's
13464|       |          // path, and url's query to base's query.
13465|      0|          ada_log("FILE base non-null");
13466|       |          if constexpr (result_type_is_ada_url) {
13467|       |            url.host = base_url->host;
13468|       |            url.path = base_url->path;
13469|       |            url.query = base_url->query;
13470|      0|          } else {
13471|      0|            url.update_host_to_base_host(base_url->get_hostname());
13472|      0|            url.update_base_pathname(base_url->get_pathname());
13473|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13473:17): [True: 0, False: 0]
  ------------------
13474|       |              // get_search() returns "" for an empty query string (URL ends
13475|       |              // with '?'). update_base_search("") would incorrectly clear the
13476|       |              // query, so pass "?" to preserve the empty query distinction.
13477|      0|              auto s = base_url->get_search();
13478|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13478:38): [True: 0, False: 0]
  ------------------
13479|      0|            }
13480|      0|          }
13481|      0|          url.has_opaque_path = base_url->has_opaque_path;
13482|       |
13483|       |          // If c is U+003F (?), then set url's query to the empty string and
13484|       |          // state to query state.
13485|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13485:15): [True: 0, False: 0]
  |  Branch (13485:47): [True: 0, False: 0]
  ------------------
13486|      0|            state = state::QUERY;
13487|      0|          }
13488|       |          // Otherwise, if c is not the EOF code point:
13489|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13489:20): [True: 0, False: 0]
  ------------------
13490|       |            // Set url's query to null.
13491|      0|            url.clear_search();
13492|       |            // If the code point substring from pointer to the end of input does
13493|       |            // not start with a Windows drive letter, then shorten url's path.
13494|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13494:17): [True: 0, False: 0]
  ------------------
13495|       |              if constexpr (result_type_is_ada_url) {
13496|       |                helpers::shorten_path(url.path, url.type);
13497|      0|              } else {
13498|      0|                std::string_view path = url.get_pathname();
13499|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13499:21): [True: 0, False: 0]
  ------------------
13500|      0|                  url.update_base_pathname(std::move(std::string(path)));
13501|      0|                }
13502|      0|              }
13503|      0|            }
13504|       |            // Otherwise:
13505|      0|            else {
13506|       |              // Set url's path to an empty list.
13507|      0|              url.clear_pathname();
13508|      0|              url.has_opaque_path = true;
13509|      0|            }
13510|       |
13511|       |            // Set state to path state and decrease pointer by 1.
13512|      0|            state = state::PATH;
13513|      0|            break;
13514|      0|          }
13515|      0|        }
13516|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13517|    122|        else {
13518|    122|          ada_log("FILE go to path");
13519|    122|          state = state::PATH;
13520|    122|          break;
13521|    122|        }
13522|       |
13523|  1.38k|        input_position++;
13524|  1.38k|        break;
13525|  1.50k|      }
13526|      0|      default:
  ------------------
  |  Branch (13526:7): [True: 0, False: 1.77M]
  ------------------
13527|      0|        unreachable();
13528|  1.77M|    }
13529|  1.77M|  }
13530|   546k|  if constexpr (store_values) {
13531|   546k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13531:9): [True: 2.38k, False: 544k]
  ------------------
13532|  2.38k|      url.update_unencoded_base_hash(*fragment);
13533|  2.38k|    }
13534|   546k|  }
13535|   546k|  enforce_max_input_length();
13536|   546k|  return url;
13537|   608k|}
_ZN3ada14url_aggregator8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14106|   195k|bool url_aggregator::set_href(const std::string_view input) {
14107|   195k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14108|   195k|  ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
14109|   195k|  ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
14110|   195k|  ada_log("url_aggregator::set_href, success :", out.has_value());
14111|       |
14112|   195k|  if (out) {
  ------------------
  |  Branch (14112:7): [True: 195k, False: 0]
  ------------------
14113|       |    // The parser enforces get_max_input_length() on both the input and the
14114|       |    // normalized result. This is a defense-in-depth check.
14115|   195k|    if (out->buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (14115:9): [True: 0, False: 195k]
  ------------------
14116|      0|      return false;
14117|      0|    }
14118|   195k|    ada_log("url_aggregator::set_href, parsed ", out->to_string());
14119|       |    // TODO: Figure out why the following line puts test to never finish.
14120|   195k|    *this = *out;
14121|   195k|  }
14122|       |
14123|   195k|  return out.has_value();
14124|   195k|}
_ZNK3ada14url_aggregator12get_usernameEv:
14442|   195k|    ada_lifetime_bound {
14443|   195k|  ada_log("url_aggregator::get_username");
14444|   195k|  if (has_non_empty_username()) {
  ------------------
  |  Branch (14444:7): [True: 10.0k, False: 185k]
  ------------------
14445|  10.0k|    return helpers::substring(buffer, components.protocol_end + 2,
14446|  10.0k|                              components.username_end);
14447|  10.0k|  }
14448|   185k|  return "";
14449|   195k|}
_ZNK3ada14url_aggregator12get_passwordEv:
14452|   195k|    ada_lifetime_bound {
14453|   195k|  ada_log("url_aggregator::get_password");
14454|   195k|  if (has_non_empty_password()) {
  ------------------
  |  Branch (14454:7): [True: 9.67k, False: 186k]
  ------------------
14455|  9.67k|    return helpers::substring(buffer, components.username_end + 1,
14456|  9.67k|                              components.host_start);
14457|  9.67k|  }
14458|   186k|  return "";
14459|   195k|}
_ZNK3ada14url_aggregator8get_portEv:
14462|   195k|    ada_lifetime_bound {
14463|   195k|  ada_log("url_aggregator::get_port");
14464|   195k|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (14464:7): [True: 175k, False: 20.1k]
  ------------------
14465|   175k|    return "";
14466|   175k|  }
14467|  20.1k|  return helpers::substring(buffer, components.host_end + 1,
14468|  20.1k|                            components.pathname_start);
14469|   195k|}
_ZNK3ada14url_aggregator8get_hashEv:
14472|   195k|    ada_lifetime_bound {
14473|   195k|  ada_log("url_aggregator::get_hash");
14474|       |  // If this's URL's fragment is either null or the empty string, then return
14475|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
14476|   195k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (14476:7): [True: 171k, False: 23.9k]
  ------------------
14477|   171k|    return "";
14478|   171k|  }
14479|  23.9k|  if (buffer.size() - components.hash_start <= 1) {
  ------------------
  |  Branch (14479:7): [True: 1.47k, False: 22.4k]
  ------------------
14480|  1.47k|    return "";
14481|  1.47k|  }
14482|  22.4k|  return helpers::substring(buffer, components.hash_start);
14483|  23.9k|}
_ZNK3ada14url_aggregator8get_hostEv:
14486|   195k|    ada_lifetime_bound {
14487|   195k|  ada_log("url_aggregator::get_host");
14488|       |  // Technically, we should check if there is a hostname, but
14489|       |  // the code below works even if there isn't.
14490|       |  // if(!has_hostname()) { return ""; }
14491|   195k|  size_t start = components.host_start;
14492|   195k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14492:7): [True: 195k, False: 557]
  ------------------
14493|   195k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14493:7): [True: 10.0k, False: 185k]
  ------------------
14494|  10.0k|    start++;
14495|  10.0k|  }
14496|       |  // if we have an empty host, then the space between components.host_end and
14497|       |  // components.pathname_start may be occupied by /.
14498|   195k|  if (start == components.host_end) {
  ------------------
  |  Branch (14498:7): [True: 557, False: 195k]
  ------------------
14499|    557|    return {};
14500|    557|  }
14501|   195k|  return helpers::substring(buffer, start, components.pathname_start);
14502|   195k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14505|   259k|    ada_lifetime_bound {
14506|   259k|  ada_log("url_aggregator::get_hostname");
14507|       |  // Technically, we should check if there is a hostname, but
14508|       |  // the code below works even if there isn't.
14509|       |  // if(!has_hostname()) { return ""; }
14510|   259k|  size_t start = components.host_start;
14511|       |  // So host_start is not where the host begins.
14512|   259k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14512:7): [True: 196k, False: 63.5k]
  ------------------
14513|   196k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14513:7): [True: 10.2k, False: 186k]
  ------------------
14514|  10.2k|    start++;
14515|  10.2k|  }
14516|   259k|  return helpers::substring(buffer, start, components.host_end);
14517|   259k|}
_ZNK3ada14url_aggregator10get_searchEv:
14520|   195k|    ada_lifetime_bound {
14521|   195k|  ada_log("url_aggregator::get_search");
14522|       |  // If this's URL's query is either null or the empty string, then return the
14523|       |  // empty string. Return U+003F (?), followed by this's URL's query.
14524|   195k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (14524:7): [True: 162k, False: 33.2k]
  ------------------
14525|   162k|    return "";
14526|   162k|  }
14527|  33.2k|  auto ending_index = uint32_t(buffer.size());
14528|  33.2k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (14528:7): [True: 13.2k, False: 19.9k]
  ------------------
14529|  13.2k|    ending_index = components.hash_start;
14530|  13.2k|  }
14531|  33.2k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (14531:7): [True: 1.09k, False: 32.1k]
  ------------------
14532|  1.09k|    return "";
14533|  1.09k|  }
14534|  32.1k|  return helpers::substring(buffer, components.search_start, ending_index);
14535|  33.2k|}
_ZNK3ada14url_aggregator12get_protocolEv:
14538|   195k|    ada_lifetime_bound {
14539|   195k|  ada_log("url_aggregator::get_protocol");
14540|   195k|  return helpers::substring(buffer, 0, components.protocol_end);
14541|   195k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
14650|  57.4k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14651|  57.4k|  ada_log("parse_ipv4 ", input, " [", input.size(),
14652|  57.4k|          " bytes], overlaps with buffer: ",
14653|  57.4k|          helpers::overlaps(input, buffer) ? "yes" : "no");
14654|  57.4k|  ADA_ASSERT_TRUE(validate());
14655|  57.4k|  if (input.empty()) {
  ------------------
  |  Branch (14655:7): [True: 0, False: 57.4k]
  ------------------
14656|      0|    return is_valid = false;
14657|      0|  }
14658|  57.4k|  const bool trailing_dot = (input.back() == '.');
14659|  57.4k|  if (trailing_dot) {
  ------------------
  |  Branch (14659:7): [True: 27.6k, False: 29.7k]
  ------------------
14660|  27.6k|    input.remove_suffix(1);
14661|  27.6k|    if (input.empty()) {
  ------------------
  |  Branch (14661:9): [True: 0, False: 27.6k]
  ------------------
14662|      0|      return is_valid = false;
14663|      0|    }
14664|  27.6k|  }
14665|       |
14666|  57.4k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
14667|  57.4k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (14667:7): [True: 18.4k, False: 38.9k]
  ------------------
14668|       |    // Pure decimal: keep the buffer when it already holds the address.
14669|       |    // Otherwise write the (trailing-dot-stripped) input.
14670|  18.4k|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (14670:11): [True: 18.4k, False: 6]
  |  Branch (14670:23): [True: 5, False: 18.4k]
  ------------------
14671|  18.4k|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (14671:11): [True: 0, False: 18.4k]
  ------------------
14672|      0|        update_base_hostname(std::string(input));
14673|  18.4k|      } else {
14674|  18.4k|        update_base_hostname(input);
14675|  18.4k|      }
14676|  18.4k|    }
14677|  18.4k|    host_type = IPV4;
14678|  18.4k|    ADA_ASSERT_TRUE(validate());
14679|  18.4k|    return true;
14680|  18.4k|  }
14681|       |
14682|  38.9k|  const char* p = input.data();
14683|  38.9k|  const char* end = p + input.size();
14684|  38.9k|  uint64_t ipv4 = 0;
14685|  38.9k|  int digit_count = 0;
14686|  38.9k|  int pure_decimal_count = 0;
14687|       |
14688|  49.1k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (14688:10): [True: 49.1k, False: 15]
  |  Branch (14688:29): [True: 49.1k, False: 0]
  ------------------
14689|  49.1k|    uint64_t segment = 0;
14690|  49.1k|    bool pure = false;
14691|  49.1k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (14691:9): [True: 18.7k, False: 30.3k]
  ------------------
14692|  18.7k|      return is_valid = false;
14693|  18.7k|    }
14694|  30.3k|    if (pure) {
  ------------------
  |  Branch (14694:9): [True: 11.3k, False: 19.0k]
  ------------------
14695|  11.3k|      ++pure_decimal_count;
14696|  11.3k|    }
14697|  30.3k|    if (p >= end) {
  ------------------
  |  Branch (14697:9): [True: 20.1k, False: 10.1k]
  ------------------
14698|  20.1k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
14699|  20.1k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (14699:11): [True: 24, False: 20.1k]
  ------------------
14700|     24|        return is_valid = false;
14701|     24|      }
14702|  20.1k|      ipv4 = (ipv4 << shift) | segment;
14703|  20.1k|      goto ipv4_done;
14704|  20.1k|    }
14705|  10.1k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (14705:9): [True: 47, False: 10.1k]
  |  Branch (14705:26): [True: 0, False: 10.1k]
  ------------------
14706|     47|      return is_valid = false;
14707|     47|    }
14708|  10.1k|    ipv4 = (ipv4 << 8) | segment;
14709|  10.1k|    ++p;
14710|  10.1k|  }
14711|     15|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (14711:7): [True: 0, False: 15]
  |  Branch (14711:27): [True: 15, False: 0]
  ------------------
14712|     15|    return is_valid = false;
14713|     15|  }
14714|  20.1k|ipv4_done:
14715|  20.1k|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
14716|  20.1k|          " host: ", get_host());
14717|  20.1k|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (14717:7): [True: 20.1k, False: 55]
  |  Branch (14717:19): [True: 0, False: 20.1k]
  |  Branch (14717:46): [True: 0, False: 0]
  ------------------
14718|      0|    ada_log(
14719|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
14720|      0|        "buffer");
14721|  20.1k|  } else {
14722|  20.1k|    update_base_hostname(ada::serializers::ipv4(ipv4));
14723|  20.1k|  }
14724|  20.1k|  host_type = IPV4;
14725|  20.1k|  ADA_ASSERT_TRUE(validate());
14726|  20.1k|  return true;
14727|     15|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14729|    588|bool url_aggregator::parse_ipv6(std::string_view input) {
14730|    588|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
14731|    588|  ADA_ASSERT_TRUE(validate());
14732|    588|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14733|    588|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (14733:7): [True: 22, False: 566]
  |  Branch (14733:24): [True: 13, False: 553]
  ------------------
14734|     35|    return is_valid = false;
14735|     35|  }
14736|    553|  std::array<uint16_t, 8> address{};
14737|       |#if defined(ADA_AVX512_IPV6)
14738|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
14739|       |                                                     address, simd_valid)) {
14740|       |    if (!simd_valid) [[unlikely]] {
14741|       |      return is_valid = false;
14742|       |    }
14743|       |    const std::string serialized = ada::serializers::ipv6(address);
14744|       |    if (get_hostname() != serialized) {
14745|       |      update_base_hostname(serialized);
14746|       |    }
14747|       |    host_type = IPV6;
14748|       |    return true;
14749|       |  }
14750|       |  address = {};
14751|       |#endif
14752|    553|  const char* pointer = input.data();
14753|    553|  const char* const end = pointer + input.size();
14754|    553|  int piece_index = 0;
14755|    553|  int compress = -1;
14756|       |
14757|    553|  if (*pointer == ':') {
  ------------------
  |  Branch (14757:7): [True: 277, False: 276]
  ------------------
14758|    277|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (14758:9): [True: 3, False: 274]
  |  Branch (14758:30): [True: 7, False: 267]
  ------------------
14759|     10|      return is_valid = false;
14760|     10|    }
14761|    267|    pointer += 2;
14762|    267|    compress = ++piece_index;
14763|    267|  }
14764|       |
14765|  1.52k|  while (pointer != end) {
  ------------------
  |  Branch (14765:10): [True: 1.09k, False: 433]
  ------------------
14766|  1.09k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (14766:9): [True: 3, False: 1.08k]
  ------------------
14767|      3|      return is_valid = false;
14768|      3|    }
14769|  1.08k|    if (*pointer == ':') {
  ------------------
  |  Branch (14769:9): [True: 143, False: 944]
  ------------------
14770|    143|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (14770:11): [True: 3, False: 140]
  ------------------
14771|      3|        return is_valid = false;
14772|      3|      }
14773|    140|      ++pointer;
14774|    140|      compress = ++piece_index;
14775|    140|      continue;
14776|    143|    }
14777|       |
14778|    944|    uint16_t value = 0;
14779|    944|    const int length = detail::parse_hex_piece(pointer, end, value);
14780|       |
14781|    944|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (14781:9): [True: 733, False: 211]
  |  Branch (14781:27): [True: 80, False: 653]
  ------------------
14782|     80|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14782:11): [True: 3, False: 77]
  ------------------
14783|      3|        return is_valid = false;
14784|      3|      }
14785|     77|      pointer -= length;
14786|     77|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (14786:11): [True: 3, False: 74]
  ------------------
14787|      3|        return is_valid = false;
14788|      3|      }
14789|       |
14790|     74|      int numbers_seen = 0;
14791|    211|      while (pointer != end) {
  ------------------
  |  Branch (14791:14): [True: 193, False: 18]
  ------------------
14792|    193|        int ipv4_piece = -1;
14793|    193|        if (numbers_seen > 0) {
  ------------------
  |  Branch (14793:13): [True: 119, False: 74]
  ------------------
14794|    119|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (14794:15): [True: 104, False: 15]
  |  Branch (14794:34): [True: 98, False: 6]
  ------------------
14795|     98|            ++pointer;
14796|     98|          } else {
14797|     21|            return is_valid = false;
14798|     21|          }
14799|    119|        }
14800|    172|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (14800:13): [True: 13, False: 159]
  |  Branch (14800:31): [True: 11, False: 148]
  |  Branch (14800:49): [True: 3, False: 145]
  ------------------
14801|     27|          return is_valid = false;
14802|     27|        }
14803|    145|        ipv4_piece = *pointer - '0';
14804|    145|        ++pointer;
14805|    145|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14805:13): [True: 135, False: 10]
  |  Branch (14805:31): [True: 57, False: 78]
  |  Branch (14805:50): [True: 54, False: 3]
  ------------------
14806|     54|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (14806:15): [True: 3, False: 51]
  ------------------
14807|      3|            return is_valid = false;
14808|      3|          }
14809|     51|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14810|     51|          ++pointer;
14811|     51|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14811:15): [True: 48, False: 3]
  |  Branch (14811:33): [True: 29, False: 19]
  |  Branch (14811:52): [True: 25, False: 4]
  ------------------
14812|     25|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14813|     25|            ++pointer;
14814|     25|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (14814:17): [True: 5, False: 20]
  ------------------
14815|      5|              return is_valid = false;
14816|      5|            }
14817|     25|          }
14818|     51|        }
14819|    137|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
14820|    137|            address[static_cast<size_t>(piece_index)] * 0x100 +
14821|    137|            static_cast<uint16_t>(ipv4_piece));
14822|    137|        ++numbers_seen;
14823|    137|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (14823:13): [True: 40, False: 97]
  |  Branch (14823:34): [True: 13, False: 84]
  ------------------
14824|     53|          ++piece_index;
14825|     53|        }
14826|    137|      }
14827|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (14827:11): [True: 12, False: 6]
  ------------------
14828|     12|        return is_valid = false;
14829|     12|      }
14830|      6|      break;
14831|     18|    }
14832|       |
14833|    864|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14833:9): [True: 16, False: 848]
  ------------------
14834|     16|      return is_valid = false;
14835|     16|    }
14836|       |
14837|    848|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (14837:9): [True: 637, False: 211]
  |  Branch (14837:27): [True: 633, False: 4]
  ------------------
14838|    633|      ++pointer;
14839|    633|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (14839:11): [True: 4, False: 629]
  ------------------
14840|      4|        return is_valid = false;
14841|      4|      }
14842|    633|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (14842:16): [True: 4, False: 211]
  ------------------
14843|      4|      return is_valid = false;
14844|      4|    }
14845|       |
14846|    840|    address[static_cast<size_t>(piece_index)] = value;
14847|    840|    ++piece_index;
14848|    840|  }
14849|       |
14850|    439|  if (compress != -1) {
  ------------------
  |  Branch (14850:7): [True: 397, False: 42]
  ------------------
14851|    397|    const int right = piece_index - compress;
14852|    397|    if (right > 0) {
  ------------------
  |  Branch (14852:9): [True: 175, False: 222]
  ------------------
14853|    175|      const size_t dest = static_cast<size_t>(8 - right);
14854|    175|      const size_t src = static_cast<size_t>(compress);
14855|    175|      if (dest != src) {
  ------------------
  |  Branch (14855:11): [True: 166, False: 9]
  ------------------
14856|    453|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (14856:53): [True: 287, False: 166]
  ------------------
14857|    287|          address[dest + i] = address[src + i];
14858|    287|          address[src + i] = 0;
14859|    287|        }
14860|    166|      }
14861|    175|    }
14862|    397|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (14862:14): [True: 26, False: 16]
  ------------------
14863|     26|    return is_valid = false;
14864|     26|  }
14865|       |
14866|       |  // Serialize once; skip rewrite when hostname is already canonical.
14867|    413|  const std::string serialized = ada::serializers::ipv6(address);
14868|    413|  const std::string_view current = get_hostname();
14869|    413|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (14869:7): [True: 0, False: 413]
  ------------------
14870|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (14870:7): [True: 0, False: 0]
  ------------------
14871|      0|    ada_log("parse_ipv6 in-place canonical match");
14872|    413|  } else {
14873|    413|    update_base_hostname(serialized);
14874|    413|  }
14875|    413|  ada_log("parse_ipv6 ", get_hostname());
14876|    413|  ADA_ASSERT_TRUE(validate());
14877|    413|  host_type = IPV6;
14878|    413|  return true;
14879|    439|}
_ZN3ada14url_aggregator17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14881|    662|bool url_aggregator::parse_opaque_host(std::string_view input) {
14882|    662|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
14883|    662|  ADA_ASSERT_TRUE(validate());
14884|    662|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14885|    662|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (14885:7): [True: 31, False: 631]
  ------------------
14886|     31|    return is_valid = false;
14887|     31|  }
14888|       |
14889|       |  // Return the result of running UTF-8 percent-encode on input using the C0
14890|       |  // control percent-encode set.
14891|    631|  size_t idx = ada::unicode::percent_encode_index(
14892|    631|      input, character_sets::C0_CONTROL_PERCENT_ENCODE);
14893|    631|  if (idx == input.size()) {
  ------------------
  |  Branch (14893:7): [True: 589, False: 42]
  ------------------
14894|    589|    update_base_hostname(input);
14895|    589|  } else {
14896|       |    // We only create a temporary string if we need to.
14897|     42|    update_base_hostname(ada::unicode::percent_encode(
14898|     42|        input, character_sets::C0_CONTROL_PERCENT_ENCODE, idx));
14899|     42|  }
14900|    631|  ADA_ASSERT_TRUE(validate());
14901|    631|  return true;
14902|    662|}
simple_absolute.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  272|   249k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  273|       |    // -65 is 0b10111111, anything larger in two-complement's
  274|       |    // should start a new code point.
  275|   249k|    return c > -65;
  276|   249k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  483|      2|inline Huff make_fixed_litlen_huff() {
  484|      2|  Huff h;
  485|      2|  uint8_t lens[288];
  486|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  487|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (487:19): [True: 288, False: 2]
  ------------------
  488|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (488:21): [True: 224, False: 2]
  ------------------
  489|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (489:21): [True: 48, False: 2]
  ------------------
  490|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (490:21): [True: 16, False: 2]
  ------------------
  491|      2|  h.build(lens, 288);
  492|      2|  return h;
  493|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  432|     16|  bool build(const uint8_t* lens, int n) {
  433|     16|    std::memset(counts, 0, sizeof(counts));
  434|     16|    std::memset(first_code, 0, sizeof(first_code));
  435|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  436|     16|    nsymbols = n;
  437|     16|    max_bits = 0;
  438|  1.98k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (438:21): [True: 1.96k, False: 16]
  ------------------
  439|  1.96k|      lengths[i] = lens[i];
  440|  1.96k|      if (lens[i]) {
  ------------------
  |  Branch (440:11): [True: 1.91k, False: 49]
  ------------------
  441|  1.91k|        counts[lens[i]]++;
  442|  1.91k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (442:13): [True: 46, False: 1.87k]
  ------------------
  443|  1.91k|      }
  444|  1.96k|    }
  445|       |    // Canonical first code for each bit length (RFC 1951).
  446|     16|    int code = 0;
  447|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (447:24): [True: 240, False: 16]
  ------------------
  448|    240|      code = (code + counts[bits - 1]) << 1;
  449|    240|      first_code[bits] = code;
  450|    240|    }
  451|     16|    int idx = 0;
  452|    158|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (452:24): [True: 142, False: 16]
  ------------------
  453|    142|      base_idx[bits] = idx;
  454|       |      // assign symbols in symbol order for codes of this length
  455|  21.6k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (455:25): [True: 21.5k, False: 142]
  ------------------
  456|  21.5k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (456:13): [True: 1.91k, False: 19.6k]
  ------------------
  457|  1.91k|          symbols[idx++] = static_cast<int16_t>(sym);
  458|  1.91k|        }
  459|  21.5k|      }
  460|    142|    }
  461|     16|    return true;
  462|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  495|      2|inline Huff make_fixed_dist_huff() {
  496|      2|  Huff h;
  497|      2|  uint8_t lens[32];
  498|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (498:19): [True: 64, False: 2]
  ------------------
  499|      2|  h.build(lens, 32);
  500|      2|  return h;
  501|      2|}
_ZN3ada4idna7deflate9BitReader6ensureEi:
  392|   457k|  bool ensure(int n) {
  393|   520k|    while (bits < n) {
  ------------------
  |  Branch (393:12): [True: 62.3k, False: 457k]
  ------------------
  394|  62.3k|      if (p >= end) return false;
  ------------------
  |  Branch (394:11): [True: 0, False: 62.3k]
  ------------------
  395|  62.3k|      acc |= uint32_t(*p++) << bits;
  396|  62.3k|      bits += 8;
  397|  62.3k|    }
  398|   457k|    return true;
  399|   457k|  }
simple_absolute.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5127|   360k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|   360k|    return 0x101010101010101ull * v;
 5129|   360k|  };
_ZN3ada4idna13ensure_tablesEv:
 4878|  36.3k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4879|  36.3k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4880|  36.3k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4880:7): [True: 36.3k, False: 1]
  ------------------
 4881|  36.3k|    return true;
 4882|  36.3k|  }
 4883|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4883:7): [True: 0, False: 1]
  ------------------
 4884|      0|    return false;
 4885|      0|  }
 4886|       |
 4887|      1|  uint8_t expected = kTablesUninit;
 4888|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4888:7): [True: 1, False: 0]
  ------------------
 4889|      1|                                                std::memory_order_acq_rel,
 4890|      1|                                                std::memory_order_acquire)) {
 4891|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4892|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4892:9): [True: 0, False: 1]
  ------------------
 4893|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4894|      0|      return false;
 4895|      0|    }
 4896|       |
 4897|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4898|      1|                                          table_blob::compressed_size, buffer,
 4899|      1|                                          table_blob::uncompressed_size);
 4900|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4900:9): [True: 0, False: 1]
  ------------------
 4901|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4901:9): [True: 0, False: 1]
  ------------------
 4902|      0|      delete[] buffer;
 4903|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4904|      0|      return false;
 4905|      0|    }
 4906|       |
 4907|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4908|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4909|       |
 4910|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|      1|      return buffer + off;
 4912|      1|    };
 4913|       |
 4914|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4915|       |    // acquire on tables_init_state and then observe these writes.
 4916|      1|    idna_stage1 =
 4917|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4918|      1|    idna_stage2 =
 4919|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4920|      1|    idna_bool_blocks =
 4921|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4922|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4923|       |
 4924|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4925|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4926|      1|        at(table_blob::off_decomposition_block));
 4927|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4928|      1|        at(table_blob::off_decomposition_data));
 4929|      1|    ccc_index = at(table_blob::off_ccc_index);
 4930|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4931|      1|    composition_index = at(table_blob::off_composition_index);
 4932|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_composition_block));
 4934|      1|    composition_data =
 4935|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4936|       |
 4937|      1|    id_continue =
 4938|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4939|      1|    id_start =
 4940|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4941|       |
 4942|      1|    dir_start =
 4943|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4944|      1|    dir_final =
 4945|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4946|      1|    dir_value = at(table_blob::off_dir_value);
 4947|      1|    combining_ranges =
 4948|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4949|       |
 4950|      1|    tables_buffer = buffer;
 4951|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4952|      1|    return true;
 4953|      1|  }
 4954|       |
 4955|       |  // Another thread owns init (or finished between our loads).
 4956|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4956:28): [True: 0, False: 0]
  ------------------
 4957|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4958|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4958:9): [True: 0, False: 0]
  ------------------
 4959|      0|      return true;
 4960|      0|    }
 4961|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4961:9): [True: 0, False: 0]
  ------------------
 4962|      0|      return false;
 4963|      0|    }
 4964|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4965|      0|    defined(_M_IX86)
 4966|      0|#if defined(__GNUC__) || defined(__clang__)
 4967|      0|    __builtin_ia32_pause();
 4968|      0|#endif
 4969|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4970|       |#if defined(__GNUC__) || defined(__clang__)
 4971|       |    asm volatile("yield" ::: "memory");
 4972|       |#endif
 4973|       |#endif
 4974|      0|  }
 4975|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4976|      0|  return false;
 4977|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  528|      1|                          size_t dst_cap) {
  529|      1|  BitReader br(src, src_len);
  530|      1|  size_t out = 0;
  531|      4|  for (;;) {
  532|      4|    uint32_t bfinal = br.get(1);
  533|      4|    uint32_t btype = br.get(2);
  534|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (534:9): [True: 0, False: 4]
  |  Branch (534:33): [True: 0, False: 4]
  ------------------
  535|      4|    if (btype == 0) {
  ------------------
  |  Branch (535:9): [True: 0, False: 4]
  ------------------
  536|       |      // stored
  537|      0|      br.align_byte();
  538|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (538:11): [True: 0, False: 0]
  ------------------
  539|       |      // read 16+16 from bit buffer awkwardly - use byte path
  540|       |      // Align: bits is multiple of 8
  541|       |      // Get len from remaining bits then bytes
  542|      0|      uint32_t len = br.get(16);
  543|      0|      uint32_t nlen = br.get(16);
  544|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (544:11): [True: 0, False: 0]
  |  Branch (544:32): [True: 0, False: 0]
  ------------------
  545|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // After get, may have bits in acc from previous - for stored, should be
  547|       |      // byte aligned Copy len bytes from p
  548|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (548:11): [True: 0, False: 0]
  ------------------
  549|       |        // leftover bits should be 0 if aligned
  550|      0|      }
  551|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  ------------------
  552|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|      0|      std::memcpy(dst + out, br.p, len);
  554|      0|      br.p += len;
  555|      0|      out += len;
  556|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (556:16): [True: 0, False: 4]
  |  Branch (556:30): [True: 4, False: 0]
  ------------------
  557|      4|      Huff lit, dist;
  558|      4|      if (btype == 1) {
  ------------------
  |  Branch (558:11): [True: 0, False: 4]
  ------------------
  559|       |        // use fixed via functions
  560|      4|      } else {
  561|       |        // dynamic
  562|      4|        uint32_t hlit = br.get(5);
  563|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (563:13): [True: 0, False: 4]
  ------------------
  564|      4|        hlit += 257;
  565|      4|        uint32_t hdist = br.get(5);
  566|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (566:13): [True: 0, False: 4]
  ------------------
  567|      4|        hdist += 1;
  568|      4|        uint32_t hclen = br.get(4);
  569|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (569:13): [True: 0, False: 4]
  ------------------
  570|      4|        hclen += 4;
  571|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  572|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  573|      4|        uint8_t clen[19]{};
  574|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (574:30): [True: 65, False: 4]
  ------------------
  575|     65|          uint32_t v = br.get(3);
  576|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:15): [True: 0, False: 65]
  ------------------
  577|     65|          clen[order[i]] = uint8_t(v);
  578|     65|        }
  579|      4|        Huff cl;
  580|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (580:13): [True: 0, False: 4]
  ------------------
  581|      4|        uint8_t lens[288 + 32]{};
  582|      4|        uint32_t n = hlit + hdist;
  583|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (583:30): [True: 1.08k, False: 4]
  ------------------
  584|  1.08k|          int sym = cl.decode(br);
  585|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (585:15): [True: 0, False: 1.08k]
  ------------------
  586|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (586:15): [True: 1.03k, False: 49]
  ------------------
  587|  1.03k|            lens[i++] = uint8_t(sym);
  588|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (588:22): [True: 49, False: 0]
  ------------------
  589|     49|            uint32_t rep = br.get(2);
  590|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 49]
  ------------------
  591|     49|            rep += 3;
  592|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (592:17): [True: 0, False: 49]
  ------------------
  593|     49|            uint8_t v = lens[i - 1];
  594|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (594:20): [True: 214, False: 49]
  ------------------
  595|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (595:22): [True: 0, False: 0]
  ------------------
  596|      0|            uint32_t rep = br.get(3);
  597|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 0]
  ------------------
  598|      0|            rep += 3;
  599|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (599:20): [True: 0, False: 0]
  ------------------
  600|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (600:22): [True: 0, False: 0]
  ------------------
  601|      0|            uint32_t rep = br.get(7);
  602|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|            rep += 11;
  604|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (604:20): [True: 0, False: 0]
  ------------------
  605|      0|          } else
  606|      0|            return 0;
  607|  1.08k|        }
  608|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (608:13): [True: 0, False: 4]
  ------------------
  609|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (609:13): [True: 0, False: 4]
  ------------------
  610|      4|      }
  611|  52.2k|      for (;;) {
  612|  52.2k|        int sym;
  613|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (613:13): [True: 0, False: 52.2k]
  ------------------
  614|      0|          sym = fixed_litlen(br);
  615|  52.2k|        else
  616|  52.2k|          sym = lit.decode(br);
  617|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (617:13): [True: 0, False: 52.2k]
  ------------------
  618|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (618:13): [True: 37.2k, False: 14.9k]
  ------------------
  619|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (619:15): [True: 0, False: 37.2k]
  ------------------
  620|  37.2k|          dst[out++] = uint8_t(sym);
  621|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (621:20): [True: 4, False: 14.9k]
  ------------------
  622|      4|          break;
  623|  14.9k|        } else {
  624|  14.9k|          int len_code = sym - 257;
  625|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (625:15): [True: 0, False: 14.9k]
  |  Branch (625:31): [True: 0, False: 14.9k]
  ------------------
  626|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  627|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (627:15): [True: 2.03k, False: 12.9k]
  |  Branch (627:38): [True: 0, False: 2.03k]
  ------------------
  628|  14.9k|          uint32_t length =
  629|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (629:37): [True: 2.03k, False: 12.9k]
  ------------------
  630|  14.9k|          int dsym;
  631|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (631:15): [True: 0, False: 14.9k]
  ------------------
  632|      0|            dsym = fixed_dist(br);
  633|  14.9k|          else
  634|  14.9k|            dsym = dist.decode(br);
  635|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (635:15): [True: 0, False: 14.9k]
  |  Branch (635:27): [True: 0, False: 14.9k]
  ------------------
  636|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  637|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (637:15): [True: 9.97k, False: 5.01k]
  |  Branch (637:35): [True: 0, False: 9.97k]
  ------------------
  638|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (638:50): [True: 9.97k, False: 5.01k]
  ------------------
  639|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (639:15): [True: 0, False: 14.9k]
  |  Branch (639:33): [True: 0, False: 14.9k]
  ------------------
  640|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (640:32): [True: 187k, False: 14.9k]
  ------------------
  641|   187k|            dst[out] = dst[out - distance];
  642|   187k|            out++;
  643|   187k|          }
  644|  14.9k|        }
  645|  52.2k|      }
  646|      4|    } else {
  647|      0|      return 0;  // reserved
  648|      0|    }
  649|      4|    if (bfinal) break;
  ------------------
  |  Branch (649:9): [True: 1, False: 3]
  ------------------
  650|      4|  }
  651|      1|  return out;
  652|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  390|      1|      : p(data), end(data + len) {}
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  464|  68.3k|  int decode(BitReader& br) const {
  465|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (465:9): [True: 0, False: 68.3k]
  ------------------
  466|  68.3k|    int code = 0;
  467|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (467:23): [True: 427k, False: 0]
  ------------------
  468|   427k|      uint32_t b = br.get(1);
  469|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (469:11): [True: 0, False: 427k]
  ------------------
  470|   427k|      code = (code << 1) | int(b);
  471|   427k|      int first = first_code[len];
  472|   427k|      int cnt = counts[len];
  473|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (473:11): [True: 263k, False: 164k]
  |  Branch (473:18): [True: 68.3k, False: 195k]
  ------------------
  474|  68.3k|        return symbols[base_idx[len] + (code - first)];
  475|  68.3k|      }
  476|   427k|    }
  477|      0|    return -1;
  478|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4861|      1|                                         size_t len) noexcept {
 4862|      1|  uint32_t c = 0xFFFFFFFFu;
 4863|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4863:22): [True: 224k, False: 1]
  ------------------
 4864|   224k|    c ^= data[i];
 4865|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4865:21): [True: 1.79M, False: 224k]
  ------------------
 4866|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4867|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4868|  1.79M|    }
 4869|   224k|  }
 4870|      1|  return ~c;
 4871|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4684|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4685|      1|  if constexpr (std::endian::native == std::endian::little) {
 4686|      1|    (void)buffer;
 4687|      1|    return;
 4688|      1|  }
 4689|      0|  auto u16 = [&](size_t off, size_t count) {
 4690|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4691|      1|  };
 4692|      1|  auto u32 = [&](size_t off, size_t count) {
 4693|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4694|      1|  };
 4695|      1|  auto u64 = [&](size_t off, size_t count) {
 4696|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4697|      1|  };
 4698|       |
 4699|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4700|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4701|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4702|      1|  u16(table_blob::off_decomposition_block,
 4703|      1|      table_blob::count_decomposition_block);
 4704|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4705|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4706|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4707|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4708|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4709|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4710|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4711|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4712|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4910|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|     18|      return buffer + off;
 4912|     18|    };
simple_absolute.cc:_ZN3ada4idnaL11idna_lookupEj:
 5065|   356k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5066|   356k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5066:7): [True: 353k, False: 2.35k]
  ------------------
 5067|   353k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5068|   353k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5068:9): [True: 144k, False: 208k]
  ------------------
 5069|   144k|      uint32_t bit_idx =
 5070|   144k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5071|   144k|          (cp & IDNA_BLOCK_MASK);
 5072|   144k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5073|   144k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5073:14): [True: 144k, False: 28]
  ------------------
 5074|   144k|    }
 5075|   208k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5076|   353k|  }
 5077|       |
 5078|  2.35k|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5078:7): [True: 2.29k, False: 62]
  |  Branch (5078:40): [True: 2.06k, False: 232]
  ------------------
 5079|  2.06k|    return IDNA_IGNORED;
 5080|  2.06k|  }
 5081|       |
 5082|    294|  return IDNA_DISALLOWED;
 5083|  2.35k|}
simple_absolute.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5108|  55.5k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5109|  55.5k|  size_t n = 0;
 5110|   344k|  while (*ptr != 0) {
  ------------------
  |  Branch (5110:10): [True: 289k, False: 55.5k]
  ------------------
 5111|   289k|    ++n;
 5112|   289k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5112:9): [True: 91.1k, False: 198k]
  ------------------
 5113|  91.1k|      ++ptr;
 5114|   198k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5114:16): [True: 156k, False: 41.0k]
  ------------------
 5115|   156k|      ptr += 2;
 5116|   156k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5116:16): [True: 40.1k, False: 850]
  ------------------
 5117|  40.1k|      ptr += 3;
 5118|  40.1k|    } else {
 5119|    850|      ptr += 4;
 5120|    850|    }
 5121|   289k|  }
 5122|  55.5k|  return n;
 5123|  55.5k|}
simple_absolute.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5086|   289k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5087|   289k|  uint8_t b0 = *ptr++;
 5088|   289k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5088:7): [True: 91.1k, False: 197k]
  ------------------
 5089|   197k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5089:7): [True: 156k, False: 41.0k]
  ------------------
 5090|   156k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5091|   156k|    cp |= (*ptr++ & 0x3Fu);
 5092|   156k|    return static_cast<char32_t>(cp);
 5093|   156k|  }
 5094|  41.0k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5094:7): [True: 40.1k, False: 820]
  ------------------
 5095|  40.1k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5096|  40.1k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5097|  40.1k|    cp |= (*ptr++ & 0x3Fu);
 5098|  40.1k|    return static_cast<char32_t>(cp);
 5099|  40.1k|  }
 5100|    820|  uint32_t cp = (b0 & 0x07u) << 18;
 5101|    820|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5102|    820|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5103|    820|  cp |= (*ptr++ & 0x3Fu);
 5104|    820|  return static_cast<char32_t>(cp);
 5105|  41.0k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4982|   800k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4983|   800k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4983:7): [True: 0, False: 800k]
  ------------------
 4984|      0|    bi = 0;
 4985|      0|  }
 4986|   800k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4987|   800k|}
_ZN3ada4idna13ccc_block_rowEh:
 4989|  1.22M|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4990|  1.22M|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 1.22M]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|  1.22M|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 4994|  1.22M|}
_ZN3ada4idna16tables_are_readyEv:
 4873|  7.80k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4874|  7.80k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4875|  7.80k|}
simple_absolute.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5265|   791k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5266|   791k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5266:7): [True: 89.7k, False: 702k]
  ------------------
 5267|  89.7k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5267:7): [True: 83.6k, False: 6.10k]
  ------------------
 5268|       |    // Hangul precomposed syllables are NFC.
 5269|  83.6k|    return 0;
 5270|  83.6k|  }
 5271|   708k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5271:7): [True: 0, False: 708k]
  ------------------
 5272|      0|    return 0;
 5273|      0|  }
 5274|   708k|  const uint8_t di = decomposition_index[current_character >> 8];
 5275|   708k|  const uint16_t* const decomposition =
 5276|   708k|      decomposition_block_row(di) + (current_character % 256);
 5277|   708k|  size_t decomposition_length =
 5278|   708k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5279|   708k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5279:7): [True: 5.65k, False: 702k]
  |  Branch (5279:37): [True: 0, False: 5.65k]
  ------------------
 5280|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5281|      0|  }
 5282|   708k|  return decomposition_length;
 5283|   708k|}
simple_absolute.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5466|   393k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5467|   393k|  const size_t length = canonical_decomp_length(c);
 5468|   393k|  if (length == 0) {
  ------------------
  |  Branch (5468:7): [True: 391k, False: 2.73k]
  ------------------
 5469|   391k|    return get_ccc(c);
 5470|   391k|  }
 5471|  2.73k|  const uint16_t* const decomposition =
 5472|  2.73k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5473|  2.73k|  const size_t base = decomposition[0] >> 2;
 5474|  2.73k|  return get_ccc(decomposition_data[base + length - 1]);
 5475|   393k|}
simple_absolute.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5397|  7.33k|static bool would_compose(std::u32string_view input) noexcept {
 5398|   369k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5398:32): [True: 364k, False: 5.03k]
  ------------------
 5399|   364k|    const char32_t current = input[input_count];
 5400|   364k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5400:9): [True: 50.5k, False: 314k]
  |  Branch (5400:36): [True: 1.40k, False: 49.1k]
  ------------------
 5401|  1.40k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5401:11): [True: 1.33k, False: 70]
  ------------------
 5402|  1.33k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5402:11): [True: 618, False: 720]
  ------------------
 5403|    618|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5403:11): [True: 168, False: 450]
  ------------------
 5404|    168|        return true;
 5405|    168|      }
 5406|  1.24k|      ++input_count;
 5407|  1.24k|      continue;
 5408|  1.40k|    }
 5409|   363k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5409:9): [True: 41.6k, False: 321k]
  |  Branch (5409:36): [True: 40.3k, False: 1.23k]
  ------------------
 5410|  40.3k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5410:11): [True: 2.47k, False: 37.9k]
  ------------------
 5411|  2.47k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5411:11): [True: 2.34k, False: 124]
  ------------------
 5412|  2.34k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5412:11): [True: 1.86k, False: 486]
  ------------------
 5413|  1.86k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5413:11): [True: 976, False: 884]
  ------------------
 5414|    976|        return true;
 5415|    976|      }
 5416|  39.4k|      ++input_count;
 5417|  39.4k|      continue;
 5418|  40.3k|    }
 5419|   323k|    if (current < 0x110000) {
  ------------------
  |  Branch (5419:9): [True: 323k, False: 0]
  ------------------
 5420|   323k|      const uint16_t* composition =
 5421|   323k|          composition_block_row(composition_index[current >> 8]) +
 5422|   323k|          (current % 256);
 5423|   323k|      int32_t previous_ccc = -1;
 5424|   323k|      size_t j = input_count;
 5425|   325k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5425:14): [True: 320k, False: 4.82k]
  ------------------
 5426|   320k|        uint8_t ccc = get_ccc(input[j + 1]);
 5427|   320k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5427:13): [True: 78.8k, False: 242k]
  |  Branch (5427:49): [True: 77.5k, False: 1.23k]
  ------------------
 5428|  77.5k|          int left = composition[0];
 5429|  77.5k|          int right = composition[1];
 5430|  77.5k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5430:15): [True: 0, False: 77.5k]
  |  Branch (5430:27): [True: 0, False: 77.5k]
  ------------------
 5431|  77.5k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5431:15): [True: 0, False: 77.5k]
  ------------------
 5432|      0|            break;
 5433|      0|          }
 5434|   198k|          while (left + 2 < right) {
  ------------------
  |  Branch (5434:18): [True: 120k, False: 77.5k]
  ------------------
 5435|   120k|            int middle = left + (((right - left) >> 1) & ~1);
 5436|   120k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5436:17): [True: 4.41k, False: 116k]
  ------------------
 5437|  4.41k|              left = middle;
 5438|  4.41k|            }
 5439|   120k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5439:17): [True: 117k, False: 3.73k]
  ------------------
 5440|   117k|              right = middle;
 5441|   117k|            }
 5442|   120k|          }
 5443|  77.5k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5443:15): [True: 77.5k, False: 0]
  ------------------
 5444|  77.5k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5444:15): [True: 1.16k, False: 76.4k]
  ------------------
 5445|  1.16k|            return true;
 5446|  1.16k|          }
 5447|  77.5k|        }
 5448|   319k|        if (ccc == 0) {
  ------------------
  |  Branch (5448:13): [True: 317k, False: 2.61k]
  ------------------
 5449|   317k|          break;
 5450|   317k|        }
 5451|  2.61k|        previous_ccc = ccc;
 5452|  2.61k|      }
 5453|   321k|      input_count = j + 1;
 5454|   321k|      continue;
 5455|   323k|    }
 5456|      0|    ++input_count;
 5457|      0|  }
 5458|  5.03k|  return false;
 5459|  7.33k|}
_ZN3ada4idna21composition_block_rowEh:
 4996|   375k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 4997|   375k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 375k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|   375k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5001|   375k|}
simple_absolute.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5643|  35.8k|static constexpr int32_t char_to_digit_value(char value) {
 5644|  35.8k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5644:7): [True: 30.0k, False: 5.77k]
  |  Branch (5644:23): [True: 30.0k, False: 6]
  ------------------
 5645|  5.78k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5645:7): [True: 5.76k, False: 22]
  |  Branch (5645:23): [True: 5.75k, False: 10]
  ------------------
 5646|     32|  return -1;
 5647|  5.78k|}
simple_absolute.cc:_ZN3ada4idnaL5adaptEiib:
 5653|   161k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5654|   161k|  if (firsttime) {
  ------------------
  |  Branch (5654:7): [True: 27.2k, False: 134k]
  ------------------
 5655|  27.2k|    d = d / damp;
 5656|   134k|  } else {
 5657|   134k|    d = d / 2;
 5658|   134k|  }
 5659|   161k|  d += d / n;
 5660|   161k|  int32_t k = 0;
 5661|   190k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5661:10): [True: 28.1k, False: 161k]
  ------------------
 5662|  28.1k|    d /= base - tmin;
 5663|  28.1k|    k += base;
 5664|  28.1k|  }
 5665|   161k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5666|   161k|}
simple_absolute.cc:_ZN3ada4idnaL13digit_to_charEi:
 5649|   276k|static constexpr char digit_to_char(int32_t digit) {
 5650|   276k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5650:10): [True: 170k, False: 106k]
  ------------------
 5651|   276k|}
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5988|   242k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6073|  2.13k|      auto is_l_or_d = [](uint32_t code) {
 6074|  2.13k|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6074:16): [True: 114, False: 2.01k]
  ------------------
 6075|  2.01k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6075:16): [True: 826, False: 1.19k]
  ------------------
 6076|  2.13k|      };
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6077|  2.20k|      auto is_r_or_d = [](uint32_t code) {
 6078|  2.20k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6078:16): [True: 480, False: 1.72k]
  ------------------
 6079|  1.72k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6079:16): [True: 344, False: 1.38k]
  ------------------
 6080|  2.20k|      };
simple_absolute.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5935|  25.6k|    const std::u32string_view label) noexcept {
 5936|  26.6k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5936:52): [True: 26.6k, False: 0]
  ------------------
 5937|  26.6k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5937:9): [True: 25.6k, False: 994]
  ------------------
 5938|       |
 5939|      0|  return std::u32string_view::npos;
 5940|  25.6k|}
simple_absolute.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  25.6k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5945|  25.6k|  const size_t mask =
 5946|  25.6k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5947|       |
 5948|  25.6k|  size_t directions = 0;
 5949|   150k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5949:22): [True: 124k, False: 25.6k]
  ------------------
 5950|   124k|    directions |= 1u << find_direction(label[i]);
 5951|   124k|  }
 5952|  25.6k|  return (directions & mask) != 0;
 5953|  25.6k|}
simple_absolute.cc:_ZN3ada4idnaL14find_directionEj:
 5916|   161k|inline static direction find_direction(uint32_t code_point) noexcept {
 5917|       |  // Binary search on dir_final (sorted upper bounds).
 5918|   161k|  size_t lo = 0, hi = dir_table_count;
 5919|  1.87M|  while (lo < hi) {
  ------------------
  |  Branch (5919:10): [True: 1.70M, False: 161k]
  ------------------
 5920|  1.70M|    size_t mid = lo + (hi - lo) / 2;
 5921|  1.70M|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5921:9): [True: 536k, False: 1.17M]
  ------------------
 5922|   536k|      lo = mid + 1;
 5923|  1.17M|    } else {
 5924|  1.17M|      hi = mid;
 5925|  1.17M|    }
 5926|  1.70M|  }
 5927|   161k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5927:7): [True: 0, False: 161k]
  ------------------
 5928|      0|    return direction::NONE;
 5929|      0|  }
 5930|   161k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5930:10): [True: 160k, False: 1.36k]
  ------------------
 5931|   161k|                                     : direction::NONE;
 5932|   161k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6301|   125k|bool constexpr is_ascii(std::string_view view) {
 6302|  1.95M|  for (uint8_t c : view) {
  ------------------
  |  Branch (6302:18): [True: 1.95M, False: 120k]
  ------------------
 6303|  1.95M|    if (c >= 0x80) {
  ------------------
  |  Branch (6303:9): [True: 5.34k, False: 1.94M]
  ------------------
 6304|  5.34k|      return false;
 6305|  5.34k|    }
 6306|  1.95M|  }
 6307|   120k|  return true;
 6308|   125k|}
simple_absolute.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6338|   120k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6339|   120k|  out.assign(ut8_string);
 6340|   120k|  ascii_map(out.data(), out.size());
 6341|   120k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  37.1k|bool constexpr is_ascii(std::u32string_view view) {
 6293|   105k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6293:19): [True: 105k, False: 2.74k]
  ------------------
 6294|   105k|    if (c >= 0x80) {
  ------------------
  |  Branch (6294:9): [True: 34.4k, False: 71.3k]
  ------------------
 6295|  34.4k|      return false;
 6296|  34.4k|    }
 6297|   105k|  }
 6298|  2.74k|  return true;
 6299|  37.1k|}
simple_absolute.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6354|  30.2k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6355|  30.2k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6355:10): [True: 23.7k, False: 6.49k]
  |  Branch (6355:31): [True: 3.65k, False: 20.1k]
  |  Branch (6355:51): [True: 3.38k, False: 264]
  ------------------
 6356|  3.38k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6356:10): [True: 3.16k, False: 228]
  |  Branch (6356:30): [True: 2.95k, False: 202]
  ------------------
 6357|  30.2k|}
simple_absolute.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6344|  4.95k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6345|  4.95k|  const size_t old = out.size();
 6346|  4.95k|  out.resize(old + label.size());
 6347|  4.95k|  char* dest = out.data() + old;
 6348|  73.2k|  for (char32_t c : label) {
  ------------------
  |  Branch (6348:19): [True: 73.2k, False: 4.95k]
  ------------------
 6349|  73.2k|    *dest++ = static_cast<char>(c);
 6350|  73.2k|  }
 6351|  4.95k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7352|   253k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|   253k|    return character_sets::bit_at(character_set, c);
 7354|   253k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7352|  49.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  49.6k|    return character_sets::bit_at(character_set, c);
 7354|  49.6k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7086|  91.9k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7087|  91.9k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7087:11): [True: 86.7k, False: 5.16k]
  |  Branch (7087:23): [True: 43.3k, False: 43.3k]
  |  Branch (7087:37): [True: 43.3k, False: 5.22k]
  |  Branch (7087:49): [True: 40.3k, False: 2.92k]
  ------------------
 7088|  8.14k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7088:11): [True: 2.81k, False: 5.33k]
  |  Branch (7088:23): [True: 2.63k, False: 180]
  ------------------
 7089|  91.9k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7176|  84.7k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7177|  84.7k|  return hex_to_binary_table[c - '0'];
 7178|  84.7k|}
simple_absolute.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7320|  1.05M|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7321|  1.05M|    return character_sets::bit_at(character_set, c);
 7322|  1.05M|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7013|   123k|    const char* input, size_t length) noexcept {
 7014|   123k|  size_t i = 0;
 7015|   123k|  uint8_t accumulator{};
 7016|   712k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7016:10): [True: 589k, False: 123k]
  ------------------
 7017|   589k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7018|   589k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7019|   589k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7020|   589k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7021|   589k|  }
 7022|   195k|  for (; i < length; i++) {
  ------------------
  |  Branch (7022:10): [True: 72.6k, False: 123k]
  ------------------
 7023|  72.6k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7024|  72.6k|  }
 7025|   123k|  return accumulator;
 7026|   123k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7702|    778|                            const uint8_t character_set[], std::string& out) {
 7703|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7704|    778|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7705|    778|#if ADA_UNICODE_SSSE3
 7706|    778|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7707|    778|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7708|       |#elif ADA_NEON
 7709|       |  percent_encode_to_neon(p, end, character_set,
 7710|       |                         load_neon_percent_table(character_set), out);
 7711|       |#elif ADA_RVV
 7712|       |  percent_encode_to_rvv(p, end, character_set, out);
 7713|       |#endif
 7714|    778|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7529|    778|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7530|    778|  ssse3_percent_tables t{};
 7531|    778|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7532|    778|  t.cs_hi =
 7533|    778|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7534|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7535|    778|  t.pow2 =
 7536|    778|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7537|    778|  t.mask_0f = _mm_set1_epi8(0x0F);
 7538|    778|  t.mask_07 = _mm_set1_epi8(0x07);
 7539|    778|  t.zero = _mm_setzero_si128();
 7540|    778|  return t;
 7541|    778|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7560|    778|    const ssse3_percent_tables& tables, std::string& out) {
 7561|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7562|  3.04k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7562:10): [True: 2.27k, False: 778]
  ------------------
 7563|  2.27k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7564|  2.27k|    const __m128i word1 =
 7565|  2.27k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7566|  2.27k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7567|  2.27k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7568|  2.27k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7568:9): [True: 177, False: 2.09k]
  ------------------
 7569|    177|      out.append(p, 32);
 7570|  2.09k|    } else {
 7571|  2.09k|      if (mask0 == 0) {
  ------------------
  |  Branch (7571:11): [True: 59, False: 2.03k]
  ------------------
 7572|     59|        out.append(p, 16);
 7573|  2.03k|      } else {
 7574|  2.03k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7575|  2.03k|      }
 7576|  2.09k|      if (mask1 == 0) {
  ------------------
  |  Branch (7576:11): [True: 237, False: 1.85k]
  ------------------
 7577|    237|        out.append(p + 16, 16);
 7578|  1.85k|      } else {
 7579|  1.85k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7580|  1.85k|      }
 7581|  2.09k|    }
 7582|  2.27k|    p += 32;
 7583|  2.27k|  }
 7584|    778|  if (p + 16 <= end) {
  ------------------
  |  Branch (7584:7): [True: 493, False: 285]
  ------------------
 7585|    493|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7586|    493|    const int mask = ssse3_percent_mask(word, tables);
 7587|    493|    if (mask == 0) {
  ------------------
  |  Branch (7587:9): [True: 136, False: 357]
  ------------------
 7588|    136|      out.append(p, 16);
 7589|    357|    } else {
 7590|    357|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7591|    357|    }
 7592|    493|    p += 16;
 7593|    493|  }
 7594|    778|  percent_encode_to_scalar(p, end, character_set, out);
 7595|    778|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7544|  5.03k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7545|  5.03k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7546|  5.03k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7547|  5.03k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7548|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7549|  5.03k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7550|  5.03k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7551|  5.03k|                                       _mm_andnot_si128(high_byte, lo));
 7552|  5.03k|  const __m128i bits =
 7553|  5.03k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7554|  5.03k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7555|  5.03k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7556|  5.03k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7484|  4.24k|                                          size_t width, std::string& out) {
 7485|  4.24k|  uint64_t bits = mask;
 7486|  4.24k|  size_t off = 0;
 7487|  61.8k|  while (bits != 0) {
  ------------------
  |  Branch (7487:10): [True: 57.5k, False: 4.24k]
  ------------------
 7488|  57.5k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7489|  57.5k|    if (zero_run != 0) {
  ------------------
  |  Branch (7489:9): [True: 2.30k, False: 55.2k]
  ------------------
 7490|  2.30k|      out.append(p + off, static_cast<size_t>(zero_run));
 7491|  2.30k|    }
 7492|  57.5k|    off += static_cast<size_t>(zero_run);
 7493|  57.5k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7494|  57.5k|    ++off;
 7495|  57.5k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7496|  57.5k|  }
 7497|  4.24k|  if (off < width) {
  ------------------
  |  Branch (7497:7): [True: 813, False: 3.43k]
  ------------------
 7498|    813|    out.append(p + off, width - off);
 7499|    813|  }
 7500|  4.24k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7472|  57.5k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7473|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7474|       |  unsigned long ret;
 7475|       |  _BitScanForward(&ret, input_num);
 7476|       |  return static_cast<int>(ret);
 7477|       |#else
 7478|  57.5k|  return __builtin_ctz(input_num);
 7479|  57.5k|#endif
 7480|  57.5k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7505|    778|                                                std::string& out) {
 7506|  4.50k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7506:10): [True: 3.72k, False: 778]
  ------------------
 7507|  3.72k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7507:9): [True: 2.15k, False: 1.57k]
  ------------------
 7508|  2.15k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7509|  2.15k|    } else {
 7510|  1.57k|      out += *p;
 7511|  1.57k|    }
 7512|  3.72k|  }
 7513|    778|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7769|  1.51k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7770|  1.51k|  static constexpr char kHex[] = "0123456789abcdef";
 7771|  1.51k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7771:7): [True: 122, False: 1.39k]
  ------------------
 7772|    122|    *p++ = kHex[(v >> 12) & 0xf];
 7773|    122|    *p++ = kHex[(v >> 8) & 0xf];
 7774|    122|    *p++ = kHex[(v >> 4) & 0xf];
 7775|    122|    *p++ = kHex[v & 0xf];
 7776|  1.39k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7776:14): [True: 200, False: 1.19k]
  ------------------
 7777|    200|    *p++ = kHex[(v >> 8) & 0xf];
 7778|    200|    *p++ = kHex[(v >> 4) & 0xf];
 7779|    200|    *p++ = kHex[v & 0xf];
 7780|  1.19k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7780:14): [True: 164, False: 1.03k]
  ------------------
 7781|    164|    *p++ = kHex[(v >> 4) & 0xf];
 7782|    164|    *p++ = kHex[v & 0xf];
 7783|  1.03k|  } else {
 7784|  1.03k|    *p++ = kHex[v & 0xf];
 7785|  1.03k|  }
 7786|  1.51k|  return p;
 7787|  1.51k|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7755|   161k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7756|   161k|  if (v < 10) {
  ------------------
  |  Branch (7756:7): [True: 66.0k, False: 95.2k]
  ------------------
 7757|  66.0k|    *p++ = static_cast<char>('0' + v);
 7758|  95.2k|  } else if (v < 100) {
  ------------------
  |  Branch (7758:14): [True: 422, False: 94.8k]
  ------------------
 7759|    422|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7760|    422|    p += 2;
 7761|  94.8k|  } else {
 7762|  94.8k|    *p++ = static_cast<char>('0' + v / 100);
 7763|  94.8k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7764|  94.8k|    p += 2;
 7765|  94.8k|  }
 7766|   161k|  return p;
 7767|   161k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6862|   619k|    std::string_view user_input) noexcept {
 6863|       |  // first check for short strings in which case we do it naively.
 6864|   619k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6864:7): [True: 121k, False: 497k]
  ------------------
 6865|   121k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6866|   121k|  }
 6867|       |  // fast path for long strings (expected to be common)
 6868|   497k|  size_t i = 0;
 6869|   497k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6870|   497k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6871|   497k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6872|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6873|   497k|  __m128i running{0};
 6874|  1.20M|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6874:10): [True: 709k, False: 497k]
  ------------------
 6875|   709k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6876|   709k|    running = _mm_or_si128(
 6877|   709k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6878|   709k|                                           _mm_cmpeq_epi8(word, mask2))),
 6879|   709k|        _mm_cmpeq_epi8(word, mask3));
 6880|   709k|  }
 6881|   497k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6881:7): [True: 493k, False: 4.52k]
  ------------------
 6882|   493k|    __m128i word = _mm_loadu_si128(
 6883|   493k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6884|   493k|    running = _mm_or_si128(
 6885|   493k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6886|   493k|                                           _mm_cmpeq_epi8(word, mask2))),
 6887|   493k|        _mm_cmpeq_epi8(word, mask3));
 6888|   493k|  }
 6889|   497k|  return _mm_movemask_epi8(running) != 0;
 6890|   619k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6753|  1.55M|constexpr bool is_tabs_or_newline(char c) noexcept {
 6754|  1.55M|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6754:10): [True: 34, False: 1.55M]
  |  Branch (6754:23): [True: 36, False: 1.55M]
  |  Branch (6754:36): [True: 20, False: 1.55M]
  ------------------
 6755|  1.55M|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8558|    962|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8559|       |  // if this ever becomes a performance issue, we could use an approach similar
 8560|       |  // to has_tabs_or_newline
 8561|    962|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8562|    962|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7107|  83.4k|    const char c) noexcept {
 7108|  83.4k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7108:10): [True: 1.93k, False: 81.5k]
  |  Branch (7108:23): [True: 1.38k, False: 80.1k]
  |  Branch (7108:36): [True: 1.24k, False: 78.8k]
  ------------------
 7109|  83.4k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7102|  1.10M|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7103|  1.10M|  return (unsigned char)c <= ' ';
 7104|  1.10M|}
_ZN3ada7helpers19parse_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS_6scheme4typeERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9255|   233k|                                           std::string& path) {
 9256|   233k|  ada_log("parse_prepared_path ", input);
 9257|   233k|  uint8_t accumulator = checkers::path_signature(input);
 9258|       |  // Let us first detect a trivial case.
 9259|       |  // If it is special, we check that we have no dot, no %,  no \ and no
 9260|       |  // character needing percent encoding. Otherwise, we check that we have no %,
 9261|       |  // no dot, and no character needing percent encoding.
 9262|   233k|  constexpr uint8_t need_encoding = 1;
 9263|   233k|  constexpr uint8_t backslash_char = 2;
 9264|   233k|  constexpr uint8_t dot_char = 4;
 9265|   233k|  constexpr uint8_t percent_char = 8;
 9266|   233k|  bool special = type != ada::scheme::NOT_SPECIAL;
 9267|   233k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (9267:39): [True: 1.37k, False: 232k]
  ------------------
 9268|  1.37k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (9268:39): [True: 34, False: 1.34k]
  ------------------
 9269|   233k|  bool trivial_path =
 9270|   233k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (9270:7): [True: 204k, False: 29.5k]
  |  Branch (9270:8): [True: 232k, False: 846]
  ------------------
 9271|   233k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
 9272|    846|                  0)) &&
 9273|   204k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (9273:7): [True: 204k, False: 17]
  ------------------
 9274|   233k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (9274:7): [True: 12.7k, False: 221k]
  |  Branch (9274:34): [True: 12.6k, False: 8]
  ------------------
 9275|       |    // '4' means that we have at least one dot, but nothing that requires
 9276|       |    // percent encoding or decoding. The only part that is not trivial is
 9277|       |    // that we may have single dots and double dots path segments.
 9278|       |    // If we have such segments, then we either have a path that begins
 9279|       |    // with '.' (easy to check), or we have the sequence './'.
 9280|       |    // Note: input cannot be empty, it must at least contain one character ('.')
 9281|       |    // Note: we know that '\' is not present.
 9282|  12.6k|    if (input[0] != '.') {
  ------------------
  |  Branch (9282:9): [True: 11.3k, False: 1.33k]
  ------------------
 9283|  11.3k|      size_t slashdot = 0;
 9284|  11.3k|      bool dot_is_file = true;
 9285|  36.8k|      for (;;) {
 9286|  36.8k|        slashdot = input.find("/.", slashdot);
 9287|  36.8k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (9287:13): [True: 11.3k, False: 25.4k]
  ------------------
 9288|  11.3k|          break;
 9289|  25.4k|        } else {  // uncommon
 9290|       |          // only three cases matter: /./, /.. or a final /
 9291|  25.4k|          slashdot += 2;
 9292|  25.4k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (9292:28): [True: 80, False: 25.3k]
  |  Branch (9292:56): [True: 12.3k, False: 12.9k]
  ------------------
 9293|  12.9k|                           input[slashdot] == '/');
  ------------------
  |  Branch (9293:28): [True: 11.8k, False: 1.14k]
  ------------------
 9294|  25.4k|        }
 9295|  36.8k|      }
 9296|  11.3k|      trivial_path = dot_is_file;
 9297|  11.3k|    }
 9298|  12.6k|  }
 9299|   233k|  if (trivial_path) {
  ------------------
  |  Branch (9299:7): [True: 205k, False: 28.4k]
  ------------------
 9300|   205k|    ada_log("parse_path trivial");
 9301|   205k|    path += '/';
 9302|   205k|    path += input;
 9303|   205k|    return;
 9304|   205k|  }
 9305|       |  // We are going to need to look a bit at the path, but let us see if we can
 9306|       |  // ignore percent encoding *and* backslashes *and* percent characters.
 9307|       |  // Except for the trivial case, this is likely to capture 99% of paths out
 9308|       |  // there.
 9309|  28.4k|  bool fast_path =
 9310|  28.4k|      (special &&
  ------------------
  |  Branch (9310:8): [True: 28.0k, False: 466]
  ------------------
 9311|  28.0k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (9311:8): [True: 11.5k, False: 16.5k]
  ------------------
 9312|  11.5k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (9312:7): [True: 11.4k, False: 89]
  ------------------
 9313|  28.4k|  if (fast_path) {
  ------------------
  |  Branch (9313:7): [True: 11.4k, False: 17.0k]
  ------------------
 9314|  11.4k|    ada_log("parse_prepared_path fast");
 9315|       |    // Here we don't need to worry about \ or percent encoding.
 9316|       |    // We also do not have a file protocol. We might have dots, however,
 9317|       |    // but dots must as appear as '.', and they cannot be encoded because
 9318|       |    // the symbol '%' is not present.
 9319|  11.4k|    size_t previous_location = 0;  // We start at 0.
 9320|  70.8k|    do {
 9321|  70.8k|      size_t new_location = input.find('/', previous_location);
 9322|       |      // std::string_view path_view = input;
 9323|       |      //  We process the last segment separately:
 9324|  70.8k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (9324:11): [True: 11.4k, False: 59.3k]
  ------------------
 9325|  11.4k|        std::string_view path_view = input.substr(previous_location);
 9326|  11.4k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (9326:13): [True: 81, False: 11.3k]
  ------------------
 9327|       |          // e.g., if you receive ".." with an empty path, you go to "/".
 9328|     81|          if (path.empty()) {
  ------------------
  |  Branch (9328:15): [True: 20, False: 61]
  ------------------
 9329|     20|            path = '/';
 9330|     20|            return;
 9331|     20|          }
 9332|       |          // Fast case where we have nothing to do:
 9333|     61|          if (path.back() == '/') {
  ------------------
  |  Branch (9333:15): [True: 18, False: 43]
  ------------------
 9334|     18|            return;
 9335|     18|          }
 9336|       |          // If you have the path "/joe/myfriend",
 9337|       |          // then you delete 'myfriend'.
 9338|     43|          path.resize(path.rfind('/') + 1);
 9339|     43|          return;
 9340|     61|        }
 9341|  11.3k|        path += '/';
 9342|  11.3k|        if (path_view != ".") {
  ------------------
  |  Branch (9342:13): [True: 11.2k, False: 103]
  ------------------
 9343|  11.2k|          path.append(path_view);
 9344|  11.2k|        }
 9345|  11.3k|        return;
 9346|  59.3k|      } else {
 9347|       |        // This is a non-final segment.
 9348|  59.3k|        std::string_view path_view =
 9349|  59.3k|            input.substr(previous_location, new_location - previous_location);
 9350|  59.3k|        previous_location = new_location + 1;
 9351|  59.3k|        if (path_view == "..") {
  ------------------
  |  Branch (9351:13): [True: 13.0k, False: 46.3k]
  ------------------
 9352|  13.0k|          size_t last_delimiter = path.rfind('/');
 9353|  13.0k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (9353:15): [True: 10.9k, False: 2.15k]
  ------------------
 9354|  10.9k|            path.erase(last_delimiter);
 9355|  10.9k|          }
 9356|  46.3k|        } else if (path_view != ".") {
  ------------------
  |  Branch (9356:20): [True: 33.5k, False: 12.7k]
  ------------------
 9357|  33.5k|          path += '/';
 9358|  33.5k|          path.append(path_view);
 9359|  33.5k|        }
 9360|  59.3k|      }
 9361|  70.8k|    } while (true);
  ------------------
  |  Branch (9361:14): [True: 59.3k, Folded]
  ------------------
 9362|  17.0k|  } else {
 9363|  17.0k|    ada_log("parse_path slow");
 9364|       |    // we have reached the general case
 9365|  17.0k|    bool needs_percent_encoding = (accumulator & 1);
 9366|  17.0k|    std::string path_buffer_tmp;
 9367|  62.8k|    do {
 9368|  62.8k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (9368:26): [True: 60.8k, False: 1.96k]
  |  Branch (9368:37): [True: 6.48k, False: 54.3k]
  ------------------
 9369|  62.8k|                            ? input.find_first_of("/\\")
 9370|  62.8k|                            : input.find('/');
 9371|  62.8k|      std::string_view path_view = input;
 9372|  62.8k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (9372:11): [True: 45.7k, False: 17.0k]
  ------------------
 9373|  45.7k|        path_view.remove_suffix(path_view.size() - location);
 9374|  45.7k|        input.remove_prefix(location + 1);
 9375|  45.7k|      }
 9376|       |      // path_buffer is either path_view or it might point at a percent encoded
 9377|       |      // temporary file.
 9378|  62.8k|      std::string_view path_buffer =
 9379|  62.8k|          (needs_percent_encoding &&
  ------------------
  |  Branch (9379:12): [True: 13.4k, False: 49.3k]
  ------------------
 9380|  13.4k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (9380:12): [True: 4.56k, False: 8.89k]
  ------------------
 9381|  13.4k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
 9382|  62.8k|              ? path_buffer_tmp
 9383|  62.8k|              : path_view;
 9384|  62.8k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9384:11): [True: 12.8k, False: 49.9k]
  ------------------
 9385|  12.8k|        helpers::shorten_path(path, type);
 9386|  12.8k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9386:13): [True: 9.57k, False: 3.29k]
  ------------------
 9387|  9.57k|          path += '/';
 9388|  9.57k|        }
 9389|  49.9k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (9389:18): [True: 2.25k, False: 47.6k]
  ------------------
 9390|  2.25k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (9390:18): [True: 447, False: 1.80k]
  ------------------
 9391|    447|        path += '/';
 9392|    447|      }
 9393|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
 9394|  49.5k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9394:16): [True: 47.6k, False: 1.80k]
  ------------------
 9395|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
 9396|       |        // Windows drive letter, then replace the second code point in
 9397|       |        // path_buffer with U+003A (:).
 9398|  47.6k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (9398:13): [True: 1.93k, False: 45.7k]
  |  Branch (9398:48): [True: 548, False: 1.38k]
  ------------------
 9399|    548|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (9399:13): [True: 36, False: 512]
  ------------------
 9400|     36|          path += '/';
 9401|     36|          path += path_buffer[0];
 9402|     36|          path += ':';
 9403|     36|          path_buffer.remove_prefix(2);
 9404|     36|          path.append(path_buffer);
 9405|  47.6k|        } else {
 9406|       |          // Append path_buffer to url's path.
 9407|  47.6k|          path += '/';
 9408|  47.6k|          path.append(path_buffer);
 9409|  47.6k|        }
 9410|  47.6k|      }
 9411|  62.8k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (9411:11): [True: 17.0k, False: 45.7k]
  ------------------
 9412|  17.0k|        return;
 9413|  17.0k|      }
 9414|  62.8k|    } while (true);
  ------------------
  |  Branch (9414:14): [True: 45.7k, Folded]
  ------------------
 9415|  17.0k|  }
 9416|  28.4k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   75|   467k|    std::string_view input) noexcept {
   76|       |  // The path percent-encode set is the query percent-encode set and U+003F (?),
   77|       |  // U+0060 (`), U+007B ({), and U+007D (}). The query percent-encode set is the
   78|       |  // C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#),
   79|       |  // U+003C (<), and U+003E (>). The C0 control percent-encode set are the C0
   80|       |  // controls and all code points greater than U+007E (~).
   81|   467k|  size_t i = 0;
   82|   467k|  uint8_t accumulator{};
   83|   627k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (83:10): [True: 159k, False: 467k]
  ------------------
   84|   159k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   85|   159k|                           path_signature_table[uint8_t(input[i + 1])] |
   86|   159k|                           path_signature_table[uint8_t(input[i + 2])] |
   87|   159k|                           path_signature_table[uint8_t(input[i + 3])] |
   88|   159k|                           path_signature_table[uint8_t(input[i + 4])] |
   89|   159k|                           path_signature_table[uint8_t(input[i + 5])] |
   90|   159k|                           path_signature_table[uint8_t(input[i + 6])] |
   91|   159k|                           path_signature_table[uint8_t(input[i + 7])]);
   92|   159k|  }
   93|   749k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (93:10): [True: 281k, False: 467k]
  ------------------
   94|   281k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   95|   281k|  }
   96|   467k|  return accumulator;
   97|   467k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7115|   125k|    std::string_view input) noexcept {
 7116|       |  // This will catch most cases:
 7117|       |  // The length must be 2,4 or 6.
 7118|       |  // We divide by two and require
 7119|       |  // that the result be between 1 and 3 inclusively.
 7120|   125k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7121|   125k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7121:7): [True: 48.2k, False: 77.3k]
  ------------------
 7122|  48.2k|    return false;
 7123|  48.2k|  }
 7124|       |  // We have a string of length 2, 4 or 6.
 7125|       |  // We now check the first character:
 7126|  77.3k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7126:7): [True: 66.1k, False: 11.2k]
  |  Branch (7126:28): [True: 25.5k, False: 40.5k]
  ------------------
 7127|  25.5k|    return false;
 7128|  25.5k|  }
 7129|       |  // We are unlikely the get beyond this point.
 7130|  51.8k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7131|  51.8k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7132|  51.8k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7132:7): [True: 16.4k, False: 35.3k]
  ------------------
 7133|  16.4k|    return false;
 7134|  16.4k|  }
 7135|       |  // We almost never get here.
 7136|       |  // Optimizing the rest is relatively unimportant.
 7137|  35.3k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7138|  35.3k|    uint16_t A, B;
 7139|  35.3k|    memcpy(&A, a.data(), sizeof(A));
 7140|  35.3k|    memcpy(&B, b.data(), sizeof(B));
 7141|  35.3k|    return A == B;
 7142|  35.3k|  };
 7143|  35.3k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7143:7): [True: 2.56k, False: 32.8k]
  ------------------
 7144|  2.56k|    return false;
 7145|  2.56k|  }
 7146|   118k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7146:22): [True: 92.2k, False: 25.7k]
  ------------------
 7147|  92.2k|    char c = input[i];
 7148|  92.2k|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7148:9): [True: 7.05k, False: 85.2k]
  |  Branch (7148:10): [True: 44.2k, False: 48.0k]
  ------------------
 7149|  7.05k|      return false;
 7150|  7.05k|    }
 7151|  92.2k|  }
 7152|  25.7k|  return true;
 7153|       |  // The above code might be a bit better than the code below. Compilers
 7154|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7155|       |  // 6 and other tricks.
 7156|       |  // return input == ".." ||
 7157|       |  //  input == ".%2e" || input == ".%2E" ||
 7158|       |  //  input == "%2e." || input == "%2E." ||
 7159|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7160|       |  //  "%2e%2E";
 7161|  32.8k|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7137|  35.3k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7138|  35.3k|    uint16_t A, B;
 7139|  35.3k|    memcpy(&A, a.data(), sizeof(A));
 7140|  35.3k|    memcpy(&B, b.data(), sizeof(B));
 7141|  35.3k|    return A == B;
 7142|  35.3k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7164|   198k|    std::string_view input) noexcept {
 7165|   198k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7165:10): [True: 4.10k, False: 194k]
  |  Branch (7165:26): [True: 3.99k, False: 190k]
  |  Branch (7165:44): [True: 28, False: 190k]
  ------------------
 7166|   198k|}
_ZN3ada7unicode28is_forbidden_host_code_pointEc:
 6985|  16.5k|    const char c) noexcept {
 6986|  16.5k|  return is_forbidden_host_code_point_table[uint8_t(c)];
 6987|  16.5k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9539|  98.2k|                              bool& is_pure_decimal) noexcept {
 9540|  98.2k|  is_pure_decimal = false;
 9541|  98.2k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9541:7): [True: 0, False: 98.2k]
  ------------------
 9542|      0|    return false;
 9543|      0|  }
 9544|  98.2k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9544:7): [True: 77.3k, False: 20.8k]
  |  Branch (9544:23): [True: 38.4k, False: 38.9k]
  |  Branch (9544:38): [True: 38.0k, False: 368]
  ------------------
 9545|  38.0k|    p += 2;
 9546|  38.0k|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9546:9): [True: 60, False: 37.9k]
  |  Branch (9546:21): [True: 34, False: 37.9k]
  ------------------
 9547|     94|      value = 0;
 9548|     94|      return true;
 9549|     94|    }
 9550|  37.9k|    uint64_t v = 0;
 9551|  37.9k|    int digits = 0;
 9552|   229k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9552:12): [True: 210k, False: 18.7k]
  |  Branch (9552:23): [True: 191k, False: 19.0k]
  ------------------
 9553|   191k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9554|   191k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9554:11): [True: 8, False: 191k]
  ------------------
 9555|      8|        return false;
 9556|      8|      }
 9557|   191k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9557:11): [True: 82, False: 191k]
  ------------------
 9558|     82|        return false;
 9559|     82|      }
 9560|   191k|      v = (v << 4) | nib;
 9561|   191k|      ++p;
 9562|   191k|      ++digits;
 9563|   191k|    }
 9564|  37.8k|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9564:9): [True: 0, False: 37.8k]
  ------------------
 9565|      0|      return false;
 9566|      0|    }
 9567|  37.8k|    value = v;
 9568|  37.8k|    return true;
 9569|  37.8k|  }
 9570|  60.1k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9570:7): [True: 39.3k, False: 20.8k]
  |  Branch (9570:23): [True: 368, False: 38.9k]
  |  Branch (9570:38): [True: 216, False: 152]
  |  Branch (9570:53): [True: 206, False: 10]
  ------------------
 9571|    206|    ++p;
 9572|    206|    uint64_t v = 0;
 9573|  4.35k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9573:12): [True: 4.26k, False: 94]
  |  Branch (9573:23): [True: 4.22k, False: 36]
  ------------------
 9574|  4.22k|      const char c = *p;
 9575|  4.22k|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9575:11): [True: 8, False: 4.22k]
  |  Branch (9575:22): [True: 14, False: 4.20k]
  ------------------
 9576|     22|        return false;
 9577|     22|      }
 9578|  4.20k|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9578:11): [True: 54, False: 4.15k]
  ------------------
 9579|     54|        return false;
 9580|     54|      }
 9581|  4.15k|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9582|  4.15k|      ++p;
 9583|  4.15k|    }
 9584|    130|    value = v;
 9585|    130|    return true;
 9586|    206|  }
 9587|  59.9k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9587:7): [True: 72, False: 59.8k]
  |  Branch (9587:19): [True: 37.0k, False: 22.8k]
  ------------------
 9588|  37.1k|    return false;
 9589|  37.1k|  }
 9590|  22.8k|  is_pure_decimal = true;
 9591|  22.8k|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9592|  22.8k|  ++p;
 9593|  30.3k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9593:10): [True: 8.85k, False: 21.4k]
  |  Branch (9593:21): [True: 7.63k, False: 1.21k]
  ------------------
 9594|  7.63k|    const char c = *p;
 9595|  7.63k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9595:9): [True: 18, False: 7.61k]
  |  Branch (9595:20): [True: 48, False: 7.56k]
  ------------------
 9596|     66|      return false;
 9597|     66|    }
 9598|  7.56k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9598:9): [True: 76, False: 7.49k]
  ------------------
 9599|     76|      return false;
 9600|     76|    }
 9601|  7.49k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9602|  7.49k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9602:9): [True: 8, False: 7.48k]
  ------------------
 9603|      8|      return false;
 9604|      8|    }
 9605|  7.48k|    ++p;
 9606|  7.48k|  }
 9607|  22.6k|  value = v;
 9608|  22.6k|  return true;
 9609|  22.8k|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9613|  1.88k|                           uint16_t& value) noexcept {
 9614|  1.88k|  if (pointer == end) {
  ------------------
  |  Branch (9614:7): [True: 0, False: 1.88k]
  ------------------
 9615|      0|    return 0;
 9616|      0|  }
 9617|  1.88k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9618|  1.88k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9618:7): [True: 38, False: 1.85k]
  ------------------
 9619|     38|    return 0;
 9620|     38|  }
 9621|  1.85k|  uint32_t v = n0;
 9622|  1.85k|  ++pointer;
 9623|  1.85k|  int length = 1;
 9624|  1.85k|  if (pointer != end) {
  ------------------
  |  Branch (9624:7): [True: 1.60k, False: 242]
  ------------------
 9625|  1.60k|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9626|  1.60k|    if (n1 != 0xff) {
  ------------------
  |  Branch (9626:9): [True: 564, False: 1.04k]
  ------------------
 9627|    564|      v = (v << 4) | n1;
 9628|    564|      ++pointer;
 9629|    564|      ++length;
 9630|    564|      if (pointer != end) {
  ------------------
  |  Branch (9630:11): [True: 522, False: 42]
  ------------------
 9631|    522|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9632|    522|        if (n2 != 0xff) {
  ------------------
  |  Branch (9632:13): [True: 372, False: 150]
  ------------------
 9633|    372|          v = (v << 4) | n2;
 9634|    372|          ++pointer;
 9635|    372|          ++length;
 9636|    372|          if (pointer != end) {
  ------------------
  |  Branch (9636:15): [True: 304, False: 68]
  ------------------
 9637|    304|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9638|    304|            if (n3 != 0xff) {
  ------------------
  |  Branch (9638:17): [True: 136, False: 168]
  ------------------
 9639|    136|              v = (v << 4) | n3;
 9640|    136|              ++pointer;
 9641|    136|              ++length;
 9642|    136|            }
 9643|    304|          }
 9644|    372|        }
 9645|    522|      }
 9646|    564|    }
 9647|  1.60k|  }
 9648|  1.85k|  value = static_cast<uint16_t>(v);
 9649|  1.85k|  return length;
 9650|  1.88k|}
_ZN3ada3url10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10222|  23.0k|ada_really_inline void url::parse_path(std::string_view input) {
10223|  23.0k|  ada_log("parse_path ", input);
10224|  23.0k|  std::string tmp_buffer;
10225|  23.0k|  std::string_view internal_input;
10226|  23.0k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (10226:7): [True: 0, False: 23.0k]
  ------------------
10227|      0|    tmp_buffer = input;
10228|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10229|       |    // just directly build the string from user_input.
10230|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10231|      0|    internal_input = tmp_buffer;
10232|  23.0k|  } else {
10233|  23.0k|    internal_input = input;
10234|  23.0k|  }
10235|       |
10236|       |  // If url is special, then:
10237|  23.0k|  if (is_special()) {
  ------------------
  |  Branch (10237:7): [True: 23.0k, False: 0]
  ------------------
10238|  23.0k|    if (internal_input.empty()) {
  ------------------
  |  Branch (10238:9): [True: 187, False: 22.9k]
  ------------------
10239|    187|      path = "/";
10240|  22.9k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (10240:16): [True: 22.9k, False: 0]
  |  Branch (10240:46): [True: 0, False: 0]
  ------------------
10241|  22.9k|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10242|  22.9k|    } else {
10243|      0|      helpers::parse_prepared_path(internal_input, type, path);
10244|      0|    }
10245|  23.0k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (10245:14): [True: 0, False: 0]
  ------------------
10246|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (10246:9): [True: 0, False: 0]
  ------------------
10247|      0|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10248|      0|    } else {
10249|      0|      helpers::parse_prepared_path(internal_input, type, path);
10250|      0|    }
10251|      0|  } else {
10252|      0|    if (!host.has_value()) {
  ------------------
  |  Branch (10252:9): [True: 0, False: 0]
  ------------------
10253|      0|      path = "/";
10254|      0|    }
10255|      0|  }
10256|  23.0k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7079|  2.28M|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7080|  2.28M|  return is_alnum_plus_table[uint8_t(c)];
 7081|       |  // A table is almost surely much faster than the
 7082|       |  // following under most compilers: return
 7083|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7084|  2.28M|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6761|  50.9k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6762|  50.9k|  uint64_t broadcast_80 = broadcast(0x80);
 6763|  50.9k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6764|  50.9k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6765|  50.9k|  uint64_t non_ascii = 0;
 6766|  50.9k|  size_t i = 0;
 6767|       |
 6768|  95.5k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6768:10): [True: 44.6k, False: 50.9k]
  ------------------
 6769|  44.6k|    uint64_t word{};
 6770|  44.6k|    memcpy(&word, input + i, sizeof(word));
 6771|  44.6k|    non_ascii |= (word & broadcast_80);
 6772|  44.6k|    word ^=
 6773|  44.6k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6774|  44.6k|    memcpy(input + i, &word, sizeof(word));
 6775|  44.6k|  }
 6776|  50.9k|  if (i < length) {
  ------------------
  |  Branch (6776:7): [True: 50.4k, False: 442]
  ------------------
 6777|  50.4k|    uint64_t word{};
 6778|  50.4k|    memcpy(&word, input + i, length - i);
 6779|  50.4k|    non_ascii |= (word & broadcast_80);
 6780|  50.4k|    word ^=
 6781|  50.4k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6782|  50.4k|    memcpy(input + i, &word, length - i);
 6783|  50.4k|  }
 6784|  50.9k|  return non_ascii == 0;
 6785|  50.9k|}
_ZN3ada7unicode9broadcastEh:
 6757|   152k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6758|   152k|  return 0x101010101010101ull * v;
 6759|   152k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12222|  21.4k|    auto apply_query_and_hash = [&]() {
12223|  21.4k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12223:11): [True: 1.18k, False: 20.2k]
  ------------------
12224|  1.18k|        const size_t q_end =
12225|  1.18k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12225:13): [True: 828, False: 353]
  ------------------
12226|  1.18k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|  1.18k|                                                q_end - query_start - 1),
12228|  1.18k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|  1.18k|      }
12230|  21.4k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12230:11): [True: 1.13k, False: 20.3k]
  ------------------
12231|  1.13k|        out.update_unencoded_base_hash(std::string_view(
12232|  1.13k|            input.data() + hash_start + 1, len - hash_start - 1));
12233|  1.13k|      }
12234|  21.4k|    };
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12222|  21.4k|    auto apply_query_and_hash = [&]() {
12223|  21.4k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12223:11): [True: 1.18k, False: 20.2k]
  ------------------
12224|  1.18k|        const size_t q_end =
12225|  1.18k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12225:13): [True: 828, False: 353]
  ------------------
12226|  1.18k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|  1.18k|                                                q_end - query_start - 1),
12228|  1.18k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|  1.18k|      }
12230|  21.4k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12230:11): [True: 1.13k, False: 20.3k]
  ------------------
12231|  1.13k|        out.update_unencoded_base_hash(std::string_view(
12232|  1.13k|            input.data() + hash_start + 1, len - hash_start - 1));
12233|  1.13k|      }
12234|  21.4k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11822|  1.61k|    auto apply_query_and_hash = [&]() {
11823|  1.61k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11823:11): [True: 730, False: 888]
  ------------------
11824|    730|        const size_t q_end =
11825|    730|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11825:13): [True: 484, False: 246]
  ------------------
11826|    730|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|    730|                                                q_end - query_start - 1),
11828|    730|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|    730|      }
11830|  1.61k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11830:11): [True: 698, False: 920]
  ------------------
11831|    698|        out.update_unencoded_base_hash(std::string_view(
11832|    698|            input.data() + hash_start + 1, len - hash_start - 1));
11833|    698|      }
11834|  1.61k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11822|  1.61k|    auto apply_query_and_hash = [&]() {
11823|  1.61k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11823:11): [True: 730, False: 888]
  ------------------
11824|    730|        const size_t q_end =
11825|    730|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11825:13): [True: 484, False: 246]
  ------------------
11826|    730|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|    730|                                                q_end - query_start - 1),
11828|    730|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|    730|      }
11830|  1.61k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11830:11): [True: 698, False: 920]
  ------------------
11831|    698|        out.update_unencoded_base_hash(std::string_view(
11832|    698|            input.data() + hash_start + 1, len - hash_start - 1));
11833|    698|      }
11834|  1.61k|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8498|   526k|    std::string_view& input) noexcept {
 8499|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8500|       |  // function). this function should be quite fast.
 8501|   526k|  size_t location_of_first = input.find('#');
 8502|   526k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8502:7): [True: 504k, False: 22.5k]
  ------------------
 8503|   504k|    return std::nullopt;
 8504|   504k|  }
 8505|  22.5k|  std::string_view hash = input;
 8506|  22.5k|  hash.remove_prefix(location_of_first + 1);
 8507|  22.5k|  input.remove_suffix(input.size() - location_of_first);
 8508|  22.5k|  return hash;
 8509|   526k|}
_ZZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12545|   241k|  const auto enforce_max_input_length = [&]() {
12546|   241k|    if constexpr (store_values) {
12547|   241k|      if (url.is_valid) {
  ------------------
  |  Branch (12547:11): [True: 241k, False: 0]
  ------------------
12548|       |        if constexpr (result_type_is_ada_url_aggregator) {
12549|       |          if (url.buffer.size() > max_input_length) [[unlikely]] {
12550|       |            url.is_valid = false;
12551|       |          }
12552|   241k|        } else {
12553|   241k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12553:15): [True: 0, False: 241k]
  ------------------
12554|      0|            url.is_valid = false;
12555|      0|          }
12556|   241k|        }
12557|   241k|      }
12558|   241k|    }
12559|   241k|  };
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9451|   185k|find_authority_delimiter_special(std::string_view view) noexcept {
 9452|       |  // performance note: we might be able to gain further performance
 9453|       |  // with SIMD intrinsics.
 9454|  2.01M|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9454:33): [True: 1.99M, False: 19.4k]
  ------------------
 9455|  1.99M|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9455:9): [True: 166k, False: 1.82M]
  ------------------
 9456|   166k|      return pos - view.begin();
 9457|   166k|    }
 9458|  1.99M|  }
 9459|  19.4k|  return size_t(view.size());
 9460|   185k|}
_ZN3ada7helpers24find_authority_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9472|    322|find_authority_delimiter(std::string_view view) noexcept {
 9473|       |  // performance note: we might be able to gain further performance
 9474|       |  // with SIMD instrinsics.
 9475|  3.83k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9475:33): [True: 3.79k, False: 40]
  ------------------
 9476|  3.79k|    if (authority_delimiter[(uint8_t)*pos]) {
  ------------------
  |  Branch (9476:9): [True: 282, False: 3.51k]
  ------------------
 9477|    282|      return pos - view.begin();
 9478|    282|    }
 9479|  3.79k|  }
 9480|     40|  return size_t(view.size());
 9481|    322|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8511|  25.7k|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8512|       |  // Let path be url's path.
 8513|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8514|       |  // Windows drive letter, then return.
 8515|  25.7k|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8515:7): [True: 350, False: 25.3k]
  ------------------
 8516|    350|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8516:7): [True: 180, False: 170]
  |  Branch (8516:54): [True: 144, False: 36]
  ------------------
 8517|    144|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8517:9): [True: 20, False: 124]
  ------------------
 8518|    144|            helpers::substring(path, 1))) {
 8519|     20|      return false;
 8520|     20|    }
 8521|    144|  }
 8522|       |
 8523|       |  // Remove path's last item, if any.
 8524|  25.7k|  size_t last_delimiter = path.rfind('/');
 8525|  25.7k|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8525:7): [True: 21.6k, False: 4.04k]
  ------------------
 8526|  21.6k|    path.erase(last_delimiter);
 8527|  21.6k|    return true;
 8528|  21.6k|  }
 8529|       |
 8530|  4.04k|  return false;
 8531|  25.7k|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9164|   520k|    const bool is_special, std::string_view& view) noexcept {
 9165|       |  /**
 9166|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9167|       |   * compute a variable called insideBrackets but this variable is only used
 9168|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9169|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9170|       |   * It is conceptually simpler and arguably more efficient to just return a
 9171|       |   * Boolean indicating whether ':' was found outside brackets.
 9172|       |   */
 9173|   520k|  const size_t view_size = view.size();
 9174|   520k|  size_t location = 0;
 9175|   520k|  bool found_colon = false;
 9176|       |  /**
 9177|       |   * Performance analysis:
 9178|       |   *
 9179|       |   * We are basically seeking the end of the hostname which can be indicated
 9180|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9181|       |   * (where '\\' is only applicable for special URLs). However, these must
 9182|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9183|       |   * '?' does not count.
 9184|       |   *
 9185|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9186|       |   * the set of delimiters, and that we handle it first.
 9187|       |   *
 9188|       |   * So the trick is to have a fast function that locates the next delimiter.
 9189|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9190|       |   * function would be provided by the C++ standard library, but it seems that
 9191|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9192|       |   *
 9193|       |   * We do not break into two loops for speed, but for clarity.
 9194|       |   */
 9195|   520k|  if (is_special) {
  ------------------
  |  Branch (9195:7): [True: 519k, False: 1.53k]
  ------------------
 9196|       |    // We move to the next delimiter.
 9197|   519k|    location = find_next_host_delimiter_special(view, location);
 9198|       |    // Unless we find '[' then we are going only going to have to call
 9199|       |    // find_next_host_delimiter_special once.
 9200|   521k|    for (; location < view_size;
  ------------------
  |  Branch (9200:12): [True: 459k, False: 61.5k]
  ------------------
 9201|   519k|         location = find_next_host_delimiter_special(view, location)) {
 9202|   459k|      if (view[location] == '[') {
  ------------------
  |  Branch (9202:11): [True: 2.61k, False: 457k]
  ------------------
 9203|  2.61k|        location = view.find(']', location);
 9204|  2.61k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9204:13): [True: 184, False: 2.43k]
  ------------------
 9205|       |          // performance: view.find might get translated to a memchr, which
 9206|       |          // has no notion of std::string_view::npos, so the code does not
 9207|       |          // reflect the assembly.
 9208|    184|          location = view_size;
 9209|    184|          break;
 9210|    184|        }
 9211|   457k|      } else {
 9212|   457k|        found_colon = view[location] == ':';
 9213|   457k|        break;
 9214|   457k|      }
 9215|   459k|    }
 9216|   519k|  } else {
 9217|       |    // We move to the next delimiter.
 9218|  1.53k|    location = find_next_host_delimiter(view, location);
 9219|       |    // Unless we find '[' then we are going only going to have to call
 9220|       |    // find_next_host_delimiter_special once.
 9221|  1.67k|    for (; location < view_size;
  ------------------
  |  Branch (9221:12): [True: 1.43k, False: 246]
  ------------------
 9222|  1.53k|         location = find_next_host_delimiter(view, location)) {
 9223|  1.43k|      if (view[location] == '[') {
  ------------------
  |  Branch (9223:11): [True: 148, False: 1.28k]
  ------------------
 9224|    148|        location = view.find(']', location);
 9225|    148|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9225:13): [True: 8, False: 140]
  ------------------
 9226|       |          // performance: view.find might get translated to a memchr, which
 9227|       |          // has no notion of std::string_view::npos, so the code does not
 9228|       |          // reflect the assembly.
 9229|      8|          location = view_size;
 9230|      8|          break;
 9231|      8|        }
 9232|  1.28k|      } else {
 9233|  1.28k|        found_colon = view[location] == ':';
 9234|  1.28k|        break;
 9235|  1.28k|      }
 9236|  1.43k|    }
 9237|  1.53k|  }
 9238|       |  // performance: remove_suffix may translate into a single instruction.
 9239|   520k|  view.remove_suffix(view_size - location);
 9240|   520k|  return {location, found_colon};
 9241|   520k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8754|   521k|    std::string_view view, size_t location) noexcept {
 8755|       |  // first check for short strings in which case we do it naively.
 8756|   521k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8756:7): [True: 403k, False: 117k]
  ------------------
 8757|  4.29M|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8757:31): [True: 4.23M, False: 59.7k]
  ------------------
 8758|  4.23M|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8758:11): [True: 1.40k, False: 4.23M]
  |  Branch (8758:29): [True: 340k, False: 3.89M]
  |  Branch (8758:47): [True: 212, False: 3.89M]
  ------------------
 8759|  3.89M|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8759:11): [True: 536, False: 3.89M]
  |  Branch (8759:29): [True: 1.04k, False: 3.88M]
  ------------------
 8760|   343k|        return i;
 8761|   343k|      }
 8762|  4.23M|    }
 8763|  59.7k|    return size_t(view.size());
 8764|   403k|  }
 8765|       |  // fast path for long strings (expected to be common)
 8766|   117k|  size_t i = location;
 8767|   117k|  const __m128i mask1 = _mm_set1_epi8(':');
 8768|   117k|  const __m128i mask2 = _mm_set1_epi8('/');
 8769|   117k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8770|   117k|  const __m128i mask4 = _mm_set1_epi8('?');
 8771|   117k|  const __m128i mask5 = _mm_set1_epi8('[');
 8772|       |
 8773|   235k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8773:10): [True: 174k, False: 60.8k]
  ------------------
 8774|   174k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8775|   174k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8776|   174k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8777|   174k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8778|   174k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8779|   174k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8780|   174k|    __m128i m = _mm_or_si128(
 8781|   174k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8782|   174k|    int mask = _mm_movemask_epi8(m);
 8783|   174k|    if (mask != 0) {
  ------------------
  |  Branch (8783:9): [True: 57.0k, False: 117k]
  ------------------
 8784|  57.0k|      return i + trailing_zeroes(mask);
 8785|  57.0k|    }
 8786|   174k|  }
 8787|  60.8k|  if (i < view.size()) {
  ------------------
  |  Branch (8787:7): [True: 60.6k, False: 276]
  ------------------
 8788|  60.6k|    __m128i word =
 8789|  60.6k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8790|  60.6k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8791|  60.6k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8792|  60.6k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8793|  60.6k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8794|  60.6k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8795|  60.6k|    __m128i m = _mm_or_si128(
 8796|  60.6k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8797|  60.6k|    int mask = _mm_movemask_epi8(m);
 8798|  60.6k|    if (mask != 0) {
  ------------------
  |  Branch (8798:9): [True: 59.0k, False: 1.57k]
  ------------------
 8799|  59.0k|      return view.length() - 16 + trailing_zeroes(mask);
 8800|  59.0k|    }
 8801|  60.6k|  }
 8802|  1.85k|  return size_t(view.length());
 8803|  60.8k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8579|   117k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8580|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8581|       |  unsigned long ret;
 8582|       |  // Search the mask data from least significant bit (LSB)
 8583|       |  // to the most significant bit (MSB) for a set bit (1).
 8584|       |  _BitScanForward(&ret, input_num);
 8585|       |  return (int)ret;
 8586|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8587|   117k|  return __builtin_ctzl(input_num);
 8588|   117k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8589|   117k|}
_ZN3ada7helpers24find_next_host_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9030|  1.67k|                                                  size_t location) noexcept {
 9031|       |  // first check for short strings in which case we do it naively.
 9032|  1.67k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9032:7): [True: 512, False: 1.16k]
  ------------------
 9033|  3.13k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9033:31): [True: 2.93k, False: 198]
  ------------------
 9034|  2.93k|      if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
  ------------------
  |  Branch (9034:11): [True: 68, False: 2.87k]
  |  Branch (9034:29): [True: 152, False: 2.71k]
  |  Branch (9034:47): [True: 50, False: 2.66k]
  ------------------
 9035|  2.66k|          view[i] == '[') {
  ------------------
  |  Branch (9035:11): [True: 44, False: 2.62k]
  ------------------
 9036|    314|        return i;
 9037|    314|      }
 9038|  2.93k|    }
 9039|    198|    return size_t(view.size());
 9040|    512|  }
 9041|       |  // fast path for long strings (expected to be common)
 9042|  1.16k|  size_t i = location;
 9043|  1.16k|  const __m128i mask1 = _mm_set1_epi8(':');
 9044|  1.16k|  const __m128i mask2 = _mm_set1_epi8('/');
 9045|  1.16k|  const __m128i mask4 = _mm_set1_epi8('?');
 9046|  1.16k|  const __m128i mask5 = _mm_set1_epi8('[');
 9047|       |
 9048|  1.67k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9048:10): [True: 1.48k, False: 184]
  ------------------
 9049|  1.48k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9050|  1.48k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9051|  1.48k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9052|  1.48k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9053|  1.48k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9054|  1.48k|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9055|  1.48k|    int mask = _mm_movemask_epi8(m);
 9056|  1.48k|    if (mask != 0) {
  ------------------
  |  Branch (9056:9): [True: 982, False: 506]
  ------------------
 9057|    982|      return i + trailing_zeroes(mask);
 9058|    982|    }
 9059|  1.48k|  }
 9060|    184|  if (i < view.size()) {
  ------------------
  |  Branch (9060:7): [True: 162, False: 22]
  ------------------
 9061|    162|    __m128i word =
 9062|    162|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9063|    162|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9064|    162|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9065|    162|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9066|    162|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9067|    162|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9068|    162|    int mask = _mm_movemask_epi8(m);
 9069|    162|    if (mask != 0) {
  ------------------
  |  Branch (9069:9): [True: 136, False: 26]
  ------------------
 9070|    136|      return view.length() - 16 + trailing_zeroes(mask);
 9071|    136|    }
 9072|    162|  }
 9073|     48|  return size_t(view.length());
 9074|    184|}
_ZN3ada3url10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10113|   261k|ada_really_inline bool url::parse_host(std::string_view input) {
10114|   261k|  ada_log("parse_host ", input, " [", input.size(), " bytes]");
10115|   261k|  if (input.empty()) {
  ------------------
  |  Branch (10115:7): [True: 7, False: 261k]
  ------------------
10116|      7|    return is_valid = false;
10117|      7|  }  // technically unnecessary.
10118|       |  // If input starts with U+005B ([), then:
10119|   261k|  if (input[0] == '[') {
  ------------------
  |  Branch (10119:7): [True: 667, False: 260k]
  ------------------
10120|       |    // If input does not end with U+005D (]), validation error, return failure.
10121|    667|    if (input.back() != ']') {
  ------------------
  |  Branch (10121:9): [True: 79, False: 588]
  ------------------
10122|     79|      return is_valid = false;
10123|     79|    }
10124|    588|    ada_log("parse_host ipv6");
10125|       |
10126|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
10127|       |    // trailing U+005D (]) removed.
10128|    588|    input.remove_prefix(1);
10129|    588|    input.remove_suffix(1);
10130|    588|    return parse_ipv6(input);
10131|    667|  }
10132|       |
10133|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
10134|       |  // input.
10135|   260k|  if (!is_special()) {
  ------------------
  |  Branch (10135:7): [True: 662, False: 259k]
  ------------------
10136|    662|    return parse_opaque_host(input);
10137|    662|  }
10138|       |
10139|       |  // Fast path: try to parse as pure decimal IPv4 first.
10140|   259k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
10141|   259k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (10141:7): [True: 105k, False: 154k]
  ------------------
10142|   105k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (10142:9): [True: 105k, False: 0]
  |  Branch (10142:27): [True: 11, False: 105k]
  ------------------
10143|     11|      host = input.substr(0, input.size() - 1);
10144|   105k|    } else {
10145|   105k|      host = input;
10146|   105k|    }
10147|   105k|    host_type = IPV4;
10148|   105k|    is_valid = true;
10149|   105k|    ada_log("parse_host fast path decimal ipv4");
10150|   105k|    return true;
10151|   105k|  }
10152|       |  // Let domain be the result of running UTF-8 decode without BOM on the
10153|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
10154|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
10155|       |  // which case we do not need to call the expensive 'to_ascii' if a few
10156|       |  // conditions are met: no '%' and no 'xn-' subsequence.
10157|   154k|  const uint8_t forbidden_or_upper =
10158|   154k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
10159|   154k|                                                             input.size());
10160|   154k|  static constexpr std::string_view xn_dash{"xn-", 3};
10161|   154k|  if ((forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (10161:7): [True: 132k, False: 21.7k]
  ------------------
10162|   132k|    host = std::string(input);
10163|   132k|    if ((forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (10163:9): [True: 864, False: 131k]
  ------------------
10164|    864|      unicode::to_lower_ascii(host->data(), host->size());
10165|    864|    }
10166|   132k|    if (host->find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10166:9): [True: 72.1k, False: 60.0k]
  ------------------
10167|  72.4k|        host->find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10167:9): [True: 222, False: 59.8k]
  ------------------
10168|  72.4k|      if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10168:11): [True: 38.7k, False: 33.6k]
  ------------------
10169|  38.7k|        ada_log("parse_host fast path ipv4");
10170|  38.7k|        return parse_ipv4(*host);
10171|  38.7k|      }
10172|  33.6k|      ada_log("parse_host fast path ", *host);
10173|  33.6k|      is_valid = true;
10174|  33.6k|      return true;
10175|  72.4k|    }
10176|   132k|  } else if (const size_t first_percent = input.find('%');
10177|  21.7k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (10177:14): [True: 19.1k, False: 2.58k]
  ------------------
10178|  19.1k|    std::string decoded = unicode::percent_decode(input, first_percent);
10179|  19.1k|    const uint8_t decoded_flags =
10180|  19.1k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
10181|  19.1k|                                                               decoded.size());
10182|  19.1k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (10182:9): [True: 18.8k, False: 350]
  ------------------
10183|  18.8k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (10183:11): [True: 139, False: 18.6k]
  ------------------
10184|    139|        unicode::to_lower_ascii(decoded.data(), decoded.size());
10185|    139|      }
10186|  18.8k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10186:11): [True: 18.7k, False: 53]
  ------------------
10187|  18.7k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10187:11): [True: 20, False: 33]
  ------------------
10188|  18.7k|        host = std::move(decoded);
10189|  18.7k|        if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10189:13): [True: 18.5k, False: 207]
  ------------------
10190|  18.5k|          return parse_ipv4(*host);
10191|  18.5k|        }
10192|    207|        is_valid = true;
10193|    207|        return true;
10194|  18.7k|      }
10195|  18.8k|    }
10196|  19.1k|  }
10197|  62.8k|  ada_log("parse_host calling to_ascii");
10198|  62.8k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
10199|  62.8k|  if (!is_valid || !host.has_value()) {
  ------------------
  |  Branch (10199:7): [True: 1.58k, False: 61.2k]
  |  Branch (10199:20): [True: 0, False: 61.2k]
  ------------------
10200|  1.58k|    ada_log("parse_host to_ascii returns false");
10201|  1.58k|    return is_valid = false;
10202|  1.58k|  }
10203|  61.2k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
10204|  61.2k|          " bytes]");
10205|       |
10206|  61.2k|  if (std::any_of(host->begin(), host->end(),
  ------------------
  |  Branch (10206:7): [True: 0, False: 61.2k]
  ------------------
10207|  61.2k|                  ada::unicode::is_forbidden_domain_code_point)) {
10208|      0|    host = std::nullopt;
10209|      0|    return is_valid = false;
10210|      0|  }
10211|       |
10212|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
10213|       |  // asciiDomain.
10214|  61.2k|  if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10214:7): [True: 116, False: 61.0k]
  ------------------
10215|    116|    ada_log("parse_host got ipv4 ", *host);
10216|    116|    return parse_ipv4(*host);
10217|    116|  }
10218|       |
10219|  61.0k|  return true;
10220|  61.2k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7049|   346k|                                              size_t length) noexcept {
 7050|   346k|  size_t i = 0;
 7051|   346k|  uint8_t accumulator{};
 7052|  1.37M|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7052:10): [True: 1.02M, False: 346k]
  ------------------
 7053|  1.02M|    accumulator |=
 7054|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7055|  1.02M|    accumulator |=
 7056|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7057|  1.02M|    accumulator |=
 7058|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7059|  1.02M|    accumulator |=
 7060|  1.02M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7061|  1.02M|  }
 7062|   936k|  for (; i < length; i++) {
  ------------------
  |  Branch (7062:10): [True: 589k, False: 346k]
  ------------------
 7063|   589k|    accumulator |=
 7064|   589k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7065|   589k|  }
 7066|   346k|  return accumulator;
 7067|   346k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7008|  2.28M|    const char c) noexcept {
 7009|  2.28M|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7010|  2.28M|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12545|   241k|  const auto enforce_max_input_length = [&]() {
12546|   241k|    if constexpr (store_values) {
12547|   241k|      if (url.is_valid) {
  ------------------
  |  Branch (12547:11): [True: 241k, False: 0]
  ------------------
12548|   241k|        if constexpr (result_type_is_ada_url_aggregator) {
12549|   241k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12549:15): [True: 0, False: 241k]
  ------------------
12550|      0|            url.is_valid = false;
12551|      0|          }
12552|       |        } else {
12553|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12554|       |            url.is_valid = false;
12555|       |          }
12556|       |        }
12557|   241k|      }
12558|   241k|    }
12559|   241k|  };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
10875|   117k|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
10876|   117k|  uint32_t digits = 1;
10877|   352k|  while (port >= 10) {
  ------------------
  |  Branch (10877:10): [True: 235k, False: 117k]
  ------------------
10878|   235k|    port /= 10;
10879|   235k|    ++digits;
10880|   235k|  }
10881|   117k|  return digits;
10882|   117k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
10885|  10.6k|                                             uint32_t port) {
10886|  10.6k|  buffer += ':';
10887|  10.6k|  char port_buf[5];
10888|  10.6k|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
10889|  10.6k|  (void)ec;
10890|  10.6k|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
10891|  10.6k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11033|  1.20M|                                        size_t n) noexcept {
11034|  1.20M|  const size_t rem = n - host_start;
11035|  1.20M|  if (rem == 0) {
  ------------------
  |  Branch (11035:7): [True: 0, False: 1.20M]
  ------------------
11036|      0|    return false;
11037|      0|  }
11038|       |#if ADA_NEON
11039|       |  if (rem >= 16) {
11040|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11041|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11042|       |    if (at == 0) {
11043|       |      return false;
11044|       |    }
11045|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11046|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11047|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11048|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11049|       |  }
11050|       |#elif ADA_SSE2
11051|  1.20M|  if (rem >= 16) {
  ------------------
  |  Branch (11051:7): [True: 656k, False: 553k]
  ------------------
11052|   656k|    const __m128i w =
11053|   656k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11054|   656k|    const uint16_t at = static_cast<uint16_t>(
11055|   656k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11056|   656k|    if (at == 0) {
  ------------------
  |  Branch (11056:9): [True: 597k, False: 58.9k]
  ------------------
11057|   597k|      return false;
11058|   597k|    }
11059|  58.9k|    const uint16_t delim = static_cast<uint16_t>(
11060|  58.9k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11061|  58.9k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11062|  58.9k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11063|  58.9k|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11063:12): [True: 58.4k, False: 492]
  |  Branch (11063:26): [True: 118, False: 374]
  ------------------
11064|   656k|  }
11065|   553k|#endif
11066|   553k|  const size_t lim = host_start + rem;
11067|  5.83M|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11067:31): [True: 5.77M, False: 59.7k]
  ------------------
11068|  5.77M|    const uint8_t c = p[i];
11069|  5.77M|    if (c == '@') {
  ------------------
  |  Branch (11069:9): [True: 18.8k, False: 5.75M]
  ------------------
11070|  18.8k|      return true;
11071|  18.8k|    }
11072|  5.75M|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11072:9): [True: 455k, False: 5.30M]
  |  Branch (11072:21): [True: 18.8k, False: 5.28M]
  |  Branch (11072:33): [True: 358, False: 5.28M]
  ------------------
11073|   474k|      return false;
11074|   474k|    }
11075|  5.75M|  }
11076|  59.7k|  return false;
11077|   553k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11084|   852k|                                     bool& has_x) noexcept {
11085|   852k|  has_upper = false;
11086|   852k|  has_x = false;
11087|   852k|  size_t i = start;
11088|   852k|#if ADA_PARSER_SSSE3
11089|   852k|  if (len - start >= 16) {
  ------------------
  |  Branch (11089:7): [True: 545k, False: 307k]
  ------------------
11090|   545k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11091|   545k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11092|   545k|    const __m128i x_splat = _mm_set1_epi8('x');
11093|   545k|    auto visit = [&](size_t at) noexcept -> bool {
11094|   545k|      const __m128i w =
11095|   545k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11096|   545k|      const int up = sse2_uppercase(w);
11097|   545k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11098|   545k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11099|   545k|      if (mask == 0) {
11100|   545k|        if (up != 0) {
11101|   545k|          has_upper = true;
11102|   545k|        }
11103|   545k|        if (xs != 0) {
11104|   545k|          has_x = true;
11105|   545k|        }
11106|   545k|        return false;
11107|   545k|      }
11108|   545k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11109|   545k|      const int valid = (1 << hit) - 1;
11110|   545k|      if ((up & valid) != 0) {
11111|   545k|        has_upper = true;
11112|   545k|      }
11113|   545k|      if ((xs & valid) != 0) {
11114|   545k|        has_x = true;
11115|   545k|      }
11116|   545k|      end = at + static_cast<size_t>(hit);
11117|   545k|      return true;
11118|   545k|    };
11119|   564k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11119:12): [True: 91.2k, False: 473k]
  ------------------
11120|  91.2k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11120:11): [True: 70.3k, False: 20.8k]
  |  Branch (11120:23): [True: 1.47k, False: 19.4k]
  ------------------
11121|  71.8k|        return k_host_class[b[end]] == 1;
11122|  71.8k|      }
11123|  91.2k|    }
11124|   531k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11124:12): [True: 472k, False: 58.3k]
  ------------------
11125|   472k|      if (visit(i)) {
  ------------------
  |  Branch (11125:11): [True: 415k, False: 57.6k]
  ------------------
11126|   415k|        return k_host_class[b[end]] == 1;
11127|   415k|      }
11128|   472k|    }
11129|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11130|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11131|  58.3k|    if (i > start && i < len) {
  ------------------
  |  Branch (11131:9): [True: 58.3k, False: 0]
  |  Branch (11131:22): [True: 58.3k, False: 42]
  ------------------
11132|  58.3k|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11132:11): [True: 58.2k, False: 120]
  |  Branch (11132:30): [True: 58.2k, False: 0]
  ------------------
11133|  58.2k|        return k_host_class[b[end]] == 1;
11134|  58.2k|      }
11135|    120|      end = len;
11136|    120|      return true;
11137|  58.3k|    }
11138|  58.3k|  }
11139|       |#elif ADA_SSE2
11140|       |  const __m128i x_splat = _mm_set1_epi8('x');
11141|       |  for (; i + 32 <= len; i += 32) {
11142|       |    for (size_t off = 0; off < 32; off += 16) {
11143|       |      const __m128i w =
11144|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11145|       |      const int up = sse2_uppercase(w);
11146|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11147|       |      const int mask = sse2_host_stop(w);
11148|       |      if (mask != 0) {
11149|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11150|       |        const int valid = (1 << hit) - 1;
11151|       |        if ((up & valid) != 0) {
11152|       |          has_upper = true;
11153|       |        }
11154|       |        if ((xs & valid) != 0) {
11155|       |          has_x = true;
11156|       |        }
11157|       |        end = i + off + static_cast<size_t>(hit);
11158|       |        return k_host_class[b[end]] == 1;
11159|       |      }
11160|       |      if (up != 0) {
11161|       |        has_upper = true;
11162|       |      }
11163|       |      if (xs != 0) {
11164|       |        has_x = true;
11165|       |      }
11166|       |    }
11167|       |  }
11168|       |  for (; i + 16 <= len; i += 16) {
11169|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11170|       |    const int up = sse2_uppercase(w);
11171|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11172|       |    const int mask = sse2_host_stop(w);
11173|       |    if (mask != 0) {
11174|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11175|       |      const int valid = (1 << hit) - 1;
11176|       |      if ((up & valid) != 0) {
11177|       |        has_upper = true;
11178|       |      }
11179|       |      if ((xs & valid) != 0) {
11180|       |        has_x = true;
11181|       |      }
11182|       |      end = i + static_cast<size_t>(hit);
11183|       |      return k_host_class[b[end]] == 1;
11184|       |    }
11185|       |    if (up != 0) {
11186|       |      has_upper = true;
11187|       |    }
11188|       |    if (xs != 0) {
11189|       |      has_x = true;
11190|       |    }
11191|       |  }
11192|       |#elif ADA_NEON
11193|       |  if (len - start >= 16) {
11194|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11195|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11196|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11197|       |    auto visit = [&](size_t at) noexcept -> bool {
11198|       |      const uint8x16_t w = vld1q_u8(b + at);
11199|       |      const uint64_t up = neon_uppercase(w);
11200|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11201|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11202|       |      if (bits == 0) {
11203|       |        if (up != 0) {
11204|       |          has_upper = true;
11205|       |        }
11206|       |        if (xs != 0) {
11207|       |          has_x = true;
11208|       |        }
11209|       |        return false;
11210|       |      }
11211|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11212|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11213|       |      if ((up & valid) != 0) {
11214|       |        has_upper = true;
11215|       |      }
11216|       |      if ((xs & valid) != 0) {
11217|       |        has_x = true;
11218|       |      }
11219|       |      end = at + hit;
11220|       |      return true;
11221|       |    };
11222|       |    for (; i + 32 <= len; i += 32) {
11223|       |      if (visit(i) || visit(i + 16)) {
11224|       |        return k_host_class[b[end]] == 1;
11225|       |      }
11226|       |    }
11227|       |    for (; i + 16 <= len; i += 16) {
11228|       |      if (visit(i)) {
11229|       |        return k_host_class[b[end]] == 1;
11230|       |      }
11231|       |    }
11232|       |    if (i > start && i < len) {
11233|       |      if (visit(len - 16) && end >= i) {
11234|       |        return k_host_class[b[end]] == 1;
11235|       |      }
11236|       |      end = len;
11237|       |      return true;
11238|       |    }
11239|       |  }
11240|       |#endif
11241|  3.30M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11241:10): [True: 3.28M, False: 18.8k]
  ------------------
11242|  3.28M|    const uint8_t c = b[i];
11243|  3.28M|    const uint8_t cls = k_host_class[c];
11244|  3.28M|    if (cls == 1) {
  ------------------
  |  Branch (11244:9): [True: 285k, False: 2.99M]
  ------------------
11245|   285k|      end = i;
11246|   285k|      return true;
11247|   285k|    }
11248|  2.99M|    if (cls == 2) {
  ------------------
  |  Branch (11248:9): [True: 2.58k, False: 2.99M]
  ------------------
11249|  2.58k|      return false;
11250|  2.58k|    }
11251|  2.99M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11251:9): [True: 2.59M, False: 401k]
  |  Branch (11251:21): [True: 756, False: 2.59M]
  ------------------
11252|    756|      has_upper = true;
11253|  2.99M|    } else if (c == 'x') {
  ------------------
  |  Branch (11253:16): [True: 318k, False: 2.67M]
  ------------------
11254|   318k|      has_x = true;
11255|   318k|    }
11256|  2.99M|  }
11257|  18.8k|  end = len;
11258|  18.8k|  return true;
11259|   307k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
10914|  1.23M|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
10915|  1.23M|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
10916|  1.23M|}
simple_absolute.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENK3$_0clEm:
11093|   643k|    auto visit = [&](size_t at) noexcept -> bool {
11094|   643k|      const __m128i w =
11095|   643k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11096|   643k|      const int up = sse2_uppercase(w);
11097|   643k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11098|   643k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11099|   643k|      if (mask == 0) {
  ------------------
  |  Branch (11099:11): [True: 98.0k, False: 545k]
  ------------------
11100|  98.0k|        if (up != 0) {
  ------------------
  |  Branch (11100:13): [True: 1.15k, False: 96.9k]
  ------------------
11101|  1.15k|          has_upper = true;
11102|  1.15k|        }
11103|  98.0k|        if (xs != 0) {
  ------------------
  |  Branch (11103:13): [True: 94.0k, False: 4.03k]
  ------------------
11104|  94.0k|          has_x = true;
11105|  94.0k|        }
11106|  98.0k|        return false;
11107|  98.0k|      }
11108|   545k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11109|   545k|      const int valid = (1 << hit) - 1;
11110|   545k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11110:11): [True: 19.6k, False: 525k]
  ------------------
11111|  19.6k|        has_upper = true;
11112|  19.6k|      }
11113|   545k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11113:11): [True: 475k, False: 70.1k]
  ------------------
11114|   475k|        has_x = true;
11115|   475k|      }
11116|   545k|      end = at + static_cast<size_t>(hit);
11117|   545k|      return true;
11118|   643k|    };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11001|   643k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11002|   643k|  return _mm_movemask_epi8(_mm_and_si128(
11003|   643k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11004|   643k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11005|   643k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
10921|   748k|                                      __m128i hi_tbl) noexcept {
10922|   748k|  const __m128i nibble = _mm_set1_epi8(0x0F);
10923|   748k|  const __m128i lo = _mm_and_si128(w, nibble);
10924|   748k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
10925|   748k|  const __m128i hit =
10926|   748k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
10927|   748k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
10928|   748k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
10893|   616k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
10894|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
10895|       |  unsigned long ret;
10896|       |  _BitScanForward(&ret, input_num);
10897|       |  return static_cast<int>(ret);
10898|       |#else
10899|   616k|  return __builtin_ctz(input_num);
10900|   616k|#endif
10901|   616k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11319|   633k|                                   bool& maybe_dot_segment) noexcept {
11320|   633k|  const size_t run_start = i;
11321|   633k|#if ADA_PARSER_SSSE3
11322|   633k|  if (i + 16 <= len) {
  ------------------
  |  Branch (11322:7): [True: 68.1k, False: 565k]
  ------------------
11323|  68.1k|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11324|  68.1k|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11325|  72.6k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11325:12): [True: 11.7k, False: 60.8k]
  ------------------
11326|  11.7k|      const __m128i w0 =
11327|  11.7k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11328|  11.7k|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11329|  11.7k|      if (m0 != 0) {
  ------------------
  |  Branch (11329:11): [True: 6.66k, False: 5.12k]
  ------------------
11330|  6.66k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11331|  6.66k|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11332|  6.66k|                            maybe_dot_segment);
11333|  6.66k|        i += static_cast<size_t>(hit_bit);
11334|  6.66k|        return;
11335|  6.66k|      }
11336|  5.12k|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11337|  5.12k|      const __m128i w1 =
11338|  5.12k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11339|  5.12k|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11340|  5.12k|      if (m1 != 0) {
  ------------------
  |  Branch (11340:11): [True: 690, False: 4.43k]
  ------------------
11341|    690|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11342|    690|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11343|    690|                            maybe_dot_segment);
11344|    690|        i += 16 + static_cast<size_t>(hit_bit);
11345|    690|        return;
11346|    690|      }
11347|  4.43k|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11348|  4.43k|    }
11349|  61.9k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11349:12): [True: 60.2k, False: 1.71k]
  ------------------
11350|  60.2k|      const __m128i w =
11351|  60.2k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11352|  60.2k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11353|  60.2k|      if (mask != 0) {
  ------------------
  |  Branch (11353:11): [True: 59.1k, False: 1.12k]
  ------------------
11354|  59.1k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11355|  59.1k|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11356|  59.1k|                            maybe_dot_segment);
11357|  59.1k|        i += static_cast<size_t>(hit_bit);
11358|  59.1k|        return;
11359|  59.1k|      }
11360|  1.12k|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11361|  1.12k|    }
11362|  1.71k|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11362:9): [True: 1.71k, False: 0]
  |  Branch (11362:26): [True: 1.37k, False: 344]
  ------------------
11363|  1.37k|      const __m128i w =
11364|  1.37k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11365|  1.37k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11366|  1.37k|      if (mask != 0) {
  ------------------
  |  Branch (11366:11): [True: 622, False: 750]
  ------------------
11367|    622|        const size_t hit =
11368|    622|            len - 16 +
11369|    622|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11370|    622|        if (hit >= i) {
  ------------------
  |  Branch (11370:13): [True: 622, False: 0]
  ------------------
11371|  3.11k|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11371:30): [True: 2.49k, False: 622]
  ------------------
11372|  2.49k|            if (b[j] == '.') {
  ------------------
  |  Branch (11372:17): [True: 512, False: 1.98k]
  ------------------
11373|    512|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11374|    512|            }
11375|  2.49k|          }
11376|    622|          i = hit;
11377|    622|          return;
11378|    622|        }
11379|    622|      }
11380|  6.45k|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11380:26): [True: 5.70k, False: 750]
  ------------------
11381|  5.70k|        if (b[j] == '.') {
  ------------------
  |  Branch (11381:13): [True: 1.39k, False: 4.31k]
  ------------------
11382|  1.39k|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11383|  1.39k|        }
11384|  5.70k|      }
11385|    750|      i = len;
11386|    750|      return;
11387|  1.37k|    }
11388|  1.71k|  }
11389|       |#elif ADA_SSE2
11390|       |  for (; i + 16 <= len; i += 16) {
11391|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11392|       |    const int mask = sse2_path_stop(w);
11393|       |    if (mask != 0) {
11394|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11395|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11396|       |                          maybe_dot_segment);
11397|       |      i += static_cast<size_t>(hit_bit);
11398|       |      return;
11399|       |    }
11400|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11401|       |  }
11402|       |#elif ADA_NEON
11403|       |  if (i + 16 <= len) {
11404|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11405|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11406|       |    for (; i + 32 <= len; i += 32) {
11407|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11408|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11409|       |      if (bits0 != 0) {
11410|       |        const size_t hit_off =
11411|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11412|       |        const uint64_t valid =
11413|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11414|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11415|       |        i += hit_off;
11416|       |        return;
11417|       |      }
11418|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11419|       |                               maybe_dot_segment);
11420|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11421|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11422|       |      if (bits1 != 0) {
11423|       |        const size_t hit_off =
11424|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11425|       |        const uint64_t valid =
11426|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11427|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11428|       |                                 maybe_dot_segment);
11429|       |        i += 16 + hit_off;
11430|       |        return;
11431|       |      }
11432|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11433|       |                               maybe_dot_segment);
11434|       |    }
11435|       |    for (; i + 16 <= len; i += 16) {
11436|       |      const uint8x16_t w = vld1q_u8(b + i);
11437|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11438|       |      if (bits != 0) {
11439|       |        const size_t hit_off =
11440|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11441|       |        const uint64_t valid =
11442|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11443|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11444|       |        i += hit_off;
11445|       |        return;
11446|       |      }
11447|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11448|       |                               maybe_dot_segment);
11449|       |    }
11450|       |    if (i > run_start && i < len) {
11451|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11452|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11453|       |      if (bits != 0) {
11454|       |        const size_t hit =
11455|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11456|       |        if (hit >= i) {
11457|       |          for (size_t j = i; j < hit; ++j) {
11458|       |            if (b[j] == '.') {
11459|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11460|       |            }
11461|       |          }
11462|       |          i = hit;
11463|       |          return;
11464|       |        }
11465|       |      }
11466|       |      for (size_t j = i; j < len; ++j) {
11467|       |        if (b[j] == '.') {
11468|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11469|       |        }
11470|       |      }
11471|       |      i = len;
11472|       |      return;
11473|       |    }
11474|       |  }
11475|       |#endif
11476|  2.11M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11476:10): [True: 1.70M, False: 410k]
  ------------------
11477|  1.70M|    const uint8_t c = b[i];
11478|  1.70M|    const uint8_t cls = k_path[c];
11479|  1.70M|    if (cls != 0) {
  ------------------
  |  Branch (11479:9): [True: 155k, False: 1.55M]
  ------------------
11480|   155k|      return;
11481|   155k|    }
11482|  1.55M|    if (c == '.') {
  ------------------
  |  Branch (11482:9): [True: 168k, False: 1.38M]
  ------------------
11483|   168k|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11484|   168k|    }
11485|  1.55M|  }
11486|   565k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11276|  77.1k|                                           bool& maybe_dot_segment) noexcept {
11277|  77.1k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11277:7): [True: 4.50k, False: 72.6k]
  |  Branch (11277:28): [True: 4.48k, False: 68.1k]
  ------------------
11278|  8.98k|    return;
11279|  8.98k|  }
11280|  68.1k|  const int dots =
11281|  68.1k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11282|  68.1k|  if (dots == 0) {
  ------------------
  |  Branch (11282:7): [True: 63.1k, False: 5.01k]
  ------------------
11283|  63.1k|    return;
11284|  63.1k|  }
11285|  5.01k|  const int slashes =
11286|  5.01k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11287|  5.01k|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11287:8): [True: 1.67k, False: 3.34k]
  |  Branch (11287:28): [True: 884, False: 788]
  |  Branch (11287:46): [True: 106, False: 682]
  ------------------
11288|  4.02k|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11288:7): [True: 1.13k, False: 2.88k]
  ------------------
11289|  2.12k|    maybe_dot_segment = true;
11290|  2.12k|  }
11291|  5.01k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11263|   169k|    bool& maybe_dot_segment) noexcept {
11264|   169k|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11264:7): [True: 540, False: 169k]
  |  Branch (11264:27): [True: 38.4k, False: 130k]
  ------------------
11265|  39.0k|    maybe_dot_segment = true;
11266|  39.0k|  }
11267|   169k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11629|   176k|                                    size_t len) noexcept {
11630|   176k|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11492|   176k|  do {                                                                       \
  |  |11493|   176k|    const size_t scan_start = i;                                             \
  |  |11494|   176k|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11494:9): [True: 4.62k, False: 171k]
  |  |  ------------------
  |  |11495|  4.62k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11496|  4.62k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11497|  11.8k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11497:14): [True: 7.69k, False: 4.19k]
  |  |  ------------------
  |  |11498|  7.69k|        const __m128i w0 =                                                   \
  |  |11499|  7.69k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11500|  7.69k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11501|  7.69k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11501:13): [True: 262, False: 7.43k]
  |  |  ------------------
  |  |11502|    262|          i += static_cast<size_t>(                                          \
  |  |11503|    262|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11504|    262|          return;                                                            \
  |  |11505|    262|        }                                                                    \
  |  |11506|  7.69k|        const __m128i w1 =                                                   \
  |  |11507|  7.43k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11508|  7.43k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11509|  7.43k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11509:13): [True: 172, False: 7.26k]
  |  |  ------------------
  |  |11510|    172|          i += 16 + static_cast<size_t>(                                     \
  |  |11511|    172|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11512|    172|          return;                                                            \
  |  |11513|    172|        }                                                                    \
  |  |11514|  7.43k|      }                                                                      \
  |  |11515|  4.62k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11515:14): [True: 1.32k, False: 3.19k]
  |  |  ------------------
  |  |11516|  1.32k|        const __m128i w =                                                    \
  |  |11517|  1.32k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11518|  1.32k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11519|  1.32k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11519:13): [True: 998, False: 322]
  |  |  ------------------
  |  |11520|    998|          i += static_cast<size_t>(                                          \
  |  |11521|    998|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11522|    998|          return;                                                            \
  |  |11523|    998|        }                                                                    \
  |  |11524|  1.32k|      }                                                                      \
  |  |11525|  4.19k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11525:11): [True: 3.19k, False: 0]
  |  |  |  Branch (11525:29): [True: 3.14k, False: 48]
  |  |  ------------------
  |  |11526|  3.14k|        const __m128i w =                                                    \
  |  |11527|  3.14k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11528|  3.14k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11529|  3.14k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11529:13): [True: 2.26k, False: 882]
  |  |  ------------------
  |  |11530|  2.26k|          const size_t hit = len - 16 +                                      \
  |  |11531|  2.26k|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11532|  2.26k|                                 static_cast<uint32_t>(mask)));              \
  |  |11533|  2.26k|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11533:15): [True: 2.26k, False: 0]
  |  |  ------------------
  |  |11534|  2.26k|            i = hit;                                                         \
  |  |11535|  2.26k|            return;                                                          \
  |  |11536|  2.26k|          }                                                                  \
  |  |11537|  2.26k|        }                                                                    \
  |  |11538|  3.14k|        i = len;                                                             \
  |  |11539|    882|        return;                                                              \
  |  |11540|  3.14k|      }                                                                      \
  |  |11541|  3.19k|    }                                                                        \
  |  |11542|  1.19M|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11542:12): [True: 1.08M, False: 112k]
  |  |  ------------------
  |  |11543|  1.08M|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11543:11): [True: 59.0k, False: 1.02M]
  |  |  ------------------
  |  |11544|  59.0k|        return;                                                              \
  |  |11545|  59.0k|      }                                                                      \
  |  |11546|  1.08M|    }                                                                        \
  |  |11547|   171k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11547:12): [Folded, False: 112k]
  |  |  ------------------
  ------------------
11631|   176k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11634|   120k|                                   size_t len) noexcept {
11635|   120k|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11492|   120k|  do {                                                                       \
  |  |11493|   120k|    const size_t scan_start = i;                                             \
  |  |11494|   120k|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11494:9): [True: 730, False: 119k]
  |  |  ------------------
  |  |11495|    730|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11496|    730|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11497|  3.59k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11497:14): [True: 2.97k, False: 612]
  |  |  ------------------
  |  |11498|  2.97k|        const __m128i w0 =                                                   \
  |  |11499|  2.97k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11500|  2.97k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11501|  2.97k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11501:13): [True: 98, False: 2.88k]
  |  |  ------------------
  |  |11502|     98|          i += static_cast<size_t>(                                          \
  |  |11503|     98|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11504|     98|          return;                                                            \
  |  |11505|     98|        }                                                                    \
  |  |11506|  2.97k|        const __m128i w1 =                                                   \
  |  |11507|  2.88k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11508|  2.88k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11509|  2.88k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11509:13): [True: 20, False: 2.86k]
  |  |  ------------------
  |  |11510|     20|          i += 16 + static_cast<size_t>(                                     \
  |  |11511|     20|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11512|     20|          return;                                                            \
  |  |11513|     20|        }                                                                    \
  |  |11514|  2.88k|      }                                                                      \
  |  |11515|    990|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11515:14): [True: 390, False: 600]
  |  |  ------------------
  |  |11516|    390|        const __m128i w =                                                    \
  |  |11517|    390|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11518|    390|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11519|    390|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11519:13): [True: 12, False: 378]
  |  |  ------------------
  |  |11520|     12|          i += static_cast<size_t>(                                          \
  |  |11521|     12|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11522|     12|          return;                                                            \
  |  |11523|     12|        }                                                                    \
  |  |11524|    390|      }                                                                      \
  |  |11525|    612|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11525:11): [True: 600, False: 0]
  |  |  |  Branch (11525:29): [True: 556, False: 44]
  |  |  ------------------
  |  |11526|    556|        const __m128i w =                                                    \
  |  |11527|    556|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11528|    556|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11529|    556|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11529:13): [True: 12, False: 544]
  |  |  ------------------
  |  |11530|     12|          const size_t hit = len - 16 +                                      \
  |  |11531|     12|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11532|     12|                                 static_cast<uint32_t>(mask)));              \
  |  |11533|     12|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11533:15): [True: 12, False: 0]
  |  |  ------------------
  |  |11534|     12|            i = hit;                                                         \
  |  |11535|     12|            return;                                                          \
  |  |11536|     12|          }                                                                  \
  |  |11537|     12|        }                                                                    \
  |  |11538|    556|        i = len;                                                             \
  |  |11539|    544|        return;                                                              \
  |  |11540|    556|      }                                                                      \
  |  |11541|    600|    }                                                                        \
  |  |11542|   586k|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11542:12): [True: 466k, False: 119k]
  |  |  ------------------
  |  |11543|   466k|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11543:11): [True: 112, False: 466k]
  |  |  ------------------
  |  |11544|    112|        return;                                                              \
  |  |11545|    112|      }                                                                      \
  |  |11546|   466k|    }                                                                        \
  |  |11547|   119k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11547:12): [Folded, False: 119k]
  |  |  ------------------
  ------------------
11636|   120k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11640|  20.5k|bool path_has_dot_segment(std::string_view path) noexcept {
11641|  20.5k|  if (path.empty()) {
  ------------------
  |  Branch (11641:7): [True: 0, False: 20.5k]
  ------------------
11642|      0|    return false;
11643|      0|  }
11644|       |  // "." / ".." at the start, with or without a leading '/'.
11645|  20.5k|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11645:20): [True: 20.5k, False: 0]
  ------------------
11646|  20.5k|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11646:7): [True: 20.5k, False: 0]
  |  Branch (11646:26): [True: 772, False: 19.8k]
  ------------------
11647|    772|    const size_t after = i + 1;
11648|    772|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11648:9): [True: 28, False: 744]
  |  Branch (11648:33): [True: 178, False: 566]
  ------------------
11649|    566|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11649:10): [True: 566, False: 0]
  |  Branch (11649:33): [True: 342, False: 224]
  ------------------
11650|    428|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11650:11): [True: 16, False: 326]
  |  Branch (11650:39): [True: 206, False: 120]
  ------------------
11651|    428|      return true;
11652|    428|    }
11653|    772|  }
11654|  20.1k|  static constexpr std::string_view slash_dot{"/.", 2};
11655|  20.1k|  size_t p = i;
11656|  22.4k|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11656:10): [True: 21.6k, False: 818]
  ------------------
11657|  21.6k|    const size_t after = p + 2;
11658|  21.6k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11658:9): [True: 104, False: 21.5k]
  |  Branch (11658:33): [True: 18.9k, False: 2.57k]
  ------------------
11659|  2.57k|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11659:10): [True: 2.57k, False: 0]
  |  Branch (11659:33): [True: 796, False: 1.77k]
  ------------------
11660|  19.3k|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11660:11): [True: 64, False: 732]
  |  Branch (11660:39): [True: 200, False: 532]
  ------------------
11661|  19.3k|      return true;
11662|  19.3k|    }
11663|  2.30k|    p = after;
11664|  2.30k|  }
11665|    818|  return false;
11666|  20.1k|}
simple_absolute.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13637|   263k|    ada::url_components& components, uint32_t new_difference) {
13638|   263k|  components.username_end += new_difference;
13639|   263k|  components.host_start += new_difference;
13640|   263k|  components.host_end += new_difference;
13641|   263k|  components.pathname_start += new_difference;
13642|   263k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13642:7): [True: 0, False: 263k]
  ------------------
13643|      0|    components.search_start += new_difference;
13644|      0|  }
13645|   263k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13645:7): [True: 0, False: 263k]
  ------------------
13646|      0|    components.hash_start += new_difference;
13647|      0|  }
13648|   263k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14007|  23.0k|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14008|  23.0k|  ada_log("url_aggregator::parse_path ", input);
14009|  23.0k|  ADA_ASSERT_TRUE(validate());
14010|  23.0k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14011|  23.0k|  std::string tmp_buffer;
14012|  23.0k|  std::string_view internal_input;
14013|  23.0k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14013:7): [True: 0, False: 23.0k]
  ------------------
14014|      0|    tmp_buffer = input;
14015|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14016|       |    // just directly build the string from user_input.
14017|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14018|      0|    internal_input = tmp_buffer;
14019|  23.0k|  } else {
14020|  23.0k|    internal_input = input;
14021|  23.0k|  }
14022|       |
14023|       |  // If url is special, then:
14024|  23.0k|  if (is_special()) {
  ------------------
  |  Branch (14024:7): [True: 23.0k, False: 0]
  ------------------
14025|  23.0k|    if (internal_input.empty()) {
  ------------------
  |  Branch (14025:9): [True: 187, False: 22.9k]
  ------------------
14026|    187|      update_base_pathname("/");
14027|  22.9k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14027:16): [True: 22.9k, False: 0]
  |  Branch (14027:46): [True: 0, False: 0]
  ------------------
14028|  22.9k|      consume_prepared_path(internal_input.substr(1));
14029|  22.9k|    } else {
14030|      0|      consume_prepared_path(internal_input);
14031|      0|    }
14032|  23.0k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14032:14): [True: 0, False: 0]
  ------------------
14033|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14033:9): [True: 0, False: 0]
  ------------------
14034|      0|      consume_prepared_path(internal_input.substr(1));
14035|      0|    } else {
14036|      0|      consume_prepared_path(internal_input);
14037|      0|    }
14038|      0|  } else {
14039|       |    // Non-special URLs with an empty host can have their paths erased
14040|       |    // Path-only URLs cannot have their paths erased
14041|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14041:9): [True: 0, False: 0]
  |  Branch (14041:57): [True: 0, False: 0]
  ------------------
14042|      0|      update_base_pathname("/");
14043|      0|    }
14044|      0|  }
14045|  23.0k|  ADA_ASSERT_TRUE(validate());
14046|  23.0k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14126|   261k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14127|   261k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14128|   261k|          " bytes]");
14129|   261k|  ADA_ASSERT_TRUE(validate());
14130|   261k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14131|   261k|  if (input.empty()) {
  ------------------
  |  Branch (14131:7): [True: 7, False: 261k]
  ------------------
14132|      7|    return is_valid = false;
14133|      7|  }  // technically unnecessary.
14134|       |  // If input starts with U+005B ([), then:
14135|   261k|  if (input[0] == '[') {
  ------------------
  |  Branch (14135:7): [True: 667, False: 260k]
  ------------------
14136|       |    // If input does not end with U+005D (]), validation error, return failure.
14137|    667|    if (input.back() != ']') {
  ------------------
  |  Branch (14137:9): [True: 79, False: 588]
  ------------------
14138|     79|      return is_valid = false;
14139|     79|    }
14140|    588|    ada_log("parse_host ipv6");
14141|       |
14142|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14143|       |    // trailing U+005D (]) removed.
14144|    588|    input.remove_prefix(1);
14145|    588|    input.remove_suffix(1);
14146|    588|    return parse_ipv6(input);
14147|    667|  }
14148|       |
14149|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14150|       |  // input.
14151|   260k|  if (!is_special()) {
  ------------------
  |  Branch (14151:7): [True: 662, False: 259k]
  ------------------
14152|    662|    return parse_opaque_host(input);
14153|    662|  }
14154|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14155|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14156|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14157|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14158|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14159|       |
14160|       |  // Often, the input does not contain any forbidden code points, and no upper
14161|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14162|       |  // optimize for such a common case.
14163|       |
14164|       |  // Fast path: try to parse as pure decimal IPv4 first.
14165|   259k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14166|   259k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14166:7): [True: 105k, False: 154k]
  ------------------
14167|   105k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14167:9): [True: 105k, False: 0]
  |  Branch (14167:27): [True: 11, False: 105k]
  ------------------
14168|     11|      update_base_hostname(input.substr(0, input.size() - 1));
14169|   105k|    } else {
14170|   105k|      update_base_hostname(input);
14171|   105k|    }
14172|   105k|    host_type = IPV4;
14173|   105k|    is_valid = true;
14174|   105k|    ada_log("parse_host fast path decimal ipv4");
14175|   105k|    ADA_ASSERT_TRUE(validate());
14176|   105k|    return true;
14177|   105k|  }
14178|   154k|  uint8_t is_forbidden_or_upper =
14179|   154k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14180|   154k|                                                             input.size());
14181|   154k|  static constexpr std::string_view xn_dash{"xn-", 3};
14182|   154k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14182:7): [True: 132k, False: 21.7k]
  ------------------
14183|   132k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14183:9): [True: 864, False: 131k]
  ------------------
14184|    864|      std::string lowered(input);
14185|    864|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14186|    864|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14186:11): [True: 619, False: 245]
  ------------------
14187|    655|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14187:11): [True: 36, False: 209]
  ------------------
14188|    655|        update_base_hostname(lowered);
14189|    655|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14189:13): [True: 141, False: 514]
  ------------------
14190|    141|          ada_log("parse_host fast path ipv4");
14191|    141|          return parse_ipv4(lowered, true);
14192|    141|        }
14193|    514|        ada_log("parse_host fast path ", get_hostname());
14194|    514|        is_valid = true;
14195|    514|        return true;
14196|    655|      }
14197|   131k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14197:16): [True: 71.5k, False: 59.8k]
  ------------------
14198|  71.7k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14198:16): [True: 186, False: 59.6k]
  ------------------
14199|  71.7k|      update_base_hostname(input);
14200|  71.7k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14200:11): [True: 38.5k, False: 33.1k]
  ------------------
14201|  38.5k|        ada_log("parse_host fast path ipv4");
14202|  38.5k|        return parse_ipv4(input, true);
14203|  38.5k|      }
14204|  33.1k|      ada_log("parse_host fast path ", get_hostname());
14205|  33.1k|      is_valid = true;
14206|  33.1k|      return true;
14207|  71.7k|    }
14208|   132k|  } else if (const size_t first_percent = input.find('%');
14209|  21.7k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14209:14): [True: 19.1k, False: 2.58k]
  ------------------
14210|  19.1k|    std::string decoded = unicode::percent_decode(input, first_percent);
14211|  19.1k|    const uint8_t decoded_flags =
14212|  19.1k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14213|  19.1k|                                                               decoded.size());
14214|  19.1k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14214:9): [True: 18.8k, False: 350]
  ------------------
14215|  18.8k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14215:11): [True: 139, False: 18.6k]
  ------------------
14216|    139|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14217|    139|      }
14218|  18.8k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14218:11): [True: 18.7k, False: 53]
  ------------------
14219|  18.7k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14219:11): [True: 20, False: 33]
  ------------------
14220|  18.7k|        update_base_hostname(decoded);
14221|  18.7k|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14221:13): [True: 18.5k, False: 207]
  ------------------
14222|  18.5k|          return parse_ipv4(decoded, true);
14223|  18.5k|        }
14224|    207|        is_valid = true;
14225|    207|        return true;
14226|  18.7k|      }
14227|  18.8k|    }
14228|  19.1k|  }
14229|       |  // We have encountered at least one forbidden code point or the input contains
14230|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14231|       |  // conversion.
14232|       |
14233|  62.8k|  ada_log("parse_host calling to_ascii");
14234|  62.8k|  std::optional<std::string> host = std::string(get_hostname());
14235|  62.8k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14236|  62.8k|  if (!is_valid) {
  ------------------
  |  Branch (14236:7): [True: 1.58k, False: 61.2k]
  ------------------
14237|  1.58k|    ada_log("parse_host to_ascii returns false");
14238|  1.58k|    return is_valid = false;
14239|  1.58k|  }
14240|  61.2k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14241|  61.2k|          " bytes]");
14242|       |
14243|  61.2k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14243:7): [True: 0, False: 61.2k]
  ------------------
14244|  61.2k|                          ada::unicode::is_forbidden_domain_code_point)) {
14245|      0|    return is_valid = false;
14246|      0|  }
14247|       |
14248|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14249|       |  // asciiDomain.
14250|  61.2k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14250:7): [True: 116, False: 61.0k]
  ------------------
14251|    116|    ada_log("parse_host got ipv4 ", *host);
14252|    116|    return parse_ipv4(host.value(), false);
14253|    116|  }
14254|       |
14255|  61.0k|  update_base_hostname(host.value());
14256|  61.0k|  ADA_ASSERT_TRUE(validate());
14257|  61.0k|  return true;
14258|  61.2k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8565|  22.6k|                                                       size_t pos) {
 8566|  22.6k|  ADA_ASSERT_TRUE(pos <= input.size());
 8567|       |  // The following is safer but unneeded if we have the above line:
 8568|       |  // return pos > input.size() ? std::string_view() : input.substr(pos);
 8569|  22.6k|  return input.substr(pos);
 8570|  22.6k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15077|   233k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15078|   233k|  ada_log("url_aggregator::consume_prepared_path ", input);
15079|       |  /***
15080|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15081|       |   * unfortunate. This particular function is nearly identical, except that it
15082|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15083|       |   * very common) merely appends to the buffer. This is the same trivial path as
15084|       |   * with helpers::parse_prepared_path, except that we have the additional check
15085|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15086|       |   * modify it, and then insert it back into the buffer.
15087|       |   */
15088|   233k|  uint8_t accumulator = checkers::path_signature(input);
15089|       |  // Let us first detect a trivial case.
15090|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15091|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15092|       |  // no dot, and no character needing percent encoding.
15093|   233k|  constexpr uint8_t need_encoding = 1;
15094|   233k|  constexpr uint8_t backslash_char = 2;
15095|   233k|  constexpr uint8_t dot_char = 4;
15096|   233k|  constexpr uint8_t percent_char = 8;
15097|   233k|  bool special = type != ada::scheme::NOT_SPECIAL;
15098|   233k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15098:39): [True: 1.37k, False: 232k]
  ------------------
15099|  1.37k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15099:39): [True: 34, False: 1.34k]
  ------------------
15100|   233k|  bool trivial_path =
15101|   233k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15101:7): [True: 204k, False: 29.5k]
  |  Branch (15101:8): [True: 232k, False: 846]
  ------------------
15102|   233k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15103|    846|                  0)) &&
15104|   204k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15104:7): [True: 204k, False: 17]
  ------------------
15105|   233k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15105:7): [True: 12.7k, False: 221k]
  |  Branch (15105:34): [True: 12.6k, False: 8]
  ------------------
15106|       |    // '4' means that we have at least one dot, but nothing that requires
15107|       |    // percent encoding or decoding. The only part that is not trivial is
15108|       |    // that we may have single dots and double dots path segments.
15109|       |    // If we have such segments, then we either have a path that begins
15110|       |    // with '.' (easy to check), or we have the sequence './'.
15111|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15112|       |    // Note: we know that '\' is not present.
15113|  12.6k|    if (input[0] != '.') {
  ------------------
  |  Branch (15113:9): [True: 11.3k, False: 1.33k]
  ------------------
15114|  11.3k|      size_t slashdot = 0;
15115|  11.3k|      bool dot_is_file = true;
15116|  36.8k|      for (;;) {
15117|  36.8k|        slashdot = input.find("/.", slashdot);
15118|  36.8k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15118:13): [True: 11.3k, False: 25.4k]
  ------------------
15119|  11.3k|          break;
15120|  25.4k|        } else {  // uncommon
15121|       |          // only three cases matter: /./, /.. or a final /
15122|  25.4k|          slashdot += 2;
15123|  25.4k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15123:28): [True: 80, False: 25.3k]
  |  Branch (15123:56): [True: 12.3k, False: 12.9k]
  ------------------
15124|  12.9k|                           input[slashdot] == '/');
  ------------------
  |  Branch (15124:28): [True: 11.8k, False: 1.14k]
  ------------------
15125|  25.4k|        }
15126|  36.8k|      }
15127|  11.3k|      trivial_path = dot_is_file;
15128|  11.3k|    }
15129|  12.6k|  }
15130|   233k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15130:7): [True: 205k, False: 28.4k]
  |  Branch (15130:23): [True: 205k, False: 0]
  ------------------
15131|   205k|    ada_log("parse_path trivial");
15132|   205k|    buffer += '/';
15133|   205k|    buffer += input;
15134|   205k|    return;
15135|   205k|  }
15136|  28.4k|  std::string path = std::string(get_pathname());
15137|       |  // We are going to need to look a bit at the path, but let us see if we can
15138|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15139|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15140|       |  // there.
15141|  28.4k|  bool fast_path =
15142|  28.4k|      (special &&
  ------------------
  |  Branch (15142:8): [True: 28.0k, False: 466]
  ------------------
15143|  28.0k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15143:8): [True: 11.5k, False: 16.5k]
  ------------------
15144|  11.5k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15144:7): [True: 11.4k, False: 89]
  ------------------
15145|  28.4k|  if (fast_path) {
  ------------------
  |  Branch (15145:7): [True: 11.4k, False: 17.0k]
  ------------------
15146|  11.4k|    ada_log("parse_prepared_path fast");
15147|       |    // Here we don't need to worry about \ or percent encoding.
15148|       |    // We also do not have a file protocol. We might have dots, however,
15149|       |    // but dots must as appear as '.', and they cannot be encoded because
15150|       |    // the symbol '%' is not present.
15151|  11.4k|    size_t previous_location = 0;  // We start at 0.
15152|  70.8k|    do {
15153|  70.8k|      size_t new_location = input.find('/', previous_location);
15154|       |      // std::string_view path_view = input;
15155|       |      //  We process the last segment separately:
15156|  70.8k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15156:11): [True: 11.4k, False: 59.3k]
  ------------------
15157|  11.4k|        std::string_view path_view = input.substr(previous_location);
15158|  11.4k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15158:13): [True: 81, False: 11.3k]
  ------------------
15159|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15160|     81|          if (path.empty()) {
  ------------------
  |  Branch (15160:15): [True: 20, False: 61]
  ------------------
15161|     20|            path = '/';
15162|     20|            update_base_pathname(path);
15163|     20|            return;
15164|     20|          }
15165|       |          // Fast case where we have nothing to do:
15166|     61|          if (path.back() == '/') {
  ------------------
  |  Branch (15166:15): [True: 18, False: 43]
  ------------------
15167|     18|            update_base_pathname(path);
15168|     18|            return;
15169|     18|          }
15170|       |          // If you have the path "/joe/myfriend",
15171|       |          // then you delete 'myfriend'.
15172|     43|          path.resize(path.rfind('/') + 1);
15173|     43|          update_base_pathname(path);
15174|     43|          return;
15175|     61|        }
15176|  11.3k|        path += '/';
15177|  11.3k|        if (path_view != ".") {
  ------------------
  |  Branch (15177:13): [True: 11.2k, False: 103]
  ------------------
15178|  11.2k|          path.append(path_view);
15179|  11.2k|        }
15180|  11.3k|        update_base_pathname(path);
15181|  11.3k|        return;
15182|  59.3k|      } else {
15183|       |        // This is a non-final segment.
15184|  59.3k|        std::string_view path_view =
15185|  59.3k|            input.substr(previous_location, new_location - previous_location);
15186|  59.3k|        previous_location = new_location + 1;
15187|  59.3k|        if (path_view == "..") {
  ------------------
  |  Branch (15187:13): [True: 13.0k, False: 46.3k]
  ------------------
15188|  13.0k|          size_t last_delimiter = path.rfind('/');
15189|  13.0k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15189:15): [True: 10.9k, False: 2.15k]
  ------------------
15190|  10.9k|            path.erase(last_delimiter);
15191|  10.9k|          }
15192|  46.3k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15192:20): [True: 33.5k, False: 12.7k]
  ------------------
15193|  33.5k|          path += '/';
15194|  33.5k|          path.append(path_view);
15195|  33.5k|        }
15196|  59.3k|      }
15197|  70.8k|    } while (true);
  ------------------
  |  Branch (15197:14): [True: 59.3k, Folded]
  ------------------
15198|  17.0k|  } else {
15199|  17.0k|    ada_log("parse_path slow");
15200|       |    // we have reached the general case
15201|  17.0k|    bool needs_percent_encoding = (accumulator & 1);
15202|  17.0k|    std::string path_buffer_tmp;
15203|  62.8k|    do {
15204|  62.8k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15204:26): [True: 60.8k, False: 1.96k]
  |  Branch (15204:37): [True: 6.48k, False: 54.3k]
  ------------------
15205|  62.8k|                            ? input.find_first_of("/\\")
15206|  62.8k|                            : input.find('/');
15207|  62.8k|      std::string_view path_view = input;
15208|  62.8k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15208:11): [True: 45.7k, False: 17.0k]
  ------------------
15209|  45.7k|        path_view.remove_suffix(path_view.size() - location);
15210|  45.7k|        input.remove_prefix(location + 1);
15211|  45.7k|      }
15212|       |      // path_buffer is either path_view or it might point at a percent encoded
15213|       |      // temporary string.
15214|  62.8k|      std::string_view path_buffer =
15215|  62.8k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15215:12): [True: 13.4k, False: 49.3k]
  ------------------
15216|  13.4k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15216:12): [True: 4.56k, False: 8.89k]
  ------------------
15217|  13.4k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15218|  62.8k|              ? path_buffer_tmp
15219|  62.8k|              : path_view;
15220|  62.8k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15220:11): [True: 12.8k, False: 49.9k]
  ------------------
15221|  12.8k|        helpers::shorten_path(path, type);
15222|  12.8k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15222:13): [True: 9.57k, False: 3.29k]
  ------------------
15223|  9.57k|          path += '/';
15224|  9.57k|        }
15225|  49.9k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15225:18): [True: 2.25k, False: 47.6k]
  ------------------
15226|  2.25k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15226:18): [True: 447, False: 1.80k]
  ------------------
15227|    447|        path += '/';
15228|    447|      }
15229|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15230|  49.5k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15230:16): [True: 47.6k, False: 1.80k]
  ------------------
15231|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15232|       |        // Windows drive letter, then replace the second code point in
15233|       |        // path_buffer with U+003A (:).
15234|  47.6k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15234:13): [True: 1.93k, False: 45.7k]
  |  Branch (15234:48): [True: 548, False: 1.38k]
  ------------------
15235|    548|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15235:13): [True: 36, False: 512]
  ------------------
15236|     36|          path += '/';
15237|     36|          path += path_buffer[0];
15238|     36|          path += ':';
15239|     36|          path_buffer.remove_prefix(2);
15240|     36|          path.append(path_buffer);
15241|  47.6k|        } else {
15242|       |          // Append path_buffer to url's path.
15243|  47.6k|          path += '/';
15244|  47.6k|          path.append(path_buffer);
15245|  47.6k|        }
15246|  47.6k|      }
15247|  62.8k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15247:11): [True: 17.0k, False: 45.7k]
  ------------------
15248|  17.0k|        update_base_pathname(path);
15249|  17.0k|        return;
15250|  17.0k|      }
15251|  62.8k|    } while (true);
  ------------------
  |  Branch (15251:14): [True: 45.7k, Folded]
  ------------------
15252|  17.0k|  }
15253|  28.4k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|   304k|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|   304k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (14:7): [True: 187k, False: 117k]
  ------------------
   15|   187k|    return false;
   16|   187k|  }
   17|       |  // If the address ends with a dot, we need to prune it (special case).
   18|   117k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (18:7): [True: 55.5k, False: 61.6k]
  ------------------
   19|  55.5k|    view.remove_suffix(1);
   20|  55.5k|  }
   21|       |  // From the last character, find the last dot.
   22|   117k|  size_t last_dot = view.rfind('.');
   23|   117k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (23:7): [True: 94.7k, False: 22.4k]
  ------------------
   24|       |    // We have at least one dot.
   25|  94.7k|    view.remove_prefix(last_dot + 1);
   26|  94.7k|  }
   27|       |  /** Optimization opportunity: we have basically identified the last number of
   28|       |     the ipv4 if we return true here. We might as well parse it and have at
   29|       |     least one number parsed when we get to parse_ipv4. */
   30|   117k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (30:7): [True: 59.0k, False: 58.1k]
  ------------------
   31|  59.0k|    return true;
   32|  59.0k|  }
   33|       |  // It could be hex (0x), but not if there is a single character.
   34|  58.1k|  if (view.size() == 1) {
  ------------------
  |  Branch (34:7): [True: 0, False: 58.1k]
  ------------------
   35|      0|    return false;
   36|      0|  }
   37|       |  // It must start with 0x.
   38|  58.1k|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (38:7): [True: 1.47k, False: 56.6k]
  ------------------
   39|  1.47k|    return false;
   40|  1.47k|  }
   41|       |  // We must allow "0x".
   42|  56.6k|  if (view.size() == 2) {
  ------------------
  |  Branch (42:7): [True: 18.5k, False: 38.1k]
  ------------------
   43|  18.5k|    return true;
   44|  18.5k|  }
   45|       |  // We have 0x followed by some characters, we need to check that they are
   46|       |  // hexadecimals.
   47|  38.1k|  view.remove_prefix(2);
   48|  38.1k|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   49|  56.6k|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7168|   327k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7169|   327k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7169:11): [True: 327k, False: 0]
  |  Branch (7169:23): [True: 14.2k, False: 312k]
  |  Branch (7169:37): [True: 312k, False: 0]
  |  Branch (7169:49): [True: 312k, False: 844]
  ------------------
 7170|   327k|}
_ZN3ada3url12parse_schemeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
10015|   263k|ada_really_inline bool url::parse_scheme(const std::string_view input) {
10016|   263k|  auto parsed_type = ada::scheme::get_scheme_type(input);
10017|   263k|  bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
10018|       |  /**
10019|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
10020|       |   *http, https), in which case, we can go really fast.
10021|       |   **/
10022|   263k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (10022:7): [True: 258k, False: 4.94k]
  ------------------
10023|       |    if constexpr (has_state_override) {
10024|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
10025|       |      // then return.
10026|       |      if (is_special() != is_input_special) {
10027|       |        return false;
10028|       |      }
10029|       |
10030|       |      // If url includes credentials or has a non-null port, and buffer is
10031|       |      // "file", then return.
10032|       |      if ((has_credentials() || port.has_value()) &&
10033|       |          parsed_type == ada::scheme::type::FILE) {
10034|       |        return false;
10035|       |      }
10036|       |
10037|       |      // If url's scheme is "file" and its host is an empty host, then return.
10038|       |      // An empty host is the empty string.
10039|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10040|       |          host->empty()) {
10041|       |        return false;
10042|       |      }
10043|       |    }
10044|       |
10045|   258k|    type = parsed_type;
10046|       |
10047|       |    if constexpr (has_state_override) {
10048|       |      // This is uncommon.
10049|       |      uint16_t urls_scheme_port = get_special_port();
10050|       |
10051|       |      if (urls_scheme_port) {
10052|       |        // If url's port is url's scheme's default port, then set url's port to
10053|       |        // null.
10054|       |        if (port.has_value() && *port == urls_scheme_port) {
10055|       |          port = std::nullopt;
10056|       |        }
10057|       |      }
10058|       |    }
10059|   258k|  } else {  // slow path
10060|  4.94k|    std::string _buffer(input);
10061|       |    // Next function is only valid if the input is ASCII and returns false
10062|       |    // otherwise, but it seems that we always have ascii content so we do not
10063|       |    // need to check the return value.
10064|       |    // bool is_ascii =
10065|  4.94k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
10066|       |
10067|       |    if constexpr (has_state_override) {
10068|       |      // The state-override validation errors below ("return" in the WHATWG URL
10069|       |      // parser) leave the URL unchanged. The setter contract is
10070|       |      // "true on success, false if the scheme is invalid" -- the fast path
10071|       |      // above already returns false here, so the slow path must agree.
10072|       |
10073|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
10074|       |      // then return. If url's scheme is not a special scheme and buffer is a
10075|       |      // special scheme, then return.
10076|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
10077|       |        return false;
10078|       |      }
10079|       |
10080|       |      // If url includes credentials or has a non-null port, and buffer is
10081|       |      // "file", then return.
10082|       |      if ((has_credentials() || port.has_value()) && _buffer == "file") {
10083|       |        return false;
10084|       |      }
10085|       |
10086|       |      // If url's scheme is "file" and its host is an empty host, then return.
10087|       |      // An empty host is the empty string.
10088|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10089|       |          host->empty()) {
10090|       |        return false;
10091|       |      }
10092|       |    }
10093|       |
10094|  4.94k|    set_scheme(std::move(_buffer));
10095|       |
10096|       |    if constexpr (has_state_override) {
10097|       |      // This is uncommon.
10098|       |      uint16_t urls_scheme_port = get_special_port();
10099|       |
10100|       |      if (urls_scheme_port) {
10101|       |        // If url's port is url's scheme's default port, then set url's port to
10102|       |        // null.
10103|       |        if (port.has_value() && *port == urls_scheme_port) {
10104|       |          port = std::nullopt;
10105|       |        }
10106|       |      }
10107|       |    }
10108|  4.94k|  }
10109|       |
10110|   263k|  return true;
10111|   263k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13655|   263k|    const std::string_view input_with_colon) {
13656|   263k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13657|   263k|  ADA_ASSERT_TRUE(validate());
13658|   263k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13659|   263k|  std::string_view input{input_with_colon};
13660|   263k|  input.remove_suffix(1);
13661|   263k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13662|   263k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13663|       |  /**
13664|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13665|       |   *http, https), in which case, we can go really fast.
13666|       |   **/
13667|   263k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13667:7): [True: 258k, False: 4.94k]
  ------------------
13668|       |    if constexpr (has_state_override) {
13669|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13670|       |      // then return.
13671|       |      if (is_special() != is_input_special) {
13672|       |        return false;
13673|       |      }
13674|       |
13675|       |      // If url includes credentials or has a non-null port, and buffer is
13676|       |      // "file", then return.
13677|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13678|       |          parsed_type == ada::scheme::type::FILE) {
13679|       |        return false;
13680|       |      }
13681|       |
13682|       |      // If url's scheme is "file" and its host is an empty host, then return.
13683|       |      // An empty host is the empty string.
13684|       |      if (type == ada::scheme::type::FILE &&
13685|       |          components.host_start == components.host_end) {
13686|       |        return false;
13687|       |      }
13688|       |    }
13689|       |
13690|   258k|    type = parsed_type;
13691|   258k|    set_scheme_from_view_with_colon(input_with_colon);
13692|       |
13693|       |    if constexpr (has_state_override) {
13694|       |      // This is uncommon.
13695|       |      uint16_t urls_scheme_port = get_special_port();
13696|       |
13697|       |      if (urls_scheme_port) {
13698|       |        // If url's port is url's scheme's default port, then set url's port to
13699|       |        // null.
13700|       |        if (components.port == urls_scheme_port) {
13701|       |          clear_port();
13702|       |        }
13703|       |      }
13704|       |    }
13705|   258k|  } else {  // slow path
13706|  4.94k|    std::string _buffer(input);
13707|       |    // Next function is only valid if the input is ASCII and returns false
13708|       |    // otherwise, but it seems that we always have ascii content so we do not
13709|       |    // need to check the return value.
13710|  4.94k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
13711|       |
13712|       |    if constexpr (has_state_override) {
13713|       |      // The state-override validation errors below ("return" in the WHATWG URL
13714|       |      // parser) leave the URL unchanged. The setter contract is
13715|       |      // "true on success, false if the scheme is invalid" -- the fast path
13716|       |      // above already returns false here, so the slow path must agree.
13717|       |
13718|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
13719|       |      // then return. If url's scheme is not a special scheme and buffer is a
13720|       |      // special scheme, then return.
13721|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
13722|       |        return false;
13723|       |      }
13724|       |
13725|       |      // If url includes credentials or has a non-null port, and buffer is
13726|       |      // "file", then return.
13727|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13728|       |          _buffer == "file") {
13729|       |        return false;
13730|       |      }
13731|       |
13732|       |      // If url's scheme is "file" and its host is an empty host, then return.
13733|       |      // An empty host is the empty string.
13734|       |      if (type == ada::scheme::type::FILE &&
13735|       |          components.host_start == components.host_end) {
13736|       |        return false;
13737|       |      }
13738|       |    }
13739|       |
13740|  4.94k|    set_scheme(_buffer);
13741|       |
13742|       |    if constexpr (has_state_override) {
13743|       |      // This is uncommon.
13744|       |      uint16_t urls_scheme_port = get_special_port();
13745|       |
13746|       |      if (urls_scheme_port) {
13747|       |        // If url's port is url's scheme's default port, then set url's port to
13748|       |        // null.
13749|       |        if (components.port == urls_scheme_port) {
13750|       |          clear_port();
13751|       |        }
13752|       |      }
13753|       |    }
13754|  4.94k|  }
13755|   263k|  ADA_ASSERT_TRUE(validate());
13756|   263k|  return true;
13757|   263k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13781|   258k|    std::string_view new_scheme_with_colon) {
13782|   258k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
13783|   258k|          new_scheme_with_colon);
13784|   258k|  ADA_ASSERT_TRUE(validate());
13785|   258k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
13786|   258k|                  new_scheme_with_colon.back() == ':');
13787|       |  // next line could overflow but unsigned arithmetic has well-defined
13788|       |  // overflows.
13789|   258k|  uint32_t new_difference =
13790|   258k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
13791|       |
13792|   258k|  if (buffer.empty()) {
  ------------------
  |  Branch (13792:7): [True: 258k, False: 0]
  ------------------
13793|   258k|    buffer.append(new_scheme_with_colon);
13794|   258k|  } else {
13795|      0|    buffer.erase(0, components.protocol_end);
13796|      0|    buffer.insert(0, new_scheme_with_colon);
13797|      0|  }
13798|   258k|  components.protocol_end += new_difference;
13799|       |
13800|   258k|  apply_shifted_non_scheme_offsets(components, new_difference);
13801|   258k|  ADA_ASSERT_TRUE(validate());
13802|   258k|}
_ZN3ada14url_aggregator10set_schemeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13804|  4.94k|inline void url_aggregator::set_scheme(std::string_view new_scheme) {
13805|  4.94k|  ada_log("url_aggregator::set_scheme ", new_scheme);
13806|  4.94k|  ADA_ASSERT_TRUE(validate());
13807|  4.94k|  ADA_ASSERT_TRUE(new_scheme.empty() || new_scheme.back() != ':');
13808|       |  // next line could overflow but unsigned arithmetic has well-defined
13809|       |  // overflows.
13810|  4.94k|  uint32_t new_difference =
13811|  4.94k|      uint32_t(new_scheme.size()) - components.protocol_end + 1;
13812|       |
13813|  4.94k|  type = ada::scheme::get_scheme_type(new_scheme);
13814|  4.94k|  if (buffer.empty()) {
  ------------------
  |  Branch (13814:7): [True: 4.94k, False: 0]
  ------------------
13815|  4.94k|    buffer.append(helpers::concat(new_scheme, ":"));
13816|  4.94k|  } else {
13817|      0|    buffer.erase(0, components.protocol_end);
13818|      0|    buffer.insert(0, helpers::concat(new_scheme, ":"));
13819|      0|  }
13820|  4.94k|  components.protocol_end = uint32_t(new_scheme.size() + 1);
13821|       |
13822|  4.94k|  apply_shifted_non_scheme_offsets(components, new_difference);
13823|  4.94k|  ADA_ASSERT_TRUE(validate());
13824|  4.94k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5755|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1074|  1.50M|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1075|  1.50M|  return !!(a[i >> 3] & (1 << (i & 7)));
 1076|  1.50M|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2189|  85.8k|  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:
 3675|  21.4k|      : impl_base(unexpect, std::move(e.value())),
 3676|  21.4k|        ctor_base(detail::default_constructor_tag{}) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2203|  42.9k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2661|  21.4k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada3urlENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3279|   608k|  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_:
 3761|   587k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3634|   587k|      : impl_base(in_place, std::forward<Args>(args)...),
 3635|   587k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2649|   587k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada3urlC2EOS0_:
 5043|   587k|  url(url&& u) noexcept = default;
_ZN3ada8url_baseD2Ev:
 1693|  2.39M|  virtual ~url_base() = default;
_ZN3ada3urlD2Ev:
 5046|  1.19M|  ~url() override = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3675|  21.4k|      : impl_base(unexpect, std::move(e.value())),
 3676|  21.4k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2661|  21.4k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3279|   608k|  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_:
 3761|   587k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3634|   587k|      : impl_base(in_place, std::forward<Args>(args)...),
 3635|   587k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2649|   587k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7771|   587k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7774|  1.19M|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6789|   536k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6790|   536k|  if (scheme.empty()) {
  ------------------
  |  Branch (6790:7): [True: 0, False: 536k]
  ------------------
 6791|      0|    return ada::scheme::NOT_SPECIAL;
 6792|      0|  }
 6793|   536k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6794|   536k|  const std::string_view target = details::is_special_list[hash_value];
 6795|   536k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6795:7): [True: 530k, False: 5.28k]
  ------------------
 6796|   530k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6796:7): [True: 522k, False: 8.47k]
  ------------------
 6797|   530k|          details::scheme_keys[hash_value]) {
 6798|   522k|    return ada::scheme::type(hash_value);
 6799|   522k|  } else {
 6800|  13.7k|    return ada::scheme::NOT_SPECIAL;
 6801|  13.7k|  }
 6802|   536k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6730|   530k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6731|   530k|  uint64_t input = (uint8_t)p[0];
 6732|   530k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6733|   530k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6734|   530k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6735|   530k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6736|   530k|  return input;
 6737|   530k|}
_ZN3ada14url_aggregatorC2Ev:
 7769|   608k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4952|   608k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1446|   634k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1447|   634k|  const size_t len = input.size();
 1448|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1449|   634k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1449:7): [True: 107k, False: 527k]
  |  Branch (1449:18): [True: 6.72k, False: 520k]
  ------------------
 1450|   113k|    return ipv4_fast_fail;
 1451|   113k|  }
 1452|   520k|  const char* data = input.data();
 1453|       |
 1454|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1455|       |  return detail::try_parse_ipv4_avx512(data, len);
 1456|       |#else
 1457|   520k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1458|   634k|#endif
 1459|   634k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1287|   520k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1288|   520k|  uint32_t ipv4 = 0;
 1289|  1.51M|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1289:19): [True: 1.26M, False: 248k]
  ------------------
 1290|  1.26M|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1290:9): [True: 18, False: 1.26M]
  ------------------
 1291|     18|      return ipv4_fast_fail;
 1292|     18|    }
 1293|  1.26M|    uint32_t val;
 1294|  1.26M|    char c = *p;
 1295|  1.26M|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1295:9): [True: 1.26M, False: 996]
  |  Branch (1295:21): [True: 1.07M, False: 194k]
  ------------------
 1296|  1.07M|      val = static_cast<uint32_t>(c - '0');
 1297|  1.07M|      ++p;
 1298|  1.07M|    } else {
 1299|   195k|      return ipv4_fast_fail;
 1300|   195k|    }
 1301|  1.07M|    if (p < pend) {
  ------------------
  |  Branch (1301:9): [True: 972k, False: 100k]
  ------------------
 1302|   972k|      c = *p;
 1303|   972k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1303:11): [True: 714k, False: 257k]
  |  Branch (1303:23): [True: 676k, False: 37.6k]
  ------------------
 1304|   676k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1304:13): [True: 270, False: 676k]
  ------------------
 1305|    270|          return ipv4_fast_fail;
 1306|    270|        }
 1307|   676k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1308|   676k|        ++p;
 1309|   676k|        if (p < pend) {
  ------------------
  |  Branch (1309:13): [True: 565k, False: 110k]
  ------------------
 1310|   565k|          c = *p;
 1311|   565k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1311:15): [True: 306k, False: 258k]
  |  Branch (1311:27): [True: 306k, False: 114]
  ------------------
 1312|   306k|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1313|   306k|            ++p;
 1314|   306k|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1314:17): [True: 1.31k, False: 305k]
  ------------------
 1315|  1.31k|              return ipv4_fast_fail;
 1316|  1.31k|            }
 1317|   306k|          }
 1318|   565k|        }
 1319|   676k|      }
 1320|   972k|    }
 1321|  1.07M|    ipv4 = (ipv4 << 8) | val;
 1322|  1.07M|    if (i < 3) {
  ------------------
  |  Branch (1322:9): [True: 822k, False: 248k]
  ------------------
 1323|   822k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1323:11): [True: 98, False: 822k]
  |  Branch (1323:24): [True: 74.8k, False: 747k]
  ------------------
 1324|  74.9k|        return ipv4_fast_fail;
 1325|  74.9k|      }
 1326|   747k|      ++p;
 1327|   747k|    }
 1328|  1.07M|  }
 1329|   248k|  if (p != pend) {
  ------------------
  |  Branch (1329:7): [True: 290, False: 248k]
  ------------------
 1330|    290|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1330:9): [True: 126, False: 164]
  |  Branch (1330:26): [True: 22, False: 104]
  ------------------
 1331|     22|      return ipv4;
 1332|     22|    }
 1333|    268|    return ipv4_fast_fail;
 1334|    290|  }
 1335|   248k|  return ipv4;
 1336|   248k|}
_ZNK3ada3url15has_credentialsEv:
 7307|  1.25M|[[nodiscard]] ada_really_inline bool url::has_credentials() const noexcept {
 7308|  1.25M|  return !username.empty() || !password.empty();
  ------------------
  |  Branch (7308:10): [True: 200k, False: 1.05M]
  |  Branch (7308:31): [True: 940, False: 1.04M]
  ------------------
 7309|  1.25M|}
_ZNK3ada8url_base10is_specialEv:
 7272|  5.65M|    const noexcept {
 7273|  5.65M|  return type != ada::scheme::NOT_SPECIAL;
 7274|  5.65M|}
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEEcvbEv:
 4074|   608k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEptEv:
 4043|   978k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4044|   978k|    TL_ASSERT(has_value());
  ------------------
  |  | 2096|   978k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4044:5): [True: 978k, False: 0]
  ------------------
 4045|   978k|    return valptr();
 4046|   978k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE6valptrEv:
 3339|   978k|  T* valptr() { return std::addressof(this->m_val); }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EED2Ev:
 2671|   608k|  ~expected_storage_base() {
 2672|   608k|    if (m_has_val) {
  ------------------
  |  Branch (2672:9): [True: 587k, False: 21.4k]
  ------------------
 2673|   587k|      m_val.~T();
 2674|   587k|    }
 2675|   608k|  }
_ZNK3ada3url13get_href_sizeEv:
 7562|  1.04M|[[nodiscard]] inline size_t url::get_href_size() const noexcept {
 7563|  1.04M|  size_t size = 0;
 7564|  1.04M|  if (is_special()) {
  ------------------
  |  Branch (7564:7): [True: 1.03M, False: 8.09k]
  ------------------
 7565|  1.03M|    size += ada::scheme::details::is_special_list[type].size() + 1;
 7566|  1.03M|  } else {
 7567|  8.09k|    size += non_special_scheme.size() + 1;
 7568|  8.09k|  }
 7569|  1.04M|  if (host.has_value()) {
  ------------------
  |  Branch (7569:7): [True: 1.03M, False: 5.07k]
  ------------------
 7570|  1.03M|    size += host->size();
 7571|  1.03M|    size += 2;
 7572|  1.03M|    if (has_credentials()) {
  ------------------
  |  Branch (7572:9): [True: 130k, False: 908k]
  ------------------
 7573|   130k|      size += username.size();
 7574|   130k|      if (!password.empty()) {
  ------------------
  |  Branch (7574:11): [True: 125k, False: 5.03k]
  ------------------
 7575|   125k|        size += 1 + password.size();
 7576|   125k|      }
 7577|   130k|      size += 1;
 7578|   130k|    }
 7579|  1.03M|    if (port.has_value()) {
  ------------------
  |  Branch (7579:9): [True: 202k, False: 836k]
  ------------------
 7580|   202k|      size += 1;
 7581|   202k|      uint16_t p = *port;
 7582|   202k|      size += (p >= 10000)  ? 5
  ------------------
  |  Branch (7582:15): [True: 5.56k, False: 197k]
  ------------------
 7583|   202k|              : (p >= 1000) ? 4
  ------------------
  |  Branch (7583:17): [True: 96.6k, False: 100k]
  ------------------
 7584|   197k|              : (p >= 100)  ? 3
  ------------------
  |  Branch (7584:17): [True: 316, False: 100k]
  ------------------
 7585|   100k|              : (p >= 10)   ? 2
  ------------------
  |  Branch (7585:17): [True: 92.5k, False: 7.87k]
  ------------------
 7586|   100k|                            : 1;
 7587|   202k|    }
 7588|  1.03M|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7588:14): [True: 1.63k, False: 3.43k]
  |  Branch (7588:34): [True: 195, False: 1.44k]
  ------------------
 7589|    195|    size += 2;
 7590|    195|  }
 7591|  1.04M|  size += path.size();
 7592|  1.04M|  if (query.has_value()) {
  ------------------
  |  Branch (7592:7): [True: 122k, False: 921k]
  ------------------
 7593|   122k|    size += 1 + query->size();
 7594|   122k|  }
 7595|  1.04M|  if (hash.has_value()) {
  ------------------
  |  Branch (7595:7): [True: 94.3k, False: 949k]
  ------------------
 7596|  94.3k|    size += 1 + hash->size();
 7597|  94.3k|  }
 7598|  1.04M|  return size;
 7599|  1.04M|}
_ZN3ada8checkers8is_alphaEc:
 1267|   531k|constexpr bool is_alpha(char x) noexcept {
 1268|   531k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1268:10): [True: 529k, False: 2.00k]
  |  Branch (1268:34): [True: 529k, False: 62]
  ------------------
 1269|   531k|}
_ZN3ada8checkers8to_lowerEc:
 1265|  1.06M|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZNR2tl8expectedIN3ada3urlENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4056|   978k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4057|   978k|    TL_ASSERT(has_value());
  ------------------
  |  | 2096|   978k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4057:5): [True: 978k, False: 0]
  ------------------
 4058|   978k|    return val();
 4059|   978k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3348|   978k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3349|   978k|    return this->m_val;
 3350|   978k|  }
_ZN3ada3urlaSERKS0_:
 5045|   195k|  url& operator=(const url& u) = default;
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEE9has_valueEv:
 4073|  2.36M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1240|  1.15M|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1241|  1.15M|  if (view.empty()) {
  ------------------
  |  Branch (1241:7): [True: 0, False: 1.15M]
  ------------------
 1242|      0|    return false;
 1243|      0|  }
 1244|  1.15M|  const char* start = view.data();
 1245|  1.15M|  const char* end = start + view.size();
 1246|  1.15M|  if (end[-1] == '.') {
  ------------------
  |  Branch (1246:7): [True: 58.7k, False: 1.09M]
  ------------------
 1247|  58.7k|    --end;
 1248|  58.7k|    if (end == start) {
  ------------------
  |  Branch (1248:9): [True: 2.07k, False: 56.6k]
  ------------------
 1249|  2.07k|      return false;
 1250|  2.07k|    }
 1251|  58.7k|  }
 1252|  1.14M|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1252:7): [True: 863k, False: 285k]
  ------------------
 1253|   863k|    return false;
 1254|   863k|  }
 1255|   285k|  const char* label = end;
 1256|  1.29M|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1256:10): [True: 1.26M, False: 27.7k]
  |  Branch (1256:28): [True: 1.00M, False: 257k]
  ------------------
 1257|  1.00M|    --label;
 1258|  1.00M|  }
 1259|   285k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1259:7): [True: 257k, False: 27.7k]
  |  Branch (1259:25): [True: 123k, False: 134k]
  ------------------
 1260|   123k|    return false;
 1261|   123k|  }
 1262|   161k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1262:10): [True: 161k, False: 0]
  |  Branch (1262:26): [True: 154k, False: 7.60k]
  ------------------
 1263|   285k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1234|  2.41M|constexpr bool is_ipv4_number_char(char x) noexcept {
 1235|  2.41M|  const unsigned char c = static_cast<unsigned char>(x);
 1236|  2.41M|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1236:11): [True: 2.15M, False: 253k]
  |  Branch (1236:23): [True: 319k, False: 1.83M]
  |  Branch (1236:37): [True: 1.83M, False: 253k]
  |  Branch (1236:49): [True: 814k, False: 1.02M]
  ------------------
 1237|  1.27M|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1237:11): [True: 1.02M, False: 253k]
  |  Branch (1237:23): [True: 0, False: 1.02M]
  |  Branch (1237:36): [True: 156k, False: 1.12M]
  |  Branch (1237:48): [True: 0, False: 1.12M]
  ------------------
 1238|  2.41M|}
_ZN3ada8checkers8is_digitEc:
 1232|   395k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6786|   122k|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6787|   122k|  return details::special_ports[int(type)];
 6788|   122k|}
_ZN3ada14url_aggregatoraSERKS0_:
 7773|   195k|  url_aggregator& operator=(const url_aggregator& u) = default;
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8494|  59.4k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8495|  59.4k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8496|  59.4k|          " bytes] \n", to_diagram());
 8497|  59.4k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8498|  59.4k|  ADA_ASSERT_TRUE(validate());
 8499|       |
 8500|  59.4k|  const bool begins_with_dashdash = input.starts_with("//");
 8501|  59.4k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8501:7): [True: 58.6k, False: 830]
  |  Branch (8501:32): [True: 0, False: 58.6k]
  ------------------
 8502|       |    // We must delete the ./
 8503|      0|    delete_dash_dot();
 8504|      0|  }
 8505|       |
 8506|  59.4k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8506:7): [True: 830, False: 58.6k]
  |  Branch (8506:31): [True: 830, False: 0]
  |  Branch (8506:51): [True: 45, False: 785]
  ------------------
 8507|     45|      !has_dash_dot()) {
  ------------------
  |  Branch (8507:7): [True: 45, False: 0]
  ------------------
 8508|       |    // If url's host is null, url does not have an opaque path, url's path's
 8509|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8510|       |    // output.
 8511|     45|    buffer.insert(components.pathname_start, "/.");
 8512|     45|    components.pathname_start += 2;
 8513|     45|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8513:9): [True: 0, False: 45]
  ------------------
 8514|      0|      components.search_start += 2;
 8515|      0|    }
 8516|     45|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8516:9): [True: 0, False: 45]
  ------------------
 8517|      0|      components.hash_start += 2;
 8518|      0|    }
 8519|     45|  }
 8520|       |
 8521|  59.4k|  uint32_t difference = replace_and_resize(
 8522|  59.4k|      components.pathname_start,
 8523|  59.4k|      components.pathname_start + get_pathname_length(), input);
 8524|  59.4k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8524:7): [True: 0, False: 59.4k]
  ------------------
 8525|      0|    components.search_start += difference;
 8526|      0|  }
 8527|  59.4k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8527:7): [True: 0, False: 59.4k]
  ------------------
 8528|      0|    components.hash_start += difference;
 8529|      0|  }
 8530|  59.4k|  ADA_ASSERT_TRUE(validate());
 8531|  59.4k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8336|   359k|    uint32_t start, uint32_t end, std::string_view input) {
 8337|   359k|  uint32_t current_length = end - start;
 8338|   359k|  uint32_t input_size = uint32_t(input.size());
 8339|   359k|  uint32_t new_difference = input_size - current_length;
 8340|       |
 8341|   359k|  if (current_length == 0) {
  ------------------
  |  Branch (8341:7): [True: 290k, False: 68.7k]
  ------------------
 8342|   290k|    buffer.insert(start, input);
 8343|   290k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8343:14): [True: 637, False: 68.1k]
  ------------------
 8344|    637|    if (input_size != 0) {
  ------------------
  |  Branch (8344:9): [True: 637, False: 0]
  ------------------
 8345|    637|      std::memmove(buffer.data() + start, input.data(), input_size);
 8346|    637|    }
 8347|  68.1k|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8347:14): [True: 18.4k, False: 49.6k]
  ------------------
 8348|  18.4k|    buffer.erase(start, current_length - input_size);
 8349|  18.4k|    buffer.replace(start, input_size, input);
 8350|  49.6k|  } else {
 8351|  49.6k|    buffer.replace(start, current_length, input.substr(0, current_length));
 8352|  49.6k|    buffer.insert(start + current_length, input.substr(current_length));
 8353|  49.6k|  }
 8354|       |
 8355|   359k|  return new_difference;
 8356|   359k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8387|  59.4k|url_aggregator::get_pathname_length() const noexcept {
 8388|  59.4k|  ada_log("url_aggregator::get_pathname_length");
 8389|  59.4k|  uint32_t ending_index = uint32_t(buffer.size());
 8390|  59.4k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8390:7): [True: 0, False: 59.4k]
  ------------------
 8391|      0|    ending_index = components.search_start;
 8392|  59.4k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8392:14): [True: 0, False: 59.4k]
  ------------------
 8393|      0|    ending_index = components.hash_start;
 8394|      0|  }
 8395|  59.4k|  return ending_index - components.pathname_start;
 8396|  59.4k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9329|   224k|    ada_lifetime_bound {
 9330|   224k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9331|   224k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9332|   224k|          " components.search_start = ", components.search_start,
 9333|   224k|          " components.hash_start = ", components.hash_start);
 9334|   224k|  auto ending_index = uint32_t(buffer.size());
 9335|   224k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9335:7): [True: 33.2k, False: 190k]
  ------------------
 9336|  33.2k|    ending_index = components.search_start;
 9337|   190k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9337:14): [True: 10.6k, False: 180k]
  ------------------
 9338|  10.6k|    ending_index = components.hash_start;
 9339|  10.6k|  }
 9340|   224k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9341|   224k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8312|  12.0k|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8313|  12.0k|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8314|  12.0k|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8315|  12.0k|          " bytes] components.hash_start = ", components.hash_start);
 8316|  12.0k|  ADA_ASSERT_TRUE(validate());
 8317|  12.0k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8318|  12.0k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8318:7): [True: 0, False: 12.0k]
  ------------------
 8319|      0|    buffer.resize(components.hash_start);
 8320|      0|  }
 8321|  12.0k|  components.hash_start = uint32_t(buffer.size());
 8322|  12.0k|  buffer += "#";
 8323|  12.0k|  bool encoding_required = unicode::percent_encode<true>(
 8324|  12.0k|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8325|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8326|       |  // encoding was not deemed required.
 8327|  12.0k|  if (!encoding_required) {
  ------------------
  |  Branch (8327:7): [True: 11.8k, False: 217]
  ------------------
 8328|  11.8k|    buffer.append(input);
 8329|  11.8k|  }
 8330|  12.0k|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8331|  12.0k|          buffer, "' [", buffer.size(), " bytes]");
 8332|  12.0k|  ADA_ASSERT_TRUE(validate());
 8333|  12.0k|}
_ZN3ada3urlC2Ev:
 5041|   608k|  url() = default;
_ZN3ada3url26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7412|  12.0k|inline void url::update_unencoded_base_hash(std::string_view input) {
 7413|       |  // We do the percent encoding
 7414|  12.0k|  hash = unicode::percent_encode(input,
 7415|  12.0k|                                 ada::character_sets::FRAGMENT_PERCENT_ENCODE);
 7416|  12.0k|}
_ZN3ada3url18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7419|  12.1k|                                    const uint8_t query_percent_encode_set[]) {
 7420|  12.1k|  query = ada::unicode::percent_encode(input, query_percent_encode_set);
 7421|  12.1k|}
_ZN3ada3url20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7410|     69|inline void url::update_base_hostname(std::string_view input) { host = input; }
_ZN3ada3url20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7427|  30.8k|inline void url::update_base_pathname(const std::string_view input) {
 7428|  30.8k|  path = input;
 7429|  30.8k|}
_ZN3ada3url10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 7602|  2.31k|                                         bool check_trailing_content) noexcept {
 7603|  2.31k|  ada_log("parse_port('", view, "') ", view.size());
 7604|  2.31k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (7604:7): [True: 2.10k, False: 210]
  |  Branch (7604:24): [True: 8, False: 2.09k]
  ------------------
 7605|      8|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 7606|      8|    is_valid = false;
 7607|      8|    return 0;
 7608|      8|  }
 7609|  2.30k|  uint16_t parsed_port{};
 7610|  2.30k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 7611|  2.30k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (7611:7): [True: 29, False: 2.27k]
  ------------------
 7612|     29|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 7613|     29|    is_valid = false;
 7614|     29|    return 0;
 7615|     29|  }
 7616|  2.27k|  ada_log("parse_port: ", parsed_port);
 7617|  2.27k|  const auto consumed = size_t(r.ptr - view.data());
 7618|  2.27k|  ada_log("parse_port: consumed ", consumed);
 7619|  2.27k|  if (check_trailing_content) {
  ------------------
  |  Branch (7619:7): [True: 2.27k, False: 0]
  ------------------
 7620|  2.27k|    is_valid &=
 7621|  2.27k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (7621:10): [True: 478, False: 1.79k]
  |  Branch (7621:37): [True: 1.44k, False: 352]
  ------------------
 7622|    352|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (7622:10): [True: 97, False: 255]
  |  Branch (7622:36): [True: 244, False: 11]
  |  Branch (7622:52): [True: 63, False: 181]
  ------------------
 7623|  2.27k|  }
 7624|  2.27k|  ada_log("parse_port: is_valid = ", is_valid);
 7625|  2.27k|  if (is_valid) {
  ------------------
  |  Branch (7625:7): [True: 2.08k, False: 192]
  ------------------
 7626|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 7627|  2.08k|    auto default_port = scheme_default_port();
 7628|  2.08k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (7628:27): [True: 171, False: 1.91k]
  |  Branch (7628:48): [True: 69, False: 102]
  ------------------
 7629|  2.01k|                         (default_port != parsed_port);
  ------------------
  |  Branch (7629:26): [True: 2.01k, False: 3]
  ------------------
 7630|  2.08k|    port = (r.ec == std::errc() && is_port_valid) ? std::optional(parsed_port)
  ------------------
  |  Branch (7630:13): [True: 1.74k, False: 341]
  |  Branch (7630:36): [True: 1.73k, False: 3]
  ------------------
 7631|  2.08k|                                                  : std::nullopt;
 7632|  2.08k|  }
 7633|  2.27k|  return consumed;
 7634|  2.30k|}
_ZNK3ada8url_base19scheme_default_portEv:
 7281|  4.16k|url_base::scheme_default_port() const noexcept {
 7282|  4.16k|  return scheme::get_special_port(type);
 7283|  4.16k|}
_ZNK3ada3url12get_pathnameEv:
 7333|   195k|[[nodiscard]] constexpr std::string_view url::get_pathname() const noexcept {
 7334|   195k|  return path;
 7335|   195k|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1271|  6.58k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1272|  6.58k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1272:10): [True: 5.03k, False: 1.55k]
  ------------------
 1273|  5.03k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1273:11): [True: 3.23k, False: 1.80k]
  |  Branch (1273:34): [True: 280, False: 2.95k]
  |  Branch (1273:55): [True: 68, False: 2.88k]
  ------------------
 1274|    348|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1274:11): [True: 88, False: 260]
  |  Branch (1274:35): [True: 52, False: 208]
  |  Branch (1274:54): [True: 2, False: 206]
  ------------------
 1275|    206|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1275:35): [True: 0, False: 206]
  |  Branch (1275:54): [True: 0, False: 206]
  ------------------
 1276|  6.58k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1279|    144|    std::string_view input) noexcept {
 1280|    144|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1280:10): [True: 42, False: 102]
  |  Branch (1280:32): [True: 30, False: 12]
  |  Branch (1280:54): [True: 20, False: 10]
  ------------------
 1281|    144|}
_ZN3ada3url20set_protocol_as_fileEv:
 7455|  1.50k|constexpr void url::set_protocol_as_file() { type = ada::scheme::type::FILE; }
_ZN3ada7helpers14leading_zeroesEj:
 1978|   283k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1979|       |#if ADA_REGULAR_VISUAL_STUDIO
 1980|       |  unsigned long leading_zero(0);
 1981|       |  unsigned long in(input_num);
 1982|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1983|       |#else
 1984|   283k|  return __builtin_clz(input_num);
 1985|   283k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1986|   283k|}
_ZN3ada14url_aggregator7reserveEj:
 9002|   263k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9003|   263k|  buffer.reserve(capacity);
 9004|   263k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8720|  36.9k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8721|  36.9k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8722|  36.9k|          "\n", to_diagram());
 8723|  36.9k|  ADA_ASSERT_TRUE(validate());
 8724|  36.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8725|       |#if ADA_DEVELOPMENT_CHECKS
 8726|       |  // computing the expected password.
 8727|       |  std::string password_expected = std::string(get_password());
 8728|       |  password_expected.append(input);
 8729|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8730|  36.9k|  add_authority_slashes_if_needed();
 8731|       |
 8732|       |  // If input is empty, do nothing.
 8733|  36.9k|  if (input.empty()) {
  ------------------
  |  Branch (8733:7): [True: 3.33k, False: 33.6k]
  ------------------
 8734|  3.33k|    return;
 8735|  3.33k|  }
 8736|       |
 8737|  33.6k|  uint32_t difference = uint32_t(input.size());
 8738|  33.6k|  if (has_password()) {
  ------------------
  |  Branch (8738:7): [True: 4.51k, False: 29.1k]
  ------------------
 8739|  4.51k|    buffer.insert(components.host_start, input);
 8740|  29.1k|  } else {
 8741|  29.1k|    difference++;  // Increment for ":"
 8742|  29.1k|    buffer.insert(components.username_end, ":");
 8743|  29.1k|    buffer.insert(components.username_end + 1, input);
 8744|  29.1k|  }
 8745|  33.6k|  components.host_start += difference;
 8746|       |
 8747|       |  // The following line is required to add "@" to hostname. When updating
 8748|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8749|       |  // responsibility to set it.
 8750|  33.6k|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8750:7): [True: 203, False: 33.4k]
  ------------------
 8751|    203|    buffer.insert(components.host_start, "@");
 8752|    203|    difference++;
 8753|    203|  }
 8754|       |
 8755|  33.6k|  components.host_end += difference;
 8756|  33.6k|  components.pathname_start += difference;
 8757|  33.6k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8757:7): [True: 0, False: 33.6k]
  ------------------
 8758|      0|    components.search_start += difference;
 8759|      0|  }
 8760|  33.6k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8760:7): [True: 0, False: 33.6k]
  ------------------
 8761|      0|    components.hash_start += difference;
 8762|      0|  }
 8763|       |#if ADA_DEVELOPMENT_CHECKS
 8764|       |  std::string password_after(get_password());
 8765|       |  ADA_ASSERT_EQUAL(
 8766|       |      password_expected, password_after,
 8767|       |      "append_base_password problem after inserting " + std::string(input));
 8768|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8769|  33.6k|  ADA_ASSERT_TRUE(validate());
 8770|  33.6k|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 8976|   395k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 8977|   395k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 8978|   395k|  ADA_ASSERT_TRUE(validate());
 8979|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 8980|       |  // to insert
 8981|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 8982|   395k|  if (has_authority()) {
  ------------------
  |  Branch (8982:7): [True: 135k, False: 260k]
  ------------------
 8983|   135k|    return;
 8984|   135k|  }
 8985|       |  // Performance: the common case is components.protocol_end == buffer.size()
 8986|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 8987|       |  // the insert could be fused with another insert.
 8988|   260k|  buffer.insert(components.protocol_end, "//");
 8989|   260k|  components.username_end += 2;
 8990|   260k|  components.host_start += 2;
 8991|   260k|  components.host_end += 2;
 8992|   260k|  components.pathname_start += 2;
 8993|   260k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8993:7): [True: 0, False: 260k]
  ------------------
 8994|      0|    components.search_start += 2;
 8995|      0|  }
 8996|   260k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8996:7): [True: 0, False: 260k]
  ------------------
 8997|      0|    components.hash_start += 2;
 8998|      0|  }
 8999|   260k|  ADA_ASSERT_TRUE(validate());
 9000|   260k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8604|  58.5k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8605|  58.5k|  ada_log("url_aggregator::append_base_username ", input);
 8606|  58.5k|  ADA_ASSERT_TRUE(validate());
 8607|  58.5k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8608|       |#if ADA_DEVELOPMENT_CHECKS
 8609|       |  // computing the expected password.
 8610|       |  std::string username_expected(get_username());
 8611|       |  username_expected.append(input);
 8612|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8613|  58.5k|  add_authority_slashes_if_needed();
 8614|       |
 8615|       |  // If input is empty, do nothing.
 8616|  58.5k|  if (input.empty()) {
  ------------------
  |  Branch (8616:7): [True: 17.8k, False: 40.7k]
  ------------------
 8617|  17.8k|    return;
 8618|  17.8k|  }
 8619|       |
 8620|  40.7k|  uint32_t difference = uint32_t(input.size());
 8621|  40.7k|  buffer.insert(components.username_end, input);
 8622|  40.7k|  components.username_end += difference;
 8623|  40.7k|  components.host_start += difference;
 8624|       |
 8625|  40.7k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8625:7): [True: 30.2k, False: 10.4k]
  ------------------
 8626|  30.2k|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8626:7): [True: 30.2k, False: 0]
  ------------------
 8627|  30.2k|    buffer.insert(components.host_start, "@");
 8628|  30.2k|    difference++;
 8629|  30.2k|  }
 8630|       |
 8631|  40.7k|  components.host_end += difference;
 8632|  40.7k|  components.pathname_start += difference;
 8633|  40.7k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8633:7): [True: 0, False: 40.7k]
  ------------------
 8634|      0|    components.search_start += difference;
 8635|      0|  }
 8636|  40.7k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8636:7): [True: 0, False: 40.7k]
  ------------------
 8637|      0|    components.hash_start += difference;
 8638|      0|  }
 8639|       |#if ADA_DEVELOPMENT_CHECKS
 8640|       |  std::string username_after(get_username());
 8641|       |  ADA_ASSERT_EQUAL(
 8642|       |      username_expected, username_after,
 8643|       |      "append_base_username problem after inserting " + std::string(input));
 8644|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8645|  40.7k|  ADA_ASSERT_TRUE(validate());
 8646|  40.7k|}
_ZNK3ada14url_aggregator8get_hrefEv:
 9080|  1.17M|    const noexcept ada_lifetime_bound {
 9081|  1.17M|  ada_log("url_aggregator::get_href");
 9082|  1.17M|  return buffer;
 9083|  1.17M|}
_ZN3ada14url_aggregator16update_base_portEj:
 8772|  1.73k|inline void url_aggregator::update_base_port(uint32_t input) {
 8773|  1.73k|  ada_log("url_aggregator::update_base_port");
 8774|  1.73k|  ADA_ASSERT_TRUE(validate());
 8775|  1.73k|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8775:7): [True: 0, False: 1.73k]
  ------------------
 8776|      0|    clear_port();
 8777|      0|    return;
 8778|      0|  }
 8779|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8780|       |  // value is probably already available as a string.
 8781|  1.73k|  std::string value = helpers::concat(":", std::to_string(input));
 8782|  1.73k|  uint32_t difference = uint32_t(value.size());
 8783|       |
 8784|  1.73k|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8784:7): [True: 0, False: 1.73k]
  ------------------
 8785|      0|    difference -= components.pathname_start - components.host_end;
 8786|      0|    buffer.erase(components.host_end,
 8787|      0|                 components.pathname_start - components.host_end);
 8788|      0|  }
 8789|       |
 8790|  1.73k|  buffer.insert(components.host_end, value);
 8791|  1.73k|  components.pathname_start += difference;
 8792|  1.73k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8792:7): [True: 0, False: 1.73k]
  ------------------
 8793|      0|    components.search_start += difference;
 8794|      0|  }
 8795|  1.73k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8795:7): [True: 0, False: 1.73k]
  ------------------
 8796|      0|    components.hash_start += difference;
 8797|      0|  }
 8798|  1.73k|  components.port = input;
 8799|  1.73k|  ADA_ASSERT_TRUE(validate());
 8800|  1.73k|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1968|  1.73k|std::string concat(Args... args) {
 1969|  1.73k|  std::string answer;
 1970|  1.73k|  inner_concat(answer, args...);
 1971|  1.73k|  return answer;
 1972|  1.73k|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1957|  1.73k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1958|  1.73k|  buffer.append(t);
 1959|  1.73k|  return inner_concat(buffer, args...);
 1960|  1.73k|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1949|  1.73k|inline void inner_concat(std::string& buffer, T t) {
 1950|  1.73k|  buffer.append(t);
 1951|  1.73k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8443|  12.1k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8444|  12.1k|  ada_log("url_aggregator::update_base_search ", input,
 8445|  12.1k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8446|  12.1k|  ADA_ASSERT_TRUE(validate());
 8447|  12.1k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8448|       |
 8449|  12.1k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8449:7): [True: 12.1k, False: 0]
  ------------------
 8450|  12.1k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8450:9): [True: 12.1k, False: 0]
  ------------------
 8451|  12.1k|      components.search_start = uint32_t(buffer.size());
 8452|  12.1k|      buffer += "?";
 8453|  12.1k|    } else {
 8454|      0|      buffer.resize(components.search_start + 1);
 8455|      0|    }
 8456|       |
 8457|  12.1k|    bool encoding_required =
 8458|  12.1k|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8459|       |    // When encoding_required is false, then buffer is left unchanged, and
 8460|       |    // percent encoding was not deemed required.
 8461|  12.1k|    if (!encoding_required) {
  ------------------
  |  Branch (8461:9): [True: 11.8k, False: 337]
  ------------------
 8462|  11.8k|      buffer.append(input);
 8463|  11.8k|    }
 8464|  12.1k|  } else {
 8465|      0|    const size_t idx =
 8466|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8467|      0|    std::string encoded;
 8468|      0|    std::string_view replacement = input;
 8469|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8469:9): [True: 0, False: 0]
  ------------------
 8470|      0|      encoded =
 8471|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8472|      0|      replacement = encoded;
 8473|      0|    }
 8474|       |
 8475|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8475:9): [True: 0, False: 0]
  ------------------
 8476|      0|      const uint32_t difference = replace_and_resize(
 8477|      0|          components.search_start + 1, components.hash_start, replacement);
 8478|      0|      components.hash_start += difference;
 8479|      0|    } else {
 8480|      0|      components.search_start = components.hash_start;
 8481|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8482|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8482:11): [True: 0, False: 0]
  ------------------
 8483|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8484|      0|                     replacement.data(), replacement.size());
 8485|      0|      }
 8486|      0|      components.hash_start +=
 8487|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8488|      0|    }
 8489|      0|  }
 8490|       |
 8491|  12.1k|  ADA_ASSERT_TRUE(validate());
 8492|  12.1k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8358|   299k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8359|   299k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8360|   299k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8361|   299k|  ADA_ASSERT_TRUE(validate());
 8362|   299k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8363|       |
 8364|       |  // This next line is required for when parsing a URL like `foo://`
 8365|   299k|  add_authority_slashes_if_needed();
 8366|       |
 8367|   299k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8368|   299k|  uint32_t new_difference =
 8369|   299k|      replace_and_resize(components.host_start, components.host_end, input);
 8370|       |
 8371|   299k|  if (has_credentials) {
  ------------------
  |  Branch (8371:7): [True: 30.2k, False: 269k]
  ------------------
 8372|  30.2k|    buffer.insert(components.host_start, "@");
 8373|  30.2k|    new_difference++;
 8374|  30.2k|  }
 8375|   299k|  components.host_end += new_difference;
 8376|   299k|  components.pathname_start += new_difference;
 8377|   299k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8377:7): [True: 0, False: 299k]
  ------------------
 8378|      0|    components.search_start += new_difference;
 8379|      0|  }
 8380|   299k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8380:7): [True: 0, False: 299k]
  ------------------
 8381|      0|    components.hash_start += new_difference;
 8382|      0|  }
 8383|   299k|  ADA_ASSERT_TRUE(validate());
 8384|   299k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9090|  2.31k|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9091|  2.31k|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9092|  2.31k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9092:7): [True: 2.10k, False: 210]
  |  Branch (9092:24): [True: 8, False: 2.09k]
  ------------------
 9093|      8|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9094|      8|    is_valid = false;
 9095|      8|    return 0;
 9096|      8|  }
 9097|  2.30k|  uint16_t parsed_port{};
 9098|  2.30k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9099|  2.30k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9099:7): [True: 29, False: 2.27k]
  ------------------
 9100|     29|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9101|     29|    is_valid = false;
 9102|     29|    return 0;
 9103|     29|  }
 9104|  2.27k|  ada_log("parse_port: ", parsed_port);
 9105|  2.27k|  const size_t consumed = size_t(r.ptr - view.data());
 9106|  2.27k|  ada_log("parse_port: consumed ", consumed);
 9107|  2.27k|  if (check_trailing_content) {
  ------------------
  |  Branch (9107:7): [True: 2.27k, False: 0]
  ------------------
 9108|  2.27k|    is_valid &=
 9109|  2.27k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9109:10): [True: 478, False: 1.79k]
  |  Branch (9109:37): [True: 1.44k, False: 352]
  ------------------
 9110|    352|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9110:10): [True: 97, False: 255]
  |  Branch (9110:36): [True: 244, False: 11]
  |  Branch (9110:52): [True: 63, False: 181]
  ------------------
 9111|  2.27k|  }
 9112|  2.27k|  ada_log("parse_port: is_valid = ", is_valid);
 9113|  2.27k|  if (is_valid) {
  ------------------
  |  Branch (9113:7): [True: 2.08k, False: 192]
  ------------------
 9114|  2.08k|    ada_log("parse_port", r.ec == std::errc());
 9115|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9116|  2.08k|    auto default_port = scheme_default_port();
 9117|  2.08k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9117:27): [True: 171, False: 1.91k]
  |  Branch (9117:48): [True: 69, False: 102]
  ------------------
 9118|  2.01k|                         (default_port != parsed_port);
  ------------------
  |  Branch (9118:26): [True: 2.01k, False: 3]
  ------------------
 9119|  2.08k|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9119:9): [True: 1.74k, False: 341]
  |  Branch (9119:32): [True: 1.73k, False: 3]
  ------------------
 9120|  1.73k|      update_base_port(parsed_port);
 9121|  1.73k|    } else {
 9122|    344|      clear_port();
 9123|    344|    }
 9124|  2.08k|  }
 9125|  2.27k|  return consumed;
 9126|  2.30k|}
_ZN3ada14url_aggregator20set_protocol_as_fileEv:
 9128|  1.50k|constexpr void url_aggregator::set_protocol_as_file() {
 9129|  1.50k|  ada_log("url_aggregator::set_protocol_as_file ");
 9130|  1.50k|  ADA_ASSERT_TRUE(validate());
 9131|  1.50k|  type = ada::scheme::type::FILE;
 9132|       |  // next line could overflow but unsigned arithmetic has well-defined
 9133|       |  // overflows.
 9134|  1.50k|  uint32_t new_difference = 5 - components.protocol_end;
 9135|       |
 9136|  1.50k|  if (buffer.empty()) {
  ------------------
  |  Branch (9136:7): [True: 0, False: 1.50k]
  ------------------
 9137|      0|    buffer.append("file:");
 9138|  1.50k|  } else {
 9139|  1.50k|    buffer.erase(0, components.protocol_end);
 9140|  1.50k|    buffer.insert(0, "file:");
 9141|  1.50k|  }
 9142|  1.50k|  components.protocol_end = 5;
 9143|       |
 9144|       |  // Update the rest of the components.
 9145|  1.50k|  components.username_end += new_difference;
 9146|  1.50k|  components.host_start += new_difference;
 9147|  1.50k|  components.host_end += new_difference;
 9148|  1.50k|  components.pathname_start += new_difference;
 9149|  1.50k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9149:7): [True: 0, False: 1.50k]
  ------------------
 9150|      0|    components.search_start += new_difference;
 9151|      0|  }
 9152|  1.50k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9152:7): [True: 0, False: 1.50k]
  ------------------
 9153|      0|    components.hash_start += new_difference;
 9154|      0|  }
 9155|  1.50k|  ADA_ASSERT_TRUE(validate());
 9156|  1.50k|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8213|    631|                                              const uint8_t character_set[]) {
 8214|    631|  const char* data = input.data();
 8215|    631|  const size_t size = input.size();
 8216|       |
 8217|       |  // Process 8 bytes at a time using unrolled loop
 8218|    631|  size_t i = 0;
 8219|  1.30k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8219:10): [True: 708, False: 596]
  ------------------
 8220|    708|    unsigned char chunk[8];
 8221|    708|    std::memcpy(&chunk, data + i,
 8222|    708|                8);  // entices compiler to unconditionally process 8 characters
 8223|       |
 8224|       |    // Check 8 characters at once
 8225|  6.20k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8225:24): [True: 5.53k, False: 673]
  ------------------
 8226|  5.53k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8226:11): [True: 35, False: 5.50k]
  ------------------
 8227|     35|        return i + j;
 8228|     35|      }
 8229|  5.53k|    }
 8230|    708|  }
 8231|       |
 8232|       |  // Handle remaining bytes
 8233|  2.44k|  for (; i < size; i++) {
  ------------------
  |  Branch (8233:10): [True: 1.85k, False: 589]
  ------------------
 8234|  1.85k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8234:9): [True: 7, False: 1.84k]
  ------------------
 8235|      7|      return i;
 8236|      7|    }
 8237|  1.85k|  }
 8238|       |
 8239|    589|  return size;
 8240|    596|}
_ZN3ada14url_aggregator10clear_portEv:
 8802|    344|inline void url_aggregator::clear_port() {
 8803|    344|  ada_log("url_aggregator::clear_port");
 8804|    344|  ADA_ASSERT_TRUE(validate());
 8805|    344|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8805:7): [True: 344, False: 0]
  ------------------
 8806|    344|    return;
 8807|    344|  }
 8808|      0|  uint32_t length = components.pathname_start - components.host_end;
 8809|      0|  buffer.erase(components.host_end, length);
 8810|      0|  components.pathname_start -= length;
 8811|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8811:7): [True: 0, False: 0]
  ------------------
 8812|      0|    components.search_start -= length;
 8813|      0|  }
 8814|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8814:7): [True: 0, False: 0]
  ------------------
 8815|      0|    components.hash_start -= length;
 8816|      0|  }
 8817|      0|  components.port = url_components::omitted;
 8818|      0|  ADA_ASSERT_TRUE(validate());
 8819|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 8967|   396k|    const noexcept {
 8968|   396k|  ada_log("url_aggregator::has_authority");
 8969|       |  // Performance: instead of doing this potentially expensive check, we could
 8970|       |  // have a boolean in the struct.
 8971|   396k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (8971:10): [True: 135k, False: 260k]
  ------------------
 8972|   135k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (8972:10): [True: 135k, False: 0]
  ------------------
 8973|   135k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (8973:10): [True: 135k, False: 0]
  ------------------
 8974|   396k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9047|  58.7k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9048|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9049|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9050|       |  // U+002F (/) followed by U+002E (.) to output.
 9051|  58.7k|  ada_log("url_aggregator::has_dash_dot");
 9052|       |#if ADA_DEVELOPMENT_CHECKS
 9053|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9054|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9055|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9056|       |  if (components.pathname_start == components.host_end + 2) {
 9057|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9058|       |                     buffer[components.host_end + 1] == '.') ||
 9059|       |                    (buffer[components.host_end] == ':' &&
 9060|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9061|       |  }
 9062|       |  if (components.pathname_start == components.host_end + 2 &&
 9063|       |      buffer[components.host_end] == '/' &&
 9064|       |      buffer[components.host_end + 1] == '.') {
 9065|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9066|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9067|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9068|       |  }
 9069|       |#endif
 9070|       |  // Performance: it should be uncommon for components.pathname_start ==
 9071|       |  // components.host_end + 2 to be true. So we put this check first in the
 9072|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9073|       |  // more expensive, but should be uncommon.
 9074|  58.7k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9074:10): [True: 911, False: 57.7k]
  ------------------
 9075|    911|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9075:10): [True: 911, False: 0]
  |  Branch (9075:30): [True: 0, False: 911]
  ------------------
 9076|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9076:10): [True: 0, False: 0]
  ------------------
 9077|  58.7k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4074|   391k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4043|   978k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4044|   978k|    TL_ASSERT(has_value());
  ------------------
  |  | 2096|   978k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4044:5): [True: 978k, False: 0]
  ------------------
 4045|   978k|    return valptr();
 4046|   978k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3339|   978k|  T* valptr() { return std::addressof(this->m_val); }
_ZNR2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4056|   978k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4057|   978k|    TL_ASSERT(has_value());
  ------------------
  |  | 2096|   978k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4057:5): [True: 978k, False: 0]
  ------------------
 4058|   978k|    return val();
 4059|   978k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3348|   978k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3349|   978k|    return this->m_val;
 3350|   978k|  }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4073|  2.36M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2671|   608k|  ~expected_storage_base() {
 2672|   608k|    if (m_has_val) {
  ------------------
  |  Branch (2672:9): [True: 587k, False: 21.4k]
  ------------------
 2673|   587k|      m_val.~T();
 2674|   587k|    }
 2675|   608k|  }
_ZNK3ada14url_aggregator22has_non_empty_usernameEv:
 9006|   195k|constexpr bool url_aggregator::has_non_empty_username() const noexcept {
 9007|   195k|  ada_log("url_aggregator::has_non_empty_username");
 9008|   195k|  return components.protocol_end + 2 < components.username_end;
 9009|   195k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1890|   946k|                                                       size_t pos2) {
 1891|       |#if ADA_DEVELOPMENT_CHECKS
 1892|       |  if (pos2 < pos1) {
 1893|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1894|       |              << std::endl;
 1895|       |    abort();
 1896|       |  }
 1897|       |#endif
 1898|   946k|  return input.substr(pos1, pos2 - pos1);
 1899|   946k|}
_ZNK3ada14url_aggregator22has_non_empty_passwordEv:
 9011|   195k|constexpr bool url_aggregator::has_non_empty_password() const noexcept {
 9012|   195k|  ada_log("url_aggregator::has_non_empty_password");
 9013|   195k|  return components.host_start > components.username_end;
 9014|   195k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8399|   205k|    const noexcept {
 8400|   205k|  return buffer.size() == components.pathname_start;
 8401|   205k|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9016|  33.6k|constexpr bool url_aggregator::has_password() const noexcept {
 9017|  33.6k|  ada_log("url_aggregator::has_password");
 9018|       |  // This function does not care about the length of the password
 9019|  33.6k|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9019:10): [True: 4.51k, False: 29.1k]
  ------------------
 9020|  4.51k|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9020:10): [True: 4.51k, False: 0]
  ------------------
 9021|  33.6k|}
_ZNK3ada14url_aggregator13get_href_sizeEv:
 9085|   391k|[[nodiscard]] constexpr size_t url_aggregator::get_href_size() const noexcept {
 9086|   391k|  return buffer.size();
 9087|   391k|}
_ZNK3ada3url8get_hrefEv:
 7475|  1.36M|[[nodiscard]] ada_really_inline std::string url::get_href() const {
 7476|  1.36M|  if (is_special() && host.has_value() && username.empty() &&
  ------------------
  |  Branch (7476:7): [True: 1.36M, False: 4.36k]
  |  Branch (7476:23): [True: 1.36M, False: 0]
  |  Branch (7476:43): [True: 1.29M, False: 69.9k]
  ------------------
 7477|  1.29M|      password.empty() && !port.has_value()) [[likely]] {
  ------------------
  |  Branch (7477:7): [True: 1.29M, False: 329]
  |  Branch (7477:27): [True: 1.15M, False: 140k]
  ------------------
 7478|  1.15M|    const std::string_view scheme = ada::scheme::details::is_special_list[type];
 7479|  1.15M|    const size_t host_size = host->size();
 7480|  1.15M|    const size_t path_size = path.size();
 7481|  1.15M|    const size_t query_size = query.has_value() ? query->size() : 0;
  ------------------
  |  Branch (7481:31): [True: 220k, False: 934k]
  ------------------
 7482|  1.15M|    const size_t hash_size = hash.has_value() ? hash->size() : 0;
  ------------------
  |  Branch (7482:30): [True: 155k, False: 999k]
  ------------------
 7483|  1.15M|    const size_t total = scheme.size() + 3 + host_size + path_size +
 7484|  1.15M|                         (query.has_value() ? query_size + 1 : 0) +
  ------------------
  |  Branch (7484:27): [True: 220k, False: 934k]
  ------------------
 7485|  1.15M|                         (hash.has_value() ? hash_size + 1 : 0);
  ------------------
  |  Branch (7485:27): [True: 155k, False: 999k]
  ------------------
 7486|  1.15M|    std::string output(total, '\0');
 7487|  1.15M|    char* p = output.data();
 7488|  1.15M|    std::memcpy(p, scheme.data(), scheme.size());
 7489|  1.15M|    p += scheme.size();
 7490|  1.15M|    p[0] = ':';
 7491|  1.15M|    p[1] = '/';
 7492|  1.15M|    p[2] = '/';
 7493|  1.15M|    p += 3;
 7494|       |    // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7495|  1.15M|    std::memcpy(p, host->data(), host_size);
 7496|  1.15M|    p += host_size;
 7497|  1.15M|    std::memcpy(p, path.data(), path_size);
 7498|  1.15M|    p += path_size;
 7499|  1.15M|    if (query.has_value()) {
  ------------------
  |  Branch (7499:9): [True: 220k, False: 934k]
  ------------------
 7500|   220k|      *p++ = '?';
 7501|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7502|   220k|      std::memcpy(p, query->data(), query_size);
 7503|   220k|      p += query_size;
 7504|   220k|    }
 7505|  1.15M|    if (hash.has_value()) {
  ------------------
  |  Branch (7505:9): [True: 155k, False: 999k]
  ------------------
 7506|   155k|      *p++ = '#';
 7507|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7508|   155k|      std::memcpy(p, hash->data(), hash_size);
 7509|   155k|    }
 7510|  1.15M|    return output;
 7511|  1.15M|  }
 7512|       |
 7513|   214k|  std::string output;
 7514|   214k|  output.reserve(get_href_size());
 7515|       |
 7516|   214k|  if (is_special()) {
  ------------------
  |  Branch (7516:7): [True: 210k, False: 4.36k]
  ------------------
 7517|   210k|    output.append(ada::scheme::details::is_special_list[type]);
 7518|   210k|    output += ':';
 7519|   210k|  } else {
 7520|  4.36k|    output.append(non_special_scheme);
 7521|  4.36k|    output += ':';
 7522|  4.36k|  }
 7523|       |
 7524|   214k|  if (host.has_value()) {
  ------------------
  |  Branch (7524:7): [True: 212k, False: 2.73k]
  ------------------
 7525|   212k|    output += '/';
 7526|   212k|    output += '/';
 7527|   212k|    if (has_credentials()) {
  ------------------
  |  Branch (7527:9): [True: 70.4k, False: 141k]
  ------------------
 7528|  70.4k|      output.append(username);
 7529|  70.4k|      if (!password.empty()) {
  ------------------
  |  Branch (7529:11): [True: 67.7k, False: 2.70k]
  ------------------
 7530|  67.7k|        output += ':';
 7531|  67.7k|        output.append(password);
 7532|  67.7k|      }
 7533|  70.4k|      output += '@';
 7534|  70.4k|    }
 7535|   212k|    output.append(*host);
 7536|   212k|    if (port.has_value()) {
  ------------------
  |  Branch (7536:9): [True: 140k, False: 71.4k]
  ------------------
 7537|   140k|      output += ':';
 7538|   140k|      char port_buf[5];
 7539|   140k|      auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, *port);
 7540|   140k|      (void)ec;
 7541|   140k|      output.append(port_buf, static_cast<size_t>(ptr - port_buf));
 7542|   140k|    }
 7543|   212k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7543:14): [True: 882, False: 1.84k]
  |  Branch (7543:34): [True: 105, False: 777]
  ------------------
 7544|       |    // If url's host is null, url does not have an opaque path, url's path's
 7545|       |    // size is greater than 1, and url's path[0] is the empty string, then
 7546|       |    // append U+002F (/) followed by U+002E (.) to output.
 7547|    105|    output += '/';
 7548|    105|    output += '.';
 7549|    105|  }
 7550|   214k|  output.append(path);
 7551|   214k|  if (query.has_value()) {
  ------------------
  |  Branch (7551:7): [True: 12.1k, False: 202k]
  ------------------
 7552|  12.1k|    output += '?';
 7553|  12.1k|    output.append(*query);
 7554|  12.1k|  }
 7555|   214k|  if (hash.has_value()) {
  ------------------
  |  Branch (7555:7): [True: 12.2k, False: 202k]
  ------------------
 7556|  12.2k|    output += '#';
 7557|  12.2k|    output.append(*hash);
 7558|  12.2k|  }
 7559|   214k|  return output;
 7560|  1.36M|}
_ZNK3ada14url_aggregator8validateEv:
 9158|   195k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9159|   195k|  if (!is_valid) {
  ------------------
  |  Branch (9159:7): [True: 0, False: 195k]
  ------------------
 9160|      0|    return true;
 9161|      0|  }
 9162|   195k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9162:7): [True: 0, False: 195k]
  ------------------
 9163|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9164|      0|            to_diagram());
 9165|      0|    return false;
 9166|      0|  }
 9167|       |  // We have a credible components struct, but let us investivate more
 9168|       |  // carefully:
 9169|       |  /**
 9170|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9171|       |   *       |     |    |          | ^^^^|       |   |
 9172|       |   *       |     |    |          | |   |       |   `----- hash_start
 9173|       |   *       |     |    |          | |   |       `--------- search_start
 9174|       |   *       |     |    |          | |   `----------------- pathname_start
 9175|       |   *       |     |    |          | `--------------------- port
 9176|       |   *       |     |    |          `----------------------- host_end
 9177|       |   *       |     |    `---------------------------------- host_start
 9178|       |   *       |     `--------------------------------------- username_end
 9179|       |   *       `--------------------------------------------- protocol_end
 9180|       |   */
 9181|   195k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9181:7): [True: 0, False: 195k]
  ------------------
 9182|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9183|      0|    return false;
 9184|      0|  }
 9185|   195k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9185:7): [True: 0, False: 195k]
  ------------------
 9186|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9187|      0|    return false;
 9188|      0|  }
 9189|   195k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9189:7): [True: 0, False: 195k]
  ------------------
 9190|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9191|      0|    return false;
 9192|      0|  }
 9193|   195k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9193:7): [True: 0, False: 195k]
  ------------------
 9194|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9195|      0|    return false;
 9196|      0|  }
 9197|   195k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9197:7): [True: 0, False: 195k]
  ------------------
 9198|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9199|      0|    return false;
 9200|      0|  }
 9201|       |
 9202|   195k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9202:7): [True: 0, False: 195k]
  ------------------
 9203|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9204|      0|    return false;
 9205|      0|  }
 9206|   195k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9206:7): [True: 0, False: 195k]
  ------------------
 9207|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9208|      0|    return false;
 9209|      0|  }
 9210|   195k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9210:7): [True: 0, False: 195k]
  ------------------
 9211|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9212|      0|    return false;
 9213|      0|  }
 9214|   195k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9214:7): [True: 0, False: 195k]
  ------------------
 9215|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9216|      0|    return false;
 9217|      0|  }
 9218|   195k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9218:7): [True: 0, False: 195k]
  ------------------
 9219|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9220|      0|            to_diagram());
 9221|      0|    return false;
 9222|      0|  }
 9223|       |
 9224|   195k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9224:7): [True: 195k, False: 0]
  ------------------
 9225|   195k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9225:9): [True: 0, False: 195k]
  ------------------
 9226|      0|      ada_log(
 9227|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9228|      0|          to_diagram());
 9229|      0|      return false;
 9230|      0|    }
 9231|   195k|  }
 9232|       |
 9233|   195k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9233:7): [True: 195k, False: 16]
  ------------------
 9234|   195k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9234:7): [True: 10.0k, False: 185k]
  ------------------
 9235|  10.0k|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9235:9): [True: 387, False: 9.62k]
  ------------------
 9236|    387|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9236:9): [True: 0, False: 387]
  ------------------
 9237|      0|      ada_log(
 9238|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9239|      0|          "\n",
 9240|      0|          to_diagram());
 9241|      0|      return false;
 9242|      0|    }
 9243|  10.0k|  }
 9244|       |
 9245|   195k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9245:7): [True: 195k, False: 16]
  ------------------
 9246|   195k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9246:9): [True: 9.67k, False: 186k]
  ------------------
 9247|  9.67k|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9247:11): [True: 0, False: 9.67k]
  ------------------
 9248|      0|        ada_log(
 9249|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9250|      0|            to_diagram());
 9251|      0|        return false;
 9252|      0|      }
 9253|   186k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9253:16): [True: 186k, False: 0]
  ------------------
 9254|   186k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9254:16): [True: 185k, False: 541]
  ------------------
 9255|   185k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9255:11): [True: 185k, False: 387]
  ------------------
 9256|   185k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9256:13): [True: 0, False: 185k]
  ------------------
 9257|   185k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9257:13): [True: 0, False: 185k]
  ------------------
 9258|      0|          ada_log(
 9259|      0|              "url_aggregator::validate missing // between protocol and host "
 9260|      0|              "\n",
 9261|      0|              to_diagram());
 9262|      0|          return false;
 9263|      0|        }
 9264|   185k|      } else {
 9265|    387|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9265:13): [True: 387, False: 0]
  ------------------
 9266|    387|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9266:13): [True: 0, False: 387]
  ------------------
 9267|      0|          ada_log(
 9268|      0|              "url_aggregator::validate missing @ at the end of the username "
 9269|      0|              "\n",
 9270|      0|              to_diagram());
 9271|      0|          return false;
 9272|      0|        }
 9273|    387|      }
 9274|   185k|    } else {
 9275|    541|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9275:11): [True: 0, False: 541]
  ------------------
 9276|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9277|      0|                to_diagram());
 9278|      0|        return false;
 9279|      0|      }
 9280|    541|    }
 9281|   195k|  }
 9282|   195k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9282:7): [True: 195k, False: 30]
  ------------------
 9283|   195k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9283:7): [True: 20.1k, False: 175k]
  ------------------
 9284|  20.1k|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9284:9): [True: 715, False: 19.4k]
  ------------------
 9285|    715|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9285:9): [True: 15, False: 700]
  ------------------
 9286|     15|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9286:9): [True: 15, False: 0]
  ------------------
 9287|     15|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9287:11): [True: 0, False: 15]
  ------------------
 9288|     15|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9288:11): [True: 0, False: 15]
  ------------------
 9289|     15|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9289:11): [True: 0, False: 15]
  ------------------
 9290|      0|        ada_log(
 9291|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9292|      0|            to_diagram());
 9293|      0|        return false;
 9294|      0|      }
 9295|  20.1k|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9295:16): [True: 0, False: 20.1k]
  ------------------
 9296|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9297|      0|              to_diagram());
 9298|      0|      return false;
 9299|      0|    }
 9300|  20.1k|  }
 9301|   195k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9301:7): [True: 195k, False: 34]
  ------------------
 9302|   195k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9302:7): [True: 195k, False: 55]
  ------------------
 9303|   195k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9303:7): [True: 195k, False: 74]
  |  Branch (9303:60): [True: 195k, False: 178]
  ------------------
 9304|   195k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9304:9): [True: 0, False: 195k]
  ------------------
 9305|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9306|      0|              to_diagram());
 9307|      0|      return false;
 9308|      0|    }
 9309|   195k|  }
 9310|   195k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9310:7): [True: 33.2k, False: 162k]
  ------------------
 9311|  33.2k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9311:9): [True: 0, False: 33.2k]
  ------------------
 9312|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9313|      0|              to_diagram());
 9314|      0|      return false;
 9315|      0|    }
 9316|  33.2k|  }
 9317|   195k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9317:7): [True: 23.9k, False: 171k]
  ------------------
 9318|  23.9k|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9318:9): [True: 0, False: 23.9k]
  ------------------
 9319|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9320|      0|              to_diagram());
 9321|      0|      return false;
 9322|      0|    }
 9323|  23.9k|  }
 9324|       |
 9325|   195k|  return true;
 9326|   195k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7652|   195k|    const noexcept {
 7653|       |  /**
 7654|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7655|       |   *       |     |    |          | ^^^^|       |   |
 7656|       |   *       |     |    |          | |   |       |   `----- hash_start
 7657|       |   *       |     |    |          | |   |       `--------- search_start
 7658|       |   *       |     |    |          | |   `----------------- pathname_start
 7659|       |   *       |     |    |          | `--------------------- port
 7660|       |   *       |     |    |          `----------------------- host_end
 7661|       |   *       |     |    `---------------------------------- host_start
 7662|       |   *       |     `--------------------------------------- username_end
 7663|       |   *       `--------------------------------------------- protocol_end
 7664|       |   */
 7665|       |  // These conditions can be made more strict.
 7666|   195k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7666:7): [True: 0, False: 195k]
  ------------------
 7667|      0|    return false;
 7668|      0|  }
 7669|   195k|  uint32_t index = protocol_end;
 7670|       |
 7671|   195k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7671:7): [True: 0, False: 195k]
  ------------------
 7672|      0|    return false;
 7673|      0|  }
 7674|   195k|  if (username_end < index) {
  ------------------
  |  Branch (7674:7): [True: 0, False: 195k]
  ------------------
 7675|      0|    return false;
 7676|      0|  }
 7677|   195k|  index = username_end;
 7678|       |
 7679|   195k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7679:7): [True: 0, False: 195k]
  ------------------
 7680|      0|    return false;
 7681|      0|  }
 7682|   195k|  if (host_start < index) {
  ------------------
  |  Branch (7682:7): [True: 0, False: 195k]
  ------------------
 7683|      0|    return false;
 7684|      0|  }
 7685|   195k|  index = host_start;
 7686|       |
 7687|   195k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7687:7): [True: 20.1k, False: 175k]
  ------------------
 7688|  20.1k|    if (port > 0xffff) {
  ------------------
  |  Branch (7688:9): [True: 0, False: 20.1k]
  ------------------
 7689|      0|      return false;
 7690|      0|    }
 7691|  20.1k|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7692|  20.1k|    if (index + port_length < index) {
  ------------------
  |  Branch (7692:9): [True: 0, False: 20.1k]
  ------------------
 7693|      0|      return false;
 7694|      0|    }
 7695|  20.1k|    index += port_length;
 7696|  20.1k|  }
 7697|       |
 7698|   195k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7698:7): [True: 0, False: 195k]
  ------------------
 7699|      0|    return false;
 7700|      0|  }
 7701|   195k|  if (pathname_start < index) {
  ------------------
  |  Branch (7701:7): [True: 0, False: 195k]
  ------------------
 7702|      0|    return false;
 7703|      0|  }
 7704|   195k|  index = pathname_start;
 7705|       |
 7706|   195k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7706:7): [True: 33.2k, False: 162k]
  ------------------
 7707|  33.2k|    if (search_start < index) {
  ------------------
  |  Branch (7707:9): [True: 0, False: 33.2k]
  ------------------
 7708|      0|      return false;
 7709|      0|    }
 7710|  33.2k|    index = search_start;
 7711|  33.2k|  }
 7712|       |
 7713|   195k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7713:7): [True: 23.9k, False: 171k]
  ------------------
 7714|  23.9k|    if (hash_start < index) {
  ------------------
  |  Branch (7714:9): [True: 0, False: 23.9k]
  ------------------
 7715|      0|      return false;
 7716|      0|    }
 7717|  23.9k|  }
 7718|       |
 7719|   195k|  return true;
 7720|   195k|}
_ZN3ada7helpers16fast_digit_countEj:
 1994|  20.1k|inline int fast_digit_count(uint32_t x) noexcept {
 1995|  20.1k|  auto int_log2 = [](uint32_t z) -> int {
 1996|  20.1k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1997|  20.1k|  };
 1998|       |  // Compiles to very few instructions. Note that the
 1999|       |  // table is static and thus effectively a constant.
 2000|       |  // We leave it inside the function because it is meaningless
 2001|       |  // outside of it (this comes at no performance cost).
 2002|  20.1k|  const static uint64_t table[] = {
 2003|  20.1k|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2004|  20.1k|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2005|  20.1k|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2006|  20.1k|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2007|  20.1k|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2008|  20.1k|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2009|  20.1k|      42949672960, 42949672960};
 2010|  20.1k|  return int((x + table[int_log2(x)]) >> 32);
 2011|  20.1k|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 1995|  20.1k|  auto int_log2 = [](uint32_t z) -> int {
 1996|  20.1k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1997|  20.1k|  };
_ZN3ada7helpers6concatIJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKcEEENS2_12basic_stringIcS5_NS2_9allocatorIcEEEEDpT_:
 1968|   200k|std::string concat(Args... args) {
 1969|   200k|  std::string answer;
 1970|   200k|  inner_concat(answer, args...);
 1971|   200k|  return answer;
 1972|   200k|}
_ZN3ada7helpers12inner_concatINSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEJPKcEEEvRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEET_DpT0_:
 1957|   200k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1958|   200k|  buffer.append(t);
 1959|   200k|  return inner_concat(buffer, args...);
 1960|   200k|}
_ZN3ada7helpers12inner_concatIPKcJEEEvRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEET_:
 1949|   200k|inline void inner_concat(std::string& buffer, T t) {
 1950|   200k|  buffer.append(t);
 1951|   200k|}
_ZN3ada7helpers6concatIJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcEEES8_DpT_:
 1968|    623|std::string concat(Args... args) {
 1969|    623|  std::string answer;
 1970|    623|  inner_concat(answer, args...);
 1971|    623|  return answer;
 1972|    623|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJPKcEEEvRS8_T_DpT0_:
 1957|    623|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1958|    623|  buffer.append(t);
 1959|    623|  return inner_concat(buffer, args...);
 1960|    623|}
_ZN3ada3url10set_schemeEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7457|  4.94k|inline void url::set_scheme(std::string&& new_scheme) noexcept {
 7458|  4.94k|  type = ada::scheme::get_scheme_type(new_scheme);
 7459|       |  // We only move the 'scheme' if it is non-special.
 7460|  4.94k|  if (!is_special()) {
  ------------------
  |  Branch (7460:7): [True: 1.94k, False: 3.00k]
  ------------------
 7461|  1.94k|    non_special_scheme = std::move(new_scheme);
 7462|  1.94k|  }
 7463|  4.94k|}

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

