_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  160|  5.16k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  161|  5.16k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  162|  5.16k|  size_t pos = 0;
  163|  5.16k|  const char32_t* start{utf32_output};
  164|   101k|  while (pos < len) {
  ------------------
  |  Branch (164:10): [True: 96.8k, False: 4.73k]
  ------------------
  165|       |    // try to convert the next block of 16 ASCII bytes
  166|  96.8k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (166:9): [True: 68.1k, False: 28.7k]
  ------------------
  167|       |                            // bytes, check that they are ascii
  168|  68.1k|      uint64_t v1;
  169|  68.1k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  170|  68.1k|      uint64_t v2;
  171|  68.1k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  172|  68.1k|      uint64_t v{v1 | v2};
  173|  68.1k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (173:11): [True: 4.17k, False: 64.0k]
  ------------------
  174|  4.17k|        size_t final_pos = pos + 16;
  175|  70.8k|        while (pos < final_pos) {
  ------------------
  |  Branch (175:16): [True: 66.7k, False: 4.17k]
  ------------------
  176|  66.7k|          *utf32_output++ = char32_t(buf[pos]);
  177|  66.7k|          pos++;
  178|  66.7k|        }
  179|  4.17k|        continue;
  180|  4.17k|      }
  181|  68.1k|    }
  182|  92.7k|    uint8_t leading_byte = data[pos];  // leading byte
  183|  92.7k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (183:9): [True: 51.2k, False: 41.4k]
  ------------------
  184|       |      // converting one ASCII byte !!!
  185|  51.2k|      *utf32_output++ = char32_t(leading_byte);
  186|  51.2k|      pos++;
  187|  51.2k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (187:16): [True: 7.45k, False: 34.0k]
  ------------------
  188|       |      // We have a two-byte UTF-8
  189|  7.45k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (189:11): [True: 62, False: 7.39k]
  ------------------
  190|     62|        return 0;
  191|     62|      }  // minimal bound checking
  192|  7.39k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (192:11): [True: 80, False: 7.31k]
  ------------------
  193|     80|        return 0;
  194|     80|      }
  195|       |      // range check
  196|  7.31k|      uint32_t code_point =
  197|  7.31k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  198|  7.31k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (198:11): [True: 8, False: 7.30k]
  |  Branch (198:32): [True: 0, False: 7.30k]
  ------------------
  199|      8|        return 0;
  200|      8|      }
  201|  7.30k|      *utf32_output++ = char32_t(code_point);
  202|  7.30k|      pos += 2;
  203|  34.0k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (203:16): [True: 32.9k, False: 1.09k]
  ------------------
  204|       |      // We have a three-byte UTF-8
  205|  32.9k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (205:11): [True: 14, False: 32.8k]
  ------------------
  206|     14|        return 0;
  207|     14|      }  // minimal bound checking
  208|       |
  209|  32.8k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (209:11): [True: 34, False: 32.8k]
  ------------------
  210|     34|        return 0;
  211|     34|      }
  212|  32.8k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (212:11): [True: 8, False: 32.8k]
  ------------------
  213|      8|        return 0;
  214|      8|      }
  215|       |      // range check
  216|  32.8k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  217|  32.8k|                            (data[pos + 1] & 0b00111111) << 6 |
  218|  32.8k|                            (data[pos + 2] & 0b00111111);
  219|  32.8k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (219:11): [True: 6, False: 32.8k]
  |  Branch (219:33): [True: 0, False: 32.8k]
  ------------------
  220|  32.8k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (220:12): [True: 9.01k, False: 23.8k]
  |  Branch (220:35): [True: 6, False: 9.00k]
  ------------------
  221|     12|        return 0;
  222|     12|      }
  223|  32.8k|      *utf32_output++ = char32_t(code_point);
  224|  32.8k|      pos += 3;
  225|  32.8k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (225:16): [True: 952, False: 146]
  ------------------
  226|       |      // we have a 4-byte UTF-8 word.
  227|    952|      if (pos + 3 >= len) {
  ------------------
  |  Branch (227:11): [True: 10, False: 942]
  ------------------
  228|     10|        return 0;
  229|     10|      }  // minimal bound checking
  230|    942|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (230:11): [True: 14, False: 928]
  ------------------
  231|     14|        return 0;
  232|     14|      }
  233|    928|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (233:11): [True: 8, False: 920]
  ------------------
  234|      8|        return 0;
  235|      8|      }
  236|    920|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (236:11): [True: 10, False: 910]
  ------------------
  237|     10|        return 0;
  238|     10|      }
  239|       |
  240|       |      // range check
  241|    910|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  242|    910|                            (data[pos + 1] & 0b00111111) << 12 |
  243|    910|                            (data[pos + 2] & 0b00111111) << 6 |
  244|    910|                            (data[pos + 3] & 0b00111111);
  245|    910|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (245:11): [True: 14, False: 896]
  |  Branch (245:35): [True: 10, False: 886]
  ------------------
  246|     24|        return 0;
  247|     24|      }
  248|    886|      *utf32_output++ = char32_t(code_point);
  249|    886|      pos += 4;
  250|    886|    } else {
  251|    146|      return 0;
  252|    146|    }
  253|  92.7k|  }
  254|  4.73k|  return utf32_output - start;
  255|  5.16k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  270|  5.20k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  271|  5.20k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  272|  5.20k|  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.20k|    return c > -65;
  276|  5.20k|  });
  277|  5.20k|}
_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|   118k|void ascii_map(char* input, size_t length) {
 5127|   118k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|   118k|    return 0x101010101010101ull * v;
 5129|   118k|  };
 5130|   118k|  uint64_t broadcast_80 = broadcast(0x80);
 5131|   118k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5132|   118k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5133|   118k|  size_t i = 0;
 5134|       |
 5135|   315k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5135:10): [True: 197k, False: 118k]
  ------------------
 5136|   197k|    uint64_t word{};
 5137|   197k|    std::memcpy(&word, input + i, sizeof(word));
 5138|   197k|    word ^=
 5139|   197k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5140|   197k|    std::memcpy(input + i, &word, sizeof(word));
 5141|   197k|  }
 5142|   118k|  if (i < length) {
  ------------------
  |  Branch (5142:7): [True: 61.3k, False: 56.6k]
  ------------------
 5143|  61.3k|    uint64_t word{};
 5144|  61.3k|    std::memcpy(&word, input + i, length - i);
 5145|  61.3k|    word ^=
 5146|  61.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|  61.3k|    std::memcpy(input + i, &word, length - i);
 5148|  61.3k|  }
 5149|   118k|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5153|  7.63k|bool map(std::u32string_view input, std::u32string& out) {
 5154|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5155|  7.63k|  out.clear();
 5156|  7.63k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5156:7): [True: 0, False: 7.63k]
  ------------------
 5157|      0|    return false;
 5158|      0|  }
 5159|       |
 5160|       |  // Pass 1: validate and compute exact output length.
 5161|  7.63k|  size_t out_size = 0;
 5162|   178k|  for (char32_t x : input) {
  ------------------
  |  Branch (5162:19): [True: 178k, False: 7.31k]
  ------------------
 5163|   178k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5164|   178k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5164:9): [True: 318, False: 178k]
  ------------------
 5165|    318|      return false;
 5166|    318|    }
 5167|   178k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5167:9): [True: 122k, False: 56.2k]
  ------------------
 5168|   122k|      ++out_size;
 5169|   122k|      continue;
 5170|   122k|    }
 5171|  56.2k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5171:9): [True: 0, False: 56.2k]
  ------------------
 5172|      0|      return false;
 5173|      0|    }
 5174|  56.2k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5175|  56.2k|  }
 5176|       |
 5177|       |  // Pass 2: write into a single allocation.
 5178|  7.31k|  out.resize(out_size);
 5179|  7.31k|  size_t w = 0;
 5180|   177k|  for (char32_t x : input) {
  ------------------
  |  Branch (5180:19): [True: 177k, False: 7.31k]
  ------------------
 5181|   177k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5182|   177k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5182:9): [True: 121k, False: 56.0k]
  ------------------
 5183|   121k|      out[w++] = x;
 5184|   121k|      continue;
 5185|   121k|    }
 5186|       |    // IGNORED or mapped (status already validated in pass 1).
 5187|  56.0k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5188|   344k|    while (*ptr != 0) {
  ------------------
  |  Branch (5188:12): [True: 288k, False: 56.0k]
  ------------------
 5189|   288k|      out[w++] = utf8_next(ptr);
 5190|   288k|    }
 5191|  56.0k|  }
 5192|  7.31k|  return true;
 5193|  7.63k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5286|  1.68k|    const std::u32string_view input) noexcept {
 5287|  1.68k|  bool decomposition_needed{false};
 5288|  1.68k|  size_t additional_elements{0};
 5289|  75.9k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5289:35): [True: 75.9k, False: 1.68k]
  ------------------
 5290|  75.9k|    size_t decomposition_length{0};
 5291|       |
 5292|  75.9k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5292:9): [True: 3.42k, False: 72.5k]
  ------------------
 5293|  3.42k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5293:9): [True: 2.09k, False: 1.33k]
  ------------------
 5294|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5295|  2.09k|      decomposition_length = 2;
 5296|  2.09k|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5296:11): [True: 1.17k, False: 916]
  ------------------
 5297|  1.17k|        decomposition_length = 3;
 5298|  1.17k|      }
 5299|  73.8k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5299:16): [True: 73.8k, False: 0]
  ------------------
 5300|  73.8k|      const uint8_t di = decomposition_index[current_character >> 8];
 5301|  73.8k|      const uint16_t* const decomposition =
 5302|  73.8k|          decomposition_block_row(di) + (current_character % 256);
 5303|  73.8k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5304|  73.8k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5304:11): [True: 2.42k, False: 71.4k]
  |  Branch (5304:41): [True: 0, False: 2.42k]
  ------------------
 5305|      0|        decomposition_length = 0;
 5306|      0|      }
 5307|  73.8k|    }
 5308|  75.9k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5308:9): [True: 4.51k, False: 71.4k]
  ------------------
 5309|  4.51k|      decomposition_needed = true;
 5310|  4.51k|      additional_elements += decomposition_length - 1;
 5311|  4.51k|    }
 5312|  75.9k|  }
 5313|  1.68k|  return {decomposition_needed, additional_elements};
 5314|  1.68k|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5316|  1.13k|void decompose(std::u32string& input, size_t additional_elements) {
 5317|  1.13k|  input.resize(input.size() + additional_elements);
 5318|  1.13k|  for (size_t descending_idx = input.size(),
 5319|  1.13k|              input_count = descending_idx - additional_elements;
 5320|  64.9k|       input_count--;) {
  ------------------
  |  Branch (5320:8): [True: 63.8k, False: 1.13k]
  ------------------
 5321|  63.8k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5321:9): [True: 2.63k, False: 61.2k]
  ------------------
 5322|  2.63k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5322:9): [True: 2.09k, False: 542]
  ------------------
 5323|       |      // Hangul decomposition.
 5324|  2.09k|      char32_t s_index = input[input_count] - hangul_sbase;
 5325|  2.09k|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5325:11): [True: 1.17k, False: 916]
  ------------------
 5326|  1.17k|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5327|  1.17k|      }
 5328|  2.09k|      input[--descending_idx] =
 5329|  2.09k|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5330|  2.09k|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5331|  61.7k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5331:16): [True: 61.7k, False: 0]
  ------------------
 5332|  61.7k|      const uint16_t* decomposition =
 5333|  61.7k|          decomposition_block_row(
 5334|  61.7k|              decomposition_index[input[input_count] >> 8]) +
 5335|  61.7k|          (input[input_count] % 256);
 5336|  61.7k|      uint16_t decomposition_length =
 5337|  61.7k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5338|  61.7k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5338:11): [True: 2.42k, False: 59.3k]
  |  Branch (5338:39): [True: 0, False: 2.42k]
  ------------------
 5339|      0|        decomposition_length = 0;
 5340|      0|      }
 5341|  61.7k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5341:11): [True: 2.42k, False: 59.3k]
  ------------------
 5342|  2.42k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5343|  2.42k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5343:13): [True: 0, False: 2.42k]
  ------------------
 5344|      0|          input[--descending_idx] = input[input_count];
 5345|  2.42k|        } else {
 5346|  7.52k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5346:18): [True: 5.10k, False: 2.42k]
  ------------------
 5347|  5.10k|            input[--descending_idx] =
 5348|  5.10k|                decomposition_data[base + decomposition_length];
 5349|  5.10k|          }
 5350|  2.42k|        }
 5351|  59.3k|      } else {
 5352|  59.3k|        input[--descending_idx] = input[input_count];
 5353|  59.3k|      }
 5354|  61.7k|    } else {
 5355|      0|      input[--descending_idx] = input[input_count];
 5356|      0|    }
 5357|  63.8k|  }
 5358|  1.13k|}
_ZN3ada4idna7get_cccEDi:
 5360|  1.36M|uint8_t get_ccc(char32_t c) noexcept {
 5361|  1.36M|  if (c >= 0x110000) {
  ------------------
  |  Branch (5361:7): [True: 0, False: 1.36M]
  ------------------
 5362|      0|    return 0;
 5363|      0|  }
 5364|  1.36M|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5365|  1.36M|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5367|  1.68k|void sort_marks(std::u32string& input) {
 5368|  81.8k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5368:24): [True: 80.2k, False: 1.68k]
  ------------------
 5369|  80.2k|    uint8_t ccc = get_ccc(input[idx]);
 5370|  80.2k|    if (ccc == 0) {
  ------------------
  |  Branch (5370:9): [True: 72.9k, False: 7.28k]
  ------------------
 5371|  72.9k|      continue;
 5372|  72.9k|    }
 5373|  7.28k|    auto current_character = input[idx];
 5374|  7.28k|    size_t back_idx = idx;
 5375|  10.0k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5375:12): [True: 9.88k, False: 144]
  |  Branch (5375:29): [True: 2.74k, False: 7.14k]
  ------------------
 5376|  2.74k|      input[back_idx] = input[back_idx - 1];
 5377|  2.74k|      back_idx--;
 5378|  2.74k|    }
 5379|  7.28k|    input[back_idx] = current_character;
 5380|  7.28k|  }
 5381|  1.68k|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5383|  1.68k|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.68k|  auto [decomposition_needed, additional_elements] =
 5389|  1.68k|      compute_decomposition_length(input);
 5390|  1.68k|  if (decomposition_needed) {
  ------------------
  |  Branch (5390:7): [True: 1.13k, False: 552]
  ------------------
 5391|  1.13k|    decompose(input, additional_elements);
 5392|  1.13k|  }
 5393|  1.68k|  sort_marks(input);
 5394|  1.68k|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5477|  8.20k|bool is_already_nfc(std::u32string_view input) noexcept {
 5478|  8.20k|  if (input.empty()) {
  ------------------
  |  Branch (5478:7): [True: 0, False: 8.20k]
  ------------------
 5479|      0|    return true;
 5480|      0|  }
 5481|  8.20k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5481:7): [True: 0, False: 8.20k]
  |  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|   431k|  for (char32_t c : input) {
  ------------------
  |  Branch (5486:19): [True: 431k, False: 8.20k]
  ------------------
 5487|   431k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5487:9): [True: 0, False: 431k]
  ------------------
 5488|      0|      return false;
 5489|      0|    }
 5490|   431k|  }
 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|  8.20k|  uint8_t prev_ccc = 0;
 5495|   424k|  for (char32_t c : input) {
  ------------------
  |  Branch (5495:19): [True: 424k, False: 6.60k]
  ------------------
 5496|   424k|    uint8_t ccc = get_ccc(c);
 5497|   424k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5497:9): [True: 8.20k, False: 416k]
  |  Branch (5497:21): [True: 1.60k, False: 6.60k]
  ------------------
 5498|  1.60k|      return false;
 5499|  1.60k|    }
 5500|   423k|    prev_ccc = trailing_ccc(c);
 5501|   423k|  }
 5502|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5503|  6.60k|  return !would_compose(input);
 5504|  8.20k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5506|  1.68k|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.68k|  size_t input_count{0};
 5512|  1.68k|  size_t composition_count{0};
 5513|  73.1k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5513:10): [True: 71.4k, False: 1.68k]
  ------------------
 5514|  71.4k|    input[composition_count] = input[input_count];
 5515|  71.4k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5515:9): [True: 6.48k, False: 64.9k]
  ------------------
 5516|  6.48k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5516:9): [True: 2.99k, False: 3.48k]
  ------------------
 5517|  2.99k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5517:11): [True: 2.92k, False: 74]
  ------------------
 5518|  2.92k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5518:11): [True: 2.50k, False: 422]
  ------------------
 5519|  2.50k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5519:11): [True: 2.15k, False: 350]
  ------------------
 5520|  2.15k|        input[composition_count] =
 5521|  2.15k|            hangul_sbase +
 5522|  2.15k|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5523|  2.15k|             input[input_count + 1] - hangul_vbase) *
 5524|  2.15k|                hangul_tcount;
 5525|  2.15k|        input_count++;
 5526|  2.15k|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5526:13): [True: 2.05k, False: 92]
  ------------------
 5527|  2.05k|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5527:13): [True: 1.39k, False: 662]
  ------------------
 5528|  1.39k|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5528:13): [True: 1.17k, False: 222]
  ------------------
 5529|  1.17k|          input[composition_count] += input[++input_count] - hangul_tbase;
 5530|  1.17k|        }
 5531|  2.15k|      }
 5532|  68.4k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5532:16): [True: 932, False: 67.5k]
  ------------------
 5533|    932|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5533:16): [True: 0, False: 932]
  ------------------
 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|  68.4k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5540:16): [True: 68.4k, False: 0]
  ------------------
 5541|  68.4k|      const uint16_t* composition =
 5542|  68.4k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5543|  68.4k|          (input[input_count] % 256);
 5544|  68.4k|      size_t initial_composition_count = composition_count;
 5545|  75.5k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5545:39): [True: 74.0k, False: 1.48k]
  ------------------
 5546|  74.0k|           input_count++) {
 5547|  74.0k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5548|       |
 5549|  74.0k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5549:13): [True: 18.5k, False: 55.5k]
  |  Branch (5549:49): [True: 17.7k, False: 760]
  ------------------
 5550|  17.7k|          int left = composition[0];
 5551|  17.7k|          int right = composition[1];
 5552|  17.7k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5552:15): [True: 0, False: 17.7k]
  |  Branch (5552:27): [True: 0, False: 17.7k]
  ------------------
 5553|  17.7k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5553:15): [True: 0, False: 17.7k]
  ------------------
 5554|      0|            break;
 5555|      0|          }
 5556|  36.5k|          while (left + 2 < right) {
  ------------------
  |  Branch (5556:18): [True: 18.7k, False: 17.7k]
  ------------------
 5557|  18.7k|            int middle = left + (((right - left) >> 1) & ~1);
 5558|  18.7k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5558:17): [True: 6.25k, False: 12.4k]
  ------------------
 5559|  18.7k|                input[input_count + 1]) {
 5560|  6.25k|              left = middle;
 5561|  6.25k|            }
 5562|  18.7k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5562:17): [True: 14.6k, False: 4.08k]
  ------------------
 5563|  18.7k|                input[input_count + 1]) {
 5564|  14.6k|              right = middle;
 5565|  14.6k|            }
 5566|  18.7k|          }
 5567|  17.7k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5567:15): [True: 17.7k, False: 0]
  ------------------
 5568|  17.7k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5568:15): [True: 3.29k, False: 14.5k]
  ------------------
 5569|  17.7k|                  input[input_count + 1]) {
 5570|  3.29k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5571|  3.29k|            input[initial_composition_count] = composed;
 5572|  3.29k|            composition =
 5573|  3.29k|                composition_block_row(composition_index[composed >> 8]) +
 5574|  3.29k|                (composed % 256);
 5575|  3.29k|            continue;
 5576|  3.29k|          }
 5577|  17.7k|        }
 5578|       |
 5579|  70.7k|        if (ccc == 0) {
  ------------------
  |  Branch (5579:13): [True: 66.9k, False: 3.84k]
  ------------------
 5580|  66.9k|          break;
 5581|  66.9k|        }
 5582|  3.84k|        previous_ccc = ccc;
 5583|  3.84k|        input[++composition_count] = input[input_count + 1];
 5584|  3.84k|      }
 5585|  68.4k|    }
 5586|  71.4k|  }
 5587|       |
 5588|  1.68k|  if (composition_count < input_count) {
  ------------------
  |  Branch (5588:7): [True: 1.55k, False: 128]
  ------------------
 5589|  1.55k|    input.resize(composition_count);
 5590|  1.55k|  }
 5591|  1.68k|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5593|  1.68k|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.68k|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5598:7): [True: 0, False: 1.68k]
  |  Branch (5598:27): [True: 0, False: 1.68k]
  ------------------
 5599|  1.68k|      composition_index == nullptr) {
  ------------------
  |  Branch (5599:7): [True: 0, False: 1.68k]
  ------------------
 5600|      0|    return false;
 5601|      0|  }
 5602|  1.68k|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5602:7): [True: 0, False: 1.68k]
  ------------------
 5603|      0|    return true;
 5604|      0|  }
 5605|  1.68k|  decompose_nfc(input);
 5606|  1.68k|  compose(input);
 5607|  1.68k|  return true;
 5608|  1.68k|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5668|  3.16k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5669|  3.16k|  int32_t written_out{0};
 5670|  3.16k|  out.reserve(out.size() + input.size());
 5671|  3.16k|  uint32_t n = initial_n;
 5672|  3.16k|  int32_t i = 0;
 5673|  3.16k|  int32_t bias = initial_bias;
 5674|       |  // grab ascii content
 5675|  3.16k|  size_t end_of_ascii = input.find_last_of('-');
 5676|  3.16k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5676:7): [True: 728, False: 2.43k]
  ------------------
 5677|  12.1k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5677:20): [True: 12.1k, False: 728]
  ------------------
 5678|  12.1k|      if (c >= 0x80) {
  ------------------
  |  Branch (5678:11): [True: 0, False: 12.1k]
  ------------------
 5679|      0|        return false;
 5680|      0|      }
 5681|  12.1k|      out.push_back(c);
 5682|  12.1k|      written_out++;
 5683|  12.1k|    }
 5684|    728|    input.remove_prefix(end_of_ascii + 1);
 5685|    728|  }
 5686|  24.7k|  while (!input.empty()) {
  ------------------
  |  Branch (5686:10): [True: 21.7k, False: 3.00k]
  ------------------
 5687|  21.7k|    int32_t oldi = i;
 5688|  21.7k|    int32_t w = 1;
 5689|  34.3k|    for (int32_t k = base;; k += base) {
 5690|  34.3k|      if (input.empty()) {
  ------------------
  |  Branch (5690:11): [True: 30, False: 34.3k]
  ------------------
 5691|     30|        return false;
 5692|     30|      }
 5693|  34.3k|      uint8_t code_point = input.front();
 5694|  34.3k|      input.remove_prefix(1);
 5695|  34.3k|      int32_t digit = char_to_digit_value(code_point);
 5696|  34.3k|      if (digit < 0) {
  ------------------
  |  Branch (5696:11): [True: 52, False: 34.3k]
  ------------------
 5697|     52|        return false;
 5698|     52|      }
 5699|  34.3k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5699:11): [True: 8, False: 34.3k]
  ------------------
 5700|      8|        return false;
 5701|      8|      }
 5702|  34.3k|      i = i + digit * w;
 5703|  34.3k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5703:19): [True: 7.90k, False: 26.3k]
  |  Branch (5703:38): [True: 24.3k, False: 2.02k]
  ------------------
 5704|  34.3k|      if (digit < t) {
  ------------------
  |  Branch (5704:11): [True: 21.6k, False: 12.6k]
  ------------------
 5705|  21.6k|        break;
 5706|  21.6k|      }
 5707|  12.6k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5707:11): [True: 0, False: 12.6k]
  ------------------
 5708|      0|        return false;
 5709|      0|      }
 5710|  12.6k|      w = w * (base - t);
 5711|  12.6k|    }
 5712|  21.6k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5713|  21.6k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5713:9): [True: 66, False: 21.5k]
  ------------------
 5714|     66|      return false;
 5715|     66|    }
 5716|  21.5k|    n = n + i / (written_out + 1);
 5717|  21.5k|    i = i % (written_out + 1);
 5718|  21.5k|    if (n < 0x80) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 21.5k]
  ------------------
 5719|      0|      return false;
 5720|      0|    }
 5721|  21.5k|    out.insert(out.begin() + i, n);
 5722|  21.5k|    written_out++;
 5723|  21.5k|    ++i;
 5724|  21.5k|  }
 5725|       |  // See https://github.com/whatwg/url/issues/803
 5726|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5727|  3.00k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5727:7): [True: 1.48k, False: 1.52k]
  |  Branch (5727:26): [True: 310, False: 1.17k]
  |  Branch (5727:44): [True: 224, False: 86]
  |  Branch (5727:62): [True: 116, False: 108]
  ------------------
 5728|    116|      out[3] == U'-') {
  ------------------
  |  Branch (5728:7): [True: 6, False: 110]
  ------------------
 5729|      6|    return false;
 5730|      6|  }
 5731|  2.99k|  return true;
 5732|  3.00k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5812|  23.3k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5813|  23.3k|  out.reserve(input.size() + out.size());
 5814|  23.3k|  uint32_t n = initial_n;
 5815|  23.3k|  int32_t d = 0;
 5816|  23.3k|  int32_t bias = initial_bias;
 5817|  23.3k|  size_t h = 0;
 5818|       |  // first push the ascii content
 5819|   213k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5819:19): [True: 213k, False: 23.3k]
  ------------------
 5820|   213k|    if (c < 0x80) {
  ------------------
  |  Branch (5820:9): [True: 65.8k, False: 147k]
  ------------------
 5821|  65.8k|      ++h;
 5822|  65.8k|      out.push_back(char(c));
 5823|  65.8k|    }
 5824|   213k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5824:9): [True: 0, False: 213k]
  |  Branch (5824:26): [True: 880, False: 212k]
  |  Branch (5824:41): [True: 0, False: 880]
  ------------------
 5825|      0|      return false;
 5826|      0|    }
 5827|   213k|  }
 5828|  23.3k|  size_t b = h;
 5829|  23.3k|  if (b > 0) {
  ------------------
  |  Branch (5829:7): [True: 19.6k, False: 3.68k]
  ------------------
 5830|  19.6k|    out.push_back('-');
 5831|  19.6k|  }
 5832|  69.9k|  while (h < input.size()) {
  ------------------
  |  Branch (5832:10): [True: 46.6k, False: 23.3k]
  ------------------
 5833|  46.6k|    uint32_t m = 0x10FFFF;
 5834|  1.94M|    for (auto code_point : input) {
  ------------------
  |  Branch (5834:26): [True: 1.94M, False: 46.6k]
  ------------------
 5835|  1.94M|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5835:11): [True: 726k, False: 1.21M]
  |  Branch (5835:30): [True: 51.4k, False: 675k]
  ------------------
 5836|  1.94M|    }
 5837|       |
 5838|  46.6k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5838:9): [True: 0, False: 46.6k]
  ------------------
 5839|      0|      return false;
 5840|      0|    }
 5841|  46.6k|    d = d + int32_t((m - n) * (h + 1));
 5842|  46.6k|    n = m;
 5843|  1.94M|    for (auto c : input) {
  ------------------
  |  Branch (5843:17): [True: 1.94M, False: 46.6k]
  ------------------
 5844|  1.94M|      if (c < n) {
  ------------------
  |  Branch (5844:11): [True: 1.21M, False: 726k]
  ------------------
 5845|  1.21M|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5845:13): [True: 0, False: 1.21M]
  ------------------
 5846|      0|          return false;
 5847|      0|        }
 5848|  1.21M|        ++d;
 5849|  1.21M|      }
 5850|  1.94M|      if (c == n) {
  ------------------
  |  Branch (5850:11): [True: 147k, False: 1.79M]
  ------------------
 5851|   147k|        int32_t q = d;
 5852|   279k|        for (int32_t k = base;; k += base) {
 5853|   279k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5853:23): [True: 49.4k, False: 230k]
  |  Branch (5853:42): [True: 209k, False: 20.5k]
  ------------------
 5854|       |
 5855|   279k|          if (q < t) {
  ------------------
  |  Branch (5855:15): [True: 147k, False: 132k]
  ------------------
 5856|   147k|            break;
 5857|   147k|          }
 5858|   132k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5859|   132k|          q = (q - t) / (base - t);
 5860|   132k|        }
 5861|   147k|        out.push_back(digit_to_char(q));
 5862|   147k|        bias = adapt(d, int32_t(h + 1), h == b);
 5863|   147k|        d = 0;
 5864|   147k|        ++h;
 5865|   147k|      }
 5866|  1.94M|    }
 5867|  46.6k|    ++d;
 5868|  46.6k|    ++n;
 5869|  46.6k|  }
 5870|  23.3k|  return true;
 5871|  23.3k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5955|  26.5k|bool is_label_valid(const std::u32string_view label) {
 5956|  26.5k|  if (label.empty()) {
  ------------------
  |  Branch (5956:7): [True: 0, False: 26.5k]
  ------------------
 5957|      0|    return true;
 5958|      0|  }
 5959|  26.5k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5959:7): [True: 0, False: 26.5k]
  |  Branch (5959:27): [True: 0, False: 26.5k]
  |  Branch (5959:58): [True: 0, False: 26.5k]
  ------------------
 5960|  26.5k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5960:7): [True: 0, False: 26.5k]
  |  Branch (5960:31): [True: 0, False: 26.5k]
  ------------------
 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|  26.5k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5986|  26.5k|                                               combining_range_count};
 5987|  26.5k|  const auto comb_it = std::ranges::lower_bound(
 5988|  26.5k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5989|  26.5k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5989:7): [True: 26.5k, False: 0]
  |  Branch (5989:7): [True: 122, False: 26.4k]
  |  Branch (5989:37): [True: 122, False: 26.4k]
  ------------------
 5990|    122|    return false;
 5991|    122|  }
 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|  26.4k|  constexpr static uint32_t virama[] = {
 6004|  26.4k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 6005|  26.4k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 6006|  26.4k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 6007|  26.4k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 6008|  26.4k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 6009|  26.4k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 6010|  26.4k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6011|  26.4k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6012|  26.4k|  constexpr static uint32_t R[] = {
 6013|  26.4k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6014|  26.4k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6015|  26.4k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6016|  26.4k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6017|  26.4k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6018|  26.4k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6019|  26.4k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6020|  26.4k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6021|  26.4k|  constexpr static uint32_t L[] = {0xa872};
 6022|  26.4k|  constexpr static uint32_t D[] = {
 6023|  26.4k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6024|  26.4k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6025|  26.4k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6026|  26.4k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6027|  26.4k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6028|  26.4k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6029|  26.4k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6030|  26.4k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6031|  26.4k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6032|  26.4k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6033|  26.4k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6034|  26.4k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6035|  26.4k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6036|  26.4k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6037|  26.4k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6038|  26.4k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6039|  26.4k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6040|  26.4k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6041|  26.4k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6042|  26.4k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6043|  26.4k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6044|  26.4k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6045|  26.4k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6046|  26.4k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6047|  26.4k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6048|  26.4k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6049|  26.4k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6050|  26.4k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6051|  26.4k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6052|  26.4k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6053|  26.4k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6054|  26.4k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6055|  26.4k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6056|  26.4k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6057|  26.4k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6058|  26.4k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6059|  26.4k|      0xa870, 0xa871};
 6060|       |
 6061|   191k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6061:22): [True: 166k, False: 24.7k]
  ------------------
 6062|   166k|    uint32_t c = label[i];
 6063|   166k|    if (c == 0x200c) {
  ------------------
  |  Branch (6063:9): [True: 1.18k, False: 165k]
  ------------------
 6064|  1.18k|      if (i > 0) {
  ------------------
  |  Branch (6064:11): [True: 1.17k, False: 6]
  ------------------
 6065|  1.17k|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6065:13): [True: 252, False: 926]
  ------------------
 6066|    252|          return true;
 6067|    252|        }
 6068|  1.17k|      }
 6069|    932|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6069:11): [True: 6, False: 926]
  |  Branch (6069:23): [True: 70, False: 856]
  ------------------
 6070|     76|        return false;
 6071|     76|      }
 6072|       |      // we go backward looking for L or D
 6073|    856|      auto is_l_or_d = [](uint32_t code) {
 6074|    856|        return std::ranges::binary_search(L, code) ||
 6075|    856|               std::ranges::binary_search(D, code);
 6076|    856|      };
 6077|    856|      auto is_r_or_d = [](uint32_t code) {
 6078|    856|        return std::ranges::binary_search(R, code) ||
 6079|    856|               std::ranges::binary_search(D, code);
 6080|    856|      };
 6081|    856|      std::u32string_view before = label.substr(0, i);
 6082|    856|      std::u32string_view after = label.substr(i + 1);
 6083|    856|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6083:14): [True: 792, False: 64]
  ------------------
 6084|    856|              before.end()) &&
 6085|    792|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6085:14): [True: 692, False: 100]
  ------------------
 6086|    792|              after.end());
 6087|   165k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6087:16): [True: 480, False: 164k]
  ------------------
 6088|    480|      if (i > 0) {
  ------------------
  |  Branch (6088:11): [True: 474, False: 6]
  ------------------
 6089|    474|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6089:13): [True: 420, False: 54]
  ------------------
 6090|    420|          return true;
 6091|    420|        }
 6092|    474|      }
 6093|     60|      return false;
 6094|    480|    }
 6095|   166k|  }
 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|  24.7k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6128|  24.7k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6128:7): [True: 0, False: 24.7k]
  ------------------
 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|  24.7k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6135:7): [True: 2.24k, False: 22.5k]
  ------------------
 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|  2.24k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6140:9): [True: 214, False: 2.02k]
  ------------------
 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.33k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6145:26): [True: 2.33k, False: 0]
  ------------------
 6146|  2.33k|        const direction d = find_direction(label[i]);
 6147|  2.33k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6147:15): [True: 690, False: 1.64k]
  |  Branch (6147:36): [True: 200, False: 1.44k]
  |  Branch (6147:58): [True: 190, False: 1.25k]
  ------------------
 6148|  1.25k|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6148:15): [True: 200, False: 1.05k]
  |  Branch (6148:37): [True: 202, False: 852]
  |  Branch (6148:59): [True: 228, False: 624]
  ------------------
 6149|    624|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6149:15): [True: 218, False: 406]
  |  Branch (6149:37): [True: 192, False: 214]
  ------------------
 6150|    214|          return false;
 6151|    214|        }
 6152|  2.33k|      }
 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|  2.02k|    } 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|  2.02k|      const direction first_dir = find_direction(label[0]);
 6167|  2.02k|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6167:11): [True: 1.24k, False: 786]
  |  Branch (6167:40): [True: 30, False: 1.21k]
  ------------------
 6168|     30|        return false;
 6169|     30|      }
 6170|       |
 6171|  1.99k|      bool has_an = false;
 6172|  1.99k|      bool has_en = false;
 6173|  8.52k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6173:26): [True: 6.71k, False: 1.81k]
  ------------------
 6174|  6.71k|        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|  6.71k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6178:14): [True: 722, False: 5.98k]
  |  Branch (6178:37): [True: 722, False: 0]
  |  Branch (6178:56): [True: 6, False: 716]
  ------------------
 6179|  6.70k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6179:14): [True: 390, False: 6.31k]
  |  Branch (6179:37): [True: 390, False: 0]
  |  Branch (6179:56): [True: 6, False: 384]
  ------------------
 6180|     12|          return false;
 6181|     12|        }
 6182|       |
 6183|  6.69k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6183:15): [True: 998, False: 5.70k]
  |  Branch (6183:36): [True: 2.36k, False: 3.33k]
  |  Branch (6183:58): [True: 384, False: 2.95k]
  ------------------
 6184|  2.95k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6184:15): [True: 716, False: 2.23k]
  |  Branch (6184:37): [True: 192, False: 2.04k]
  |  Branch (6184:59): [True: 340, False: 1.70k]
  ------------------
 6185|  1.70k|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6185:15): [True: 196, False: 1.51k]
  |  Branch (6185:37): [True: 220, False: 1.29k]
  |  Branch (6185:59): [True: 298, False: 992]
  ------------------
 6186|    992|              d == direction::NSM)) {
  ------------------
  |  Branch (6186:15): [True: 896, False: 96]
  ------------------
 6187|     96|          return false;
 6188|     96|        }
 6189|       |
 6190|  6.60k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6190:13): [True: 1.88k, False: 4.71k]
  ------------------
 6191|  1.88k|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6191:15): [True: 388, False: 1.50k]
  |  Branch (6191:36): [True: 1.00k, False: 492]
  |  Branch (6191:58): [True: 200, False: 292]
  ------------------
 6192|    292|              d == direction::EN)) {
  ------------------
  |  Branch (6192:15): [True: 214, False: 78]
  ------------------
 6193|     78|          return false;
 6194|     78|        }
 6195|  6.60k|      }
 6196|       |
 6197|  1.81k|      return true;
 6198|  1.99k|    }
 6199|  2.24k|  }
 6200|       |
 6201|  22.5k|  return true;
 6202|  24.7k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6359|   123k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6360|   123k|  out.clear();
 6361|   123k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6361:7): [True: 0, False: 123k]
  ------------------
 6362|      0|    return false;
 6363|      0|  }
 6364|   123k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6364:7): [True: 118k, False: 5.20k]
  ------------------
 6365|   118k|    from_ascii_to_ascii(ut8_string, out);
 6366|   118k|    return true;
 6367|   118k|  }
 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.20k|  size_t utf32_length =
 6380|  5.20k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6381|  5.20k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6381:7): [True: 46, False: 5.16k]
  |  Branch (6381:28): [True: 46, False: 0]
  ------------------
 6382|     46|    return false;
 6383|     46|  }
 6384|  5.16k|  std::u32string working(utf32_length, U'\0');
 6385|  5.16k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6386|  5.16k|      ut8_string.data(), ut8_string.size(), working.data());
 6387|  5.16k|#endif
 6388|  5.16k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6388:7): [True: 430, False: 4.73k]
  |  Branch (6388:35): [True: 0, False: 4.73k]
  ------------------
 6389|    430|    return false;
 6390|    430|  }
 6391|  4.73k|  working.resize(actual_utf32_length);
 6392|       |
 6393|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6394|  4.73k|  std::u32string mapped;
 6395|  4.73k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6395:7): [True: 62, False: 4.67k]
  ------------------
 6396|     62|    return false;
 6397|     62|  }
 6398|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6399|  4.67k|  working.clear();
 6400|       |
 6401|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6402|  4.67k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6402:7): [True: 3.97k, False: 696]
  |  Branch (6402:28): [True: 728, False: 3.24k]
  ------------------
 6403|    728|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6403:9): [True: 0, False: 728]
  ------------------
 6404|      0|      return false;
 6405|      0|    }
 6406|    728|  }
 6407|       |
 6408|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6409|  4.67k|  out.reserve(mapped.size() + 8);
 6410|       |
 6411|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6412|  4.67k|  const char32_t* p = mapped.data();
 6413|  4.67k|  const char32_t* const end = p + mapped.size();
 6414|  4.67k|  std::u32string post_map;
 6415|       |
 6416|  34.3k|  while (p < end) {
  ------------------
  |  Branch (6416:10): [True: 31.3k, False: 3.01k]
  ------------------
 6417|  31.3k|    const char32_t* label_begin = p;
 6418|   359k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6418:12): [True: 355k, False: 4.00k]
  |  Branch (6418:23): [True: 328k, False: 27.3k]
  ------------------
 6419|   328k|      ++p;
 6420|   328k|    }
 6421|  31.3k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6422|  31.3k|    std::u32string_view label_view(label_begin, label_size);
 6423|  31.3k|    const bool is_last_label = (p == end);
 6424|  31.3k|    if (p < end) {
  ------------------
  |  Branch (6424:9): [True: 27.3k, False: 4.00k]
  ------------------
 6425|  27.3k|      ++p;  // skip dot
 6426|  27.3k|    }
 6427|       |
 6428|  31.3k|    if (label_size == 0) {
  ------------------
  |  Branch (6428:9): [True: 1.75k, False: 29.6k]
  ------------------
 6429|       |      // empty label
 6430|  29.6k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6430:16): [True: 3.19k, False: 26.4k]
  ------------------
 6431|  62.1k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6431:23): [True: 62.1k, False: 3.16k]
  ------------------
 6432|  62.1k|        if (c >= 0x80) {
  ------------------
  |  Branch (6432:13): [True: 30, False: 62.0k]
  ------------------
 6433|     30|          out.clear();
 6434|     30|          return false;
 6435|     30|        }
 6436|  62.1k|      }
 6437|  3.16k|      append_ascii_label(out, label_view);
 6438|  3.16k|      std::string_view puny_segment_ascii(
 6439|  3.16k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6440|  3.16k|      working.clear();
 6441|  3.16k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6441:11): [True: 162, False: 2.99k]
  ------------------
 6442|    162|        out.clear();
 6443|    162|        return false;
 6444|    162|      }
 6445|  2.99k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6445:11): [True: 96, False: 2.90k]
  ------------------
 6446|     96|        out.clear();
 6447|     96|        return false;
 6448|     96|      }
 6449|  2.90k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6449:11): [True: 256, False: 2.64k]
  |  Branch (6449:49): [True: 100, False: 2.54k]
  ------------------
 6450|    356|        out.clear();
 6451|    356|        return false;
 6452|    356|      }
 6453|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6454|  2.54k|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6454:11): [True: 2.54k, False: 0]
  |  Branch (6454:34): [True: 956, False: 1.59k]
  ------------------
 6455|    956|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6455:13): [True: 0, False: 956]
  |  Branch (6455:37): [True: 158, False: 798]
  ------------------
 6456|    158|          out.clear();
 6457|    158|          return false;
 6458|    158|        }
 6459|    956|      }
 6460|  2.38k|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6460:11): [True: 0, False: 2.38k]
  |  Branch (6460:31): [True: 52, False: 2.33k]
  ------------------
 6461|     52|        out.clear();
 6462|     52|        return false;
 6463|     52|      }
 6464|  26.4k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6464:16): [True: 2.26k, False: 24.1k]
  ------------------
 6465|  2.26k|      append_ascii_label(out, label_view);
 6466|  24.1k|    } else {
 6467|  24.1k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6467:11): [True: 800, False: 23.3k]
  ------------------
 6468|    800|        out.clear();
 6469|    800|        return false;
 6470|    800|      }
 6471|  23.3k|      out.append("xn--");
 6472|  23.3k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6472:11): [True: 0, False: 23.3k]
  ------------------
 6473|      0|        out.clear();
 6474|      0|        return false;
 6475|      0|      }
 6476|  23.3k|    }
 6477|  29.7k|    if (!is_last_label) {
  ------------------
  |  Branch (6477:9): [True: 26.9k, False: 2.81k]
  ------------------
 6478|  26.9k|      out.push_back('.');
 6479|  26.9k|    }
 6480|  29.7k|  }
 6481|  3.01k|  return true;
 6482|  4.67k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6484|   123k|std::string to_ascii(std::string_view ut8_string) {
 6485|   123k|  std::string out;
 6486|   123k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6486:7): [True: 2.19k, False: 121k]
  ------------------
 6487|  2.19k|    return {};
 6488|  2.19k|  }
 6489|   121k|  return out;
 6490|   123k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  23.9k|                    std::string& out) {
 7356|  23.9k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  23.9k|          append ? "appending" : "overwriting");
 7358|  23.9k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  23.9k|    return character_sets::bit_at(character_set, c);
 7360|  23.9k|  });
 7361|  23.9k|  ada_log("percent_encode done checking, moved to ",
 7362|  23.9k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  23.9k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 23.3k, False: 598]
  ------------------
 7366|  23.3k|    ada_log("percent_encode encoding not needed.");
 7367|  23.3k|    return false;
 7368|  23.3k|  }
 7369|       |  if constexpr (!append) {
 7370|       |    out.clear();
 7371|       |  }
 7372|    598|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|    598|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|    598|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|    598|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|    598|          " bytes");
 7378|  38.0k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 37.4k, False: 598]
  ------------------
 7379|  37.4k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 23.7k, False: 13.7k]
  ------------------
 7380|  23.7k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  23.7k|    } else {
 7382|  13.7k|      out += *pointer;
 7383|  13.7k|    }
 7384|  37.4k|  }
 7385|    598|  return true;
 7386|  23.9k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  26.2k|                    std::string& out) {
 7356|  26.2k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  26.2k|          append ? "appending" : "overwriting");
 7358|  26.2k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  26.2k|    return character_sets::bit_at(character_set, c);
 7360|  26.2k|  });
 7361|  26.2k|  ada_log("percent_encode done checking, moved to ",
 7362|  26.2k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  26.2k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 17.9k, False: 8.31k]
  ------------------
 7366|  17.9k|    ada_log("percent_encode encoding not needed.");
 7367|  17.9k|    return false;
 7368|  17.9k|  }
 7369|  8.31k|  if constexpr (!append) {
 7370|  8.31k|    out.clear();
 7371|  8.31k|  }
 7372|  8.31k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|  8.31k|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|  8.31k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|  8.31k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|  8.31k|          " bytes");
 7378|   100k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 92.5k, False: 8.31k]
  ------------------
 7379|  92.5k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 78.9k, False: 13.6k]
  ------------------
 7380|  78.9k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  78.9k|    } else {
 7382|  13.6k|      out += *pointer;
 7383|  13.6k|    }
 7384|  92.5k|  }
 7385|  8.31k|  return true;
 7386|  26.2k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7186|  38.3k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7187|       |  // next line is for safety only, we expect users to avoid calling
 7188|       |  // percent_decode when first_percent is outside the range.
 7189|  38.3k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7189:7): [True: 0, False: 38.3k]
  ------------------
 7190|      0|    return std::string(input);
 7191|      0|  }
 7192|       |
 7193|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7194|  38.3k|  const char* const src = input.data();
 7195|  38.3k|  const char* const end = src + input.size();
 7196|       |
 7197|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7198|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7199|       |  // byte-at-a-time appends of the naive version.
 7200|  38.3k|  std::string out(input.size(), '\0');
 7201|  38.3k|  char* d = out.data();
 7202|  38.3k|  char* const d0 = d;
 7203|       |
 7204|  38.3k|  std::memcpy(d, src, first_percent);
 7205|  38.3k|  d += first_percent;
 7206|       |
 7207|  38.3k|  const char* p = src + first_percent;
 7208|   122k|  while (p < end) {
  ------------------
  |  Branch (7208:10): [True: 84.1k, False: 38.3k]
  ------------------
 7209|  84.1k|    if (*p == '%') {
  ------------------
  |  Branch (7209:9): [True: 43.6k, False: 40.5k]
  ------------------
 7210|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7211|  84.9k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7211:14): [True: 83.6k, False: 1.33k]
  |  Branch (7211:29): [True: 45.5k, False: 38.1k]
  ------------------
 7212|  45.5k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7212:13): [True: 2.64k, False: 42.8k]
  |  Branch (7212:42): [True: 1.55k, False: 41.3k]
  ------------------
 7213|  4.20k|          break;
 7214|  4.20k|        }
 7215|  41.3k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7216|  41.3k|                                 convert_hex_to_binary(p[2]));
 7217|  41.3k|        p += 3;
 7218|  41.3k|      }
 7219|  43.6k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7219:11): [True: 42.8k, False: 848]
  |  Branch (7219:22): [True: 4.50k, False: 38.3k]
  ------------------
 7220|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7221|       |        // literally and keep scanning after it.
 7222|  4.50k|        *d++ = *p++;
 7223|  4.50k|      }
 7224|  43.6k|    } else {
 7225|  40.5k|      const char* q = static_cast<const char*>(
 7226|  40.5k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7227|  40.5k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7227:29): [True: 3.25k, False: 37.2k]
  ------------------
 7228|  40.5k|      const size_t n = static_cast<size_t>(run_end - p);
 7229|  40.5k|      std::memcpy(d, p, n);
 7230|  40.5k|      d += n;
 7231|  40.5k|      p = run_end;
 7232|  40.5k|    }
 7233|  84.1k|  }
 7234|       |
 7235|  38.3k|  out.resize(static_cast<size_t>(d - d0));
 7236|  38.3k|  return out;
 7237|  38.3k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7325|   189k|                           const uint8_t character_set[]) {
 7326|   189k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|   189k|    return character_sets::bit_at(character_set, c);
 7328|   189k|  });
 7329|       |  // Optimization: Don't iterate if percent encode is not required
 7330|   189k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7330:7): [True: 186k, False: 3.10k]
  ------------------
 7331|   186k|    return std::string(input);
 7332|   186k|  }
 7333|       |
 7334|  3.10k|  std::string result;
 7335|  3.10k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7336|       |                                   // produce 3 characters.
 7337|  3.10k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7338|  3.10k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7338:7): [True: 804, False: 2.29k]
  ------------------
 7339|    804|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7340|    804|                          result);
 7341|  2.29k|  } else {
 7342|  18.0k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7342:12): [True: 15.7k, False: 2.29k]
  ------------------
 7343|  15.7k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7343:11): [True: 10.1k, False: 5.64k]
  ------------------
 7344|  10.1k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7345|  10.1k|      } else {
 7346|  5.64k|        result += *pointer;
 7347|  5.64k|      }
 7348|  15.7k|    }
 7349|  2.29k|  }
 7350|  3.10k|  return result;
 7351|   189k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7396|   123k|              size_t first_percent) {
 7397|   123k|  std::string percent_decoded_buffer;
 7398|   123k|  std::string_view input = plain;
 7399|   123k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7399:7): [True: 714, False: 122k]
  ------------------
 7400|    714|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7401|    714|    input = percent_decoded_buffer;
 7402|    714|  }
 7403|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7404|   123k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7405|   123k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7405:7): [True: 2.21k, False: 121k]
  |  Branch (7405:29): [True: 846, False: 120k]
  ------------------
 7406|   121k|                                idna_ascii.data(), idna_ascii.size())) {
 7407|  3.06k|    return false;
 7408|  3.06k|  }
 7409|   120k|  out = std::move(idna_ascii);
 7410|   120k|  return true;
 7411|   123k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7414|     41|                           const uint8_t character_set[], size_t index) {
 7415|     41|  std::string out;
 7416|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7417|     41|  out.append(input.data(), index);
 7418|     41|  auto pointer = input.begin() + index;
 7419|     41|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7419:7): [True: 2, False: 39]
  ------------------
 7420|      2|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7421|      2|                          out);
 7422|     39|  } else {
 7423|    608|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7423:12): [True: 569, False: 39]
  ------------------
 7424|    569|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7424:11): [True: 169, False: 400]
  ------------------
 7425|    169|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7426|    400|      } else {
 7427|    400|        out += *pointer;
 7428|    400|      }
 7429|    569|    }
 7430|     39|  }
 7431|     41|  return out;
 7432|     41|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7726|    806|                           const uint8_t character_set[], std::string& out) {
 7727|    806|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7728|    806|  if (static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (7728:7): [True: 806, False: 0]
  ------------------
 7729|    806|    percent_encode_to_wide(p, end, character_set, out);
 7730|    806|    return;
 7731|    806|  }
 7732|      0|#endif
 7733|      0|  percent_encode_to_scalar(p, end, character_set, out);
 7734|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7799|    880|    size_t& compress_length) noexcept {
 7800|    880|  compress = 0;
 7801|    880|  compress_length = 0;
 7802|    880|  size_t i = 0;
 7803|  3.28k|  while (i < 8) {
  ------------------
  |  Branch (7803:10): [True: 2.40k, False: 880]
  ------------------
 7804|  2.40k|    if (address[i] != 0) {
  ------------------
  |  Branch (7804:9): [True: 1.30k, False: 1.10k]
  ------------------
 7805|  1.30k|      ++i;
 7806|  1.30k|      continue;
 7807|  1.30k|    }
 7808|  1.10k|    size_t next = i + 1;
 7809|  5.73k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7809:12): [True: 5.19k, False: 540]
  |  Branch (7809:24): [True: 4.63k, False: 560]
  ------------------
 7810|  4.63k|      ++next;
 7811|  4.63k|    }
 7812|  1.10k|    const size_t count = next - i;
 7813|  1.10k|    if (count > compress_length) {
  ------------------
  |  Branch (7813:9): [True: 940, False: 160]
  ------------------
 7814|    940|      compress_length = count;
 7815|    940|      compress = i;
 7816|    940|    }
 7817|  1.10k|    i = next;
 7818|  1.10k|  }
 7819|    880|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7821|    880|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7822|    880|  size_t compress = 0;
 7823|    880|  size_t compress_length = 0;
 7824|    880|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7825|       |
 7826|       |  // Skip compression when the longest zero run is a single piece.
 7827|    880|  if (compress_length <= 1) {
  ------------------
  |  Branch (7827:7): [True: 38, False: 842]
  ------------------
 7828|     38|    compress = compress_length = 8;
 7829|     38|  }
 7830|       |
 7831|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7832|    880|  std::string output(4 * 8 + 7 + 2, '\0');
 7833|    880|  char* point = output.data();
 7834|    880|  *point++ = '[';
 7835|    880|  size_t piece_index = 0;
 7836|  2.07k|  while (true) {
  ------------------
  |  Branch (7836:10): [True: 2.07k, Folded]
  ------------------
 7837|  2.07k|    if (piece_index == compress) {
  ------------------
  |  Branch (7837:9): [True: 842, False: 1.23k]
  ------------------
 7838|    842|      *point++ = ':';
 7839|       |      // If we skip a value initially, we need to write '::'.
 7840|    842|      if (piece_index == 0) {
  ------------------
  |  Branch (7840:11): [True: 558, False: 284]
  ------------------
 7841|    558|        *point++ = ':';
 7842|    558|      }
 7843|    842|      piece_index += compress_length;
 7844|    842|      if (piece_index == 8) {
  ------------------
  |  Branch (7844:11): [True: 478, False: 364]
  ------------------
 7845|    478|        break;
 7846|    478|      }
 7847|    842|    }
 7848|  1.60k|    point = write_hex_u16(point, address[piece_index]);
 7849|  1.60k|    ++piece_index;
 7850|  1.60k|    if (piece_index == 8) {
  ------------------
  |  Branch (7850:9): [True: 402, False: 1.19k]
  ------------------
 7851|    402|      break;
 7852|    402|    }
 7853|  1.19k|    *point++ = ':';
 7854|  1.19k|  }
 7855|    880|  *point++ = ']';
 7856|    880|  output.resize(static_cast<size_t>(point - output.data()));
 7857|    880|  return output;
 7858|    880|}
_ZN3ada11serializers4ipv4Em:
 7860|  39.5k|std::string ipv4(const uint64_t address) {
 7861|  39.5k|  std::string output(15, '\0');
 7862|  39.5k|  char* point = output.data();
 7863|  39.5k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7864|  39.5k|  *point++ = '.';
 7865|  39.5k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7866|  39.5k|  *point++ = '.';
 7867|  39.5k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7868|  39.5k|  *point++ = '.';
 7869|  39.5k|  point = write_u8(point, static_cast<uint8_t>(address));
 7870|  39.5k|  output.resize(static_cast<size_t>(point - output.data()));
 7871|  39.5k|  return output;
 7872|  39.5k|}
_ZN3ada5parseINS_3urlEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8274|   597k|    std::string_view input, const result_type* base_url) {
 8275|   597k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8276|   597k|  if (!u.is_valid) {
  ------------------
  |  Branch (8276:7): [True: 21.0k, False: 576k]
  ------------------
 8277|  21.0k|    return tl::unexpected(errors::type_error);
 8278|  21.0k|  }
 8279|   576k|  return u;
 8280|   597k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8274|   597k|    std::string_view input, const result_type* base_url) {
 8275|   597k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8276|   597k|  if (!u.is_valid) {
  ------------------
  |  Branch (8276:7): [True: 21.0k, False: 576k]
  ------------------
 8277|  21.0k|    return tl::unexpected(errors::type_error);
 8278|  21.0k|  }
 8279|   576k|  return u;
 8280|   597k|}
_ZN3ada20get_max_input_lengthEv:
 7895|  1.57M|uint32_t get_max_input_length() {
 7896|  1.57M|  return max_input_length_.load(std::memory_order_relaxed);
 7897|  1.57M|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9254|   516k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9255|   517k|  while (!input.empty() &&
  ------------------
  |  Branch (9255:10): [True: 517k, False: 0]
  ------------------
 9256|   517k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9256:10): [True: 436, False: 516k]
  ------------------
 9257|    436|    input.remove_prefix(1);
 9258|    436|  }
 9259|   520k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9259:10): [True: 520k, False: 0]
  |  Branch (9259:28): [True: 3.59k, False: 516k]
  ------------------
 9260|  3.59k|    input.remove_suffix(1);
 9261|  3.59k|  }
 9262|   516k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9429|  18.1k|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9430|  18.1k|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9431|  18.1k|          input1.size(), " bytes] is part of string '", input2, "' [",
 9432|  18.1k|          input2.size(), " bytes]");
 9433|  18.1k|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9433:10): [True: 18.1k, False: 0]
  |  Branch (9433:29): [True: 18.1k, False: 0]
  |  Branch (9433:48): [True: 18.1k, False: 2]
  ------------------
 9434|  18.1k|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9434:10): [True: 0, False: 18.1k]
  ------------------
 9435|  18.1k|}
_ZN3ada3url17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9810|    651|bool url::parse_opaque_host(std::string_view input) {
 9811|    651|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
 9812|    651|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (9812:7): [True: 32, False: 619]
  ------------------
 9813|     32|    return is_valid = false;
 9814|     32|  }
 9815|       |
 9816|       |  // Return the result of running UTF-8 percent-encode on input using the C0
 9817|       |  // control percent-encode set.
 9818|    619|  host = ada::unicode::percent_encode(
 9819|    619|      input, ada::character_sets::C0_CONTROL_PERCENT_ENCODE);
 9820|    619|  return true;
 9821|    651|}
_ZN3ada3url10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9823|  56.3k|bool url::parse_ipv4(std::string_view input) {
 9824|  56.3k|  ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
 9825|  56.3k|  if (input.empty()) {
  ------------------
  |  Branch (9825:7): [True: 0, False: 56.3k]
  ------------------
 9826|      0|    return is_valid = false;
 9827|      0|  }
 9828|  56.3k|  std::string_view original_input = input;
 9829|  56.3k|  if (original_input.back() == '.') {
  ------------------
  |  Branch (9829:7): [True: 27.2k, False: 29.1k]
  ------------------
 9830|  27.2k|    original_input.remove_suffix(1);
 9831|  27.2k|  }
 9832|  56.3k|  if (input.back() == '.') {
  ------------------
  |  Branch (9832:7): [True: 27.2k, False: 29.1k]
  ------------------
 9833|  27.2k|    input.remove_suffix(1);
 9834|  27.2k|    if (input.empty()) {
  ------------------
  |  Branch (9834:9): [True: 0, False: 27.2k]
  ------------------
 9835|      0|      return is_valid = false;
 9836|      0|    }
 9837|  27.2k|  }
 9838|       |
 9839|  56.3k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
 9840|  56.3k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (9840:7): [True: 18.1k, False: 38.2k]
  ------------------
 9841|  18.1k|    host = original_input;
 9842|  18.1k|    host_type = IPV4;
 9843|  18.1k|    return true;
 9844|  18.1k|  }
 9845|       |
 9846|  38.2k|  const char* p = input.data();
 9847|  38.2k|  const char* end = p + input.size();
 9848|  38.2k|  uint64_t ipv4 = 0;
 9849|  38.2k|  int digit_count = 0;
 9850|  38.2k|  int pure_decimal_count = 0;
 9851|       |
 9852|  48.1k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (9852:10): [True: 48.1k, False: 14]
  |  Branch (9852:29): [True: 48.1k, False: 0]
  ------------------
 9853|  48.1k|    uint64_t segment = 0;
 9854|  48.1k|    bool pure = false;
 9855|  48.1k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (9855:9): [True: 18.4k, False: 29.7k]
  ------------------
 9856|  18.4k|      return is_valid = false;
 9857|  18.4k|    }
 9858|  29.7k|    if (pure) {
  ------------------
  |  Branch (9858:9): [True: 11.0k, False: 18.6k]
  ------------------
 9859|  11.0k|      ++pure_decimal_count;
 9860|  11.0k|    }
 9861|  29.7k|    if (p >= end) {
  ------------------
  |  Branch (9861:9): [True: 19.7k, False: 9.92k]
  ------------------
 9862|  19.7k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
 9863|  19.7k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (9863:11): [True: 24, False: 19.7k]
  ------------------
 9864|     24|        return is_valid = false;
 9865|     24|      }
 9866|  19.7k|      ipv4 = (ipv4 << shift) | segment;
 9867|  19.7k|      host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9867:14): [True: 0, False: 19.7k]
  ------------------
 9868|  19.7k|                                       : ada::serializers::ipv4(ipv4);
 9869|  19.7k|      host_type = IPV4;
 9870|  19.7k|      return true;
 9871|  19.7k|    }
 9872|  9.92k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (9872:9): [True: 51, False: 9.87k]
  |  Branch (9872:26): [True: 0, False: 9.87k]
  ------------------
 9873|     51|      return is_valid = false;
 9874|     51|    }
 9875|  9.87k|    ipv4 = (ipv4 << 8) | segment;
 9876|  9.87k|    ++p;
 9877|  9.87k|  }
 9878|     14|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (9878:7): [True: 0, False: 14]
  |  Branch (9878:27): [True: 14, False: 0]
  ------------------
 9879|     14|    return is_valid = false;
 9880|     14|  }
 9881|      0|  host = (pure_decimal_count == 4) ? std::string(original_input)
  ------------------
  |  Branch (9881:10): [True: 0, False: 0]
  ------------------
 9882|      0|                                   : ada::serializers::ipv4(ipv4);
 9883|      0|  host_type = IPV4;
 9884|      0|  return true;
 9885|     14|}
_ZN3ada3url10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9887|    608|bool url::parse_ipv6(std::string_view input) {
 9888|    608|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
 9889|    608|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (9889:7): [True: 21, False: 587]
  |  Branch (9889:24): [True: 10, False: 577]
  ------------------
 9890|     31|    return is_valid = false;
 9891|     31|  }
 9892|    577|  std::array<uint16_t, 8> address{};
 9893|       |#if defined(ADA_AVX512_IPV6)
 9894|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
 9895|       |                                                     address, simd_valid)) {
 9896|       |    if (!simd_valid) [[unlikely]] {
 9897|       |      return is_valid = false;
 9898|       |    }
 9899|       |    host = ada::serializers::ipv6(address);
 9900|       |    host_type = IPV6;
 9901|       |    return true;
 9902|       |  }
 9903|       |  address = {};
 9904|       |#endif
 9905|    577|  const char* pointer = input.data();
 9906|    577|  const char* const end = pointer + input.size();
 9907|    577|  int piece_index = 0;
 9908|    577|  int compress = -1;
 9909|       |
 9910|    577|  if (*pointer == ':') {
  ------------------
  |  Branch (9910:7): [True: 285, False: 292]
  ------------------
 9911|    285|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (9911:9): [True: 3, False: 282]
  |  Branch (9911:30): [True: 3, False: 279]
  ------------------
 9912|      6|      return is_valid = false;
 9913|      6|    }
 9914|    279|    pointer += 2;
 9915|    279|    compress = ++piece_index;
 9916|    279|  }
 9917|       |
 9918|  1.61k|  while (pointer != end) {
  ------------------
  |  Branch (9918:10): [True: 1.14k, False: 463]
  ------------------
 9919|  1.14k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (9919:9): [True: 3, False: 1.14k]
  ------------------
 9920|      3|      return is_valid = false;
 9921|      3|    }
 9922|  1.14k|    if (*pointer == ':') {
  ------------------
  |  Branch (9922:9): [True: 159, False: 985]
  ------------------
 9923|    159|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (9923:11): [True: 3, False: 156]
  ------------------
 9924|      3|        return is_valid = false;
 9925|      3|      }
 9926|    156|      ++pointer;
 9927|    156|      compress = ++piece_index;
 9928|    156|      continue;
 9929|    159|    }
 9930|       |
 9931|    985|    uint16_t value = 0;
 9932|    985|    const int length = detail::parse_hex_piece(pointer, end, value);
 9933|       |
 9934|    985|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (9934:9): [True: 756, False: 229]
  |  Branch (9934:27): [True: 72, False: 684]
  ------------------
 9935|     72|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9935:11): [True: 4, False: 68]
  ------------------
 9936|      4|        return is_valid = false;
 9937|      4|      }
 9938|     68|      pointer -= length;
 9939|     68|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (9939:11): [True: 3, False: 65]
  ------------------
 9940|      3|        return is_valid = false;
 9941|      3|      }
 9942|       |
 9943|     65|      int numbers_seen = 0;
 9944|    193|      while (pointer != end) {
  ------------------
  |  Branch (9944:14): [True: 175, False: 18]
  ------------------
 9945|    175|        int ipv4_piece = -1;
 9946|    175|        if (numbers_seen > 0) {
  ------------------
  |  Branch (9946:13): [True: 110, False: 65]
  ------------------
 9947|    110|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (9947:15): [True: 94, False: 16]
  |  Branch (9947:34): [True: 89, False: 5]
  ------------------
 9948|     89|            ++pointer;
 9949|     89|          } else {
 9950|     21|            return is_valid = false;
 9951|     21|          }
 9952|    110|        }
 9953|    154|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (9953:13): [True: 11, False: 143]
  |  Branch (9953:31): [True: 4, False: 139]
  |  Branch (9953:49): [True: 3, False: 136]
  ------------------
 9954|     18|          return is_valid = false;
 9955|     18|        }
 9956|    136|        ipv4_piece = *pointer - '0';
 9957|    136|        ++pointer;
 9958|    136|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9958:13): [True: 126, False: 10]
  |  Branch (9958:31): [True: 53, False: 73]
  |  Branch (9958:50): [True: 50, False: 3]
  ------------------
 9959|     50|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (9959:15): [True: 3, False: 47]
  ------------------
 9960|      3|            return is_valid = false;
 9961|      3|          }
 9962|     47|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9963|     47|          ++pointer;
 9964|     47|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (9964:15): [True: 44, False: 3]
  |  Branch (9964:33): [True: 26, False: 18]
  |  Branch (9964:52): [True: 23, False: 3]
  ------------------
 9965|     23|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
 9966|     23|            ++pointer;
 9967|     23|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (9967:17): [True: 5, False: 18]
  ------------------
 9968|      5|              return is_valid = false;
 9969|      5|            }
 9970|     23|          }
 9971|     47|        }
 9972|    128|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
 9973|    128|            address[static_cast<size_t>(piece_index)] * 0x100 +
 9974|    128|            static_cast<uint16_t>(ipv4_piece));
 9975|    128|        ++numbers_seen;
 9976|    128|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (9976:13): [True: 41, False: 87]
  |  Branch (9976:34): [True: 12, False: 75]
  ------------------
 9977|     53|          ++piece_index;
 9978|     53|        }
 9979|    128|      }
 9980|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (9980:11): [True: 12, False: 6]
  ------------------
 9981|     12|        return is_valid = false;
 9982|     12|      }
 9983|      6|      break;
 9984|     18|    }
 9985|       |
 9986|    913|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (9986:9): [True: 16, False: 897]
  ------------------
 9987|     16|      return is_valid = false;
 9988|     16|    }
 9989|       |
 9990|    897|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (9990:9): [True: 668, False: 229]
  |  Branch (9990:27): [True: 657, False: 11]
  ------------------
 9991|    657|      ++pointer;
 9992|    657|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (9992:11): [True: 3, False: 654]
  ------------------
 9993|      3|        return is_valid = false;
 9994|      3|      }
 9995|    657|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (9995:16): [True: 11, False: 229]
  ------------------
 9996|     11|      return is_valid = false;
 9997|     11|    }
 9998|       |
 9999|    883|    address[static_cast<size_t>(piece_index)] = value;
10000|    883|    ++piece_index;
10001|    883|  }
10002|       |
10003|    469|  if (compress != -1) {
  ------------------
  |  Branch (10003:7): [True: 426, False: 43]
  ------------------
10004|    426|    const int right = piece_index - compress;
10005|    426|    if (right > 0) {
  ------------------
  |  Branch (10005:9): [True: 192, False: 234]
  ------------------
10006|    192|      const size_t dest = static_cast<size_t>(8 - right);
10007|    192|      const size_t src = static_cast<size_t>(compress);
10008|    192|      if (dest != src) {
  ------------------
  |  Branch (10008:11): [True: 183, False: 9]
  ------------------
10009|    503|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (10009:53): [True: 320, False: 183]
  ------------------
10010|    320|          address[dest + i] = address[src + i];
10011|    320|          address[src + i] = 0;
10012|    320|        }
10013|    183|      }
10014|    192|    }
10015|    426|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (10015:14): [True: 29, False: 14]
  ------------------
10016|     29|    return is_valid = false;
10017|     29|  }
10018|       |
10019|    440|  host = ada::serializers::ipv6(address);
10020|    440|  ada_log("parse_ipv6 ", *host);
10021|    440|  host_type = IPV6;
10022|    440|  return true;
10023|    469|}
_ZNK3ada3url12get_protocolEv:
10352|   192k|[[nodiscard]] std::string url::get_protocol() const {
10353|   192k|  if (is_special()) {
  ------------------
  |  Branch (10353:7): [True: 191k, False: 623]
  ------------------
10354|   191k|    return helpers::concat(ada::scheme::details::is_special_list[type], ":");
10355|   191k|  }
10356|       |  // We only move the 'scheme' if it is non-special.
10357|    623|  return helpers::concat(non_special_scheme, ":");
10358|   192k|}
_ZNK3ada3url8get_hostEv:
10360|   192k|[[nodiscard]] std::string url::get_host() const {
10361|       |  // If url's host is null, then return the empty string.
10362|       |  // If url's port is null, return url's host, serialized.
10363|       |  // Return url's host, serialized, followed by U+003A (:) and url's port,
10364|       |  // serialized.
10365|   192k|  if (!host.has_value()) {
  ------------------
  |  Branch (10365:7): [True: 396, False: 191k]
  ------------------
10366|    396|    return "";
10367|    396|  }
10368|   191k|  if (port.has_value()) {
  ------------------
  |  Branch (10368:7): [True: 19.8k, False: 171k]
  ------------------
10369|  19.8k|    return host.value() + ":" + get_port();
10370|  19.8k|  }
10371|   171k|  return host.value();
10372|   191k|}
_ZNK3ada3url12get_hostnameEv:
10374|   192k|[[nodiscard]] std::string url::get_hostname() const {
10375|   192k|  return host.value_or("");
10376|   192k|}
_ZNK3ada3url10get_searchEv:
10378|   192k|[[nodiscard]] std::string url::get_search() const {
10379|       |  // If this's URL's query is either null or the empty string, then return the
10380|       |  // empty string. Return U+003F (?), followed by this's URL's query.
10381|   192k|  return (!query.has_value() || (query->empty())) ? "" : "?" + query.value();
  ------------------
  |  Branch (10381:11): [True: 159k, False: 32.6k]
  |  Branch (10381:33): [True: 1.09k, False: 31.5k]
  ------------------
10382|   192k|}
_ZNK3ada3url12get_usernameEv:
10384|   192k|[[nodiscard]] const std::string& url::get_username() const noexcept {
10385|   192k|  return username;
10386|   192k|}
_ZNK3ada3url12get_passwordEv:
10388|   192k|[[nodiscard]] const std::string& url::get_password() const noexcept {
10389|   192k|  return password;
10390|   192k|}
_ZNK3ada3url8get_portEv:
10392|   212k|[[nodiscard]] std::string url::get_port() const {
10393|   212k|  return port.has_value() ? std::to_string(port.value()) : "";
  ------------------
  |  Branch (10393:10): [True: 39.7k, False: 172k]
  ------------------
10394|   212k|}
_ZNK3ada3url8get_hashEv:
10396|   192k|[[nodiscard]] std::string url::get_hash() const {
10397|       |  // If this's URL's fragment is either null or the empty string, then return
10398|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
10399|   192k|  return (!hash.has_value() || (hash->empty())) ? "" : "#" + hash.value();
  ------------------
  |  Branch (10399:11): [True: 168k, False: 23.5k]
  |  Branch (10399:32): [True: 1.40k, False: 22.1k]
  ------------------
10400|   192k|}
_ZN3ada3url8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10690|   192k|bool url::set_href(const std::string_view input) {
10691|   192k|  ada::result<ada::url> out = ada::parse<ada::url>(input);
10692|       |
10693|   192k|  if (out) {
  ------------------
  |  Branch (10693:7): [True: 192k, False: 0]
  ------------------
10694|       |    // The parser enforces get_max_input_length() on both the input and the
10695|       |    // normalized result. This is a defense-in-depth check.
10696|   192k|    if (out->get_href_size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (10696:9): [True: 0, False: 192k]
  ------------------
10697|      0|      return false;
10698|      0|    }
10699|   192k|    *this = *out;
10700|   192k|  }
10701|       |
10702|   192k|  return out.has_value();
10703|   192k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11957|   425k|                                                result_type& out) {
11958|   425k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11959|   425k|  constexpr bool is_aggregator =
11960|   425k|      std::is_same_v<result_type, ada::url_aggregator>;
11961|   425k|  static_assert(is_ada_url || is_aggregator);
11962|       |
11963|   425k|  const size_t len = input.size();
11964|       |  // Shortest accepted form is "ws://x" (6).
11965|   425k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11965:7): [True: 18, False: 425k]
  ------------------
11966|     18|    return false;
11967|     18|  }
11968|   425k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11969|       |
11970|   425k|  size_t pos = 0;
11971|   425k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11972|   425k|  uint32_t protocol_end = 0;
11973|   425k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11974|   425k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11975|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11976|       |  // Masked compares cover the shorter special schemes without extra loads.
11977|   425k|  if (len >= 8) {
  ------------------
  |  Branch (11977:7): [True: 424k, False: 219]
  ------------------
11978|   424k|    uint64_t first8 = 0;
11979|   424k|    std::memcpy(&first8, b, 8);
11980|   424k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11980:9): [True: 334k, False: 90.6k]
  ------------------
11981|   334k|      pos = 8;
11982|   334k|      scheme_type = ada::scheme::type::HTTPS;
11983|   334k|      protocol_end = 6;
11984|   334k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11984:16): [True: 84.3k, False: 6.34k]
  ------------------
11985|  90.6k|               0x002f2f3a70747468ull) {  // "http://"
11986|  84.3k|      pos = 7;
11987|  84.3k|      scheme_type = ada::scheme::type::HTTP;
11988|  84.3k|      protocol_end = 5;
11989|  84.3k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11989:16): [True: 8, False: 6.33k]
  ------------------
11990|  6.34k|               0x00002f2f3a737377ull) {  // "wss://"
11991|      8|      pos = 6;
11992|      8|      scheme_type = ada::scheme::type::WSS;
11993|      8|      protocol_end = 4;
11994|  6.33k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11994:16): [True: 49, False: 6.28k]
  ------------------
11995|  6.33k|               0x00002f2f3a707466ull) {  // "ftp://"
11996|     49|      pos = 6;
11997|     49|      scheme_type = ada::scheme::type::FTP;
11998|     49|      protocol_end = 4;
11999|  6.28k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11999:16): [True: 203, False: 6.08k]
  ------------------
12000|  6.28k|               0x0000002f2f3a7377ull) {  // "ws://"
12001|    203|      pos = 5;
12002|    203|      scheme_type = ada::scheme::type::WS;
12003|    203|      protocol_end = 3;
12004|  6.08k|    } else {
12005|  6.08k|      return false;
12006|  6.08k|    }
12007|   424k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12007:14): [True: 48, False: 171]
  |  Branch (12007:29): [True: 30, False: 18]
  ------------------
12008|     30|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12008:9): [True: 3, False: 27]
  |  Branch (12008:24): [True: 2, False: 1]
  |  Branch (12008:39): [True: 2, False: 0]
  ------------------
12009|      2|      pos = 5;
12010|      2|      scheme_type = ada::scheme::type::WS;
12011|      2|      protocol_end = 3;
12012|     28|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12012:16): [True: 5, False: 23]
  |  Branch (12012:31): [True: 0, False: 5]
  |  Branch (12012:46): [True: 0, False: 0]
  |  Branch (12012:61): [True: 0, False: 0]
  ------------------
12013|      0|      pos = 6;
12014|      0|      scheme_type = ada::scheme::type::WSS;
12015|      0|      protocol_end = 4;
12016|     28|    } else {
12017|     28|      return false;
12018|     28|    }
12019|    189|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12019:14): [True: 40, False: 149]
  |  Branch (12019:29): [True: 19, False: 21]
  |  Branch (12019:44): [True: 6, False: 13]
  |  Branch (12019:59): [True: 0, False: 6]
  ------------------
12020|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12020:14): [True: 0, False: 0]
  |  Branch (12020:29): [True: 0, False: 0]
  ------------------
12021|      0|    pos = 6;
12022|      0|    scheme_type = ada::scheme::type::FTP;
12023|      0|    protocol_end = 4;
12024|    189|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12024:14): [True: 150, False: 39]
  |  Branch (12024:26): [True: 90, False: 60]
  |  Branch (12024:41): [True: 69, False: 21]
  |  Branch (12024:56): [True: 53, False: 16]
  ------------------
12025|     53|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12025:14): [True: 44, False: 9]
  |  Branch (12025:29): [True: 23, False: 21]
  |  Branch (12025:44): [True: 11, False: 12]
  |  Branch (12025:59): [True: 4, False: 7]
  ------------------
12026|      4|    pos = 7;
12027|      4|    scheme_type = ada::scheme::type::HTTP;
12028|      4|    protocol_end = 5;
12029|    185|  } else {
12030|    185|    return false;
12031|    185|  }
12032|       |#else
12033|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12034|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12035|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12036|       |    pos = 8;
12037|       |    scheme_type = ada::scheme::type::HTTPS;
12038|       |    protocol_end = 6;
12039|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12040|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12041|       |    pos = 7;
12042|       |    scheme_type = ada::scheme::type::HTTP;
12043|       |    protocol_end = 5;
12044|       |  } else if (b[0] == 'w' && b[1] == 's') {
12045|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12046|       |      pos = 5;
12047|       |      scheme_type = ada::scheme::type::WS;
12048|       |      protocol_end = 3;
12049|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12050|       |               b[5] == '/') {
12051|       |      pos = 6;
12052|       |      scheme_type = ada::scheme::type::WSS;
12053|       |      protocol_end = 4;
12054|       |    } else {
12055|       |      return false;
12056|       |    }
12057|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12058|       |             b[4] == '/' && b[5] == '/') {
12059|       |    pos = 6;
12060|       |    scheme_type = ada::scheme::type::FTP;
12061|       |    protocol_end = 4;
12062|       |  } else {
12063|       |    return false;
12064|       |  }
12065|       |#endif
12066|   418k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12066:7): [True: 418k, False: 5]
  |  Branch (12066:21): [True: 101, False: 418k]
  |  Branch (12066:38): [True: 19, False: 418k]
  ------------------
12067|    120|    return false;
12068|    120|  }
12069|       |
12070|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12071|   418k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12071:7): [True: 418k, False: 5]
  |  Branch (12071:22): [True: 416k, False: 2.16k]
  |  Branch (12071:39): [True: 32, False: 416k]
  |  Branch (12071:57): [True: 6, False: 418k]
  ------------------
12072|     38|    return false;
12073|     38|  }
12074|       |
12075|   418k|  const size_t host_start = pos;
12076|   418k|  bool has_upper = false;
12077|   418k|  bool has_x = false;
12078|   418k|  size_t host_end = pos;
12079|   418k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12079:7): [True: 2.86k, False: 415k]
  ------------------
12080|  2.86k|    return false;
12081|  2.86k|  }
12082|   415k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12082:7): [True: 83, False: 415k]
  ------------------
12083|     83|    return false;
12084|     83|  }
12085|   415k|  const size_t host_len = host_end - host_start;
12086|   415k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12086:7): [True: 278, False: 415k]
  ------------------
12087|    278|    return false;
12088|    278|  }
12089|   415k|  {
12090|   415k|    std::string_view hv(input.data() + host_start, host_len);
12091|   415k|    char host_buf[256];
12092|   415k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12092:9): [True: 9.72k, False: 405k]
  ------------------
12093|  9.72k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12094|  9.72k|      unicode::to_lower_ascii(host_buf, host_len);
12095|  9.72k|      hv = std::string_view(host_buf, host_len);
12096|  9.72k|    }
12097|   415k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12097:9): [True: 18.2k, False: 397k]
  ------------------
12098|  18.2k|      return false;
12099|  18.2k|    }
12100|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12101|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12102|   397k|    static constexpr std::string_view xn{"xn-", 3};
12103|   397k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12103:10): [True: 362k, False: 34.3k]
  |  Branch (12103:19): [True: 460, False: 33.9k]
  |  Branch (12103:33): [True: 57.6k, False: 305k]
  ------------------
12104|  57.6k|        [[unlikely]] {
12105|  57.6k|      return false;
12106|  57.6k|    }
12107|   397k|  }
12108|       |
12109|   339k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12109:7): [True: 330k, False: 9.24k]
  |  Branch (12109:25): [True: 58.5k, False: 271k]
  ------------------
12110|  58.5k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12111|  58.5k|                                            protocol_end, host_start, host_end,
12112|  58.5k|                                            host_len, has_upper);
12113|  58.5k|  }
12114|       |
12115|   281k|  size_t i = host_end;
12116|   281k|  size_t path_start = host_end;
12117|   281k|  size_t path_end = host_end;
12118|   281k|  size_t query_start = std::string_view::npos;
12119|   281k|  size_t hash_start = std::string_view::npos;
12120|   281k|  bool has_path = false;
12121|   281k|  bool maybe_dot_segment = false;
12122|   281k|  bool rest_simple = true;
12123|       |
12124|   281k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12124:7): [True: 271k, False: 9.24k]
  |  Branch (12124:18): [True: 253k, False: 18.5k]
  ------------------
12125|   253k|    has_path = true;
12126|   253k|    path_start = i;
12127|   253k|    ++i;
12128|   253k|    scan_path_run(b, i, len, maybe_dot_segment);
12129|   253k|    if (i < len) {
  ------------------
  |  Branch (12129:9): [True: 106k, False: 147k]
  ------------------
12130|   106k|      const uint8_t cls = k_path[b[i]];
12131|   106k|      if (cls == 1) {
  ------------------
  |  Branch (12131:11): [True: 94.4k, False: 11.5k]
  ------------------
12132|  94.4k|        path_end = i;
12133|  94.4k|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 75.4k, False: 18.9k]
  ------------------
12134|  75.4k|          query_start = i;
12135|  75.4k|          ++i;
12136|  75.4k|          goto scan_query;
12137|  75.4k|        }
12138|  18.9k|        hash_start = i;
12139|  18.9k|        ++i;
12140|  18.9k|        goto scan_hash;
12141|  94.4k|      }
12142|  11.5k|      rest_simple = false;
12143|   269k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12143:14): [True: 259k, False: 10.3k]
  ------------------
12144|   259k|        if (b[i] == '?') {
  ------------------
  |  Branch (12144:13): [True: 943, False: 258k]
  ------------------
12145|    943|          path_end = i;
12146|    943|          query_start = i;
12147|    943|          ++i;
12148|    943|          goto scan_query_boundary;
12149|    943|        }
12150|   258k|        if (b[i] == '#') {
  ------------------
  |  Branch (12150:13): [True: 236, False: 258k]
  ------------------
12151|    236|          path_end = i;
12152|    236|          hash_start = i;
12153|    236|          ++i;
12154|    236|          goto after_rest;
12155|    236|        }
12156|   258k|      }
12157|  10.3k|      path_end = i;
12158|  10.3k|      goto after_rest;
12159|  11.5k|    }
12160|   147k|    path_end = i;
12161|   147k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12161:14): [True: 18.5k, False: 9.24k]
  |  Branch (12161:25): [True: 9.33k, False: 9.18k]
  ------------------
12162|  9.33k|    query_start = i;
12163|  9.33k|    ++i;
12164|  9.33k|    goto scan_query;
12165|  18.4k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12165:14): [True: 9.18k, False: 9.24k]
  |  Branch (12165:25): [True: 9.18k, False: 0]
  ------------------
12166|  9.18k|    hash_start = i;
12167|  9.18k|    ++i;
12168|  9.18k|    goto scan_hash;
12169|  9.18k|  }
12170|   156k|  goto after_rest;
12171|       |
12172|   156k|scan_query:
12173|  84.8k|  scan_query_run(b, i, len);
12174|  84.8k|  if (i < len) {
  ------------------
  |  Branch (12174:7): [True: 29.5k, False: 55.3k]
  ------------------
12175|  29.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12175:9): [True: 29.3k, False: 149]
  ------------------
12176|  29.3k|      hash_start = i;
12177|  29.3k|      ++i;
12178|  29.3k|      goto scan_hash;
12179|  29.3k|    }
12180|    149|    rest_simple = false;
12181|    149|    goto scan_query_boundary;
12182|  29.5k|  }
12183|  55.3k|  goto after_rest;
12184|       |
12185|  55.3k|scan_query_boundary:
12186|  24.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12186:10): [True: 24.4k, False: 467]
  ------------------
12187|  24.4k|    if (b[i] == '#') {
  ------------------
  |  Branch (12187:9): [True: 625, False: 23.8k]
  ------------------
12188|    625|      hash_start = i;
12189|    625|      ++i;
12190|    625|      goto after_rest;
12191|    625|    }
12192|  24.4k|  }
12193|    467|  goto after_rest;
12194|       |
12195|  57.5k|scan_hash:
12196|  57.5k|  scan_hash_run(b, i, len);
12197|  57.5k|  if (i < len) {
  ------------------
  |  Branch (12197:7): [True: 101, False: 57.4k]
  ------------------
12198|    101|    rest_simple = false;
12199|    101|  }
12200|       |
12201|   281k|after_rest:
12202|   281k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12202:7): [True: 269k, False: 11.8k]
  |  Branch (12202:22): [True: 9.76k, False: 259k]
  ------------------
12203|  9.76k|    const std::string_view path_body(input.data() + path_start,
12204|  9.76k|                                     path_end - path_start);
12205|  9.76k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12205:9): [True: 9.42k, False: 342]
  ------------------
12206|  9.42k|      rest_simple = false;
12207|  9.42k|    }
12208|  9.76k|  }
12209|       |
12210|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12211|       |  // trailing C0 control or space; this fast path does neither. A query or
12212|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12213|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12214|       |  // inputs back to the slow path.
12215|   281k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12215:7): [True: 21.2k, False: 259k]
  |  Branch (12215:24): [True: 38, False: 21.1k]
  ------------------
12216|  21.1k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12216:24): [True: 71, False: 21.1k]
  ------------------
12217|    109|    return false;
12218|    109|  }
12219|       |
12220|   280k|  out.type = scheme_type;
12221|   280k|  out.is_valid = true;
12222|   280k|  out.has_opaque_path = false;
12223|   280k|  out.host_type = DEFAULT;
12224|       |
12225|   280k|  if (!rest_simple) {
  ------------------
  |  Branch (12225:7): [True: 21.1k, False: 259k]
  ------------------
12226|       |    // Host is a plain domain. Finish path/query/hash with
12227|       |    // the regular helpers
12228|       |    // so percent-encoding and dot segments do not re-parse the authority.
12229|  21.1k|    const std::string_view path_view =
12230|  21.1k|        has_path
  ------------------
  |  Branch (12230:9): [True: 20.9k, False: 166]
  ------------------
12231|  21.1k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12232|  21.1k|            : std::string_view{};
12233|  21.1k|    auto apply_query_and_hash = [&]() {
12234|  21.1k|      if (query_start != std::string_view::npos) {
12235|  21.1k|        const size_t q_end =
12236|  21.1k|            (hash_start != std::string_view::npos) ? hash_start : len;
12237|  21.1k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|  21.1k|                                                q_end - query_start - 1),
12239|  21.1k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|  21.1k|      }
12241|  21.1k|      if (hash_start != std::string_view::npos) {
12242|  21.1k|        out.update_unencoded_base_hash(std::string_view(
12243|  21.1k|            input.data() + hash_start + 1, len - hash_start - 1));
12244|  21.1k|      }
12245|  21.1k|    };
12246|       |    if constexpr (is_aggregator) {
12247|       |      out.buffer.assign(input.substr(0, host_end));
12248|       |      if (has_upper) {
12249|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12250|       |      }
12251|       |      out.components.protocol_end = protocol_end;
12252|       |      out.components.username_end = protocol_end + 2;
12253|       |      out.components.host_start = protocol_end + 2;
12254|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12255|       |      out.components.port = url_components::omitted;
12256|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12257|       |      out.components.search_start = url_components::omitted;
12258|       |      out.components.hash_start = url_components::omitted;
12259|       |      out.parse_path(path_view);
12260|       |      apply_query_and_hash();
12261|  21.1k|    } else {
12262|  21.1k|      std::string host_str(input.substr(host_start, host_len));
12263|  21.1k|      if (has_upper) {
  ------------------
  |  Branch (12263:11): [True: 170, False: 20.9k]
  ------------------
12264|    170|        unicode::to_lower_ascii(host_str.data(), host_str.size());
12265|    170|      }
12266|  21.1k|      out.host = std::move(host_str);
12267|  21.1k|      out.parse_path(path_view);
12268|  21.1k|      apply_query_and_hash();
12269|  21.1k|    }
12270|  21.1k|    return true;
12271|  21.1k|  }
12272|       |
12273|   259k|  const bool need_slash = !has_path;
12274|       |  if constexpr (is_aggregator) {
12275|       |    if (!need_slash) {
12276|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12277|       |      out.buffer.assign(input);
12278|       |      if (has_upper) {
12279|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12280|       |      }
12281|       |      out.components.protocol_end = protocol_end;
12282|       |      out.components.username_end = protocol_end + 2;
12283|       |      out.components.host_start = protocol_end + 2;
12284|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12285|       |      out.components.port = url_components::omitted;
12286|       |      out.components.pathname_start = static_cast<uint32_t>(path_start);
12287|       |      out.components.search_start = (query_start != std::string_view::npos)
12288|       |                                        ? static_cast<uint32_t>(query_start)
12289|       |                                        : url_components::omitted;
12290|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12291|       |                                      ? static_cast<uint32_t>(hash_start)
12292|       |                                      : url_components::omitted;
12293|       |    } else {
12294|       |      out.buffer.clear();
12295|       |      out.buffer.reserve(len + 1);
12296|       |      out.buffer.append(input.substr(0, host_end));
12297|       |      out.buffer.push_back('/');
12298|       |      if (host_end < len) {
12299|       |        out.buffer.append(input.substr(host_end));
12300|       |      }
12301|       |      if (has_upper) {
12302|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12303|       |      }
12304|       |      out.components.protocol_end = protocol_end;
12305|       |      out.components.username_end = protocol_end + 2;
12306|       |      out.components.host_start = protocol_end + 2;
12307|       |      out.components.host_end = static_cast<uint32_t>(host_end);
12308|       |      out.components.port = url_components::omitted;
12309|       |      out.components.pathname_start = static_cast<uint32_t>(host_end);
12310|       |      out.components.search_start = (query_start != std::string_view::npos)
12311|       |                                        ? static_cast<uint32_t>(query_start + 1)
12312|       |                                        : url_components::omitted;
12313|       |      out.components.hash_start = (hash_start != std::string_view::npos)
12314|       |                                      ? static_cast<uint32_t>(hash_start + 1)
12315|       |                                      : url_components::omitted;
12316|       |    }
12317|   259k|  } else {
12318|   259k|    std::string host_str(input.substr(host_start, host_len));
12319|   259k|    if (has_upper) {
  ------------------
  |  Branch (12319:9): [True: 9.17k, False: 250k]
  ------------------
12320|  9.17k|      unicode::to_lower_ascii(host_str.data(), host_str.size());
12321|  9.17k|    }
12322|   259k|    out.host = std::move(host_str);
12323|   259k|    if (need_slash) {
  ------------------
  |  Branch (12323:9): [True: 27.5k, False: 232k]
  ------------------
12324|  27.5k|      out.path = "/";
12325|   232k|    } else {
12326|   232k|      out.path.assign(input.data() + path_start, path_end - path_start);
12327|   232k|    }
12328|   259k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12328:9): [True: 84.4k, False: 175k]
  ------------------
12329|  84.4k|      const size_t q_end =
12330|  84.4k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12330:11): [True: 29.2k, False: 55.2k]
  ------------------
12331|  84.4k|      out.query.emplace(input.data() + query_start + 1,
12332|  84.4k|                        q_end - query_start - 1);
12333|  84.4k|    }
12334|   259k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12334:9): [True: 57.2k, False: 202k]
  ------------------
12335|  57.2k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12336|  57.2k|    }
12337|   259k|  }
12338|   259k|  return true;
12339|   280k|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11957|   425k|                                                result_type& out) {
11958|   425k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11959|   425k|  constexpr bool is_aggregator =
11960|   425k|      std::is_same_v<result_type, ada::url_aggregator>;
11961|   425k|  static_assert(is_ada_url || is_aggregator);
11962|       |
11963|   425k|  const size_t len = input.size();
11964|       |  // Shortest accepted form is "ws://x" (6).
11965|   425k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11965:7): [True: 18, False: 425k]
  ------------------
11966|     18|    return false;
11967|     18|  }
11968|   425k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11969|       |
11970|   425k|  size_t pos = 0;
11971|   425k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11972|   425k|  uint32_t protocol_end = 0;
11973|   425k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11974|   425k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11975|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11976|       |  // Masked compares cover the shorter special schemes without extra loads.
11977|   425k|  if (len >= 8) {
  ------------------
  |  Branch (11977:7): [True: 424k, False: 219]
  ------------------
11978|   424k|    uint64_t first8 = 0;
11979|   424k|    std::memcpy(&first8, b, 8);
11980|   424k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11980:9): [True: 334k, False: 90.6k]
  ------------------
11981|   334k|      pos = 8;
11982|   334k|      scheme_type = ada::scheme::type::HTTPS;
11983|   334k|      protocol_end = 6;
11984|   334k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11984:16): [True: 84.3k, False: 6.34k]
  ------------------
11985|  90.6k|               0x002f2f3a70747468ull) {  // "http://"
11986|  84.3k|      pos = 7;
11987|  84.3k|      scheme_type = ada::scheme::type::HTTP;
11988|  84.3k|      protocol_end = 5;
11989|  84.3k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11989:16): [True: 8, False: 6.33k]
  ------------------
11990|  6.34k|               0x00002f2f3a737377ull) {  // "wss://"
11991|      8|      pos = 6;
11992|      8|      scheme_type = ada::scheme::type::WSS;
11993|      8|      protocol_end = 4;
11994|  6.33k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11994:16): [True: 49, False: 6.28k]
  ------------------
11995|  6.33k|               0x00002f2f3a707466ull) {  // "ftp://"
11996|     49|      pos = 6;
11997|     49|      scheme_type = ada::scheme::type::FTP;
11998|     49|      protocol_end = 4;
11999|  6.28k|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11999:16): [True: 203, False: 6.08k]
  ------------------
12000|  6.28k|               0x0000002f2f3a7377ull) {  // "ws://"
12001|    203|      pos = 5;
12002|    203|      scheme_type = ada::scheme::type::WS;
12003|    203|      protocol_end = 3;
12004|  6.08k|    } else {
12005|  6.08k|      return false;
12006|  6.08k|    }
12007|   424k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12007:14): [True: 48, False: 171]
  |  Branch (12007:29): [True: 30, False: 18]
  ------------------
12008|     30|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12008:9): [True: 3, False: 27]
  |  Branch (12008:24): [True: 2, False: 1]
  |  Branch (12008:39): [True: 2, False: 0]
  ------------------
12009|      2|      pos = 5;
12010|      2|      scheme_type = ada::scheme::type::WS;
12011|      2|      protocol_end = 3;
12012|     28|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12012:16): [True: 5, False: 23]
  |  Branch (12012:31): [True: 0, False: 5]
  |  Branch (12012:46): [True: 0, False: 0]
  |  Branch (12012:61): [True: 0, False: 0]
  ------------------
12013|      0|      pos = 6;
12014|      0|      scheme_type = ada::scheme::type::WSS;
12015|      0|      protocol_end = 4;
12016|     28|    } else {
12017|     28|      return false;
12018|     28|    }
12019|    189|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12019:14): [True: 40, False: 149]
  |  Branch (12019:29): [True: 19, False: 21]
  |  Branch (12019:44): [True: 6, False: 13]
  |  Branch (12019:59): [True: 0, False: 6]
  ------------------
12020|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12020:14): [True: 0, False: 0]
  |  Branch (12020:29): [True: 0, False: 0]
  ------------------
12021|      0|    pos = 6;
12022|      0|    scheme_type = ada::scheme::type::FTP;
12023|      0|    protocol_end = 4;
12024|    189|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12024:14): [True: 150, False: 39]
  |  Branch (12024:26): [True: 90, False: 60]
  |  Branch (12024:41): [True: 69, False: 21]
  |  Branch (12024:56): [True: 53, False: 16]
  ------------------
12025|     53|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12025:14): [True: 44, False: 9]
  |  Branch (12025:29): [True: 23, False: 21]
  |  Branch (12025:44): [True: 11, False: 12]
  |  Branch (12025:59): [True: 4, False: 7]
  ------------------
12026|      4|    pos = 7;
12027|      4|    scheme_type = ada::scheme::type::HTTP;
12028|      4|    protocol_end = 5;
12029|    185|  } else {
12030|    185|    return false;
12031|    185|  }
12032|       |#else
12033|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12034|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12035|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12036|       |    pos = 8;
12037|       |    scheme_type = ada::scheme::type::HTTPS;
12038|       |    protocol_end = 6;
12039|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12040|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12041|       |    pos = 7;
12042|       |    scheme_type = ada::scheme::type::HTTP;
12043|       |    protocol_end = 5;
12044|       |  } else if (b[0] == 'w' && b[1] == 's') {
12045|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12046|       |      pos = 5;
12047|       |      scheme_type = ada::scheme::type::WS;
12048|       |      protocol_end = 3;
12049|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12050|       |               b[5] == '/') {
12051|       |      pos = 6;
12052|       |      scheme_type = ada::scheme::type::WSS;
12053|       |      protocol_end = 4;
12054|       |    } else {
12055|       |      return false;
12056|       |    }
12057|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12058|       |             b[4] == '/' && b[5] == '/') {
12059|       |    pos = 6;
12060|       |    scheme_type = ada::scheme::type::FTP;
12061|       |    protocol_end = 4;
12062|       |  } else {
12063|       |    return false;
12064|       |  }
12065|       |#endif
12066|   418k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12066:7): [True: 418k, False: 5]
  |  Branch (12066:21): [True: 101, False: 418k]
  |  Branch (12066:38): [True: 19, False: 418k]
  ------------------
12067|    120|    return false;
12068|    120|  }
12069|       |
12070|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12071|   418k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12071:7): [True: 418k, False: 5]
  |  Branch (12071:22): [True: 416k, False: 2.16k]
  |  Branch (12071:39): [True: 32, False: 416k]
  |  Branch (12071:57): [True: 6, False: 418k]
  ------------------
12072|     38|    return false;
12073|     38|  }
12074|       |
12075|   418k|  const size_t host_start = pos;
12076|   418k|  bool has_upper = false;
12077|   418k|  bool has_x = false;
12078|   418k|  size_t host_end = pos;
12079|   418k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12079:7): [True: 2.86k, False: 415k]
  ------------------
12080|  2.86k|    return false;
12081|  2.86k|  }
12082|   415k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12082:7): [True: 83, False: 415k]
  ------------------
12083|     83|    return false;
12084|     83|  }
12085|   415k|  const size_t host_len = host_end - host_start;
12086|   415k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12086:7): [True: 278, False: 415k]
  ------------------
12087|    278|    return false;
12088|    278|  }
12089|   415k|  {
12090|   415k|    std::string_view hv(input.data() + host_start, host_len);
12091|   415k|    char host_buf[256];
12092|   415k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12092:9): [True: 9.72k, False: 405k]
  ------------------
12093|  9.72k|      std::memcpy(host_buf, input.data() + host_start, host_len);
12094|  9.72k|      unicode::to_lower_ascii(host_buf, host_len);
12095|  9.72k|      hv = std::string_view(host_buf, host_len);
12096|  9.72k|    }
12097|   415k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12097:9): [True: 18.2k, False: 397k]
  ------------------
12098|  18.2k|      return false;
12099|  18.2k|    }
12100|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12101|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12102|   397k|    static constexpr std::string_view xn{"xn-", 3};
12103|   397k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12103:10): [True: 362k, False: 34.3k]
  |  Branch (12103:19): [True: 460, False: 33.9k]
  |  Branch (12103:33): [True: 57.6k, False: 305k]
  ------------------
12104|  57.6k|        [[unlikely]] {
12105|  57.6k|      return false;
12106|  57.6k|    }
12107|   397k|  }
12108|       |
12109|   339k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12109:7): [True: 330k, False: 9.24k]
  |  Branch (12109:25): [True: 58.5k, False: 271k]
  ------------------
12110|  58.5k|    return finish_simple_absolute_with_port(input, out, scheme_type,
12111|  58.5k|                                            protocol_end, host_start, host_end,
12112|  58.5k|                                            host_len, has_upper);
12113|  58.5k|  }
12114|       |
12115|   281k|  size_t i = host_end;
12116|   281k|  size_t path_start = host_end;
12117|   281k|  size_t path_end = host_end;
12118|   281k|  size_t query_start = std::string_view::npos;
12119|   281k|  size_t hash_start = std::string_view::npos;
12120|   281k|  bool has_path = false;
12121|   281k|  bool maybe_dot_segment = false;
12122|   281k|  bool rest_simple = true;
12123|       |
12124|   281k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12124:7): [True: 271k, False: 9.24k]
  |  Branch (12124:18): [True: 253k, False: 18.5k]
  ------------------
12125|   253k|    has_path = true;
12126|   253k|    path_start = i;
12127|   253k|    ++i;
12128|   253k|    scan_path_run(b, i, len, maybe_dot_segment);
12129|   253k|    if (i < len) {
  ------------------
  |  Branch (12129:9): [True: 106k, False: 147k]
  ------------------
12130|   106k|      const uint8_t cls = k_path[b[i]];
12131|   106k|      if (cls == 1) {
  ------------------
  |  Branch (12131:11): [True: 94.4k, False: 11.5k]
  ------------------
12132|  94.4k|        path_end = i;
12133|  94.4k|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 75.4k, False: 18.9k]
  ------------------
12134|  75.4k|          query_start = i;
12135|  75.4k|          ++i;
12136|  75.4k|          goto scan_query;
12137|  75.4k|        }
12138|  18.9k|        hash_start = i;
12139|  18.9k|        ++i;
12140|  18.9k|        goto scan_hash;
12141|  94.4k|      }
12142|  11.5k|      rest_simple = false;
12143|   269k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12143:14): [True: 259k, False: 10.3k]
  ------------------
12144|   259k|        if (b[i] == '?') {
  ------------------
  |  Branch (12144:13): [True: 943, False: 258k]
  ------------------
12145|    943|          path_end = i;
12146|    943|          query_start = i;
12147|    943|          ++i;
12148|    943|          goto scan_query_boundary;
12149|    943|        }
12150|   258k|        if (b[i] == '#') {
  ------------------
  |  Branch (12150:13): [True: 236, False: 258k]
  ------------------
12151|    236|          path_end = i;
12152|    236|          hash_start = i;
12153|    236|          ++i;
12154|    236|          goto after_rest;
12155|    236|        }
12156|   258k|      }
12157|  10.3k|      path_end = i;
12158|  10.3k|      goto after_rest;
12159|  11.5k|    }
12160|   147k|    path_end = i;
12161|   147k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12161:14): [True: 18.5k, False: 9.24k]
  |  Branch (12161:25): [True: 9.33k, False: 9.18k]
  ------------------
12162|  9.33k|    query_start = i;
12163|  9.33k|    ++i;
12164|  9.33k|    goto scan_query;
12165|  18.4k|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12165:14): [True: 9.18k, False: 9.24k]
  |  Branch (12165:25): [True: 9.18k, False: 0]
  ------------------
12166|  9.18k|    hash_start = i;
12167|  9.18k|    ++i;
12168|  9.18k|    goto scan_hash;
12169|  9.18k|  }
12170|   156k|  goto after_rest;
12171|       |
12172|   156k|scan_query:
12173|  84.8k|  scan_query_run(b, i, len);
12174|  84.8k|  if (i < len) {
  ------------------
  |  Branch (12174:7): [True: 29.5k, False: 55.3k]
  ------------------
12175|  29.5k|    if (b[i] == '#') {
  ------------------
  |  Branch (12175:9): [True: 29.3k, False: 149]
  ------------------
12176|  29.3k|      hash_start = i;
12177|  29.3k|      ++i;
12178|  29.3k|      goto scan_hash;
12179|  29.3k|    }
12180|    149|    rest_simple = false;
12181|    149|    goto scan_query_boundary;
12182|  29.5k|  }
12183|  55.3k|  goto after_rest;
12184|       |
12185|  55.3k|scan_query_boundary:
12186|  24.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12186:10): [True: 24.4k, False: 467]
  ------------------
12187|  24.4k|    if (b[i] == '#') {
  ------------------
  |  Branch (12187:9): [True: 625, False: 23.8k]
  ------------------
12188|    625|      hash_start = i;
12189|    625|      ++i;
12190|    625|      goto after_rest;
12191|    625|    }
12192|  24.4k|  }
12193|    467|  goto after_rest;
12194|       |
12195|  57.5k|scan_hash:
12196|  57.5k|  scan_hash_run(b, i, len);
12197|  57.5k|  if (i < len) {
  ------------------
  |  Branch (12197:7): [True: 101, False: 57.4k]
  ------------------
12198|    101|    rest_simple = false;
12199|    101|  }
12200|       |
12201|   281k|after_rest:
12202|   281k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12202:7): [True: 269k, False: 11.8k]
  |  Branch (12202:22): [True: 9.76k, False: 259k]
  ------------------
12203|  9.76k|    const std::string_view path_body(input.data() + path_start,
12204|  9.76k|                                     path_end - path_start);
12205|  9.76k|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12205:9): [True: 9.42k, False: 342]
  ------------------
12206|  9.42k|      rest_simple = false;
12207|  9.42k|    }
12208|  9.76k|  }
12209|       |
12210|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12211|       |  // trailing C0 control or space; this fast path does neither. A query or
12212|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12213|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12214|       |  // inputs back to the slow path.
12215|   281k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12215:7): [True: 21.2k, False: 259k]
  |  Branch (12215:24): [True: 38, False: 21.1k]
  ------------------
12216|  21.1k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12216:24): [True: 71, False: 21.1k]
  ------------------
12217|    109|    return false;
12218|    109|  }
12219|       |
12220|   280k|  out.type = scheme_type;
12221|   280k|  out.is_valid = true;
12222|   280k|  out.has_opaque_path = false;
12223|   280k|  out.host_type = DEFAULT;
12224|       |
12225|   280k|  if (!rest_simple) {
  ------------------
  |  Branch (12225:7): [True: 21.1k, False: 259k]
  ------------------
12226|       |    // Host is a plain domain. Finish path/query/hash with
12227|       |    // the regular helpers
12228|       |    // so percent-encoding and dot segments do not re-parse the authority.
12229|  21.1k|    const std::string_view path_view =
12230|  21.1k|        has_path
  ------------------
  |  Branch (12230:9): [True: 20.9k, False: 166]
  ------------------
12231|  21.1k|            ? std::string_view(input.data() + path_start, path_end - path_start)
12232|  21.1k|            : std::string_view{};
12233|  21.1k|    auto apply_query_and_hash = [&]() {
12234|  21.1k|      if (query_start != std::string_view::npos) {
12235|  21.1k|        const size_t q_end =
12236|  21.1k|            (hash_start != std::string_view::npos) ? hash_start : len;
12237|  21.1k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|  21.1k|                                                q_end - query_start - 1),
12239|  21.1k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|  21.1k|      }
12241|  21.1k|      if (hash_start != std::string_view::npos) {
12242|  21.1k|        out.update_unencoded_base_hash(std::string_view(
12243|  21.1k|            input.data() + hash_start + 1, len - hash_start - 1));
12244|  21.1k|      }
12245|  21.1k|    };
12246|  21.1k|    if constexpr (is_aggregator) {
12247|  21.1k|      out.buffer.assign(input.substr(0, host_end));
12248|  21.1k|      if (has_upper) {
  ------------------
  |  Branch (12248:11): [True: 170, False: 20.9k]
  ------------------
12249|    170|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12250|    170|      }
12251|  21.1k|      out.components.protocol_end = protocol_end;
12252|  21.1k|      out.components.username_end = protocol_end + 2;
12253|  21.1k|      out.components.host_start = protocol_end + 2;
12254|  21.1k|      out.components.host_end = static_cast<uint32_t>(host_end);
12255|  21.1k|      out.components.port = url_components::omitted;
12256|  21.1k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12257|  21.1k|      out.components.search_start = url_components::omitted;
12258|  21.1k|      out.components.hash_start = url_components::omitted;
12259|  21.1k|      out.parse_path(path_view);
12260|  21.1k|      apply_query_and_hash();
12261|       |    } else {
12262|       |      std::string host_str(input.substr(host_start, host_len));
12263|       |      if (has_upper) {
12264|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12265|       |      }
12266|       |      out.host = std::move(host_str);
12267|       |      out.parse_path(path_view);
12268|       |      apply_query_and_hash();
12269|       |    }
12270|  21.1k|    return true;
12271|  21.1k|  }
12272|       |
12273|   259k|  const bool need_slash = !has_path;
12274|   259k|  if constexpr (is_aggregator) {
12275|   259k|    if (!need_slash) {
  ------------------
  |  Branch (12275:9): [True: 232k, False: 27.5k]
  ------------------
12276|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12277|   232k|      out.buffer.assign(input);
12278|   232k|      if (has_upper) {
  ------------------
  |  Branch (12278:11): [True: 9.09k, False: 223k]
  ------------------
12279|  9.09k|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12280|  9.09k|      }
12281|   232k|      out.components.protocol_end = protocol_end;
12282|   232k|      out.components.username_end = protocol_end + 2;
12283|   232k|      out.components.host_start = protocol_end + 2;
12284|   232k|      out.components.host_end = static_cast<uint32_t>(host_end);
12285|   232k|      out.components.port = url_components::omitted;
12286|   232k|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12287|   232k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12287:37): [True: 75.2k, False: 156k]
  ------------------
12288|   232k|                                        ? static_cast<uint32_t>(query_start)
12289|   232k|                                        : url_components::omitted;
12290|   232k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12290:35): [True: 48.0k, False: 184k]
  ------------------
12291|   232k|                                      ? static_cast<uint32_t>(hash_start)
12292|   232k|                                      : url_components::omitted;
12293|   232k|    } else {
12294|  27.5k|      out.buffer.clear();
12295|  27.5k|      out.buffer.reserve(len + 1);
12296|  27.5k|      out.buffer.append(input.substr(0, host_end));
12297|  27.5k|      out.buffer.push_back('/');
12298|  27.5k|      if (host_end < len) {
  ------------------
  |  Branch (12298:11): [True: 18.3k, False: 9.24k]
  ------------------
12299|  18.3k|        out.buffer.append(input.substr(host_end));
12300|  18.3k|      }
12301|  27.5k|      if (has_upper) {
  ------------------
  |  Branch (12301:11): [True: 83, False: 27.4k]
  ------------------
12302|     83|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12303|     83|      }
12304|  27.5k|      out.components.protocol_end = protocol_end;
12305|  27.5k|      out.components.username_end = protocol_end + 2;
12306|  27.5k|      out.components.host_start = protocol_end + 2;
12307|  27.5k|      out.components.host_end = static_cast<uint32_t>(host_end);
12308|  27.5k|      out.components.port = url_components::omitted;
12309|  27.5k|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12310|  27.5k|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12310:37): [True: 9.20k, False: 18.3k]
  ------------------
12311|  27.5k|                                        ? static_cast<uint32_t>(query_start + 1)
12312|  27.5k|                                        : url_components::omitted;
12313|  27.5k|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12313:35): [True: 9.21k, False: 18.3k]
  ------------------
12314|  27.5k|                                      ? static_cast<uint32_t>(hash_start + 1)
12315|  27.5k|                                      : url_components::omitted;
12316|  27.5k|    }
12317|       |  } else {
12318|       |    std::string host_str(input.substr(host_start, host_len));
12319|       |    if (has_upper) {
12320|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12321|       |    }
12322|       |    out.host = std::move(host_str);
12323|       |    if (need_slash) {
12324|       |      out.path = "/";
12325|       |    } else {
12326|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12327|       |    }
12328|       |    if (query_start != std::string_view::npos) {
12329|       |      const size_t q_end =
12330|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12331|       |      out.query.emplace(input.data() + query_start + 1,
12332|       |                        q_end - query_start - 1);
12333|       |    }
12334|       |    if (hash_start != std::string_view::npos) {
12335|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12336|       |    }
12337|       |  }
12338|   259k|  return true;
12339|   280k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11685|  58.5k|    bool has_upper) {
11686|  58.5k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11687|  58.5k|  constexpr bool is_aggregator =
11688|  58.5k|      std::is_same_v<result_type, ada::url_aggregator>;
11689|  58.5k|  static_assert(is_ada_url || is_aggregator);
11690|       |
11691|  58.5k|  const size_t len = input.size();
11692|  58.5k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11693|  58.5k|  size_t p = host_end + 1;
11694|  58.5k|  uint32_t port_value = 0;
11695|  58.5k|  bool any_digit = false;
11696|   253k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11696:10): [True: 253k, False: 54]
  |  Branch (11696:21): [True: 194k, False: 58.2k]
  |  Branch (11696:36): [True: 194k, False: 257]
  ------------------
11697|   194k|    any_digit = true;
11698|   194k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11699|   194k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11699:9): [True: 19, False: 194k]
  ------------------
11700|     19|      return false;
11701|     19|    }
11702|   194k|    ++p;
11703|   194k|  }
11704|  58.5k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11704:7): [True: 58.4k, False: 54]
  |  Branch (11704:18): [True: 362, False: 58.0k]
  |  Branch (11704:33): [True: 260, False: 102]
  |  Branch (11704:48): [True: 194, False: 66]
  ------------------
11705|    194|    return false;
11706|    194|  }
11707|  58.3k|  uint32_t parsed_port = url_components::omitted;
11708|  58.3k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11709|  58.3k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11709:7): [True: 57.9k, False: 393]
  |  Branch (11709:20): [True: 57.9k, False: 6]
  ------------------
11710|  57.9k|    parsed_port = port_value;
11711|  57.9k|  }
11712|  58.3k|  const size_t authority_end = p;
11713|       |
11714|  58.3k|  size_t i = authority_end;
11715|  58.3k|  size_t path_start = host_end;
11716|  58.3k|  size_t path_end = host_end;
11717|  58.3k|  size_t query_start = std::string_view::npos;
11718|  58.3k|  size_t hash_start = std::string_view::npos;
11719|  58.3k|  bool has_path = false;
11720|  58.3k|  bool maybe_dot_segment = false;
11721|  58.3k|  bool rest_simple = true;
11722|       |
11723|  58.3k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11723:7): [True: 58.2k, False: 54]
  |  Branch (11723:18): [True: 58.0k, False: 168]
  ------------------
11724|  58.0k|    has_path = true;
11725|  58.0k|    path_start = i;
11726|  58.0k|    ++i;
11727|  58.0k|    scan_path_run(b, i, len, maybe_dot_segment);
11728|  58.0k|    if (i < len) {
  ------------------
  |  Branch (11728:9): [True: 3.37k, False: 54.7k]
  ------------------
11729|  3.37k|      const uint8_t cls = k_path[b[i]];
11730|  3.37k|      if (cls == 1) {
  ------------------
  |  Branch (11730:11): [True: 2.00k, False: 1.37k]
  ------------------
11731|  2.00k|        path_end = i;
11732|  2.00k|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 1.57k, False: 426]
  ------------------
11733|  1.57k|          query_start = i;
11734|  1.57k|          ++i;
11735|  1.57k|          goto scan_query;
11736|  1.57k|        }
11737|    426|        hash_start = i;
11738|    426|        ++i;
11739|    426|        goto scan_hash;
11740|  2.00k|      }
11741|  1.37k|      rest_simple = false;
11742|  76.6k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11742:14): [True: 76.0k, False: 560]
  ------------------
11743|  76.0k|        if (b[i] == '?') {
  ------------------
  |  Branch (11743:13): [True: 659, False: 75.4k]
  ------------------
11744|    659|          path_end = i;
11745|    659|          query_start = i;
11746|    659|          ++i;
11747|    659|          goto scan_query_boundary;
11748|    659|        }
11749|  75.4k|        if (b[i] == '#') {
  ------------------
  |  Branch (11749:13): [True: 154, False: 75.2k]
  ------------------
11750|    154|          path_end = i;
11751|    154|          hash_start = i;
11752|    154|          ++i;
11753|    154|          goto after_rest;
11754|    154|        }
11755|  75.4k|      }
11756|    560|      path_end = i;
11757|    560|      goto after_rest;
11758|  1.37k|    }
11759|  54.7k|    path_end = i;
11760|  54.7k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11760:14): [True: 168, False: 54]
  |  Branch (11760:25): [True: 102, False: 66]
  ------------------
11761|    102|    query_start = i;
11762|    102|    ++i;
11763|    102|    goto scan_query;
11764|    120|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11764:14): [True: 66, False: 54]
  |  Branch (11764:25): [True: 66, False: 0]
  ------------------
11765|     66|    hash_start = i;
11766|     66|    ++i;
11767|     66|    goto scan_hash;
11768|     66|  }
11769|  54.7k|  goto after_rest;
11770|       |
11771|  54.7k|scan_query:
11772|  1.68k|  scan_query_run(b, i, len);
11773|  1.68k|  if (i < len) {
  ------------------
  |  Branch (11773:7): [True: 1.16k, False: 521]
  ------------------
11774|  1.16k|    if (b[i] == '#') {
  ------------------
  |  Branch (11774:9): [True: 1.09k, False: 61]
  ------------------
11775|  1.09k|      hash_start = i;
11776|  1.09k|      ++i;
11777|  1.09k|      goto scan_hash;
11778|  1.09k|    }
11779|     61|    rest_simple = false;
11780|     61|    goto scan_query_boundary;
11781|  1.16k|  }
11782|    521|  goto after_rest;
11783|       |
11784|    720|scan_query_boundary:
11785|  17.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11785:10): [True: 17.7k, False: 260]
  ------------------
11786|  17.7k|    if (b[i] == '#') {
  ------------------
  |  Branch (11786:9): [True: 460, False: 17.2k]
  ------------------
11787|    460|      hash_start = i;
11788|    460|      ++i;
11789|    460|      goto after_rest;
11790|    460|    }
11791|  17.7k|  }
11792|    260|  goto after_rest;
11793|       |
11794|  1.59k|scan_hash:
11795|  1.59k|  scan_hash_run(b, i, len);
11796|  1.59k|  if (i < len) {
  ------------------
  |  Branch (11796:7): [True: 51, False: 1.54k]
  ------------------
11797|     51|    rest_simple = false;
11798|     51|  }
11799|       |
11800|  58.3k|after_rest:
11801|  58.3k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11801:7): [True: 56.8k, False: 1.48k]
  |  Branch (11801:22): [True: 388, False: 56.4k]
  ------------------
11802|    388|    const std::string_view path_body(input.data() + path_start,
11803|    388|                                     path_end - path_start);
11804|    388|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11804:9): [True: 315, False: 73]
  ------------------
11805|    315|      rest_simple = false;
11806|    315|    }
11807|    388|  }
11808|       |
11809|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11810|       |  // trailing C0 control or space; this fast path does neither. A query or
11811|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11812|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11813|       |  // inputs back to the slow path.
11814|  58.3k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11814:7): [True: 1.80k, False: 56.5k]
  |  Branch (11814:24): [True: 21, False: 1.77k]
  ------------------
11815|  1.77k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11815:24): [True: 39, False: 1.74k]
  ------------------
11816|     60|    return false;
11817|     60|  }
11818|       |
11819|  58.2k|  out.type = scheme_type;
11820|  58.2k|  out.is_valid = true;
11821|  58.2k|  out.has_opaque_path = false;
11822|  58.2k|  out.host_type = DEFAULT;
11823|       |
11824|  58.2k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11824:31): [True: 57.8k, False: 370]
  ------------------
11825|  58.2k|                                  ? (1 + port_decimal_digit_count(parsed_port))
11826|  58.2k|                                  : 0;
11827|       |
11828|  58.2k|  if (!rest_simple) {
  ------------------
  |  Branch (11828:7): [True: 1.74k, False: 56.5k]
  ------------------
11829|  1.74k|    const std::string_view path_view =
11830|  1.74k|        has_path
  ------------------
  |  Branch (11830:9): [True: 1.69k, False: 50]
  ------------------
11831|  1.74k|            ? std::string_view(input.data() + path_start, path_end - path_start)
11832|  1.74k|            : std::string_view{};
11833|  1.74k|    auto apply_query_and_hash = [&]() {
11834|  1.74k|      if (query_start != std::string_view::npos) {
11835|  1.74k|        const size_t q_end =
11836|  1.74k|            (hash_start != std::string_view::npos) ? hash_start : len;
11837|  1.74k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|  1.74k|                                                q_end - query_start - 1),
11839|  1.74k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|  1.74k|      }
11841|  1.74k|      if (hash_start != std::string_view::npos) {
11842|  1.74k|        out.update_unencoded_base_hash(std::string_view(
11843|  1.74k|            input.data() + hash_start + 1, len - hash_start - 1));
11844|  1.74k|      }
11845|  1.74k|    };
11846|       |    if constexpr (is_aggregator) {
11847|       |      out.buffer.assign(input.substr(0, host_end));
11848|       |      if (parsed_port != url_components::omitted) {
11849|       |        append_canonical_port(out.buffer, parsed_port);
11850|       |      }
11851|       |      if (has_upper) {
11852|       |        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11853|       |      }
11854|       |      out.components.protocol_end = protocol_end;
11855|       |      out.components.username_end = protocol_end + 2;
11856|       |      out.components.host_start = protocol_end + 2;
11857|       |      out.components.host_end = static_cast<uint32_t>(host_end);
11858|       |      out.components.port = parsed_port;
11859|       |      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11860|       |      out.components.search_start = url_components::omitted;
11861|       |      out.components.hash_start = url_components::omitted;
11862|       |      out.parse_path(path_view);
11863|       |      apply_query_and_hash();
11864|  1.74k|    } else {
11865|  1.74k|      std::string host_str(input.substr(host_start, host_len));
11866|  1.74k|      if (has_upper) {
  ------------------
  |  Branch (11866:11): [True: 112, False: 1.62k]
  ------------------
11867|    112|        unicode::to_lower_ascii(host_str.data(), host_str.size());
11868|    112|      }
11869|  1.74k|      out.host = std::move(host_str);
11870|  1.74k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11870:11): [True: 1.41k, False: 323]
  ------------------
11871|  1.41k|        out.port = static_cast<uint16_t>(parsed_port);
11872|  1.41k|      }
11873|  1.74k|      out.parse_path(path_view);
11874|  1.74k|      apply_query_and_hash();
11875|  1.74k|    }
11876|  1.74k|    return true;
11877|  1.74k|  }
11878|       |
11879|  56.5k|  const bool insert_slash = !has_path;
11880|       |  if constexpr (is_aggregator) {
11881|       |    const size_t out_len =
11882|       |        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
11883|       |    const bool omit_port_bytes = parsed_port == url_components::omitted;
11884|       |    if (out_len == len && !insert_slash && !omit_port_bytes) {
11885|       |      out.buffer.assign(input);
11886|       |    } else {
11887|       |      out.buffer.clear();
11888|       |      out.buffer.reserve(out_len);
11889|       |      out.buffer.append(input.substr(0, host_end));
11890|       |      if (parsed_port != url_components::omitted) {
11891|       |        append_canonical_port(out.buffer, parsed_port);
11892|       |      }
11893|       |      if (insert_slash) {
11894|       |        out.buffer.push_back('/');
11895|       |      }
11896|       |      if (authority_end < len) {
11897|       |        out.buffer.append(input.substr(authority_end));
11898|       |      }
11899|       |    }
11900|       |    if (has_upper) {
11901|       |      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11902|       |    }
11903|       |    const uint32_t pathname_start =
11904|       |        static_cast<uint32_t>(host_end) + port_bytes;
11905|       |    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11906|       |                               (insert_slash ? 1 : 0) -
11907|       |                               static_cast<int32_t>(authority_end);
11908|       |    out.components.protocol_end = protocol_end;
11909|       |    out.components.username_end = protocol_end + 2;
11910|       |    out.components.host_start = protocol_end + 2;
11911|       |    out.components.host_end = static_cast<uint32_t>(host_end);
11912|       |    out.components.port = parsed_port;
11913|       |    out.components.pathname_start = pathname_start;
11914|       |    out.components.search_start =
11915|       |        (query_start != std::string_view::npos)
11916|       |            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11917|       |                                    tail_delta)
11918|       |            : url_components::omitted;
11919|       |    out.components.hash_start =
11920|       |        (hash_start != std::string_view::npos)
11921|       |            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11922|       |                                    tail_delta)
11923|       |            : url_components::omitted;
11924|  56.5k|  } else {
11925|  56.5k|    std::string host_str(input.substr(host_start, host_len));
11926|  56.5k|    if (has_upper) {
  ------------------
  |  Branch (11926:9): [True: 37, False: 56.4k]
  ------------------
11927|     37|      unicode::to_lower_ascii(host_str.data(), host_str.size());
11928|     37|    }
11929|  56.5k|    out.host = std::move(host_str);
11930|  56.5k|    if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11930:9): [True: 56.4k, False: 47]
  ------------------
11931|  56.4k|      out.port = static_cast<uint16_t>(parsed_port);
11932|  56.4k|    }
11933|  56.5k|    if (insert_slash) {
  ------------------
  |  Branch (11933:9): [True: 158, False: 56.3k]
  ------------------
11934|    158|      out.path = "/";
11935|  56.3k|    } else {
11936|  56.3k|      out.path.assign(input.data() + path_start, path_end - path_start);
11937|  56.3k|    }
11938|  56.5k|    if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11938:9): [True: 1.46k, False: 55.0k]
  ------------------
11939|  1.46k|      const size_t q_end =
11940|  1.46k|          (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11940:11): [True: 996, False: 469]
  ------------------
11941|  1.46k|      out.query.emplace(input.data() + query_start + 1,
11942|  1.46k|                        q_end - query_start - 1);
11943|  1.46k|    }
11944|  56.5k|    if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11944:9): [True: 1.41k, False: 55.1k]
  ------------------
11945|  1.41k|      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11946|  1.41k|    }
11947|  56.5k|  }
11948|  56.5k|  return true;
11949|  58.2k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11685|  58.5k|    bool has_upper) {
11686|  58.5k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11687|  58.5k|  constexpr bool is_aggregator =
11688|  58.5k|      std::is_same_v<result_type, ada::url_aggregator>;
11689|  58.5k|  static_assert(is_ada_url || is_aggregator);
11690|       |
11691|  58.5k|  const size_t len = input.size();
11692|  58.5k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11693|  58.5k|  size_t p = host_end + 1;
11694|  58.5k|  uint32_t port_value = 0;
11695|  58.5k|  bool any_digit = false;
11696|   253k|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11696:10): [True: 253k, False: 54]
  |  Branch (11696:21): [True: 194k, False: 58.2k]
  |  Branch (11696:36): [True: 194k, False: 257]
  ------------------
11697|   194k|    any_digit = true;
11698|   194k|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11699|   194k|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11699:9): [True: 19, False: 194k]
  ------------------
11700|     19|      return false;
11701|     19|    }
11702|   194k|    ++p;
11703|   194k|  }
11704|  58.5k|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11704:7): [True: 58.4k, False: 54]
  |  Branch (11704:18): [True: 362, False: 58.0k]
  |  Branch (11704:33): [True: 260, False: 102]
  |  Branch (11704:48): [True: 194, False: 66]
  ------------------
11705|    194|    return false;
11706|    194|  }
11707|  58.3k|  uint32_t parsed_port = url_components::omitted;
11708|  58.3k|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11709|  58.3k|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11709:7): [True: 57.9k, False: 393]
  |  Branch (11709:20): [True: 57.9k, False: 6]
  ------------------
11710|  57.9k|    parsed_port = port_value;
11711|  57.9k|  }
11712|  58.3k|  const size_t authority_end = p;
11713|       |
11714|  58.3k|  size_t i = authority_end;
11715|  58.3k|  size_t path_start = host_end;
11716|  58.3k|  size_t path_end = host_end;
11717|  58.3k|  size_t query_start = std::string_view::npos;
11718|  58.3k|  size_t hash_start = std::string_view::npos;
11719|  58.3k|  bool has_path = false;
11720|  58.3k|  bool maybe_dot_segment = false;
11721|  58.3k|  bool rest_simple = true;
11722|       |
11723|  58.3k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11723:7): [True: 58.2k, False: 54]
  |  Branch (11723:18): [True: 58.0k, False: 168]
  ------------------
11724|  58.0k|    has_path = true;
11725|  58.0k|    path_start = i;
11726|  58.0k|    ++i;
11727|  58.0k|    scan_path_run(b, i, len, maybe_dot_segment);
11728|  58.0k|    if (i < len) {
  ------------------
  |  Branch (11728:9): [True: 3.37k, False: 54.7k]
  ------------------
11729|  3.37k|      const uint8_t cls = k_path[b[i]];
11730|  3.37k|      if (cls == 1) {
  ------------------
  |  Branch (11730:11): [True: 2.00k, False: 1.37k]
  ------------------
11731|  2.00k|        path_end = i;
11732|  2.00k|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 1.57k, False: 426]
  ------------------
11733|  1.57k|          query_start = i;
11734|  1.57k|          ++i;
11735|  1.57k|          goto scan_query;
11736|  1.57k|        }
11737|    426|        hash_start = i;
11738|    426|        ++i;
11739|    426|        goto scan_hash;
11740|  2.00k|      }
11741|  1.37k|      rest_simple = false;
11742|  76.6k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11742:14): [True: 76.0k, False: 560]
  ------------------
11743|  76.0k|        if (b[i] == '?') {
  ------------------
  |  Branch (11743:13): [True: 659, False: 75.4k]
  ------------------
11744|    659|          path_end = i;
11745|    659|          query_start = i;
11746|    659|          ++i;
11747|    659|          goto scan_query_boundary;
11748|    659|        }
11749|  75.4k|        if (b[i] == '#') {
  ------------------
  |  Branch (11749:13): [True: 154, False: 75.2k]
  ------------------
11750|    154|          path_end = i;
11751|    154|          hash_start = i;
11752|    154|          ++i;
11753|    154|          goto after_rest;
11754|    154|        }
11755|  75.4k|      }
11756|    560|      path_end = i;
11757|    560|      goto after_rest;
11758|  1.37k|    }
11759|  54.7k|    path_end = i;
11760|  54.7k|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11760:14): [True: 168, False: 54]
  |  Branch (11760:25): [True: 102, False: 66]
  ------------------
11761|    102|    query_start = i;
11762|    102|    ++i;
11763|    102|    goto scan_query;
11764|    120|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11764:14): [True: 66, False: 54]
  |  Branch (11764:25): [True: 66, False: 0]
  ------------------
11765|     66|    hash_start = i;
11766|     66|    ++i;
11767|     66|    goto scan_hash;
11768|     66|  }
11769|  54.7k|  goto after_rest;
11770|       |
11771|  54.7k|scan_query:
11772|  1.68k|  scan_query_run(b, i, len);
11773|  1.68k|  if (i < len) {
  ------------------
  |  Branch (11773:7): [True: 1.16k, False: 521]
  ------------------
11774|  1.16k|    if (b[i] == '#') {
  ------------------
  |  Branch (11774:9): [True: 1.09k, False: 61]
  ------------------
11775|  1.09k|      hash_start = i;
11776|  1.09k|      ++i;
11777|  1.09k|      goto scan_hash;
11778|  1.09k|    }
11779|     61|    rest_simple = false;
11780|     61|    goto scan_query_boundary;
11781|  1.16k|  }
11782|    521|  goto after_rest;
11783|       |
11784|    720|scan_query_boundary:
11785|  17.9k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11785:10): [True: 17.7k, False: 260]
  ------------------
11786|  17.7k|    if (b[i] == '#') {
  ------------------
  |  Branch (11786:9): [True: 460, False: 17.2k]
  ------------------
11787|    460|      hash_start = i;
11788|    460|      ++i;
11789|    460|      goto after_rest;
11790|    460|    }
11791|  17.7k|  }
11792|    260|  goto after_rest;
11793|       |
11794|  1.59k|scan_hash:
11795|  1.59k|  scan_hash_run(b, i, len);
11796|  1.59k|  if (i < len) {
  ------------------
  |  Branch (11796:7): [True: 51, False: 1.54k]
  ------------------
11797|     51|    rest_simple = false;
11798|     51|  }
11799|       |
11800|  58.3k|after_rest:
11801|  58.3k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11801:7): [True: 56.8k, False: 1.48k]
  |  Branch (11801:22): [True: 388, False: 56.4k]
  ------------------
11802|    388|    const std::string_view path_body(input.data() + path_start,
11803|    388|                                     path_end - path_start);
11804|    388|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11804:9): [True: 315, False: 73]
  ------------------
11805|    315|      rest_simple = false;
11806|    315|    }
11807|    388|  }
11808|       |
11809|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11810|       |  // trailing C0 control or space; this fast path does neither. A query or
11811|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11812|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11813|       |  // inputs back to the slow path.
11814|  58.3k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11814:7): [True: 1.80k, False: 56.5k]
  |  Branch (11814:24): [True: 21, False: 1.77k]
  ------------------
11815|  1.77k|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11815:24): [True: 39, False: 1.74k]
  ------------------
11816|     60|    return false;
11817|     60|  }
11818|       |
11819|  58.2k|  out.type = scheme_type;
11820|  58.2k|  out.is_valid = true;
11821|  58.2k|  out.has_opaque_path = false;
11822|  58.2k|  out.host_type = DEFAULT;
11823|       |
11824|  58.2k|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11824:31): [True: 57.8k, False: 370]
  ------------------
11825|  58.2k|                                  ? (1 + port_decimal_digit_count(parsed_port))
11826|  58.2k|                                  : 0;
11827|       |
11828|  58.2k|  if (!rest_simple) {
  ------------------
  |  Branch (11828:7): [True: 1.74k, False: 56.5k]
  ------------------
11829|  1.74k|    const std::string_view path_view =
11830|  1.74k|        has_path
  ------------------
  |  Branch (11830:9): [True: 1.69k, False: 50]
  ------------------
11831|  1.74k|            ? std::string_view(input.data() + path_start, path_end - path_start)
11832|  1.74k|            : std::string_view{};
11833|  1.74k|    auto apply_query_and_hash = [&]() {
11834|  1.74k|      if (query_start != std::string_view::npos) {
11835|  1.74k|        const size_t q_end =
11836|  1.74k|            (hash_start != std::string_view::npos) ? hash_start : len;
11837|  1.74k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|  1.74k|                                                q_end - query_start - 1),
11839|  1.74k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|  1.74k|      }
11841|  1.74k|      if (hash_start != std::string_view::npos) {
11842|  1.74k|        out.update_unencoded_base_hash(std::string_view(
11843|  1.74k|            input.data() + hash_start + 1, len - hash_start - 1));
11844|  1.74k|      }
11845|  1.74k|    };
11846|  1.74k|    if constexpr (is_aggregator) {
11847|  1.74k|      out.buffer.assign(input.substr(0, host_end));
11848|  1.74k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11848:11): [True: 1.41k, False: 323]
  ------------------
11849|  1.41k|        append_canonical_port(out.buffer, parsed_port);
11850|  1.41k|      }
11851|  1.74k|      if (has_upper) {
  ------------------
  |  Branch (11851:11): [True: 112, False: 1.62k]
  ------------------
11852|    112|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11853|    112|      }
11854|  1.74k|      out.components.protocol_end = protocol_end;
11855|  1.74k|      out.components.username_end = protocol_end + 2;
11856|  1.74k|      out.components.host_start = protocol_end + 2;
11857|  1.74k|      out.components.host_end = static_cast<uint32_t>(host_end);
11858|  1.74k|      out.components.port = parsed_port;
11859|  1.74k|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11860|  1.74k|      out.components.search_start = url_components::omitted;
11861|  1.74k|      out.components.hash_start = url_components::omitted;
11862|  1.74k|      out.parse_path(path_view);
11863|  1.74k|      apply_query_and_hash();
11864|       |    } else {
11865|       |      std::string host_str(input.substr(host_start, host_len));
11866|       |      if (has_upper) {
11867|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
11868|       |      }
11869|       |      out.host = std::move(host_str);
11870|       |      if (parsed_port != url_components::omitted) {
11871|       |        out.port = static_cast<uint16_t>(parsed_port);
11872|       |      }
11873|       |      out.parse_path(path_view);
11874|       |      apply_query_and_hash();
11875|       |    }
11876|  1.74k|    return true;
11877|  1.74k|  }
11878|       |
11879|  56.5k|  const bool insert_slash = !has_path;
11880|  56.5k|  if constexpr (is_aggregator) {
11881|  56.5k|    const size_t out_len =
11882|  56.5k|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (11882:34): [True: 158, False: 56.3k]
  ------------------
11883|  56.5k|    const bool omit_port_bytes = parsed_port == url_components::omitted;
11884|  56.5k|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (11884:9): [True: 47.3k, False: 9.19k]
  |  Branch (11884:27): [True: 47.2k, False: 29]
  |  Branch (11884:44): [True: 47.2k, False: 0]
  ------------------
11885|  47.2k|      out.buffer.assign(input);
11886|  47.2k|    } else {
11887|  9.22k|      out.buffer.clear();
11888|  9.22k|      out.buffer.reserve(out_len);
11889|  9.22k|      out.buffer.append(input.substr(0, host_end));
11890|  9.22k|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11890:11): [True: 9.18k, False: 47]
  ------------------
11891|  9.18k|        append_canonical_port(out.buffer, parsed_port);
11892|  9.18k|      }
11893|  9.22k|      if (insert_slash) {
  ------------------
  |  Branch (11893:11): [True: 158, False: 9.07k]
  ------------------
11894|    158|        out.buffer.push_back('/');
11895|    158|      }
11896|  9.22k|      if (authority_end < len) {
  ------------------
  |  Branch (11896:11): [True: 9.17k, False: 54]
  ------------------
11897|  9.17k|        out.buffer.append(input.substr(authority_end));
11898|  9.17k|      }
11899|  9.22k|    }
11900|  56.5k|    if (has_upper) {
  ------------------
  |  Branch (11900:9): [True: 37, False: 56.4k]
  ------------------
11901|     37|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11902|     37|    }
11903|  56.5k|    const uint32_t pathname_start =
11904|  56.5k|        static_cast<uint32_t>(host_end) + port_bytes;
11905|  56.5k|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11906|  56.5k|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (11906:33): [True: 158, False: 56.3k]
  ------------------
11907|  56.5k|                               static_cast<int32_t>(authority_end);
11908|  56.5k|    out.components.protocol_end = protocol_end;
11909|  56.5k|    out.components.username_end = protocol_end + 2;
11910|  56.5k|    out.components.host_start = protocol_end + 2;
11911|  56.5k|    out.components.host_end = static_cast<uint32_t>(host_end);
11912|  56.5k|    out.components.port = parsed_port;
11913|  56.5k|    out.components.pathname_start = pathname_start;
11914|  56.5k|    out.components.search_start =
11915|  56.5k|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (11915:9): [True: 1.46k, False: 55.0k]
  ------------------
11916|  56.5k|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11917|  1.46k|                                    tail_delta)
11918|  56.5k|            : url_components::omitted;
11919|  56.5k|    out.components.hash_start =
11920|  56.5k|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (11920:9): [True: 1.41k, False: 55.1k]
  ------------------
11921|  56.5k|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11922|  1.41k|                                    tail_delta)
11923|  56.5k|            : url_components::omitted;
11924|       |  } else {
11925|       |    std::string host_str(input.substr(host_start, host_len));
11926|       |    if (has_upper) {
11927|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
11928|       |    }
11929|       |    out.host = std::move(host_str);
11930|       |    if (parsed_port != url_components::omitted) {
11931|       |      out.port = static_cast<uint16_t>(parsed_port);
11932|       |    }
11933|       |    if (insert_slash) {
11934|       |      out.path = "/";
11935|       |    } else {
11936|       |      out.path.assign(input.data() + path_start, path_end - path_start);
11937|       |    }
11938|       |    if (query_start != std::string_view::npos) {
11939|       |      const size_t q_end =
11940|       |          (hash_start != std::string_view::npos) ? hash_start : len;
11941|       |      out.query.emplace(input.data() + query_start + 1,
11942|       |                        q_end - query_start - 1);
11943|       |    }
11944|       |    if (hash_start != std::string_view::npos) {
11945|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11946|       |    }
11947|       |  }
11948|  56.5k|  return true;
11949|  58.2k|}
_ZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12528|   597k|                           const result_type* base_url) {
12529|       |  // We can specialize the implementation per type.
12530|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12531|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12532|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12533|       |  // and ada::url **do not have to support the exact same API**.
12534|   597k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12535|   597k|  constexpr bool result_type_is_ada_url_aggregator =
12536|   597k|      std::is_same_v<url_aggregator, result_type>;
12537|   597k|  static_assert(result_type_is_ada_url ||
12538|   597k|                result_type_is_ada_url_aggregator);  // We don't support
12539|       |                                                     // anything else for now.
12540|       |
12541|   597k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12542|   597k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12543|   597k|          ")");
12544|       |
12545|   597k|  result_type url{};
12546|       |
12547|   597k|  const uint32_t max_input_length = ada::get_max_input_length();
12548|       |
12549|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12550|       |  // max_input_length even when the input fit under it. The check at the end of
12551|       |  // the state machine covers URLs that run to completion, but several states
12552|       |  // return early after appending a query or fragment, so run the same check on
12553|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12554|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12555|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12556|   597k|  const auto enforce_max_input_length = [&]() {
12557|   597k|    if constexpr (store_values) {
12558|   597k|      if (url.is_valid) {
12559|   597k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|   597k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12561|   597k|            url.is_valid = false;
12562|   597k|          }
12563|   597k|        } else {
12564|   597k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|   597k|            url.is_valid = false;
12566|   597k|          }
12567|   597k|        }
12568|   597k|      }
12569|   597k|    }
12570|   597k|  };
12571|       |
12572|       |  // We refuse to parse URL strings that exceed the maximum input length.
12573|       |  // By default, this is 4GB but can be configured via
12574|       |  // ada::set_max_input_length().
12575|   597k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12575:7): [True: 0, False: 597k]
  ------------------
12576|      0|    url.is_valid = false;
12577|      0|  }
12578|       |  // Going forward, user_input.size() is in [0,
12579|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12580|       |  // base, or the optional_url was invalid, we must return.
12581|   597k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12581:7): [True: 0, False: 597k]
  ------------------
12582|      0|    url.is_valid &= base_url->is_valid;
12583|      0|  }
12584|   597k|  if (!url.is_valid) {
  ------------------
  |  Branch (12584:7): [True: 0, False: 597k]
  ------------------
12585|      0|    return url;
12586|      0|  }
12587|       |
12588|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12589|   597k|  if constexpr (store_values) {
12590|   597k|    bool hit_fast_path = false;
12591|   597k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12591:9): [True: 597k, False: 0]
  ------------------
12592|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12593|       |      // call so those URLs (including SetHref) do not pay for a miss.
12594|   597k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12595|   597k|      const size_t n = user_input.size();
12596|   597k|      size_t host_start = 0;
12597|   597k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12597:11): [True: 597k, False: 237]
  |  Branch (12597:21): [True: 228k, False: 368k]
  |  Branch (12597:36): [True: 227k, False: 896]
  |  Branch (12597:51): [True: 227k, False: 151]
  ------------------
12598|   227k|        host_start = 7;
12599|   369k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12599:18): [True: 369k, False: 250]
  |  Branch (12599:28): [True: 366k, False: 2.63k]
  |  Branch (12599:43): [True: 366k, False: 829]
  |  Branch (12599:58): [True: 365k, False: 100]
  ------------------
12600|   365k|        host_start = 8;
12601|   365k|      }
12602|   597k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12602:34): [True: 593k, False: 3.81k]
  ------------------
12603|   597k|      const bool skip_ip =
12604|   597k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12604:11): [True: 550, False: 596k]
  |  Branch (12604:33): [True: 590k, False: 6.73k]
  |  Branch (12604:54): [True: 133k, False: 456k]
  ------------------
12605|   597k|      const bool skip_userinfo =
12606|   597k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12606:11): [True: 593k, False: 3.81k]
  |  Branch (12606:30): [True: 38.0k, False: 555k]
  ------------------
12607|   597k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12607:23): [True: 463k, False: 134k]
  |  Branch (12607:35): [True: 425k, False: 38.0k]
  ------------------
12608|   425k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12608:23): [True: 339k, False: 86.0k]
  ------------------
12609|   597k|    } else {
12610|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12611|      0|    }
12612|   597k|    if (hit_fast_path) {
  ------------------
  |  Branch (12612:9): [True: 339k, False: 258k]
  ------------------
12613|       |      if constexpr (result_type_is_ada_url_aggregator) {
12614|       |        if (url.buffer.size() > max_input_length) [[unlikely]] {
12615|       |          url.is_valid = false;
12616|       |        }
12617|   339k|      } else {
12618|       |        // For a small absolute input, even worst-case normalization cannot
12619|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12620|       |        // most 4.5x. Avoid traversing every stored component on the common
12621|       |        // default-limit path.
12622|   339k|        if ((base_url != nullptr ||
  ------------------
  |  Branch (12622:14): [True: 0, False: 339k]
  ------------------
12623|   339k|             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
  ------------------
  |  Branch (12623:14): [True: 0, False: 339k]
  ------------------
12624|      0|            url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12624:13): [True: 0, False: 0]
  ------------------
12625|      0|          url.is_valid = false;
12626|      0|        }
12627|   339k|      }
12628|   339k|      return url;
12629|   339k|    }
12630|   597k|  }
12631|       |
12632|   258k|  state state = state::SCHEME_START;
12633|       |
12634|   597k|  std::string tmp_buffer;
12635|   597k|  std::string_view url_data;
12636|   597k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12636:7): [True: 432, False: 597k]
  ------------------
12637|    432|    tmp_buffer = user_input;
12638|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12639|       |    // just directly build the string from user_input.
12640|    432|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12641|    432|    url_data = tmp_buffer;
12642|   597k|  } else [[likely]] {
12643|   597k|    url_data = user_input;
12644|   597k|  }
12645|       |
12646|       |  // Leading and trailing control characters are uncommon and easy to deal with
12647|       |  // (no performance concern).
12648|   597k|  helpers::trim_c0_whitespace(url_data);
12649|       |
12650|       |  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12651|       |    // Most of the time, we just need user_input.size().
12652|       |    // In some instances, we may need a bit more.
12653|       |    ///////////////////////////
12654|       |    // This is *very* important. This line should *not* be removed
12655|       |    // hastily. There are principled reasons why reserve is important
12656|       |    // for performance. If you have a benchmark with small inputs,
12657|       |    // it may not matter, but in other instances, it could.
12658|       |    ////
12659|       |    // This rounds up to the next power of two.
12660|       |    // We know that user_input.size() is in [0,
12661|       |    // std::numeric_limits<uint32_t>::max).
12662|       |    uint32_t reserve_capacity =
12663|       |        (0xFFFFFFFF >>
12664|       |         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12665|       |        1;
12666|       |    url.reserve(reserve_capacity);
12667|       |  }
12668|       |
12669|       |  // Optimization opportunity. Most websites do not have fragment.
12670|   597k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12671|       |  // We add it last so that an implementation like ada::url_aggregator
12672|       |  // can append it last to its internal buffer, thus improving performance.
12673|       |
12674|       |  // Here url_data no longer has its fragment.
12675|       |  // We are going to access the data from url_data (it is immutable).
12676|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12677|       |  // The input_position variable should range from 0 to input_size.
12678|       |  // It is illegal to access url_data at input_size.
12679|   597k|  size_t input_position = 0;
12680|   597k|  const size_t input_size = url_data.size();
12681|       |  // Keep running the following state machine by switching on state.
12682|       |  // If after a run pointer points to the EOF code point, go to the next step.
12683|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12684|       |  // We never decrement input_position.
12685|  2.27M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12685:10): [True: 1.74M, False: 537k]
  ------------------
12686|  1.74M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12687|  1.74M|            " in state ", ada::to_string(state));
12688|  1.74M|    switch (state) {
12689|   258k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12689:7): [True: 258k, False: 1.48M]
  ------------------
12690|   258k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12691|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12692|       |        // state to scheme state.
12693|   258k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12693:13): [True: 258k, False: 2]
  ------------------
12694|   258k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12694:13): [True: 258k, False: 139]
  ------------------
12695|   258k|          state = state::SCHEME;
12696|   258k|          input_position++;
12697|   258k|        } else {
12698|       |          // Otherwise, if state override is not given, set state to no scheme
12699|       |          // state and decrease pointer by 1.
12700|    141|          state = state::NO_SCHEME;
12701|    141|        }
12702|   258k|        break;
12703|      0|      }
12704|   258k|      case state::SCHEME: {
  ------------------
  |  Branch (12704:7): [True: 258k, False: 1.48M]
  ------------------
12705|   258k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12706|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12707|       |        // append c, lowercased, to buffer.
12708|  1.12M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12708:16): [True: 1.12M, False: 1]
  ------------------
12709|  1.12M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12709:16): [True: 862k, False: 258k]
  ------------------
12710|   862k|          input_position++;
12711|   862k|        }
12712|       |        // Otherwise, if c is U+003A (:), then:
12713|   258k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12713:13): [True: 258k, False: 1]
  ------------------
12714|   258k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12714:13): [True: 258k, False: 76]
  ------------------
12715|   258k|          ada_log("SCHEME the scheme should be ",
12716|   258k|                  url_data.substr(0, input_position));
12717|   258k|          if constexpr (result_type_is_ada_url) {
12718|   258k|            if (!url.parse_scheme(url_data.substr(0, input_position))) {
  ------------------
  |  Branch (12718:17): [True: 0, False: 258k]
  ------------------
12719|      0|              return url;
12720|      0|            }
12721|       |          } else {
12722|       |            // we pass the colon along instead of painfully adding it back.
12723|       |            if (!url.parse_scheme_with_colon(
12724|       |                    url_data.substr(0, input_position + 1))) {
12725|       |              return url;
12726|       |            }
12727|       |          }
12728|   258k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12729|       |
12730|       |          // If url's scheme is "file", then:
12731|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12732|   258k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12732:15): [True: 1.48k, False: 256k]
  ------------------
12733|       |            // Set state to file state.
12734|  1.48k|            state = state::FILE;
12735|  1.48k|          }
12736|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12737|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12738|       |          // != nullptr is false.
12739|   256k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12739:20): [True: 254k, False: 1.92k]
  |  Branch (12739:40): [True: 0, False: 254k]
  ------------------
12740|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12740:20): [True: 0, False: 0]
  ------------------
12741|       |            // Set state to special relative or authority state.
12742|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12743|      0|          }
12744|       |          // Otherwise, if url is special, set state to special authority
12745|       |          // slashes state.
12746|   256k|          else if (url.is_special()) {
  ------------------
  |  Branch (12746:20): [True: 254k, False: 1.92k]
  ------------------
12747|   254k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12748|   254k|          }
12749|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12750|       |          // path or authority state and increase pointer by 1.
12751|  1.92k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12751:20): [True: 1.71k, False: 210]
  ------------------
12752|  1.71k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12752:20): [True: 1.11k, False: 609]
  ------------------
12753|  1.11k|            state = state::PATH_OR_AUTHORITY;
12754|  1.11k|            input_position++;
12755|  1.11k|          }
12756|       |          // Otherwise, set url's path to the empty string and set state to
12757|       |          // opaque path state.
12758|    819|          else {
12759|    819|            state = state::OPAQUE_PATH;
12760|    819|          }
12761|   258k|        }
12762|       |        // Otherwise, if state override is not given, set buffer to the empty
12763|       |        // string, state to no scheme state, and start over (from the first code
12764|       |        // point in input).
12765|     77|        else {
12766|     77|          state = state::NO_SCHEME;
12767|     77|          input_position = 0;
12768|     77|          break;
12769|     77|        }
12770|   258k|        input_position++;
12771|   258k|        break;
12772|   258k|      }
12773|    218|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12773:7): [True: 218, False: 1.74M]
  ------------------
12774|    218|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12775|       |        // The fragment was pruned from url_data before the state machine ran,
12776|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12777|       |        // nothing else remains in front of it.
12778|    218|        const bool c_is_hash =
12779|    218|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12779:13): [True: 139, False: 79]
  |  Branch (12779:37): [True: 2, False: 137]
  ------------------
12780|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12781|       |        // validation error, return failure.
12782|    218|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12782:13): [True: 218, False: 0]
  |  Branch (12782:37): [True: 0, False: 0]
  |  Branch (12782:66): [True: 0, False: 0]
  ------------------
12783|    218|          ada_log("NO_SCHEME validation error");
12784|    218|          url.is_valid = false;
12785|    218|          return url;
12786|    218|        }
12787|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12788|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12789|       |        // query to base's query, and set state to fragment state.
12790|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12790:18): [True: 0, False: 0]
  |  Branch (12790:47): [True: 0, False: 0]
  ------------------
12791|      0|          ada_log("NO_SCHEME opaque base with fragment");
12792|      0|          url.copy_scheme(*base_url);
12793|      0|          url.has_opaque_path = base_url->has_opaque_path;
12794|       |
12795|      0|          if constexpr (result_type_is_ada_url) {
12796|      0|            url.path = base_url->path;
12797|      0|            url.query = base_url->query;
12798|       |          } else {
12799|       |            url.update_base_pathname(base_url->get_pathname());
12800|       |            if (base_url->has_search()) {
12801|       |              // get_search() returns "" for an empty query string (URL ends
12802|       |              // with '?'). update_base_search("") would incorrectly clear the
12803|       |              // query, so pass "?" to preserve the empty query distinction.
12804|       |              auto s = base_url->get_search();
12805|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
12806|       |            }
12807|       |          }
12808|      0|          url.update_unencoded_base_hash(*fragment);
12809|      0|          enforce_max_input_length();
12810|      0|          return url;
12811|      0|        }
12812|       |        // Otherwise, if base's scheme is not "file", set state to relative
12813|       |        // state and decrease pointer by 1.
12814|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12815|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12815:18): [True: 0, False: 0]
  ------------------
12816|      0|          ada_log("NO_SCHEME non-file relative path");
12817|      0|          state = state::RELATIVE_SCHEME;
12818|      0|        }
12819|       |        // Otherwise, set state to file state and decrease pointer by 1.
12820|      0|        else {
12821|      0|          ada_log("NO_SCHEME file base type");
12822|      0|          state = state::FILE;
12823|      0|        }
12824|      0|        break;
12825|    218|      }
12826|   255k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12826:7): [True: 255k, False: 1.48M]
  ------------------
12827|   255k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12828|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12829|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12830|       |        // worry about AUTHORITY.
12831|       |        // TODO: Instead of just collecting a bool, collect the location of the
12832|       |        // '@' and do something useful with it.
12833|       |        // TODO: We could do various processing early on, using a single pass
12834|       |        // over the string to collect information about it, e.g., telling us
12835|       |        // whether there is a @ and if so, where (or how many).
12836|       |
12837|       |        // Check if url data contains an @.
12838|   255k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12838:13): [True: 216k, False: 39.2k]
  ------------------
12839|   216k|          state = state::HOST;
12840|   216k|          break;
12841|   216k|        }
12842|  39.2k|        bool at_sign_seen{false};
12843|  39.2k|        bool password_token_seen{false};
12844|       |        /**
12845|       |         * We expect something of the sort...
12846|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12847|       |         * --------^
12848|       |         */
12849|  92.3k|        do {
12850|  92.3k|          std::string_view view = url_data.substr(input_position);
12851|       |          // The delimiters are @, /, ? \\.
12852|  92.3k|          size_t location =
12853|  92.3k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12853:15): [True: 92.1k, False: 154]
  ------------------
12854|  92.3k|                               : helpers::find_authority_delimiter(view);
12855|  92.3k|          std::string_view authority_view = view.substr(0, location);
12856|  92.3k|          size_t end_of_authority = input_position + authority_view.size();
12857|       |          // If c is U+0040 (@), then:
12858|  92.3k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12858:15): [True: 82.7k, False: 9.55k]
  ------------------
12859|  82.7k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12859:15): [True: 53.0k, False: 29.7k]
  ------------------
12860|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12861|  53.0k|            if (at_sign_seen) {
  ------------------
  |  Branch (12861:17): [True: 14.0k, False: 39.0k]
  ------------------
12862|  14.0k|              if (password_token_seen) {
  ------------------
  |  Branch (12862:19): [True: 4.64k, False: 9.40k]
  ------------------
12863|  4.64k|                if constexpr (result_type_is_ada_url) {
12864|  4.64k|                  url.password += "%40";
12865|       |                } else {
12866|       |                  url.append_base_password("%40");
12867|       |                }
12868|  9.40k|              } else {
12869|  9.40k|                if constexpr (result_type_is_ada_url) {
12870|  9.40k|                  url.username += "%40";
12871|       |                } else {
12872|       |                  url.append_base_username("%40");
12873|       |                }
12874|  9.40k|              }
12875|  14.0k|            }
12876|       |
12877|  53.0k|            at_sign_seen = true;
12878|       |
12879|  53.0k|            if (!password_token_seen) {
  ------------------
  |  Branch (12879:17): [True: 48.4k, False: 4.64k]
  ------------------
12880|  48.4k|              size_t password_token_location = authority_view.find(':');
12881|  48.4k|              password_token_seen =
12882|  48.4k|                  password_token_location != std::string_view::npos;
12883|       |
12884|  48.4k|              if constexpr (store_values) {
12885|  48.4k|                if (!password_token_seen) {
  ------------------
  |  Branch (12885:21): [True: 19.8k, False: 28.5k]
  ------------------
12886|  19.8k|                  if constexpr (result_type_is_ada_url) {
12887|  19.8k|                    url.username += unicode::percent_encode(
12888|  19.8k|                        authority_view,
12889|  19.8k|                        character_sets::USERINFO_PERCENT_ENCODE);
12890|       |                  } else {
12891|       |                    url.append_base_username(unicode::percent_encode(
12892|       |                        authority_view,
12893|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12894|       |                  }
12895|  28.5k|                } else {
12896|  28.5k|                  if constexpr (result_type_is_ada_url) {
12897|  28.5k|                    url.username += unicode::percent_encode(
12898|  28.5k|                        authority_view.substr(0, password_token_location),
12899|  28.5k|                        character_sets::USERINFO_PERCENT_ENCODE);
12900|  28.5k|                    url.password += unicode::percent_encode(
12901|  28.5k|                        authority_view.substr(password_token_location + 1),
12902|  28.5k|                        character_sets::USERINFO_PERCENT_ENCODE);
12903|       |                  } else {
12904|       |                    url.append_base_username(unicode::percent_encode(
12905|       |                        authority_view.substr(0, password_token_location),
12906|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12907|       |                    url.append_base_password(unicode::percent_encode(
12908|       |                        authority_view.substr(password_token_location + 1),
12909|       |                        character_sets::USERINFO_PERCENT_ENCODE));
12910|       |                  }
12911|  28.5k|                }
12912|  48.4k|              }
12913|  48.4k|            } else if constexpr (store_values) {
12914|  4.64k|              if constexpr (result_type_is_ada_url) {
12915|  4.64k|                url.password += unicode::percent_encode(
12916|  4.64k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12917|       |              } else {
12918|       |                url.append_base_password(unicode::percent_encode(
12919|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12920|       |              }
12921|  4.64k|            }
12922|  53.0k|          }
12923|       |          // Otherwise, if one of the following is true:
12924|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12925|       |          // - url is special and c is U+005C (\)
12926|  39.2k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12926:20): [True: 9.55k, False: 29.7k]
  ------------------
12927|  29.7k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12927:20): [True: 29.5k, False: 169]
  ------------------
12928|    169|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12928:20): [True: 134, False: 35]
  ------------------
12929|  39.2k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12929:21): [True: 35, False: 0]
  |  Branch (12929:41): [True: 35, False: 0]
  ------------------
12930|       |            // If atSignSeen is true and authority_view is the empty string,
12931|       |            // validation error, return failure.
12932|  39.2k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12932:17): [True: 39.0k, False: 241]
  |  Branch (12932:33): [True: 237, False: 38.7k]
  ------------------
12933|    237|              url.is_valid = false;
12934|    237|              return url;
12935|    237|            }
12936|  39.0k|            state = state::HOST;
12937|  39.0k|            break;
12938|  39.2k|          }
12939|  53.0k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12939:15): [True: 0, False: 53.0k]
  ------------------
12940|      0|            if constexpr (store_values) {
12941|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12941:19): [True: 0, False: 0]
  ------------------
12942|      0|                url.update_unencoded_base_hash(*fragment);
12943|      0|              }
12944|      0|            }
12945|      0|            enforce_max_input_length();
12946|      0|            return url;
12947|      0|          }
12948|  53.0k|          input_position = end_of_authority + 1;
12949|  53.0k|        } while (true);
  ------------------
  |  Branch (12949:18): [True: 53.0k, Folded]
  ------------------
12950|       |
12951|  39.0k|        break;
12952|  39.2k|      }
12953|  39.0k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12953:7): [True: 0, False: 1.74M]
  ------------------
12954|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12955|      0|                helpers::substring(url_data, input_position));
12956|       |
12957|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12958|       |        // then set state to special authority ignore slashes state and increase
12959|       |        // pointer by 1.
12960|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12960:13): [True: 0, False: 0]
  ------------------
12961|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12962|      0|          input_position += 2;
12963|      0|        } else {
12964|       |          // Otherwise, validation error, set state to relative state and
12965|       |          // decrease pointer by 1.
12966|      0|          state = state::RELATIVE_SCHEME;
12967|      0|        }
12968|       |
12969|      0|        break;
12970|  39.2k|      }
12971|  1.11k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12971:7): [True: 1.11k, False: 1.73M]
  ------------------
12972|  1.11k|        ada_log("PATH_OR_AUTHORITY ",
12973|  1.11k|                helpers::substring(url_data, input_position));
12974|       |
12975|       |        // If c is U+002F (/), then set state to authority state.
12976|  1.11k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12976:13): [True: 1.05k, False: 51]
  ------------------
12977|  1.05k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12977:13): [True: 741, False: 318]
  ------------------
12978|    741|          state = state::AUTHORITY;
12979|    741|          input_position++;
12980|    741|        } else {
12981|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12982|    369|          state = state::PATH;
12983|    369|        }
12984|       |
12985|  1.11k|        break;
12986|  39.2k|      }
12987|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12987:7): [True: 0, False: 1.74M]
  ------------------
12988|      0|        ada_log("RELATIVE_SCHEME ",
12989|      0|                helpers::substring(url_data, input_position));
12990|       |
12991|       |        // Set url's scheme to base's scheme.
12992|      0|        url.copy_scheme(*base_url);
12993|       |
12994|       |        // If c is U+002F (/), then set state to relative slash state.
12995|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12995:13): [True: 0, False: 0]
  ------------------
12996|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12997|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12997:13): [True: 0, False: 0]
  ------------------
12998|      0|          ada_log(
12999|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13000|      0|              "slash state");
13001|      0|          state = state::RELATIVE_SLASH;
13002|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13002:20): [True: 0, False: 0]
  |  Branch (13002:40): [True: 0, False: 0]
  ------------------
13003|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13003:20): [True: 0, False: 0]
  ------------------
13004|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13005|       |          // set state to relative slash state.
13006|      0|          ada_log(
13007|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13008|      0|              "error, set state to relative slash state");
13009|      0|          state = state::RELATIVE_SLASH;
13010|      0|        } else {
13011|      0|          ada_log("RELATIVE_SCHEME otherwise");
13012|       |          // Set url's username to base's username, url's password to base's
13013|       |          // password, url's host to base's host, url's port to base's port,
13014|       |          // url's path to a clone of base's path, and url's query to base's
13015|       |          // query.
13016|      0|          if constexpr (result_type_is_ada_url) {
13017|      0|            url.username = base_url->username;
13018|      0|            url.password = base_url->password;
13019|      0|            url.host = base_url->host;
13020|      0|            url.port = base_url->port;
13021|       |            // cloning the base path includes cloning the has_opaque_path flag
13022|      0|            url.has_opaque_path = base_url->has_opaque_path;
13023|      0|            url.path = base_url->path;
13024|      0|            url.query = base_url->query;
13025|       |          } else {
13026|       |            url.update_base_authority(base_url->get_href(),
13027|       |                                      base_url->get_components());
13028|       |            url.update_host_to_base_host(base_url->get_hostname());
13029|       |            url.update_base_port(base_url->retrieve_base_port());
13030|       |            // cloning the base path includes cloning the has_opaque_path flag
13031|       |            url.has_opaque_path = base_url->has_opaque_path;
13032|       |            url.update_base_pathname(base_url->get_pathname());
13033|       |            if (base_url->has_search()) {
13034|       |              // get_search() returns "" for an empty query string (URL ends
13035|       |              // with '?'). update_base_search("") would incorrectly clear the
13036|       |              // query, so pass "?" to preserve the empty query distinction.
13037|       |              auto s = base_url->get_search();
13038|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13039|       |            }
13040|       |          }
13041|       |
13042|      0|          url.has_opaque_path = base_url->has_opaque_path;
13043|       |
13044|       |          // If c is U+003F (?), then set url's query to the empty string, and
13045|       |          // state to query state.
13046|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13046:15): [True: 0, False: 0]
  ------------------
13047|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13047:15): [True: 0, False: 0]
  ------------------
13048|      0|            state = state::QUERY;
13049|      0|          }
13050|       |          // Otherwise, if c is not the EOF code point:
13051|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13051:20): [True: 0, False: 0]
  ------------------
13052|       |            // Set url's query to null.
13053|      0|            url.clear_search();
13054|      0|            if constexpr (result_type_is_ada_url) {
13055|       |              // Shorten url's path.
13056|      0|              helpers::shorten_path(url.path, url.type);
13057|       |            } else {
13058|       |              std::string_view path = url.get_pathname();
13059|       |              if (helpers::shorten_path(path, url.type)) {
13060|       |                url.update_base_pathname(std::move(std::string(path)));
13061|       |              }
13062|       |            }
13063|       |            // Set state to path state and decrease pointer by 1.
13064|      0|            state = state::PATH;
13065|      0|            break;
13066|      0|          }
13067|      0|        }
13068|      0|        input_position++;
13069|      0|        break;
13070|      0|      }
13071|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13071:7): [True: 0, False: 1.74M]
  ------------------
13072|      0|        ada_log("RELATIVE_SLASH ",
13073|      0|                helpers::substring(url_data, input_position));
13074|       |
13075|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13076|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13077|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13077:13): [True: 0, False: 0]
  |  Branch (13077:33): [True: 0, False: 0]
  ------------------
13078|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13078:14): [True: 0, False: 0]
  ------------------
13079|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13079:14): [True: 0, False: 0]
  ------------------
13080|       |          // Set state to special authority ignore slashes state.
13081|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13082|      0|        }
13083|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13084|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13084:18): [True: 0, False: 0]
  ------------------
13085|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13085:18): [True: 0, False: 0]
  ------------------
13086|      0|          state = state::AUTHORITY;
13087|      0|        }
13088|       |        // Otherwise, set
13089|       |        // - url's username to base's username,
13090|       |        // - url's password to base's password,
13091|       |        // - url's host to base's host,
13092|       |        // - url's port to base's port,
13093|       |        // - state to path state, and then, decrease pointer by 1.
13094|      0|        else {
13095|      0|          if constexpr (result_type_is_ada_url) {
13096|      0|            url.username = base_url->username;
13097|      0|            url.password = base_url->password;
13098|      0|            url.host = base_url->host;
13099|      0|            url.port = base_url->port;
13100|       |          } else {
13101|       |            url.update_base_authority(base_url->get_href(),
13102|       |                                      base_url->get_components());
13103|       |            url.update_host_to_base_host(base_url->get_hostname());
13104|       |            url.update_base_port(base_url->retrieve_base_port());
13105|       |          }
13106|      0|          state = state::PATH;
13107|      0|          break;
13108|      0|        }
13109|       |
13110|      0|        input_position++;
13111|      0|        break;
13112|      0|      }
13113|   254k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13113:7): [True: 254k, False: 1.48M]
  ------------------
13114|   254k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13115|   254k|                helpers::substring(url_data, input_position));
13116|       |
13117|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13118|       |        // then set state to special authority ignore slashes state and increase
13119|       |        // pointer by 1.
13120|   254k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13120:13): [True: 252k, False: 1.69k]
  ------------------
13121|   252k|          input_position += 2;
13122|   252k|        }
13123|       |
13124|   254k|        [[fallthrough]];
13125|   254k|      }
13126|   254k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13126:7): [True: 0, False: 1.74M]
  ------------------
13127|   254k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13128|   254k|                helpers::substring(url_data, input_position));
13129|       |
13130|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13131|       |        // authority state and decrease pointer by 1.
13132|   256k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13132:16): [True: 256k, False: 70]
  ------------------
13133|   256k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13133:17): [True: 615, False: 255k]
  ------------------
13134|   255k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13134:17): [True: 1.25k, False: 254k]
  ------------------
13135|  1.86k|          input_position++;
13136|  1.86k|        }
13137|   254k|        state = state::AUTHORITY;
13138|       |
13139|   254k|        break;
13140|   254k|      }
13141|  9.99k|      case state::QUERY: {
  ------------------
  |  Branch (13141:7): [True: 9.99k, False: 1.73M]
  ------------------
13142|  9.99k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13143|  9.99k|        if constexpr (store_values) {
13144|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13145|       |          // if url is special; otherwise the query percent-encode set.
13146|  9.99k|          const uint8_t* query_percent_encode_set =
13147|  9.99k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13147:15): [True: 8.80k, False: 1.18k]
  ------------------
13148|  9.99k|                               : character_sets::QUERY_PERCENT_ENCODE;
13149|       |
13150|       |          // Percent-encode after encoding, with encoding, buffer, and
13151|       |          // queryPercentEncodeSet, and append the result to url's query.
13152|  9.99k|          url.update_base_search(url_data.substr(input_position),
13153|  9.99k|                                 query_percent_encode_set);
13154|  9.99k|          ada_log("QUERY update_base_search completed ");
13155|  9.99k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13155:15): [True: 7.43k, False: 2.56k]
  ------------------
13156|  7.43k|            url.update_unencoded_base_hash(*fragment);
13157|  7.43k|          }
13158|  9.99k|        }
13159|  9.99k|        enforce_max_input_length();
13160|  9.99k|        return url;
13161|   254k|      }
13162|   255k|      case state::HOST: {
  ------------------
  |  Branch (13162:7): [True: 255k, False: 1.48M]
  ------------------
13163|   255k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13164|       |
13165|   255k|        std::string_view host_view = url_data.substr(input_position);
13166|   255k|        auto [location, found_colon] =
13167|   255k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13168|   255k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13168:26): [True: 255k, False: 0]
  ------------------
13169|   255k|                             ? input_position + location
13170|   255k|                             : input_size;
13171|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13172|       |        // Note: the 'found_colon' value is true if and only if a colon was
13173|       |        // encountered while not inside brackets.
13174|   255k|        if (found_colon) {
  ------------------
  |  Branch (13174:13): [True: 2.40k, False: 252k]
  ------------------
13175|       |          // If buffer is the empty string, validation error, return failure.
13176|       |          // Let host be the result of host parsing buffer with url is not
13177|       |          // special.
13178|  2.40k|          ada_log("HOST parsing ", host_view);
13179|  2.40k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13179:15): [True: 163, False: 2.24k]
  ------------------
13180|    163|            return url;
13181|    163|          }
13182|  2.24k|          ada_log("HOST parsing results in ", url.get_hostname());
13183|       |          // Set url's host to host, buffer to the empty string, and state to
13184|       |          // port state.
13185|  2.24k|          state = state::PORT;
13186|  2.24k|          input_position++;
13187|  2.24k|        }
13188|       |        // Otherwise, if one of the following is true:
13189|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13190|       |        // - url is special and c is U+005C (\)
13191|       |        // The get_host_delimiter_location function either brings us to
13192|       |        // the colon outside of the bracket, or to one of those characters.
13193|   252k|        else {
13194|       |          // If url is special and host_view is the empty string, validation
13195|       |          // error, return failure.
13196|   252k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13196:15): [True: 161, False: 252k]
  |  Branch (13196:36): [True: 101, False: 60]
  ------------------
13197|    101|            url.is_valid = false;
13198|    101|            return url;
13199|    101|          }
13200|   252k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13201|       |          // Let host be the result of host parsing host_view with url is not
13202|       |          // special.
13203|   252k|          if (host_view.empty()) {
  ------------------
  |  Branch (13203:15): [True: 60, False: 252k]
  ------------------
13204|     60|            url.update_base_hostname("");
13205|   252k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13205:22): [True: 20.0k, False: 232k]
  ------------------
13206|  20.0k|            return url;
13207|  20.0k|          }
13208|   232k|          ada_log("HOST parsing results in ", url.get_hostname(),
13209|   232k|                  " href=", url.get_href());
13210|       |
13211|       |          // Set url's host to host, and state to path start state.
13212|   232k|          state = state::PATH_START;
13213|   232k|        }
13214|       |
13215|   234k|        break;
13216|   255k|      }
13217|   234k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13217:7): [True: 819, False: 1.74M]
  ------------------
13218|    819|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13219|       |        // Opaque path, query, and fragment are structurally always valid:
13220|       |        // the parser would just percent-encode whatever is there. When we
13221|       |        // are not storing values (can_parse), we can return immediately.
13222|       |        // We must set has_opaque_path = true before returning so that when
13223|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13224|       |        // correctly rejects relative inputs against an opaque-path base
13225|       |        // (e.g. can_parse("", &"W:") must return false).
13226|       |        if constexpr (!store_values) {
13227|       |          url.has_opaque_path = true;
13228|       |          return url;
13229|       |        }
13230|    819|        std::string_view view = url_data.substr(input_position);
13231|       |        // If c is U+003F (?), then set url's query to the empty string and
13232|       |        // state to query state.
13233|    819|        size_t location = view.find('?');
13234|    819|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13234:13): [True: 480, False: 339]
  ------------------
13235|    480|          view.remove_suffix(view.size() - location);
13236|    480|          state = state::QUERY;
13237|    480|          input_position += location + 1;
13238|    480|        } else {
13239|    339|          input_position = input_size + 1;
13240|    339|        }
13241|    819|        url.has_opaque_path = true;
13242|       |
13243|       |        // This is a really unlikely scenario in real world. We should not seek
13244|       |        // to optimize it.
13245|    819|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13245:13): [True: 9, False: 810]
  ------------------
13246|      9|          std::string modified_view =
13247|      9|              std::string(view.substr(0, view.size() - 1)) + "%20";
13248|      9|          url.update_base_pathname(unicode::percent_encode(
13249|      9|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13250|    810|        } else {
13251|    810|          url.update_base_pathname(unicode::percent_encode(
13252|    810|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13253|    810|        }
13254|    819|        break;
13255|   255k|      }
13256|  2.24k|      case state::PORT: {
  ------------------
  |  Branch (13256:7): [True: 2.24k, False: 1.73M]
  ------------------
13257|  2.24k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13258|  2.24k|        std::string_view port_view = url_data.substr(input_position);
13259|  2.24k|        input_position += url.parse_port(port_view, true);
13260|  2.24k|        if (!url.is_valid) {
  ------------------
  |  Branch (13260:13): [True: 208, False: 2.03k]
  ------------------
13261|    208|          return url;
13262|    208|        }
13263|  2.03k|        state = state::PATH_START;
13264|  2.03k|        [[fallthrough]];
13265|  2.03k|      }
13266|   235k|      case state::PATH_START: {
  ------------------
  |  Branch (13266:7): [True: 233k, False: 1.50M]
  ------------------
13267|   235k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13268|       |        // Path, query, and fragment are structurally always valid: the
13269|       |        // parser would just percent-encode whatever is there. When we are
13270|       |        // not storing values (can_parse), we can return immediately since
13271|       |        // no subsequent state can invalidate the URL.
13272|       |        if constexpr (!store_values) {
13273|       |          return url;
13274|       |        }
13275|       |
13276|       |        // If url is special, then:
13277|   235k|        if (url.is_special()) {
  ------------------
  |  Branch (13277:13): [True: 235k, False: 681]
  ------------------
13278|       |          // Set state to path state.
13279|   235k|          state = state::PATH;
13280|       |
13281|       |          // Optimization: Avoiding going into PATH state improves the
13282|       |          // performance of urls ending with /.
13283|   235k|          if (input_position == input_size) {
  ------------------
  |  Branch (13283:15): [True: 29.3k, False: 205k]
  ------------------
13284|  29.3k|            if constexpr (store_values) {
13285|  29.3k|              url.update_base_pathname("/");
13286|  29.3k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13286:19): [True: 276, False: 29.1k]
  ------------------
13287|    276|                url.update_unencoded_base_hash(*fragment);
13288|    276|              }
13289|  29.3k|            }
13290|  29.3k|            enforce_max_input_length();
13291|  29.3k|            return url;
13292|  29.3k|          }
13293|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13294|       |          // by 1. We know that (input_position == input_size) is impossible
13295|       |          // here, because of the previous if-check.
13296|   205k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13296:15): [True: 1.04k, False: 204k]
  ------------------
13297|  1.04k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13297:15): [True: 639, False: 402]
  ------------------
13298|    639|            break;
13299|    639|          }
13300|   205k|        }
13301|       |        // Otherwise, if state override is not given and c is U+003F (?),
13302|       |        // set url's query to the empty string and state to query state.
13303|    681|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13303:18): [True: 540, False: 141]
  ------------------
13304|    540|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13304:18): [True: 99, False: 441]
  ------------------
13305|     99|          state = state::QUERY;
13306|     99|        }
13307|       |        // Otherwise, if c is not the EOF code point:
13308|    582|        else if (input_position != input_size) {
  ------------------
  |  Branch (13308:18): [True: 441, False: 141]
  ------------------
13309|       |          // Set state to path state.
13310|    441|          state = state::PATH;
13311|       |
13312|       |          // If c is not U+002F (/), then decrease pointer by 1.
13313|    441|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13313:15): [True: 0, False: 441]
  ------------------
13314|      0|            break;
13315|      0|          }
13316|    441|        }
13317|       |
13318|   205k|        input_position++;
13319|   205k|        break;
13320|   235k|      }
13321|   206k|      case state::PATH: {
  ------------------
  |  Branch (13321:7): [True: 206k, False: 1.53M]
  ------------------
13322|   206k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13323|       |        // Path, query, and fragment are structurally always valid: the
13324|       |        // parser would just percent-encode whatever is there. When we are
13325|       |        // not storing values (can_parse), we can return immediately since
13326|       |        // no subsequent state can invalidate the URL.
13327|       |        if constexpr (!store_values) {
13328|       |          return url;
13329|       |        }
13330|   206k|        std::string_view view = url_data.substr(input_position);
13331|       |
13332|       |        // Most time, we do not need percent encoding.
13333|       |        // Furthermore, we can immediately locate the '?'.
13334|   206k|        size_t locofquestionmark = view.find('?');
13335|   206k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13335:13): [True: 9.41k, False: 197k]
  ------------------
13336|  9.41k|          state = state::QUERY;
13337|  9.41k|          view.remove_suffix(view.size() - locofquestionmark);
13338|  9.41k|          input_position += locofquestionmark + 1;
13339|   197k|        } else {
13340|   197k|          input_position = input_size + 1;
13341|   197k|        }
13342|   206k|        if constexpr (store_values) {
13343|   206k|          if constexpr (result_type_is_ada_url) {
13344|   206k|            helpers::parse_prepared_path(view, url.type, url.path);
13345|       |          } else {
13346|       |            url.consume_prepared_path(view);
13347|       |            ADA_ASSERT_TRUE(url.validate());
13348|       |          }
13349|   206k|        }
13350|   206k|        break;
13351|   235k|      }
13352|  1.36k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13352:7): [True: 1.36k, False: 1.73M]
  ------------------
13353|  1.36k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13354|       |
13355|       |        // If c is U+002F (/) or U+005C (\), then:
13356|  1.36k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13356:13): [True: 1.36k, False: 1]
  ------------------
13357|  1.36k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13357:14): [True: 1.35k, False: 13]
  ------------------
13358|  1.35k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13358:14): [True: 3, False: 10]
  ------------------
13359|  1.35k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13360|       |          // Set state to file host state.
13361|  1.35k|          state = state::FILE_HOST;
13362|  1.35k|          input_position++;
13363|  1.35k|        } else {
13364|     11|          ada_log("FILE_SLASH otherwise");
13365|       |          // If base is non-null and base's scheme is "file", then:
13366|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13367|       |          // base_url_has_value() is true.
13368|     11|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13368:15): [True: 0, False: 11]
  |  Branch (13368:38): [True: 0, False: 0]
  ------------------
13369|       |            // Set url's host to base's host.
13370|      0|            if constexpr (result_type_is_ada_url) {
13371|      0|              url.host = base_url->host;
13372|       |            } else {
13373|       |              url.update_host_to_base_host(base_url->get_host());
13374|       |            }
13375|       |            // If the code point substring from pointer to the end of input does
13376|       |            // not start with a Windows drive letter and base's path[0] is a
13377|       |            // normalized Windows drive letter, then append base's path[0] to
13378|       |            // url's path.
13379|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13379:17): [True: 0, False: 0]
  ------------------
13380|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13380:19): [True: 0, False: 0]
  ------------------
13381|      0|                      url_data.substr(input_position))) {
13382|      0|                std::string_view first_base_url_path =
13383|      0|                    base_url->get_pathname().substr(1);
13384|      0|                size_t loc = first_base_url_path.find('/');
13385|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13385:21): [True: 0, False: 0]
  ------------------
13386|      0|                  helpers::resize(first_base_url_path, loc);
13387|      0|                }
13388|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13388:21): [True: 0, False: 0]
  ------------------
13389|      0|                        first_base_url_path)) {
13390|      0|                  if constexpr (result_type_is_ada_url) {
13391|      0|                    url.path += '/';
13392|      0|                    url.path += first_base_url_path;
13393|       |                  } else {
13394|       |                    url.append_base_pathname(
13395|       |                        helpers::concat("/", first_base_url_path));
13396|       |                  }
13397|      0|                }
13398|      0|              }
13399|      0|            }
13400|      0|          }
13401|       |
13402|       |          // Set state to path state, and decrease pointer by 1.
13403|     11|          state = state::PATH;
13404|     11|        }
13405|       |
13406|  1.36k|        break;
13407|   235k|      }
13408|  1.35k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13408:7): [True: 1.35k, False: 1.73M]
  ------------------
13409|  1.35k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13410|  1.35k|        std::string_view view = url_data.substr(input_position);
13411|       |
13412|  1.35k|        size_t location = view.find_first_of("/\\?");
13413|  1.35k|        std::string_view file_host_buffer = view.substr(
13414|  1.35k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13414:16): [True: 1.31k, False: 39]
  ------------------
13415|       |
13416|  1.35k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13416:13): [True: 1, False: 1.35k]
  ------------------
13417|      1|          state = state::PATH;
13418|  1.35k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13418:20): [True: 276, False: 1.07k]
  ------------------
13419|       |          // Set url's host to the empty string.
13420|    276|          if constexpr (result_type_is_ada_url) {
13421|    276|            url.host = "";
13422|       |          } else {
13423|       |            url.update_base_hostname("");
13424|       |          }
13425|       |          // Set state to path start state.
13426|    276|          state = state::PATH_START;
13427|  1.07k|        } else {
13428|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13429|  1.07k|          input_position += consumed_bytes;
13430|       |          // Let host be the result of host parsing buffer with url is not
13431|       |          // special.
13432|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13432:15): [True: 81, False: 998]
  ------------------
13433|     81|            return url;
13434|     81|          }
13435|       |
13436|    998|          if constexpr (result_type_is_ada_url) {
13437|       |            // If host is "localhost", then set host to the empty string.
13438|    998|            if (url.host.has_value() && url.host.value() == "localhost") {
  ------------------
  |  Branch (13438:17): [True: 998, False: 0]
  |  Branch (13438:41): [True: 2, False: 996]
  ------------------
13439|      2|              url.host = "";
13440|      2|            }
13441|       |          } else {
13442|       |            if (url.get_hostname() == "localhost") {
13443|       |              url.update_base_hostname("");
13444|       |            }
13445|       |          }
13446|       |
13447|       |          // Set buffer to the empty string and state to path start state.
13448|    998|          state = state::PATH_START;
13449|    998|        }
13450|       |
13451|  1.27k|        break;
13452|  1.35k|      }
13453|  1.48k|      case state::FILE: {
  ------------------
  |  Branch (13453:7): [True: 1.48k, False: 1.73M]
  ------------------
13454|  1.48k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13455|  1.48k|        std::string_view file_view = url_data.substr(input_position);
13456|       |
13457|  1.48k|        url.set_protocol_as_file();
13458|  1.48k|        if constexpr (result_type_is_ada_url) {
13459|       |          // Set url's host to the empty string.
13460|  1.48k|          url.host = "";
13461|       |        } else {
13462|       |          url.update_base_hostname("");
13463|       |        }
13464|       |        // If c is U+002F (/) or U+005C (\), then:
13465|  1.48k|        if (input_position != input_size &&
  ------------------
  |  Branch (13465:13): [True: 1.48k, False: 1]
  ------------------
13466|  1.48k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13466:14): [True: 1.36k, False: 119]
  ------------------
13467|  1.36k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13467:14): [True: 2, False: 117]
  ------------------
13468|  1.36k|          ada_log("FILE c is U+002F or U+005C");
13469|       |          // Set state to file slash state.
13470|  1.36k|          state = state::FILE_SLASH;
13471|  1.36k|        }
13472|       |        // Otherwise, if base is non-null and base's scheme is "file":
13473|    118|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13473:18): [True: 0, False: 118]
  |  Branch (13473:41): [True: 0, False: 0]
  ------------------
13474|       |          // Set url's host to base's host, url's path to a clone of base's
13475|       |          // path, and url's query to base's query.
13476|      0|          ada_log("FILE base non-null");
13477|      0|          if constexpr (result_type_is_ada_url) {
13478|      0|            url.host = base_url->host;
13479|      0|            url.path = base_url->path;
13480|      0|            url.query = base_url->query;
13481|       |          } else {
13482|       |            url.update_host_to_base_host(base_url->get_hostname());
13483|       |            url.update_base_pathname(base_url->get_pathname());
13484|       |            if (base_url->has_search()) {
13485|       |              // get_search() returns "" for an empty query string (URL ends
13486|       |              // with '?'). update_base_search("") would incorrectly clear the
13487|       |              // query, so pass "?" to preserve the empty query distinction.
13488|       |              auto s = base_url->get_search();
13489|       |              url.update_base_search(s.empty() ? std::string_view("?") : s);
13490|       |            }
13491|       |          }
13492|      0|          url.has_opaque_path = base_url->has_opaque_path;
13493|       |
13494|       |          // If c is U+003F (?), then set url's query to the empty string and
13495|       |          // state to query state.
13496|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13496:15): [True: 0, False: 0]
  |  Branch (13496:47): [True: 0, False: 0]
  ------------------
13497|      0|            state = state::QUERY;
13498|      0|          }
13499|       |          // Otherwise, if c is not the EOF code point:
13500|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13500:20): [True: 0, False: 0]
  ------------------
13501|       |            // Set url's query to null.
13502|      0|            url.clear_search();
13503|       |            // If the code point substring from pointer to the end of input does
13504|       |            // not start with a Windows drive letter, then shorten url's path.
13505|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13505:17): [True: 0, False: 0]
  ------------------
13506|      0|              if constexpr (result_type_is_ada_url) {
13507|      0|                helpers::shorten_path(url.path, url.type);
13508|       |              } else {
13509|       |                std::string_view path = url.get_pathname();
13510|       |                if (helpers::shorten_path(path, url.type)) {
13511|       |                  url.update_base_pathname(std::move(std::string(path)));
13512|       |                }
13513|       |              }
13514|      0|            }
13515|       |            // Otherwise:
13516|      0|            else {
13517|       |              // Set url's path to an empty list.
13518|      0|              url.clear_pathname();
13519|      0|              url.has_opaque_path = true;
13520|      0|            }
13521|       |
13522|       |            // Set state to path state and decrease pointer by 1.
13523|      0|            state = state::PATH;
13524|      0|            break;
13525|      0|          }
13526|      0|        }
13527|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13528|    118|        else {
13529|    118|          ada_log("FILE go to path");
13530|    118|          state = state::PATH;
13531|    118|          break;
13532|    118|        }
13533|       |
13534|  1.36k|        input_position++;
13535|  1.36k|        break;
13536|  1.48k|      }
13537|      0|      default:
  ------------------
  |  Branch (13537:7): [True: 0, False: 1.74M]
  ------------------
13538|      0|        unreachable();
13539|  1.74M|    }
13540|  1.74M|  }
13541|   537k|  if constexpr (store_values) {
13542|   537k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13542:9): [True: 2.33k, False: 534k]
  ------------------
13543|  2.33k|      url.update_unencoded_base_hash(*fragment);
13544|  2.33k|    }
13545|   537k|  }
13546|   537k|  enforce_max_input_length();
13547|   537k|  return url;
13548|   597k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12528|   597k|                           const result_type* base_url) {
12529|       |  // We can specialize the implementation per type.
12530|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12531|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12532|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12533|       |  // and ada::url **do not have to support the exact same API**.
12534|   597k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12535|   597k|  constexpr bool result_type_is_ada_url_aggregator =
12536|   597k|      std::is_same_v<url_aggregator, result_type>;
12537|   597k|  static_assert(result_type_is_ada_url ||
12538|   597k|                result_type_is_ada_url_aggregator);  // We don't support
12539|       |                                                     // anything else for now.
12540|       |
12541|   597k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12542|   597k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12543|   597k|          ")");
12544|       |
12545|   597k|  result_type url{};
12546|       |
12547|   597k|  const uint32_t max_input_length = ada::get_max_input_length();
12548|       |
12549|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12550|       |  // max_input_length even when the input fit under it. The check at the end of
12551|       |  // the state machine covers URLs that run to completion, but several states
12552|       |  // return early after appending a query or fragment, so run the same check on
12553|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12554|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12555|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12556|   597k|  const auto enforce_max_input_length = [&]() {
12557|   597k|    if constexpr (store_values) {
12558|   597k|      if (url.is_valid) {
12559|   597k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|   597k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12561|   597k|            url.is_valid = false;
12562|   597k|          }
12563|   597k|        } else {
12564|   597k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|   597k|            url.is_valid = false;
12566|   597k|          }
12567|   597k|        }
12568|   597k|      }
12569|   597k|    }
12570|   597k|  };
12571|       |
12572|       |  // We refuse to parse URL strings that exceed the maximum input length.
12573|       |  // By default, this is 4GB but can be configured via
12574|       |  // ada::set_max_input_length().
12575|   597k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12575:7): [True: 0, False: 597k]
  ------------------
12576|      0|    url.is_valid = false;
12577|      0|  }
12578|       |  // Going forward, user_input.size() is in [0,
12579|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12580|       |  // base, or the optional_url was invalid, we must return.
12581|   597k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12581:7): [True: 0, False: 597k]
  ------------------
12582|      0|    url.is_valid &= base_url->is_valid;
12583|      0|  }
12584|   597k|  if (!url.is_valid) {
  ------------------
  |  Branch (12584:7): [True: 0, False: 597k]
  ------------------
12585|      0|    return url;
12586|      0|  }
12587|       |
12588|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12589|   597k|  if constexpr (store_values) {
12590|   597k|    bool hit_fast_path = false;
12591|   597k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12591:9): [True: 597k, False: 0]
  ------------------
12592|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12593|       |      // call so those URLs (including SetHref) do not pay for a miss.
12594|   597k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12595|   597k|      const size_t n = user_input.size();
12596|   597k|      size_t host_start = 0;
12597|   597k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12597:11): [True: 597k, False: 237]
  |  Branch (12597:21): [True: 228k, False: 368k]
  |  Branch (12597:36): [True: 227k, False: 896]
  |  Branch (12597:51): [True: 227k, False: 151]
  ------------------
12598|   227k|        host_start = 7;
12599|   369k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12599:18): [True: 369k, False: 250]
  |  Branch (12599:28): [True: 366k, False: 2.63k]
  |  Branch (12599:43): [True: 366k, False: 829]
  |  Branch (12599:58): [True: 365k, False: 100]
  ------------------
12600|   365k|        host_start = 8;
12601|   365k|      }
12602|   597k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12602:34): [True: 593k, False: 3.81k]
  ------------------
12603|   597k|      const bool skip_ip =
12604|   597k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12604:11): [True: 550, False: 596k]
  |  Branch (12604:33): [True: 590k, False: 6.73k]
  |  Branch (12604:54): [True: 133k, False: 456k]
  ------------------
12605|   597k|      const bool skip_userinfo =
12606|   597k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12606:11): [True: 593k, False: 3.81k]
  |  Branch (12606:30): [True: 38.0k, False: 555k]
  ------------------
12607|   597k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12607:23): [True: 463k, False: 134k]
  |  Branch (12607:35): [True: 425k, False: 38.0k]
  ------------------
12608|   425k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12608:23): [True: 339k, False: 86.0k]
  ------------------
12609|   597k|    } else {
12610|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12611|      0|    }
12612|   597k|    if (hit_fast_path) {
  ------------------
  |  Branch (12612:9): [True: 339k, False: 258k]
  ------------------
12613|   339k|      if constexpr (result_type_is_ada_url_aggregator) {
12614|   339k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12614:13): [True: 0, False: 339k]
  ------------------
12615|      0|          url.is_valid = false;
12616|      0|        }
12617|       |      } else {
12618|       |        // For a small absolute input, even worst-case normalization cannot
12619|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12620|       |        // most 4.5x. Avoid traversing every stored component on the common
12621|       |        // default-limit path.
12622|       |        if ((base_url != nullptr ||
12623|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12624|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12625|       |          url.is_valid = false;
12626|       |        }
12627|       |      }
12628|   339k|      return url;
12629|   339k|    }
12630|   597k|  }
12631|       |
12632|   258k|  state state = state::SCHEME_START;
12633|       |
12634|   597k|  std::string tmp_buffer;
12635|   597k|  std::string_view url_data;
12636|   597k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12636:7): [True: 432, False: 597k]
  ------------------
12637|    432|    tmp_buffer = user_input;
12638|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12639|       |    // just directly build the string from user_input.
12640|    432|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12641|    432|    url_data = tmp_buffer;
12642|   597k|  } else [[likely]] {
12643|   597k|    url_data = user_input;
12644|   597k|  }
12645|       |
12646|       |  // Leading and trailing control characters are uncommon and easy to deal with
12647|       |  // (no performance concern).
12648|   597k|  helpers::trim_c0_whitespace(url_data);
12649|       |
12650|   597k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12651|       |    // Most of the time, we just need user_input.size().
12652|       |    // In some instances, we may need a bit more.
12653|       |    ///////////////////////////
12654|       |    // This is *very* important. This line should *not* be removed
12655|       |    // hastily. There are principled reasons why reserve is important
12656|       |    // for performance. If you have a benchmark with small inputs,
12657|       |    // it may not matter, but in other instances, it could.
12658|       |    ////
12659|       |    // This rounds up to the next power of two.
12660|       |    // We know that user_input.size() is in [0,
12661|       |    // std::numeric_limits<uint32_t>::max).
12662|   597k|    uint32_t reserve_capacity =
12663|   597k|        (0xFFFFFFFF >>
12664|   597k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12665|   597k|        1;
12666|   597k|    url.reserve(reserve_capacity);
12667|   597k|  }
12668|       |
12669|       |  // Optimization opportunity. Most websites do not have fragment.
12670|   597k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12671|       |  // We add it last so that an implementation like ada::url_aggregator
12672|       |  // can append it last to its internal buffer, thus improving performance.
12673|       |
12674|       |  // Here url_data no longer has its fragment.
12675|       |  // We are going to access the data from url_data (it is immutable).
12676|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12677|       |  // The input_position variable should range from 0 to input_size.
12678|       |  // It is illegal to access url_data at input_size.
12679|   597k|  size_t input_position = 0;
12680|   597k|  const size_t input_size = url_data.size();
12681|       |  // Keep running the following state machine by switching on state.
12682|       |  // If after a run pointer points to the EOF code point, go to the next step.
12683|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12684|       |  // We never decrement input_position.
12685|  2.27M|  while (input_position <= input_size) {
  ------------------
  |  Branch (12685:10): [True: 1.74M, False: 537k]
  ------------------
12686|  1.74M|    ada_log("In parsing at ", input_position, " out of ", input_size,
12687|  1.74M|            " in state ", ada::to_string(state));
12688|  1.74M|    switch (state) {
12689|   258k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12689:7): [True: 258k, False: 1.48M]
  ------------------
12690|   258k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12691|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12692|       |        // state to scheme state.
12693|   258k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12693:13): [True: 258k, False: 2]
  ------------------
12694|   258k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12694:13): [True: 258k, False: 139]
  ------------------
12695|   258k|          state = state::SCHEME;
12696|   258k|          input_position++;
12697|   258k|        } else {
12698|       |          // Otherwise, if state override is not given, set state to no scheme
12699|       |          // state and decrease pointer by 1.
12700|    141|          state = state::NO_SCHEME;
12701|    141|        }
12702|   258k|        break;
12703|      0|      }
12704|   258k|      case state::SCHEME: {
  ------------------
  |  Branch (12704:7): [True: 258k, False: 1.48M]
  ------------------
12705|   258k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12706|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12707|       |        // append c, lowercased, to buffer.
12708|  1.12M|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12708:16): [True: 1.12M, False: 1]
  ------------------
12709|  1.12M|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12709:16): [True: 862k, False: 258k]
  ------------------
12710|   862k|          input_position++;
12711|   862k|        }
12712|       |        // Otherwise, if c is U+003A (:), then:
12713|   258k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12713:13): [True: 258k, False: 1]
  ------------------
12714|   258k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12714:13): [True: 258k, False: 76]
  ------------------
12715|   258k|          ada_log("SCHEME the scheme should be ",
12716|   258k|                  url_data.substr(0, input_position));
12717|       |          if constexpr (result_type_is_ada_url) {
12718|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
12719|       |              return url;
12720|       |            }
12721|   258k|          } else {
12722|       |            // we pass the colon along instead of painfully adding it back.
12723|   258k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (12723:17): [True: 0, False: 258k]
  ------------------
12724|   258k|                    url_data.substr(0, input_position + 1))) {
12725|      0|              return url;
12726|      0|            }
12727|   258k|          }
12728|   258k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12729|       |
12730|       |          // If url's scheme is "file", then:
12731|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12732|   258k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12732:15): [True: 1.48k, False: 256k]
  ------------------
12733|       |            // Set state to file state.
12734|  1.48k|            state = state::FILE;
12735|  1.48k|          }
12736|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12737|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12738|       |          // != nullptr is false.
12739|   256k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12739:20): [True: 254k, False: 1.92k]
  |  Branch (12739:40): [True: 0, False: 254k]
  ------------------
12740|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12740:20): [True: 0, False: 0]
  ------------------
12741|       |            // Set state to special relative or authority state.
12742|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12743|      0|          }
12744|       |          // Otherwise, if url is special, set state to special authority
12745|       |          // slashes state.
12746|   256k|          else if (url.is_special()) {
  ------------------
  |  Branch (12746:20): [True: 254k, False: 1.92k]
  ------------------
12747|   254k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12748|   254k|          }
12749|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12750|       |          // path or authority state and increase pointer by 1.
12751|  1.92k|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12751:20): [True: 1.71k, False: 210]
  ------------------
12752|  1.71k|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12752:20): [True: 1.11k, False: 609]
  ------------------
12753|  1.11k|            state = state::PATH_OR_AUTHORITY;
12754|  1.11k|            input_position++;
12755|  1.11k|          }
12756|       |          // Otherwise, set url's path to the empty string and set state to
12757|       |          // opaque path state.
12758|    819|          else {
12759|    819|            state = state::OPAQUE_PATH;
12760|    819|          }
12761|   258k|        }
12762|       |        // Otherwise, if state override is not given, set buffer to the empty
12763|       |        // string, state to no scheme state, and start over (from the first code
12764|       |        // point in input).
12765|     77|        else {
12766|     77|          state = state::NO_SCHEME;
12767|     77|          input_position = 0;
12768|     77|          break;
12769|     77|        }
12770|   258k|        input_position++;
12771|   258k|        break;
12772|   258k|      }
12773|    218|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12773:7): [True: 218, False: 1.74M]
  ------------------
12774|    218|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12775|       |        // The fragment was pruned from url_data before the state machine ran,
12776|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12777|       |        // nothing else remains in front of it.
12778|    218|        const bool c_is_hash =
12779|    218|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12779:13): [True: 139, False: 79]
  |  Branch (12779:37): [True: 2, False: 137]
  ------------------
12780|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12781|       |        // validation error, return failure.
12782|    218|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12782:13): [True: 218, False: 0]
  |  Branch (12782:37): [True: 0, False: 0]
  |  Branch (12782:66): [True: 0, False: 0]
  ------------------
12783|    218|          ada_log("NO_SCHEME validation error");
12784|    218|          url.is_valid = false;
12785|    218|          return url;
12786|    218|        }
12787|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12788|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12789|       |        // query to base's query, and set state to fragment state.
12790|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12790:18): [True: 0, False: 0]
  |  Branch (12790:47): [True: 0, False: 0]
  ------------------
12791|      0|          ada_log("NO_SCHEME opaque base with fragment");
12792|      0|          url.copy_scheme(*base_url);
12793|      0|          url.has_opaque_path = base_url->has_opaque_path;
12794|       |
12795|       |          if constexpr (result_type_is_ada_url) {
12796|       |            url.path = base_url->path;
12797|       |            url.query = base_url->query;
12798|      0|          } else {
12799|      0|            url.update_base_pathname(base_url->get_pathname());
12800|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (12800:17): [True: 0, False: 0]
  ------------------
12801|       |              // get_search() returns "" for an empty query string (URL ends
12802|       |              // with '?'). update_base_search("") would incorrectly clear the
12803|       |              // query, so pass "?" to preserve the empty query distinction.
12804|      0|              auto s = base_url->get_search();
12805|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (12805:38): [True: 0, False: 0]
  ------------------
12806|      0|            }
12807|      0|          }
12808|      0|          url.update_unencoded_base_hash(*fragment);
12809|      0|          enforce_max_input_length();
12810|      0|          return url;
12811|      0|        }
12812|       |        // Otherwise, if base's scheme is not "file", set state to relative
12813|       |        // state and decrease pointer by 1.
12814|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12815|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12815:18): [True: 0, False: 0]
  ------------------
12816|      0|          ada_log("NO_SCHEME non-file relative path");
12817|      0|          state = state::RELATIVE_SCHEME;
12818|      0|        }
12819|       |        // Otherwise, set state to file state and decrease pointer by 1.
12820|      0|        else {
12821|      0|          ada_log("NO_SCHEME file base type");
12822|      0|          state = state::FILE;
12823|      0|        }
12824|      0|        break;
12825|    218|      }
12826|   255k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12826:7): [True: 255k, False: 1.48M]
  ------------------
12827|   255k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12828|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12829|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12830|       |        // worry about AUTHORITY.
12831|       |        // TODO: Instead of just collecting a bool, collect the location of the
12832|       |        // '@' and do something useful with it.
12833|       |        // TODO: We could do various processing early on, using a single pass
12834|       |        // over the string to collect information about it, e.g., telling us
12835|       |        // whether there is a @ and if so, where (or how many).
12836|       |
12837|       |        // Check if url data contains an @.
12838|   255k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12838:13): [True: 216k, False: 39.2k]
  ------------------
12839|   216k|          state = state::HOST;
12840|   216k|          break;
12841|   216k|        }
12842|  39.2k|        bool at_sign_seen{false};
12843|  39.2k|        bool password_token_seen{false};
12844|       |        /**
12845|       |         * We expect something of the sort...
12846|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12847|       |         * --------^
12848|       |         */
12849|  92.3k|        do {
12850|  92.3k|          std::string_view view = url_data.substr(input_position);
12851|       |          // The delimiters are @, /, ? \\.
12852|  92.3k|          size_t location =
12853|  92.3k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12853:15): [True: 92.1k, False: 154]
  ------------------
12854|  92.3k|                               : helpers::find_authority_delimiter(view);
12855|  92.3k|          std::string_view authority_view = view.substr(0, location);
12856|  92.3k|          size_t end_of_authority = input_position + authority_view.size();
12857|       |          // If c is U+0040 (@), then:
12858|  92.3k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12858:15): [True: 82.7k, False: 9.55k]
  ------------------
12859|  82.7k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12859:15): [True: 53.0k, False: 29.7k]
  ------------------
12860|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12861|  53.0k|            if (at_sign_seen) {
  ------------------
  |  Branch (12861:17): [True: 14.0k, False: 39.0k]
  ------------------
12862|  14.0k|              if (password_token_seen) {
  ------------------
  |  Branch (12862:19): [True: 4.64k, False: 9.40k]
  ------------------
12863|       |                if constexpr (result_type_is_ada_url) {
12864|       |                  url.password += "%40";
12865|  4.64k|                } else {
12866|  4.64k|                  url.append_base_password("%40");
12867|  4.64k|                }
12868|  9.40k|              } else {
12869|       |                if constexpr (result_type_is_ada_url) {
12870|       |                  url.username += "%40";
12871|  9.40k|                } else {
12872|  9.40k|                  url.append_base_username("%40");
12873|  9.40k|                }
12874|  9.40k|              }
12875|  14.0k|            }
12876|       |
12877|  53.0k|            at_sign_seen = true;
12878|       |
12879|  53.0k|            if (!password_token_seen) {
  ------------------
  |  Branch (12879:17): [True: 48.4k, False: 4.64k]
  ------------------
12880|  48.4k|              size_t password_token_location = authority_view.find(':');
12881|  48.4k|              password_token_seen =
12882|  48.4k|                  password_token_location != std::string_view::npos;
12883|       |
12884|  48.4k|              if constexpr (store_values) {
12885|  48.4k|                if (!password_token_seen) {
  ------------------
  |  Branch (12885:21): [True: 19.8k, False: 28.5k]
  ------------------
12886|       |                  if constexpr (result_type_is_ada_url) {
12887|       |                    url.username += unicode::percent_encode(
12888|       |                        authority_view,
12889|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12890|  19.8k|                  } else {
12891|  19.8k|                    url.append_base_username(unicode::percent_encode(
12892|  19.8k|                        authority_view,
12893|  19.8k|                        character_sets::USERINFO_PERCENT_ENCODE));
12894|  19.8k|                  }
12895|  28.5k|                } else {
12896|       |                  if constexpr (result_type_is_ada_url) {
12897|       |                    url.username += unicode::percent_encode(
12898|       |                        authority_view.substr(0, password_token_location),
12899|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12900|       |                    url.password += unicode::percent_encode(
12901|       |                        authority_view.substr(password_token_location + 1),
12902|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12903|  28.5k|                  } else {
12904|  28.5k|                    url.append_base_username(unicode::percent_encode(
12905|  28.5k|                        authority_view.substr(0, password_token_location),
12906|  28.5k|                        character_sets::USERINFO_PERCENT_ENCODE));
12907|  28.5k|                    url.append_base_password(unicode::percent_encode(
12908|  28.5k|                        authority_view.substr(password_token_location + 1),
12909|  28.5k|                        character_sets::USERINFO_PERCENT_ENCODE));
12910|  28.5k|                  }
12911|  28.5k|                }
12912|  48.4k|              }
12913|  48.4k|            } else if constexpr (store_values) {
12914|       |              if constexpr (result_type_is_ada_url) {
12915|       |                url.password += unicode::percent_encode(
12916|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12917|  4.64k|              } else {
12918|  4.64k|                url.append_base_password(unicode::percent_encode(
12919|  4.64k|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12920|  4.64k|              }
12921|  4.64k|            }
12922|  53.0k|          }
12923|       |          // Otherwise, if one of the following is true:
12924|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12925|       |          // - url is special and c is U+005C (\)
12926|  39.2k|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12926:20): [True: 9.55k, False: 29.7k]
  ------------------
12927|  29.7k|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12927:20): [True: 29.5k, False: 169]
  ------------------
12928|    169|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12928:20): [True: 134, False: 35]
  ------------------
12929|  39.2k|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12929:21): [True: 35, False: 0]
  |  Branch (12929:41): [True: 35, False: 0]
  ------------------
12930|       |            // If atSignSeen is true and authority_view is the empty string,
12931|       |            // validation error, return failure.
12932|  39.2k|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12932:17): [True: 39.0k, False: 241]
  |  Branch (12932:33): [True: 237, False: 38.7k]
  ------------------
12933|    237|              url.is_valid = false;
12934|    237|              return url;
12935|    237|            }
12936|  39.0k|            state = state::HOST;
12937|  39.0k|            break;
12938|  39.2k|          }
12939|  53.0k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12939:15): [True: 0, False: 53.0k]
  ------------------
12940|      0|            if constexpr (store_values) {
12941|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12941:19): [True: 0, False: 0]
  ------------------
12942|      0|                url.update_unencoded_base_hash(*fragment);
12943|      0|              }
12944|      0|            }
12945|      0|            enforce_max_input_length();
12946|      0|            return url;
12947|      0|          }
12948|  53.0k|          input_position = end_of_authority + 1;
12949|  53.0k|        } while (true);
  ------------------
  |  Branch (12949:18): [True: 53.0k, Folded]
  ------------------
12950|       |
12951|  39.0k|        break;
12952|  39.2k|      }
12953|  39.0k|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12953:7): [True: 0, False: 1.74M]
  ------------------
12954|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12955|      0|                helpers::substring(url_data, input_position));
12956|       |
12957|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12958|       |        // then set state to special authority ignore slashes state and increase
12959|       |        // pointer by 1.
12960|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12960:13): [True: 0, False: 0]
  ------------------
12961|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12962|      0|          input_position += 2;
12963|      0|        } else {
12964|       |          // Otherwise, validation error, set state to relative state and
12965|       |          // decrease pointer by 1.
12966|      0|          state = state::RELATIVE_SCHEME;
12967|      0|        }
12968|       |
12969|      0|        break;
12970|  39.2k|      }
12971|  1.11k|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12971:7): [True: 1.11k, False: 1.73M]
  ------------------
12972|  1.11k|        ada_log("PATH_OR_AUTHORITY ",
12973|  1.11k|                helpers::substring(url_data, input_position));
12974|       |
12975|       |        // If c is U+002F (/), then set state to authority state.
12976|  1.11k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12976:13): [True: 1.05k, False: 51]
  ------------------
12977|  1.05k|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12977:13): [True: 741, False: 318]
  ------------------
12978|    741|          state = state::AUTHORITY;
12979|    741|          input_position++;
12980|    741|        } else {
12981|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12982|    369|          state = state::PATH;
12983|    369|        }
12984|       |
12985|  1.11k|        break;
12986|  39.2k|      }
12987|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12987:7): [True: 0, False: 1.74M]
  ------------------
12988|      0|        ada_log("RELATIVE_SCHEME ",
12989|      0|                helpers::substring(url_data, input_position));
12990|       |
12991|       |        // Set url's scheme to base's scheme.
12992|      0|        url.copy_scheme(*base_url);
12993|       |
12994|       |        // If c is U+002F (/), then set state to relative slash state.
12995|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12995:13): [True: 0, False: 0]
  ------------------
12996|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12997|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12997:13): [True: 0, False: 0]
  ------------------
12998|      0|          ada_log(
12999|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13000|      0|              "slash state");
13001|      0|          state = state::RELATIVE_SLASH;
13002|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13002:20): [True: 0, False: 0]
  |  Branch (13002:40): [True: 0, False: 0]
  ------------------
13003|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13003:20): [True: 0, False: 0]
  ------------------
13004|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13005|       |          // set state to relative slash state.
13006|      0|          ada_log(
13007|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13008|      0|              "error, set state to relative slash state");
13009|      0|          state = state::RELATIVE_SLASH;
13010|      0|        } else {
13011|      0|          ada_log("RELATIVE_SCHEME otherwise");
13012|       |          // Set url's username to base's username, url's password to base's
13013|       |          // password, url's host to base's host, url's port to base's port,
13014|       |          // url's path to a clone of base's path, and url's query to base's
13015|       |          // query.
13016|       |          if constexpr (result_type_is_ada_url) {
13017|       |            url.username = base_url->username;
13018|       |            url.password = base_url->password;
13019|       |            url.host = base_url->host;
13020|       |            url.port = base_url->port;
13021|       |            // cloning the base path includes cloning the has_opaque_path flag
13022|       |            url.has_opaque_path = base_url->has_opaque_path;
13023|       |            url.path = base_url->path;
13024|       |            url.query = base_url->query;
13025|      0|          } else {
13026|      0|            url.update_base_authority(base_url->get_href(),
13027|      0|                                      base_url->get_components());
13028|      0|            url.update_host_to_base_host(base_url->get_hostname());
13029|      0|            url.update_base_port(base_url->retrieve_base_port());
13030|       |            // cloning the base path includes cloning the has_opaque_path flag
13031|      0|            url.has_opaque_path = base_url->has_opaque_path;
13032|      0|            url.update_base_pathname(base_url->get_pathname());
13033|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13033:17): [True: 0, False: 0]
  ------------------
13034|       |              // get_search() returns "" for an empty query string (URL ends
13035|       |              // with '?'). update_base_search("") would incorrectly clear the
13036|       |              // query, so pass "?" to preserve the empty query distinction.
13037|      0|              auto s = base_url->get_search();
13038|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13038:38): [True: 0, False: 0]
  ------------------
13039|      0|            }
13040|      0|          }
13041|       |
13042|      0|          url.has_opaque_path = base_url->has_opaque_path;
13043|       |
13044|       |          // If c is U+003F (?), then set url's query to the empty string, and
13045|       |          // state to query state.
13046|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13046:15): [True: 0, False: 0]
  ------------------
13047|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13047:15): [True: 0, False: 0]
  ------------------
13048|      0|            state = state::QUERY;
13049|      0|          }
13050|       |          // Otherwise, if c is not the EOF code point:
13051|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13051:20): [True: 0, False: 0]
  ------------------
13052|       |            // Set url's query to null.
13053|      0|            url.clear_search();
13054|       |            if constexpr (result_type_is_ada_url) {
13055|       |              // Shorten url's path.
13056|       |              helpers::shorten_path(url.path, url.type);
13057|      0|            } else {
13058|      0|              std::string_view path = url.get_pathname();
13059|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13059:19): [True: 0, False: 0]
  ------------------
13060|      0|                url.update_base_pathname(std::move(std::string(path)));
13061|      0|              }
13062|      0|            }
13063|       |            // Set state to path state and decrease pointer by 1.
13064|      0|            state = state::PATH;
13065|      0|            break;
13066|      0|          }
13067|      0|        }
13068|      0|        input_position++;
13069|      0|        break;
13070|      0|      }
13071|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13071:7): [True: 0, False: 1.74M]
  ------------------
13072|      0|        ada_log("RELATIVE_SLASH ",
13073|      0|                helpers::substring(url_data, input_position));
13074|       |
13075|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13076|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13077|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13077:13): [True: 0, False: 0]
  |  Branch (13077:33): [True: 0, False: 0]
  ------------------
13078|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13078:14): [True: 0, False: 0]
  ------------------
13079|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13079:14): [True: 0, False: 0]
  ------------------
13080|       |          // Set state to special authority ignore slashes state.
13081|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13082|      0|        }
13083|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13084|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13084:18): [True: 0, False: 0]
  ------------------
13085|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13085:18): [True: 0, False: 0]
  ------------------
13086|      0|          state = state::AUTHORITY;
13087|      0|        }
13088|       |        // Otherwise, set
13089|       |        // - url's username to base's username,
13090|       |        // - url's password to base's password,
13091|       |        // - url's host to base's host,
13092|       |        // - url's port to base's port,
13093|       |        // - state to path state, and then, decrease pointer by 1.
13094|      0|        else {
13095|       |          if constexpr (result_type_is_ada_url) {
13096|       |            url.username = base_url->username;
13097|       |            url.password = base_url->password;
13098|       |            url.host = base_url->host;
13099|       |            url.port = base_url->port;
13100|      0|          } else {
13101|      0|            url.update_base_authority(base_url->get_href(),
13102|      0|                                      base_url->get_components());
13103|      0|            url.update_host_to_base_host(base_url->get_hostname());
13104|      0|            url.update_base_port(base_url->retrieve_base_port());
13105|      0|          }
13106|      0|          state = state::PATH;
13107|      0|          break;
13108|      0|        }
13109|       |
13110|      0|        input_position++;
13111|      0|        break;
13112|      0|      }
13113|   254k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13113:7): [True: 254k, False: 1.48M]
  ------------------
13114|   254k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13115|   254k|                helpers::substring(url_data, input_position));
13116|       |
13117|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13118|       |        // then set state to special authority ignore slashes state and increase
13119|       |        // pointer by 1.
13120|   254k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13120:13): [True: 252k, False: 1.69k]
  ------------------
13121|   252k|          input_position += 2;
13122|   252k|        }
13123|       |
13124|   254k|        [[fallthrough]];
13125|   254k|      }
13126|   254k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13126:7): [True: 0, False: 1.74M]
  ------------------
13127|   254k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13128|   254k|                helpers::substring(url_data, input_position));
13129|       |
13130|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13131|       |        // authority state and decrease pointer by 1.
13132|   256k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13132:16): [True: 256k, False: 70]
  ------------------
13133|   256k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13133:17): [True: 615, False: 255k]
  ------------------
13134|   255k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13134:17): [True: 1.25k, False: 254k]
  ------------------
13135|  1.86k|          input_position++;
13136|  1.86k|        }
13137|   254k|        state = state::AUTHORITY;
13138|       |
13139|   254k|        break;
13140|   254k|      }
13141|  9.99k|      case state::QUERY: {
  ------------------
  |  Branch (13141:7): [True: 9.99k, False: 1.73M]
  ------------------
13142|  9.99k|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13143|  9.99k|        if constexpr (store_values) {
13144|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13145|       |          // if url is special; otherwise the query percent-encode set.
13146|  9.99k|          const uint8_t* query_percent_encode_set =
13147|  9.99k|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13147:15): [True: 8.80k, False: 1.18k]
  ------------------
13148|  9.99k|                               : character_sets::QUERY_PERCENT_ENCODE;
13149|       |
13150|       |          // Percent-encode after encoding, with encoding, buffer, and
13151|       |          // queryPercentEncodeSet, and append the result to url's query.
13152|  9.99k|          url.update_base_search(url_data.substr(input_position),
13153|  9.99k|                                 query_percent_encode_set);
13154|  9.99k|          ada_log("QUERY update_base_search completed ");
13155|  9.99k|          if (fragment.has_value()) {
  ------------------
  |  Branch (13155:15): [True: 7.43k, False: 2.56k]
  ------------------
13156|  7.43k|            url.update_unencoded_base_hash(*fragment);
13157|  7.43k|          }
13158|  9.99k|        }
13159|  9.99k|        enforce_max_input_length();
13160|  9.99k|        return url;
13161|   254k|      }
13162|   255k|      case state::HOST: {
  ------------------
  |  Branch (13162:7): [True: 255k, False: 1.48M]
  ------------------
13163|   255k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13164|       |
13165|   255k|        std::string_view host_view = url_data.substr(input_position);
13166|   255k|        auto [location, found_colon] =
13167|   255k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13168|   255k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13168:26): [True: 255k, False: 0]
  ------------------
13169|   255k|                             ? input_position + location
13170|   255k|                             : input_size;
13171|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13172|       |        // Note: the 'found_colon' value is true if and only if a colon was
13173|       |        // encountered while not inside brackets.
13174|   255k|        if (found_colon) {
  ------------------
  |  Branch (13174:13): [True: 2.40k, False: 252k]
  ------------------
13175|       |          // If buffer is the empty string, validation error, return failure.
13176|       |          // Let host be the result of host parsing buffer with url is not
13177|       |          // special.
13178|  2.40k|          ada_log("HOST parsing ", host_view);
13179|  2.40k|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13179:15): [True: 163, False: 2.24k]
  ------------------
13180|    163|            return url;
13181|    163|          }
13182|  2.24k|          ada_log("HOST parsing results in ", url.get_hostname());
13183|       |          // Set url's host to host, buffer to the empty string, and state to
13184|       |          // port state.
13185|  2.24k|          state = state::PORT;
13186|  2.24k|          input_position++;
13187|  2.24k|        }
13188|       |        // Otherwise, if one of the following is true:
13189|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13190|       |        // - url is special and c is U+005C (\)
13191|       |        // The get_host_delimiter_location function either brings us to
13192|       |        // the colon outside of the bracket, or to one of those characters.
13193|   252k|        else {
13194|       |          // If url is special and host_view is the empty string, validation
13195|       |          // error, return failure.
13196|   252k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13196:15): [True: 161, False: 252k]
  |  Branch (13196:36): [True: 101, False: 60]
  ------------------
13197|    101|            url.is_valid = false;
13198|    101|            return url;
13199|    101|          }
13200|   252k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13201|       |          // Let host be the result of host parsing host_view with url is not
13202|       |          // special.
13203|   252k|          if (host_view.empty()) {
  ------------------
  |  Branch (13203:15): [True: 60, False: 252k]
  ------------------
13204|     60|            url.update_base_hostname("");
13205|   252k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13205:22): [True: 20.0k, False: 232k]
  ------------------
13206|  20.0k|            return url;
13207|  20.0k|          }
13208|   232k|          ada_log("HOST parsing results in ", url.get_hostname(),
13209|   232k|                  " href=", url.get_href());
13210|       |
13211|       |          // Set url's host to host, and state to path start state.
13212|   232k|          state = state::PATH_START;
13213|   232k|        }
13214|       |
13215|   234k|        break;
13216|   255k|      }
13217|   234k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13217:7): [True: 819, False: 1.74M]
  ------------------
13218|    819|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13219|       |        // Opaque path, query, and fragment are structurally always valid:
13220|       |        // the parser would just percent-encode whatever is there. When we
13221|       |        // are not storing values (can_parse), we can return immediately.
13222|       |        // We must set has_opaque_path = true before returning so that when
13223|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13224|       |        // correctly rejects relative inputs against an opaque-path base
13225|       |        // (e.g. can_parse("", &"W:") must return false).
13226|       |        if constexpr (!store_values) {
13227|       |          url.has_opaque_path = true;
13228|       |          return url;
13229|       |        }
13230|    819|        std::string_view view = url_data.substr(input_position);
13231|       |        // If c is U+003F (?), then set url's query to the empty string and
13232|       |        // state to query state.
13233|    819|        size_t location = view.find('?');
13234|    819|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13234:13): [True: 480, False: 339]
  ------------------
13235|    480|          view.remove_suffix(view.size() - location);
13236|    480|          state = state::QUERY;
13237|    480|          input_position += location + 1;
13238|    480|        } else {
13239|    339|          input_position = input_size + 1;
13240|    339|        }
13241|    819|        url.has_opaque_path = true;
13242|       |
13243|       |        // This is a really unlikely scenario in real world. We should not seek
13244|       |        // to optimize it.
13245|    819|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13245:13): [True: 9, False: 810]
  ------------------
13246|      9|          std::string modified_view =
13247|      9|              std::string(view.substr(0, view.size() - 1)) + "%20";
13248|      9|          url.update_base_pathname(unicode::percent_encode(
13249|      9|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13250|    810|        } else {
13251|    810|          url.update_base_pathname(unicode::percent_encode(
13252|    810|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13253|    810|        }
13254|    819|        break;
13255|   255k|      }
13256|  2.24k|      case state::PORT: {
  ------------------
  |  Branch (13256:7): [True: 2.24k, False: 1.73M]
  ------------------
13257|  2.24k|        ada_log("PORT ", helpers::substring(url_data, input_position));
13258|  2.24k|        std::string_view port_view = url_data.substr(input_position);
13259|  2.24k|        input_position += url.parse_port(port_view, true);
13260|  2.24k|        if (!url.is_valid) {
  ------------------
  |  Branch (13260:13): [True: 208, False: 2.03k]
  ------------------
13261|    208|          return url;
13262|    208|        }
13263|  2.03k|        state = state::PATH_START;
13264|  2.03k|        [[fallthrough]];
13265|  2.03k|      }
13266|   235k|      case state::PATH_START: {
  ------------------
  |  Branch (13266:7): [True: 233k, False: 1.50M]
  ------------------
13267|   235k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13268|       |        // Path, query, and fragment are structurally always valid: the
13269|       |        // parser would just percent-encode whatever is there. When we are
13270|       |        // not storing values (can_parse), we can return immediately since
13271|       |        // no subsequent state can invalidate the URL.
13272|       |        if constexpr (!store_values) {
13273|       |          return url;
13274|       |        }
13275|       |
13276|       |        // If url is special, then:
13277|   235k|        if (url.is_special()) {
  ------------------
  |  Branch (13277:13): [True: 235k, False: 681]
  ------------------
13278|       |          // Set state to path state.
13279|   235k|          state = state::PATH;
13280|       |
13281|       |          // Optimization: Avoiding going into PATH state improves the
13282|       |          // performance of urls ending with /.
13283|   235k|          if (input_position == input_size) {
  ------------------
  |  Branch (13283:15): [True: 29.3k, False: 205k]
  ------------------
13284|  29.3k|            if constexpr (store_values) {
13285|  29.3k|              url.update_base_pathname("/");
13286|  29.3k|              if (fragment.has_value()) {
  ------------------
  |  Branch (13286:19): [True: 276, False: 29.1k]
  ------------------
13287|    276|                url.update_unencoded_base_hash(*fragment);
13288|    276|              }
13289|  29.3k|            }
13290|  29.3k|            enforce_max_input_length();
13291|  29.3k|            return url;
13292|  29.3k|          }
13293|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13294|       |          // by 1. We know that (input_position == input_size) is impossible
13295|       |          // here, because of the previous if-check.
13296|   205k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13296:15): [True: 1.04k, False: 204k]
  ------------------
13297|  1.04k|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13297:15): [True: 639, False: 402]
  ------------------
13298|    639|            break;
13299|    639|          }
13300|   205k|        }
13301|       |        // Otherwise, if state override is not given and c is U+003F (?),
13302|       |        // set url's query to the empty string and state to query state.
13303|    681|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13303:18): [True: 540, False: 141]
  ------------------
13304|    540|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13304:18): [True: 99, False: 441]
  ------------------
13305|     99|          state = state::QUERY;
13306|     99|        }
13307|       |        // Otherwise, if c is not the EOF code point:
13308|    582|        else if (input_position != input_size) {
  ------------------
  |  Branch (13308:18): [True: 441, False: 141]
  ------------------
13309|       |          // Set state to path state.
13310|    441|          state = state::PATH;
13311|       |
13312|       |          // If c is not U+002F (/), then decrease pointer by 1.
13313|    441|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13313:15): [True: 0, False: 441]
  ------------------
13314|      0|            break;
13315|      0|          }
13316|    441|        }
13317|       |
13318|   205k|        input_position++;
13319|   205k|        break;
13320|   235k|      }
13321|   206k|      case state::PATH: {
  ------------------
  |  Branch (13321:7): [True: 206k, False: 1.53M]
  ------------------
13322|   206k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13323|       |        // Path, query, and fragment are structurally always valid: the
13324|       |        // parser would just percent-encode whatever is there. When we are
13325|       |        // not storing values (can_parse), we can return immediately since
13326|       |        // no subsequent state can invalidate the URL.
13327|       |        if constexpr (!store_values) {
13328|       |          return url;
13329|       |        }
13330|   206k|        std::string_view view = url_data.substr(input_position);
13331|       |
13332|       |        // Most time, we do not need percent encoding.
13333|       |        // Furthermore, we can immediately locate the '?'.
13334|   206k|        size_t locofquestionmark = view.find('?');
13335|   206k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13335:13): [True: 9.41k, False: 197k]
  ------------------
13336|  9.41k|          state = state::QUERY;
13337|  9.41k|          view.remove_suffix(view.size() - locofquestionmark);
13338|  9.41k|          input_position += locofquestionmark + 1;
13339|   197k|        } else {
13340|   197k|          input_position = input_size + 1;
13341|   197k|        }
13342|   206k|        if constexpr (store_values) {
13343|       |          if constexpr (result_type_is_ada_url) {
13344|       |            helpers::parse_prepared_path(view, url.type, url.path);
13345|   206k|          } else {
13346|   206k|            url.consume_prepared_path(view);
13347|   206k|            ADA_ASSERT_TRUE(url.validate());
13348|   206k|          }
13349|   206k|        }
13350|   206k|        break;
13351|   235k|      }
13352|  1.36k|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13352:7): [True: 1.36k, False: 1.73M]
  ------------------
13353|  1.36k|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13354|       |
13355|       |        // If c is U+002F (/) or U+005C (\), then:
13356|  1.36k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13356:13): [True: 1.36k, False: 1]
  ------------------
13357|  1.36k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13357:14): [True: 1.35k, False: 13]
  ------------------
13358|  1.35k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13358:14): [True: 3, False: 10]
  ------------------
13359|  1.35k|          ada_log("FILE_SLASH c is U+002F or U+005C");
13360|       |          // Set state to file host state.
13361|  1.35k|          state = state::FILE_HOST;
13362|  1.35k|          input_position++;
13363|  1.35k|        } else {
13364|     11|          ada_log("FILE_SLASH otherwise");
13365|       |          // If base is non-null and base's scheme is "file", then:
13366|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13367|       |          // base_url_has_value() is true.
13368|     11|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13368:15): [True: 0, False: 11]
  |  Branch (13368:38): [True: 0, False: 0]
  ------------------
13369|       |            // Set url's host to base's host.
13370|       |            if constexpr (result_type_is_ada_url) {
13371|       |              url.host = base_url->host;
13372|      0|            } else {
13373|      0|              url.update_host_to_base_host(base_url->get_host());
13374|      0|            }
13375|       |            // If the code point substring from pointer to the end of input does
13376|       |            // not start with a Windows drive letter and base's path[0] is a
13377|       |            // normalized Windows drive letter, then append base's path[0] to
13378|       |            // url's path.
13379|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13379:17): [True: 0, False: 0]
  ------------------
13380|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13380:19): [True: 0, False: 0]
  ------------------
13381|      0|                      url_data.substr(input_position))) {
13382|      0|                std::string_view first_base_url_path =
13383|      0|                    base_url->get_pathname().substr(1);
13384|      0|                size_t loc = first_base_url_path.find('/');
13385|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13385:21): [True: 0, False: 0]
  ------------------
13386|      0|                  helpers::resize(first_base_url_path, loc);
13387|      0|                }
13388|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13388:21): [True: 0, False: 0]
  ------------------
13389|      0|                        first_base_url_path)) {
13390|       |                  if constexpr (result_type_is_ada_url) {
13391|       |                    url.path += '/';
13392|       |                    url.path += first_base_url_path;
13393|      0|                  } else {
13394|      0|                    url.append_base_pathname(
13395|      0|                        helpers::concat("/", first_base_url_path));
13396|      0|                  }
13397|      0|                }
13398|      0|              }
13399|      0|            }
13400|      0|          }
13401|       |
13402|       |          // Set state to path state, and decrease pointer by 1.
13403|     11|          state = state::PATH;
13404|     11|        }
13405|       |
13406|  1.36k|        break;
13407|   235k|      }
13408|  1.35k|      case state::FILE_HOST: {
  ------------------
  |  Branch (13408:7): [True: 1.35k, False: 1.73M]
  ------------------
13409|  1.35k|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13410|  1.35k|        std::string_view view = url_data.substr(input_position);
13411|       |
13412|  1.35k|        size_t location = view.find_first_of("/\\?");
13413|  1.35k|        std::string_view file_host_buffer = view.substr(
13414|  1.35k|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13414:16): [True: 1.31k, False: 39]
  ------------------
13415|       |
13416|  1.35k|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13416:13): [True: 1, False: 1.35k]
  ------------------
13417|      1|          state = state::PATH;
13418|  1.35k|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13418:20): [True: 276, False: 1.07k]
  ------------------
13419|       |          // Set url's host to the empty string.
13420|       |          if constexpr (result_type_is_ada_url) {
13421|       |            url.host = "";
13422|    276|          } else {
13423|    276|            url.update_base_hostname("");
13424|    276|          }
13425|       |          // Set state to path start state.
13426|    276|          state = state::PATH_START;
13427|  1.07k|        } else {
13428|  1.07k|          size_t consumed_bytes = file_host_buffer.size();
13429|  1.07k|          input_position += consumed_bytes;
13430|       |          // Let host be the result of host parsing buffer with url is not
13431|       |          // special.
13432|  1.07k|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13432:15): [True: 81, False: 998]
  ------------------
13433|     81|            return url;
13434|     81|          }
13435|       |
13436|       |          if constexpr (result_type_is_ada_url) {
13437|       |            // If host is "localhost", then set host to the empty string.
13438|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13439|       |              url.host = "";
13440|       |            }
13441|    998|          } else {
13442|    998|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13442:17): [True: 2, False: 996]
  ------------------
13443|      2|              url.update_base_hostname("");
13444|      2|            }
13445|    998|          }
13446|       |
13447|       |          // Set buffer to the empty string and state to path start state.
13448|    998|          state = state::PATH_START;
13449|    998|        }
13450|       |
13451|  1.27k|        break;
13452|  1.35k|      }
13453|  1.48k|      case state::FILE: {
  ------------------
  |  Branch (13453:7): [True: 1.48k, False: 1.73M]
  ------------------
13454|  1.48k|        ada_log("FILE ", helpers::substring(url_data, input_position));
13455|  1.48k|        std::string_view file_view = url_data.substr(input_position);
13456|       |
13457|  1.48k|        url.set_protocol_as_file();
13458|       |        if constexpr (result_type_is_ada_url) {
13459|       |          // Set url's host to the empty string.
13460|       |          url.host = "";
13461|  1.48k|        } else {
13462|  1.48k|          url.update_base_hostname("");
13463|  1.48k|        }
13464|       |        // If c is U+002F (/) or U+005C (\), then:
13465|  1.48k|        if (input_position != input_size &&
  ------------------
  |  Branch (13465:13): [True: 1.48k, False: 1]
  ------------------
13466|  1.48k|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13466:14): [True: 1.36k, False: 119]
  ------------------
13467|  1.36k|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13467:14): [True: 2, False: 117]
  ------------------
13468|  1.36k|          ada_log("FILE c is U+002F or U+005C");
13469|       |          // Set state to file slash state.
13470|  1.36k|          state = state::FILE_SLASH;
13471|  1.36k|        }
13472|       |        // Otherwise, if base is non-null and base's scheme is "file":
13473|    118|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13473:18): [True: 0, False: 118]
  |  Branch (13473:41): [True: 0, False: 0]
  ------------------
13474|       |          // Set url's host to base's host, url's path to a clone of base's
13475|       |          // path, and url's query to base's query.
13476|      0|          ada_log("FILE base non-null");
13477|       |          if constexpr (result_type_is_ada_url) {
13478|       |            url.host = base_url->host;
13479|       |            url.path = base_url->path;
13480|       |            url.query = base_url->query;
13481|      0|          } else {
13482|      0|            url.update_host_to_base_host(base_url->get_hostname());
13483|      0|            url.update_base_pathname(base_url->get_pathname());
13484|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13484:17): [True: 0, False: 0]
  ------------------
13485|       |              // get_search() returns "" for an empty query string (URL ends
13486|       |              // with '?'). update_base_search("") would incorrectly clear the
13487|       |              // query, so pass "?" to preserve the empty query distinction.
13488|      0|              auto s = base_url->get_search();
13489|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13489:38): [True: 0, False: 0]
  ------------------
13490|      0|            }
13491|      0|          }
13492|      0|          url.has_opaque_path = base_url->has_opaque_path;
13493|       |
13494|       |          // If c is U+003F (?), then set url's query to the empty string and
13495|       |          // state to query state.
13496|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13496:15): [True: 0, False: 0]
  |  Branch (13496:47): [True: 0, False: 0]
  ------------------
13497|      0|            state = state::QUERY;
13498|      0|          }
13499|       |          // Otherwise, if c is not the EOF code point:
13500|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13500:20): [True: 0, False: 0]
  ------------------
13501|       |            // Set url's query to null.
13502|      0|            url.clear_search();
13503|       |            // If the code point substring from pointer to the end of input does
13504|       |            // not start with a Windows drive letter, then shorten url's path.
13505|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13505:17): [True: 0, False: 0]
  ------------------
13506|       |              if constexpr (result_type_is_ada_url) {
13507|       |                helpers::shorten_path(url.path, url.type);
13508|      0|              } else {
13509|      0|                std::string_view path = url.get_pathname();
13510|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13510:21): [True: 0, False: 0]
  ------------------
13511|      0|                  url.update_base_pathname(std::move(std::string(path)));
13512|      0|                }
13513|      0|              }
13514|      0|            }
13515|       |            // Otherwise:
13516|      0|            else {
13517|       |              // Set url's path to an empty list.
13518|      0|              url.clear_pathname();
13519|      0|              url.has_opaque_path = true;
13520|      0|            }
13521|       |
13522|       |            // Set state to path state and decrease pointer by 1.
13523|      0|            state = state::PATH;
13524|      0|            break;
13525|      0|          }
13526|      0|        }
13527|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13528|    118|        else {
13529|    118|          ada_log("FILE go to path");
13530|    118|          state = state::PATH;
13531|    118|          break;
13532|    118|        }
13533|       |
13534|  1.36k|        input_position++;
13535|  1.36k|        break;
13536|  1.48k|      }
13537|      0|      default:
  ------------------
  |  Branch (13537:7): [True: 0, False: 1.74M]
  ------------------
13538|      0|        unreachable();
13539|  1.74M|    }
13540|  1.74M|  }
13541|   537k|  if constexpr (store_values) {
13542|   537k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13542:9): [True: 2.33k, False: 534k]
  ------------------
13543|  2.33k|      url.update_unencoded_base_hash(*fragment);
13544|  2.33k|    }
13545|   537k|  }
13546|   537k|  enforce_max_input_length();
13547|   537k|  return url;
13548|   597k|}
_ZN3ada14url_aggregator8set_hrefENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14117|   192k|bool url_aggregator::set_href(const std::string_view input) {
14118|   192k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14119|   192k|  ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
14120|   192k|  ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
14121|   192k|  ada_log("url_aggregator::set_href, success :", out.has_value());
14122|       |
14123|   192k|  if (out) {
  ------------------
  |  Branch (14123:7): [True: 192k, False: 0]
  ------------------
14124|       |    // The parser enforces get_max_input_length() on both the input and the
14125|       |    // normalized result. This is a defense-in-depth check.
14126|   192k|    if (out->buffer.size() > ada::get_max_input_length()) {
  ------------------
  |  Branch (14126:9): [True: 0, False: 192k]
  ------------------
14127|      0|      return false;
14128|      0|    }
14129|   192k|    ada_log("url_aggregator::set_href, parsed ", out->to_string());
14130|       |    // TODO: Figure out why the following line puts test to never finish.
14131|   192k|    *this = *out;
14132|   192k|  }
14133|       |
14134|   192k|  return out.has_value();
14135|   192k|}
_ZNK3ada14url_aggregator12get_usernameEv:
14453|   192k|    ada_lifetime_bound {
14454|   192k|  ada_log("url_aggregator::get_username");
14455|   192k|  if (has_non_empty_username()) {
  ------------------
  |  Branch (14455:7): [True: 9.85k, False: 182k]
  ------------------
14456|  9.85k|    return helpers::substring(buffer, components.protocol_end + 2,
14457|  9.85k|                              components.username_end);
14458|  9.85k|  }
14459|   182k|  return "";
14460|   192k|}
_ZNK3ada14url_aggregator12get_passwordEv:
14463|   192k|    ada_lifetime_bound {
14464|   192k|  ada_log("url_aggregator::get_password");
14465|   192k|  if (has_non_empty_password()) {
  ------------------
  |  Branch (14465:7): [True: 9.49k, False: 182k]
  ------------------
14466|  9.49k|    return helpers::substring(buffer, components.username_end + 1,
14467|  9.49k|                              components.host_start);
14468|  9.49k|  }
14469|   182k|  return "";
14470|   192k|}
_ZNK3ada14url_aggregator8get_portEv:
14473|   192k|    ada_lifetime_bound {
14474|   192k|  ada_log("url_aggregator::get_port");
14475|   192k|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (14475:7): [True: 172k, False: 19.8k]
  ------------------
14476|   172k|    return "";
14477|   172k|  }
14478|  19.8k|  return helpers::substring(buffer, components.host_end + 1,
14479|  19.8k|                            components.pathname_start);
14480|   192k|}
_ZNK3ada14url_aggregator8get_hashEv:
14483|   192k|    ada_lifetime_bound {
14484|   192k|  ada_log("url_aggregator::get_hash");
14485|       |  // If this's URL's fragment is either null or the empty string, then return
14486|       |  // the empty string. Return U+0023 (#), followed by this's URL's fragment.
14487|   192k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (14487:7): [True: 168k, False: 23.5k]
  ------------------
14488|   168k|    return "";
14489|   168k|  }
14490|  23.5k|  if (buffer.size() - components.hash_start <= 1) {
  ------------------
  |  Branch (14490:7): [True: 1.40k, False: 22.1k]
  ------------------
14491|  1.40k|    return "";
14492|  1.40k|  }
14493|  22.1k|  return helpers::substring(buffer, components.hash_start);
14494|  23.5k|}
_ZNK3ada14url_aggregator8get_hostEv:
14497|   192k|    ada_lifetime_bound {
14498|   192k|  ada_log("url_aggregator::get_host");
14499|       |  // Technically, we should check if there is a hostname, but
14500|       |  // the code below works even if there isn't.
14501|       |  // if(!has_hostname()) { return ""; }
14502|   192k|  size_t start = components.host_start;
14503|   192k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14503:7): [True: 191k, False: 552]
  ------------------
14504|   191k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14504:7): [True: 9.89k, False: 181k]
  ------------------
14505|  9.89k|    start++;
14506|  9.89k|  }
14507|       |  // if we have an empty host, then the space between components.host_end and
14508|       |  // components.pathname_start may be occupied by /.
14509|   192k|  if (start == components.host_end) {
  ------------------
  |  Branch (14509:7): [True: 552, False: 191k]
  ------------------
14510|    552|    return {};
14511|    552|  }
14512|   191k|  return helpers::substring(buffer, start, components.pathname_start);
14513|   192k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14516|   255k|    ada_lifetime_bound {
14517|   255k|  ada_log("url_aggregator::get_hostname");
14518|       |  // Technically, we should check if there is a hostname, but
14519|       |  // the code below works even if there isn't.
14520|       |  // if(!has_hostname()) { return ""; }
14521|   255k|  size_t start = components.host_start;
14522|       |  // So host_start is not where the host begins.
14523|   255k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14523:7): [True: 192k, False: 62.4k]
  ------------------
14524|   192k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14524:7): [True: 10.0k, False: 182k]
  ------------------
14525|  10.0k|    start++;
14526|  10.0k|  }
14527|   255k|  return helpers::substring(buffer, start, components.host_end);
14528|   255k|}
_ZNK3ada14url_aggregator10get_searchEv:
14531|   192k|    ada_lifetime_bound {
14532|   192k|  ada_log("url_aggregator::get_search");
14533|       |  // If this's URL's query is either null or the empty string, then return the
14534|       |  // empty string. Return U+003F (?), followed by this's URL's query.
14535|   192k|  if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (14535:7): [True: 159k, False: 32.6k]
  ------------------
14536|   159k|    return "";
14537|   159k|  }
14538|  32.6k|  auto ending_index = uint32_t(buffer.size());
14539|  32.6k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (14539:7): [True: 12.9k, False: 19.6k]
  ------------------
14540|  12.9k|    ending_index = components.hash_start;
14541|  12.9k|  }
14542|  32.6k|  if (ending_index - components.search_start <= 1) {
  ------------------
  |  Branch (14542:7): [True: 1.09k, False: 31.5k]
  ------------------
14543|  1.09k|    return "";
14544|  1.09k|  }
14545|  31.5k|  return helpers::substring(buffer, components.search_start, ending_index);
14546|  32.6k|}
_ZNK3ada14url_aggregator12get_protocolEv:
14549|   192k|    ada_lifetime_bound {
14550|   192k|  ada_log("url_aggregator::get_protocol");
14551|   192k|  return helpers::substring(buffer, 0, components.protocol_end);
14552|   192k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
14661|  56.3k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14662|  56.3k|  ada_log("parse_ipv4 ", input, " [", input.size(),
14663|  56.3k|          " bytes], overlaps with buffer: ",
14664|  56.3k|          helpers::overlaps(input, buffer) ? "yes" : "no");
14665|  56.3k|  ADA_ASSERT_TRUE(validate());
14666|  56.3k|  if (input.empty()) {
  ------------------
  |  Branch (14666:7): [True: 0, False: 56.3k]
  ------------------
14667|      0|    return is_valid = false;
14668|      0|  }
14669|  56.3k|  const bool trailing_dot = (input.back() == '.');
14670|  56.3k|  if (trailing_dot) {
  ------------------
  |  Branch (14670:7): [True: 27.2k, False: 29.1k]
  ------------------
14671|  27.2k|    input.remove_suffix(1);
14672|  27.2k|    if (input.empty()) {
  ------------------
  |  Branch (14672:9): [True: 0, False: 27.2k]
  ------------------
14673|      0|      return is_valid = false;
14674|      0|    }
14675|  27.2k|  }
14676|       |
14677|  56.3k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
14678|  56.3k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (14678:7): [True: 18.1k, False: 38.2k]
  ------------------
14679|       |    // Pure decimal: keep the buffer when it already holds the address.
14680|       |    // Otherwise write the (trailing-dot-stripped) input.
14681|  18.1k|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (14681:11): [True: 18.1k, False: 9]
  |  Branch (14681:23): [True: 3, False: 18.1k]
  ------------------
14682|  18.1k|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (14682:11): [True: 0, False: 18.1k]
  ------------------
14683|      0|        update_base_hostname(std::string(input));
14684|  18.1k|      } else {
14685|  18.1k|        update_base_hostname(input);
14686|  18.1k|      }
14687|  18.1k|    }
14688|  18.1k|    host_type = IPV4;
14689|  18.1k|    ADA_ASSERT_TRUE(validate());
14690|  18.1k|    return true;
14691|  18.1k|  }
14692|       |
14693|  38.2k|  const char* p = input.data();
14694|  38.2k|  const char* end = p + input.size();
14695|  38.2k|  uint64_t ipv4 = 0;
14696|  38.2k|  int digit_count = 0;
14697|  38.2k|  int pure_decimal_count = 0;
14698|       |
14699|  48.1k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (14699:10): [True: 48.1k, False: 14]
  |  Branch (14699:29): [True: 48.1k, False: 0]
  ------------------
14700|  48.1k|    uint64_t segment = 0;
14701|  48.1k|    bool pure = false;
14702|  48.1k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (14702:9): [True: 18.4k, False: 29.7k]
  ------------------
14703|  18.4k|      return is_valid = false;
14704|  18.4k|    }
14705|  29.7k|    if (pure) {
  ------------------
  |  Branch (14705:9): [True: 11.0k, False: 18.6k]
  ------------------
14706|  11.0k|      ++pure_decimal_count;
14707|  11.0k|    }
14708|  29.7k|    if (p >= end) {
  ------------------
  |  Branch (14708:9): [True: 19.7k, False: 9.92k]
  ------------------
14709|  19.7k|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
14710|  19.7k|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (14710:11): [True: 24, False: 19.7k]
  ------------------
14711|     24|        return is_valid = false;
14712|     24|      }
14713|  19.7k|      ipv4 = (ipv4 << shift) | segment;
14714|  19.7k|      goto ipv4_done;
14715|  19.7k|    }
14716|  9.92k|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (14716:9): [True: 51, False: 9.87k]
  |  Branch (14716:26): [True: 0, False: 9.87k]
  ------------------
14717|     51|      return is_valid = false;
14718|     51|    }
14719|  9.87k|    ipv4 = (ipv4 << 8) | segment;
14720|  9.87k|    ++p;
14721|  9.87k|  }
14722|     14|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (14722:7): [True: 0, False: 14]
  |  Branch (14722:27): [True: 14, False: 0]
  ------------------
14723|     14|    return is_valid = false;
14724|     14|  }
14725|  19.7k|ipv4_done:
14726|  19.7k|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
14727|  19.7k|          " host: ", get_host());
14728|  19.7k|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (14728:7): [True: 19.7k, False: 58]
  |  Branch (14728:19): [True: 0, False: 19.7k]
  |  Branch (14728:46): [True: 0, False: 0]
  ------------------
14729|      0|    ada_log(
14730|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
14731|      0|        "buffer");
14732|  19.7k|  } else {
14733|  19.7k|    update_base_hostname(ada::serializers::ipv4(ipv4));
14734|  19.7k|  }
14735|  19.7k|  host_type = IPV4;
14736|  19.7k|  ADA_ASSERT_TRUE(validate());
14737|  19.7k|  return true;
14738|     14|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14740|    608|bool url_aggregator::parse_ipv6(std::string_view input) {
14741|    608|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
14742|    608|  ADA_ASSERT_TRUE(validate());
14743|    608|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14744|    608|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (14744:7): [True: 21, False: 587]
  |  Branch (14744:24): [True: 10, False: 577]
  ------------------
14745|     31|    return is_valid = false;
14746|     31|  }
14747|    577|  std::array<uint16_t, 8> address{};
14748|       |#if defined(ADA_AVX512_IPV6)
14749|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
14750|       |                                                     address, simd_valid)) {
14751|       |    if (!simd_valid) [[unlikely]] {
14752|       |      return is_valid = false;
14753|       |    }
14754|       |    const std::string serialized = ada::serializers::ipv6(address);
14755|       |    if (get_hostname() != serialized) {
14756|       |      update_base_hostname(serialized);
14757|       |    }
14758|       |    host_type = IPV6;
14759|       |    return true;
14760|       |  }
14761|       |  address = {};
14762|       |#endif
14763|    577|  const char* pointer = input.data();
14764|    577|  const char* const end = pointer + input.size();
14765|    577|  int piece_index = 0;
14766|    577|  int compress = -1;
14767|       |
14768|    577|  if (*pointer == ':') {
  ------------------
  |  Branch (14768:7): [True: 285, False: 292]
  ------------------
14769|    285|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (14769:9): [True: 3, False: 282]
  |  Branch (14769:30): [True: 3, False: 279]
  ------------------
14770|      6|      return is_valid = false;
14771|      6|    }
14772|    279|    pointer += 2;
14773|    279|    compress = ++piece_index;
14774|    279|  }
14775|       |
14776|  1.61k|  while (pointer != end) {
  ------------------
  |  Branch (14776:10): [True: 1.14k, False: 463]
  ------------------
14777|  1.14k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (14777:9): [True: 3, False: 1.14k]
  ------------------
14778|      3|      return is_valid = false;
14779|      3|    }
14780|  1.14k|    if (*pointer == ':') {
  ------------------
  |  Branch (14780:9): [True: 159, False: 985]
  ------------------
14781|    159|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (14781:11): [True: 3, False: 156]
  ------------------
14782|      3|        return is_valid = false;
14783|      3|      }
14784|    156|      ++pointer;
14785|    156|      compress = ++piece_index;
14786|    156|      continue;
14787|    159|    }
14788|       |
14789|    985|    uint16_t value = 0;
14790|    985|    const int length = detail::parse_hex_piece(pointer, end, value);
14791|       |
14792|    985|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (14792:9): [True: 756, False: 229]
  |  Branch (14792:27): [True: 72, False: 684]
  ------------------
14793|     72|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14793:11): [True: 4, False: 68]
  ------------------
14794|      4|        return is_valid = false;
14795|      4|      }
14796|     68|      pointer -= length;
14797|     68|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (14797:11): [True: 3, False: 65]
  ------------------
14798|      3|        return is_valid = false;
14799|      3|      }
14800|       |
14801|     65|      int numbers_seen = 0;
14802|    193|      while (pointer != end) {
  ------------------
  |  Branch (14802:14): [True: 175, False: 18]
  ------------------
14803|    175|        int ipv4_piece = -1;
14804|    175|        if (numbers_seen > 0) {
  ------------------
  |  Branch (14804:13): [True: 110, False: 65]
  ------------------
14805|    110|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (14805:15): [True: 94, False: 16]
  |  Branch (14805:34): [True: 89, False: 5]
  ------------------
14806|     89|            ++pointer;
14807|     89|          } else {
14808|     21|            return is_valid = false;
14809|     21|          }
14810|    110|        }
14811|    154|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (14811:13): [True: 11, False: 143]
  |  Branch (14811:31): [True: 4, False: 139]
  |  Branch (14811:49): [True: 3, False: 136]
  ------------------
14812|     18|          return is_valid = false;
14813|     18|        }
14814|    136|        ipv4_piece = *pointer - '0';
14815|    136|        ++pointer;
14816|    136|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14816:13): [True: 126, False: 10]
  |  Branch (14816:31): [True: 53, False: 73]
  |  Branch (14816:50): [True: 50, False: 3]
  ------------------
14817|     50|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (14817:15): [True: 3, False: 47]
  ------------------
14818|      3|            return is_valid = false;
14819|      3|          }
14820|     47|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14821|     47|          ++pointer;
14822|     47|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14822:15): [True: 44, False: 3]
  |  Branch (14822:33): [True: 26, False: 18]
  |  Branch (14822:52): [True: 23, False: 3]
  ------------------
14823|     23|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14824|     23|            ++pointer;
14825|     23|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (14825:17): [True: 5, False: 18]
  ------------------
14826|      5|              return is_valid = false;
14827|      5|            }
14828|     23|          }
14829|     47|        }
14830|    128|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
14831|    128|            address[static_cast<size_t>(piece_index)] * 0x100 +
14832|    128|            static_cast<uint16_t>(ipv4_piece));
14833|    128|        ++numbers_seen;
14834|    128|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (14834:13): [True: 41, False: 87]
  |  Branch (14834:34): [True: 12, False: 75]
  ------------------
14835|     53|          ++piece_index;
14836|     53|        }
14837|    128|      }
14838|     18|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (14838:11): [True: 12, False: 6]
  ------------------
14839|     12|        return is_valid = false;
14840|     12|      }
14841|      6|      break;
14842|     18|    }
14843|       |
14844|    913|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14844:9): [True: 16, False: 897]
  ------------------
14845|     16|      return is_valid = false;
14846|     16|    }
14847|       |
14848|    897|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (14848:9): [True: 668, False: 229]
  |  Branch (14848:27): [True: 657, False: 11]
  ------------------
14849|    657|      ++pointer;
14850|    657|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (14850:11): [True: 3, False: 654]
  ------------------
14851|      3|        return is_valid = false;
14852|      3|      }
14853|    657|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (14853:16): [True: 11, False: 229]
  ------------------
14854|     11|      return is_valid = false;
14855|     11|    }
14856|       |
14857|    883|    address[static_cast<size_t>(piece_index)] = value;
14858|    883|    ++piece_index;
14859|    883|  }
14860|       |
14861|    469|  if (compress != -1) {
  ------------------
  |  Branch (14861:7): [True: 426, False: 43]
  ------------------
14862|    426|    const int right = piece_index - compress;
14863|    426|    if (right > 0) {
  ------------------
  |  Branch (14863:9): [True: 192, False: 234]
  ------------------
14864|    192|      const size_t dest = static_cast<size_t>(8 - right);
14865|    192|      const size_t src = static_cast<size_t>(compress);
14866|    192|      if (dest != src) {
  ------------------
  |  Branch (14866:11): [True: 183, False: 9]
  ------------------
14867|    503|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (14867:53): [True: 320, False: 183]
  ------------------
14868|    320|          address[dest + i] = address[src + i];
14869|    320|          address[src + i] = 0;
14870|    320|        }
14871|    183|      }
14872|    192|    }
14873|    426|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (14873:14): [True: 29, False: 14]
  ------------------
14874|     29|    return is_valid = false;
14875|     29|  }
14876|       |
14877|       |  // Serialize once; skip rewrite when hostname is already canonical.
14878|    440|  const std::string serialized = ada::serializers::ipv6(address);
14879|    440|  const std::string_view current = get_hostname();
14880|    440|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (14880:7): [True: 0, False: 440]
  ------------------
14881|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (14881:7): [True: 0, False: 0]
  ------------------
14882|      0|    ada_log("parse_ipv6 in-place canonical match");
14883|    440|  } else {
14884|    440|    update_base_hostname(serialized);
14885|    440|  }
14886|    440|  ada_log("parse_ipv6 ", get_hostname());
14887|    440|  ADA_ASSERT_TRUE(validate());
14888|    440|  host_type = IPV6;
14889|    440|  return true;
14890|    469|}
_ZN3ada14url_aggregator17parse_opaque_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14892|    651|bool url_aggregator::parse_opaque_host(std::string_view input) {
14893|    651|  ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
14894|    651|  ADA_ASSERT_TRUE(validate());
14895|    651|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14896|    651|  if (std::ranges::any_of(input, ada::unicode::is_forbidden_host_code_point)) {
  ------------------
  |  Branch (14896:7): [True: 32, False: 619]
  ------------------
14897|     32|    return is_valid = false;
14898|     32|  }
14899|       |
14900|       |  // Return the result of running UTF-8 percent-encode on input using the C0
14901|       |  // control percent-encode set.
14902|    619|  size_t idx = ada::unicode::percent_encode_index(
14903|    619|      input, character_sets::C0_CONTROL_PERCENT_ENCODE);
14904|    619|  if (idx == input.size()) {
  ------------------
  |  Branch (14904:7): [True: 578, False: 41]
  ------------------
14905|    578|    update_base_hostname(input);
14906|    578|  } else {
14907|       |    // We only create a temporary string if we need to.
14908|     41|    update_base_hostname(ada::unicode::percent_encode(
14909|     41|        input, character_sets::C0_CONTROL_PERCENT_ENCODE, idx));
14910|     41|  }
14911|    619|  ADA_ASSERT_TRUE(validate());
14912|    619|  return true;
14913|    651|}
simple_absolute.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  272|   250k|  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|   250k|    return c > -65;
  276|   250k|  });
_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|   354k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|   354k|    return 0x101010101010101ull * v;
 5129|   354k|  };
_ZN3ada4idna13ensure_tablesEv:
 4878|  35.8k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4879|  35.8k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4880|  35.8k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4880:7): [True: 35.8k, False: 1]
  ------------------
 4881|  35.8k|    return true;
 4882|  35.8k|  }
 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: 354k, False: 2.34k]
  ------------------
 5067|   354k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5068|   354k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5068:9): [True: 149k, False: 205k]
  ------------------
 5069|   149k|      uint32_t bit_idx =
 5070|   149k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5071|   149k|          (cp & IDNA_BLOCK_MASK);
 5072|   149k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5073|   149k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5073:14): [True: 149k, False: 22]
  ------------------
 5074|   149k|    }
 5075|   205k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5076|   354k|  }
 5077|       |
 5078|  2.34k|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5078:7): [True: 2.30k, False: 42]
  |  Branch (5078:40): [True: 2.09k, False: 214]
  ------------------
 5079|  2.09k|    return IDNA_IGNORED;
 5080|  2.09k|  }
 5081|       |
 5082|    256|  return IDNA_DISALLOWED;
 5083|  2.34k|}
simple_absolute.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5108|  56.2k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5109|  56.2k|  size_t n = 0;
 5110|   345k|  while (*ptr != 0) {
  ------------------
  |  Branch (5110:10): [True: 289k, False: 56.2k]
  ------------------
 5111|   289k|    ++n;
 5112|   289k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5112:9): [True: 92.0k, False: 197k]
  ------------------
 5113|  92.0k|      ++ptr;
 5114|   197k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5114:16): [True: 156k, False: 40.7k]
  ------------------
 5115|   156k|      ptr += 2;
 5116|   156k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5116:16): [True: 39.5k, False: 1.19k]
  ------------------
 5117|  39.5k|      ptr += 3;
 5118|  39.5k|    } else {
 5119|  1.19k|      ptr += 4;
 5120|  1.19k|    }
 5121|   289k|  }
 5122|  56.2k|  return n;
 5123|  56.2k|}
simple_absolute.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5086|   288k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5087|   288k|  uint8_t b0 = *ptr++;
 5088|   288k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5088:7): [True: 91.9k, False: 196k]
  ------------------
 5089|   196k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5089:7): [True: 155k, False: 40.4k]
  ------------------
 5090|   155k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5091|   155k|    cp |= (*ptr++ & 0x3Fu);
 5092|   155k|    return static_cast<char32_t>(cp);
 5093|   155k|  }
 5094|  40.4k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5094:7): [True: 39.5k, False: 940]
  ------------------
 5095|  39.5k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5096|  39.5k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5097|  39.5k|    cp |= (*ptr++ & 0x3Fu);
 5098|  39.5k|    return static_cast<char32_t>(cp);
 5099|  39.5k|  }
 5100|    940|  uint32_t cp = (b0 & 0x07u) << 18;
 5101|    940|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5102|    940|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5103|    940|  cp |= (*ptr++ & 0x3Fu);
 5104|    940|  return static_cast<char32_t>(cp);
 5105|  40.4k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4982|   915k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4983|   915k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4983:7): [True: 0, False: 915k]
  ------------------
 4984|      0|    bi = 0;
 4985|      0|  }
 4986|   915k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4987|   915k|}
_ZN3ada4idna13ccc_block_rowEh:
 4989|  1.36M|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4990|  1.36M|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 1.36M]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|  1.36M|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 4994|  1.36M|}
_ZN3ada4idna16tables_are_readyEv:
 4873|  8.20k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4874|  8.20k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4875|  8.20k|}
simple_absolute.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5265|   854k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5266|   854k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5266:7): [True: 86.9k, False: 768k]
  ------------------
 5267|  86.9k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5267:7): [True: 80.0k, False: 6.86k]
  ------------------
 5268|       |    // Hangul precomposed syllables are NFC.
 5269|  80.0k|    return 0;
 5270|  80.0k|  }
 5271|   774k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5271:7): [True: 0, False: 774k]
  ------------------
 5272|      0|    return 0;
 5273|      0|  }
 5274|   774k|  const uint8_t di = decomposition_index[current_character >> 8];
 5275|   774k|  const uint16_t* const decomposition =
 5276|   774k|      decomposition_block_row(di) + (current_character % 256);
 5277|   774k|  size_t decomposition_length =
 5278|   774k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5279|   774k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5279:7): [True: 10.8k, False: 764k]
  |  Branch (5279:37): [True: 0, False: 10.8k]
  ------------------
 5280|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5281|      0|  }
 5282|   774k|  return decomposition_length;
 5283|   774k|}
simple_absolute.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5466|   423k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5467|   423k|  const size_t length = canonical_decomp_length(c);
 5468|   423k|  if (length == 0) {
  ------------------
  |  Branch (5468:7): [True: 418k, False: 4.86k]
  ------------------
 5469|   418k|    return get_ccc(c);
 5470|   418k|  }
 5471|  4.86k|  const uint16_t* const decomposition =
 5472|  4.86k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5473|  4.86k|  const size_t base = decomposition[0] >> 2;
 5474|  4.86k|  return get_ccc(decomposition_data[base + length - 1]);
 5475|   423k|}
simple_absolute.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5397|  6.60k|static bool would_compose(std::u32string_view input) noexcept {
 5398|   397k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5398:32): [True: 392k, False: 4.83k]
  ------------------
 5399|   392k|    const char32_t current = input[input_count];
 5400|   392k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5400:9): [True: 50.0k, False: 342k]
  |  Branch (5400:36): [True: 1.48k, False: 48.5k]
  ------------------
 5401|  1.48k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5401:11): [True: 1.38k, False: 100]
  ------------------
 5402|  1.38k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5402:11): [True: 652, False: 730]
  ------------------
 5403|    652|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5403:11): [True: 112, False: 540]
  ------------------
 5404|    112|        return true;
 5405|    112|      }
 5406|  1.37k|      ++input_count;
 5407|  1.37k|      continue;
 5408|  1.48k|    }
 5409|   391k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5409:9): [True: 40.4k, False: 350k]
  |  Branch (5409:36): [True: 38.9k, False: 1.54k]
  ------------------
 5410|  38.9k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5410:11): [True: 2.34k, False: 36.5k]
  ------------------
 5411|  2.34k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5411:11): [True: 2.21k, False: 128]
  ------------------
 5412|  2.21k|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5412:11): [True: 1.72k, False: 492]
  ------------------
 5413|  1.72k|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5413:11): [True: 504, False: 1.22k]
  ------------------
 5414|    504|        return true;
 5415|    504|      }
 5416|  38.4k|      ++input_count;
 5417|  38.4k|      continue;
 5418|  38.9k|    }
 5419|   352k|    if (current < 0x110000) {
  ------------------
  |  Branch (5419:9): [True: 352k, False: 0]
  ------------------
 5420|   352k|      const uint16_t* composition =
 5421|   352k|          composition_block_row(composition_index[current >> 8]) +
 5422|   352k|          (current % 256);
 5423|   352k|      int32_t previous_ccc = -1;
 5424|   352k|      size_t j = input_count;
 5425|   355k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5425:14): [True: 350k, False: 4.59k]
  ------------------
 5426|   350k|        uint8_t ccc = get_ccc(input[j + 1]);
 5427|   350k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5427:13): [True: 83.5k, False: 266k]
  |  Branch (5427:49): [True: 82.1k, False: 1.48k]
  ------------------
 5428|  82.1k|          int left = composition[0];
 5429|  82.1k|          int right = composition[1];
 5430|  82.1k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5430:15): [True: 0, False: 82.1k]
  |  Branch (5430:27): [True: 0, False: 82.1k]
  ------------------
 5431|  82.1k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5431:15): [True: 0, False: 82.1k]
  ------------------
 5432|      0|            break;
 5433|      0|          }
 5434|   199k|          while (left + 2 < right) {
  ------------------
  |  Branch (5434:18): [True: 117k, False: 82.1k]
  ------------------
 5435|   117k|            int middle = left + (((right - left) >> 1) & ~1);
 5436|   117k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5436:17): [True: 4.40k, False: 113k]
  ------------------
 5437|  4.40k|              left = middle;
 5438|  4.40k|            }
 5439|   117k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5439:17): [True: 114k, False: 3.67k]
  ------------------
 5440|   114k|              right = middle;
 5441|   114k|            }
 5442|   117k|          }
 5443|  82.1k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5443:15): [True: 82.1k, False: 0]
  ------------------
 5444|  82.1k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5444:15): [True: 1.15k, False: 80.9k]
  ------------------
 5445|  1.15k|            return true;
 5446|  1.15k|          }
 5447|  82.1k|        }
 5448|   349k|        if (ccc == 0) {
  ------------------
  |  Branch (5448:13): [True: 346k, False: 2.83k]
  ------------------
 5449|   346k|          break;
 5450|   346k|        }
 5451|  2.83k|        previous_ccc = ccc;
 5452|  2.83k|      }
 5453|   351k|      input_count = j + 1;
 5454|   351k|      continue;
 5455|   352k|    }
 5456|      0|    ++input_count;
 5457|      0|  }
 5458|  4.83k|  return false;
 5459|  6.60k|}
_ZN3ada4idna21composition_block_rowEh:
 4996|   424k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 4997|   424k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 424k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|   424k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5001|   424k|}
simple_absolute.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5643|  34.3k|static constexpr int32_t char_to_digit_value(char value) {
 5644|  34.3k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5644:7): [True: 28.6k, False: 5.72k]
  |  Branch (5644:23): [True: 28.6k, False: 8]
  ------------------
 5645|  5.73k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5645:7): [True: 5.70k, False: 30]
  |  Branch (5645:23): [True: 5.68k, False: 22]
  ------------------
 5646|     52|  return -1;
 5647|  5.73k|}
simple_absolute.cc:_ZN3ada4idnaL5adaptEiib:
 5653|   169k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5654|   169k|  if (firsttime) {
  ------------------
  |  Branch (5654:7): [True: 26.3k, False: 143k]
  ------------------
 5655|  26.3k|    d = d / damp;
 5656|   143k|  } else {
 5657|   143k|    d = d / 2;
 5658|   143k|  }
 5659|   169k|  d += d / n;
 5660|   169k|  int32_t k = 0;
 5661|   196k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5661:10): [True: 26.6k, False: 169k]
  ------------------
 5662|  26.6k|    d /= base - tmin;
 5663|  26.6k|    k += base;
 5664|  26.6k|  }
 5665|   169k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5666|   169k|}
simple_absolute.cc:_ZN3ada4idnaL13digit_to_charEi:
 5649|   279k|static constexpr char digit_to_char(int32_t digit) {
 5650|   279k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5650:10): [True: 177k, False: 102k]
  ------------------
 5651|   279k|}
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5988|   234k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6073|  1.78k|      auto is_l_or_d = [](uint32_t code) {
 6074|  1.78k|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6074:16): [True: 62, False: 1.72k]
  ------------------
 6075|  1.72k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6075:16): [True: 730, False: 994]
  ------------------
 6076|  1.78k|      };
simple_absolute.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6077|  1.90k|      auto is_r_or_d = [](uint32_t code) {
 6078|  1.90k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6078:16): [True: 390, False: 1.51k]
  ------------------
 6079|  1.51k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6079:16): [True: 302, False: 1.21k]
  ------------------
 6080|  1.90k|      };
simple_absolute.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5935|  24.7k|    const std::u32string_view label) noexcept {
 5936|  26.3k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5936:52): [True: 26.3k, False: 0]
  ------------------
 5937|  26.3k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5937:9): [True: 24.7k, False: 1.55k]
  ------------------
 5938|       |
 5939|      0|  return std::u32string_view::npos;
 5940|  24.7k|}
simple_absolute.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  24.7k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5945|  24.7k|  const size_t mask =
 5946|  24.7k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5947|       |
 5948|  24.7k|  size_t directions = 0;
 5949|   158k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5949:22): [True: 133k, False: 24.7k]
  ------------------
 5950|   133k|    directions |= 1u << find_direction(label[i]);
 5951|   133k|  }
 5952|  24.7k|  return (directions & mask) != 0;
 5953|  24.7k|}
simple_absolute.cc:_ZN3ada4idnaL14find_directionEj:
 5916|   173k|inline static direction find_direction(uint32_t code_point) noexcept {
 5917|       |  // Binary search on dir_final (sorted upper bounds).
 5918|   173k|  size_t lo = 0, hi = dir_table_count;
 5919|  2.01M|  while (lo < hi) {
  ------------------
  |  Branch (5919:10): [True: 1.83M, False: 173k]
  ------------------
 5920|  1.83M|    size_t mid = lo + (hi - lo) / 2;
 5921|  1.83M|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5921:9): [True: 590k, False: 1.24M]
  ------------------
 5922|   590k|      lo = mid + 1;
 5923|  1.24M|    } else {
 5924|  1.24M|      hi = mid;
 5925|  1.24M|    }
 5926|  1.83M|  }
 5927|   173k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5927:7): [True: 0, False: 173k]
  ------------------
 5928|      0|    return direction::NONE;
 5929|      0|  }
 5930|   173k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5930:10): [True: 172k, False: 1.34k]
  ------------------
 5931|   173k|                                     : direction::NONE;
 5932|   173k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6301|   123k|bool constexpr is_ascii(std::string_view view) {
 6302|  1.90M|  for (uint8_t c : view) {
  ------------------
  |  Branch (6302:18): [True: 1.90M, False: 118k]
  ------------------
 6303|  1.90M|    if (c >= 0x80) {
  ------------------
  |  Branch (6303:9): [True: 5.20k, False: 1.90M]
  ------------------
 6304|  5.20k|      return false;
 6305|  5.20k|    }
 6306|  1.90M|  }
 6307|   118k|  return true;
 6308|   123k|}
simple_absolute.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6338|   118k|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6339|   118k|  out.assign(ut8_string);
 6340|   118k|  ascii_map(out.data(), out.size());
 6341|   118k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  36.6k|bool constexpr is_ascii(std::u32string_view view) {
 6293|   112k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6293:19): [True: 112k, False: 3.06k]
  ------------------
 6294|   112k|    if (c >= 0x80) {
  ------------------
  |  Branch (6294:9): [True: 33.5k, False: 79.2k]
  ------------------
 6295|  33.5k|      return false;
 6296|  33.5k|    }
 6297|   112k|  }
 6298|  3.06k|  return true;
 6299|  36.6k|}
simple_absolute.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6354|  29.6k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6355|  29.6k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6355:10): [True: 23.2k, False: 6.40k]
  |  Branch (6355:31): [True: 3.85k, False: 19.3k]
  |  Branch (6355:51): [True: 3.60k, False: 242]
  ------------------
 6356|  3.60k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6356:10): [True: 3.38k, False: 220]
  |  Branch (6356:30): [True: 3.19k, False: 198]
  ------------------
 6357|  29.6k|}
simple_absolute.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6344|  5.42k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6345|  5.42k|  const size_t old = out.size();
 6346|  5.42k|  out.resize(old + label.size());
 6347|  5.42k|  char* dest = out.data() + old;
 6348|  76.3k|  for (char32_t c : label) {
  ------------------
  |  Branch (6348:19): [True: 76.3k, False: 5.42k]
  ------------------
 6349|  76.3k|    *dest++ = static_cast<char>(c);
 6350|  76.3k|  }
 6351|  5.42k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|   247k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|   247k|    return character_sets::bit_at(character_set, c);
 7360|   247k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|  45.0k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  45.0k|    return character_sets::bit_at(character_set, c);
 7360|  45.0k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7092|  88.3k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7093|  88.3k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7093:11): [True: 84.3k, False: 4.00k]
  |  Branch (7093:23): [True: 42.5k, False: 41.8k]
  |  Branch (7093:37): [True: 41.7k, False: 4.02k]
  |  Branch (7093:49): [True: 39.8k, False: 1.95k]
  ------------------
 7094|  5.97k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7094:11): [True: 1.90k, False: 4.07k]
  |  Branch (7094:23): [True: 1.77k, False: 128]
  ------------------
 7095|  88.3k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7182|  82.6k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7183|  82.6k|  return hex_to_binary_table[c - '0'];
 7184|  82.6k|}
simple_absolute.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7326|   996k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|   996k|    return character_sets::bit_at(character_set, c);
 7328|   996k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7019|   121k|    const char* input, size_t length) noexcept {
 7020|   121k|  size_t i = 0;
 7021|   121k|  uint8_t accumulator{};
 7022|   700k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7022:10): [True: 579k, False: 121k]
  ------------------
 7023|   579k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7024|   579k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7025|   579k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7026|   579k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7027|   579k|  }
 7028|   191k|  for (; i < length; i++) {
  ------------------
  |  Branch (7028:10): [True: 70.8k, False: 121k]
  ------------------
 7029|  70.8k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7030|  70.8k|  }
 7031|   121k|  return accumulator;
 7032|   121k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7708|    806|                            const uint8_t character_set[], std::string& out) {
 7709|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7710|    806|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7711|    806|#if ADA_UNICODE_SSSE3
 7712|    806|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7713|    806|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7714|       |#elif ADA_NEON
 7715|       |  percent_encode_to_neon(p, end, character_set,
 7716|       |                         load_neon_percent_table(character_set), out);
 7717|       |#elif ADA_RVV
 7718|       |  percent_encode_to_rvv(p, end, character_set, out);
 7719|       |#endif
 7720|    806|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7535|    806|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7536|    806|  ssse3_percent_tables t{};
 7537|    806|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7538|    806|  t.cs_hi =
 7539|    806|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7540|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7541|    806|  t.pow2 =
 7542|    806|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7543|    806|  t.mask_0f = _mm_set1_epi8(0x0F);
 7544|    806|  t.mask_07 = _mm_set1_epi8(0x07);
 7545|    806|  t.zero = _mm_setzero_si128();
 7546|    806|  return t;
 7547|    806|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7566|    806|    const ssse3_percent_tables& tables, std::string& out) {
 7567|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7568|  3.29k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7568:10): [True: 2.48k, False: 806]
  ------------------
 7569|  2.48k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7570|  2.48k|    const __m128i word1 =
 7571|  2.48k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7572|  2.48k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7573|  2.48k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7574|  2.48k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7574:9): [True: 280, False: 2.20k]
  ------------------
 7575|    280|      out.append(p, 32);
 7576|  2.20k|    } else {
 7577|  2.20k|      if (mask0 == 0) {
  ------------------
  |  Branch (7577:11): [True: 61, False: 2.14k]
  ------------------
 7578|     61|        out.append(p, 16);
 7579|  2.14k|      } else {
 7580|  2.14k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7581|  2.14k|      }
 7582|  2.20k|      if (mask1 == 0) {
  ------------------
  |  Branch (7582:11): [True: 287, False: 1.92k]
  ------------------
 7583|    287|        out.append(p + 16, 16);
 7584|  1.92k|      } else {
 7585|  1.92k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7586|  1.92k|      }
 7587|  2.20k|    }
 7588|  2.48k|    p += 32;
 7589|  2.48k|  }
 7590|    806|  if (p + 16 <= end) {
  ------------------
  |  Branch (7590:7): [True: 519, False: 287]
  ------------------
 7591|    519|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7592|    519|    const int mask = ssse3_percent_mask(word, tables);
 7593|    519|    if (mask == 0) {
  ------------------
  |  Branch (7593:9): [True: 157, False: 362]
  ------------------
 7594|    157|      out.append(p, 16);
 7595|    362|    } else {
 7596|    362|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7597|    362|    }
 7598|    519|    p += 16;
 7599|    519|  }
 7600|    806|  percent_encode_to_scalar(p, end, character_set, out);
 7601|    806|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7550|  5.49k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7551|  5.49k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7552|  5.49k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7553|  5.49k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7554|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7555|  5.49k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7556|  5.49k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7557|  5.49k|                                       _mm_andnot_si128(high_byte, lo));
 7558|  5.49k|  const __m128i bits =
 7559|  5.49k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7560|  5.49k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7561|  5.49k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7562|  5.49k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7490|  4.43k|                                          size_t width, std::string& out) {
 7491|  4.43k|  uint64_t bits = mask;
 7492|  4.43k|  size_t off = 0;
 7493|  62.8k|  while (bits != 0) {
  ------------------
  |  Branch (7493:10): [True: 58.3k, False: 4.43k]
  ------------------
 7494|  58.3k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7495|  58.3k|    if (zero_run != 0) {
  ------------------
  |  Branch (7495:9): [True: 2.65k, False: 55.7k]
  ------------------
 7496|  2.65k|      out.append(p + off, static_cast<size_t>(zero_run));
 7497|  2.65k|    }
 7498|  58.3k|    off += static_cast<size_t>(zero_run);
 7499|  58.3k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7500|  58.3k|    ++off;
 7501|  58.3k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7502|  58.3k|  }
 7503|  4.43k|  if (off < width) {
  ------------------
  |  Branch (7503:7): [True: 957, False: 3.47k]
  ------------------
 7504|    957|    out.append(p + off, width - off);
 7505|    957|  }
 7506|  4.43k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7478|  58.3k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7479|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7480|       |  unsigned long ret;
 7481|       |  _BitScanForward(&ret, input_num);
 7482|       |  return static_cast<int>(ret);
 7483|       |#else
 7484|  58.3k|  return __builtin_ctz(input_num);
 7485|  58.3k|#endif
 7486|  58.3k|}
simple_absolute.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7511|    806|                                                std::string& out) {
 7512|  4.34k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7512:10): [True: 3.53k, False: 806]
  ------------------
 7513|  3.53k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7513:9): [True: 1.89k, False: 1.64k]
  ------------------
 7514|  1.89k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7515|  1.89k|    } else {
 7516|  1.64k|      out += *p;
 7517|  1.64k|    }
 7518|  3.53k|  }
 7519|    806|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7775|  1.60k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7776|  1.60k|  static constexpr char kHex[] = "0123456789abcdef";
 7777|  1.60k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7777:7): [True: 128, False: 1.47k]
  ------------------
 7778|    128|    *p++ = kHex[(v >> 12) & 0xf];
 7779|    128|    *p++ = kHex[(v >> 8) & 0xf];
 7780|    128|    *p++ = kHex[(v >> 4) & 0xf];
 7781|    128|    *p++ = kHex[v & 0xf];
 7782|  1.47k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7782:14): [True: 218, False: 1.25k]
  ------------------
 7783|    218|    *p++ = kHex[(v >> 8) & 0xf];
 7784|    218|    *p++ = kHex[(v >> 4) & 0xf];
 7785|    218|    *p++ = kHex[v & 0xf];
 7786|  1.25k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7786:14): [True: 260, False: 994]
  ------------------
 7787|    260|    *p++ = kHex[(v >> 4) & 0xf];
 7788|    260|    *p++ = kHex[v & 0xf];
 7789|    994|  } else {
 7790|    994|    *p++ = kHex[v & 0xf];
 7791|    994|  }
 7792|  1.60k|  return p;
 7793|  1.60k|}
simple_absolute.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7761|   158k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7762|   158k|  if (v < 10) {
  ------------------
  |  Branch (7762:7): [True: 64.6k, False: 93.4k]
  ------------------
 7763|  64.6k|    *p++ = static_cast<char>('0' + v);
 7764|  93.4k|  } else if (v < 100) {
  ------------------
  |  Branch (7764:14): [True: 350, False: 93.1k]
  ------------------
 7765|    350|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7766|    350|    p += 2;
 7767|  93.1k|  } else {
 7768|  93.1k|    *p++ = static_cast<char>('0' + v / 100);
 7769|  93.1k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7770|  93.1k|    p += 2;
 7771|  93.1k|  }
 7772|   158k|  return p;
 7773|   158k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6868|   608k|    std::string_view user_input) noexcept {
 6869|       |  // first check for short strings in which case we do it naively.
 6870|   608k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6870:7): [True: 119k, False: 488k]
  ------------------
 6871|   119k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6872|   119k|  }
 6873|       |  // fast path for long strings (expected to be common)
 6874|   488k|  size_t i = 0;
 6875|   488k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6876|   488k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6877|   488k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6878|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6879|   488k|  __m128i running{0};
 6880|  1.18M|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6880:10): [True: 697k, False: 488k]
  ------------------
 6881|   697k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6882|   697k|    running = _mm_or_si128(
 6883|   697k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6884|   697k|                                           _mm_cmpeq_epi8(word, mask2))),
 6885|   697k|        _mm_cmpeq_epi8(word, mask3));
 6886|   697k|  }
 6887|   488k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6887:7): [True: 484k, False: 4.54k]
  ------------------
 6888|   484k|    __m128i word = _mm_loadu_si128(
 6889|   484k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6890|   484k|    running = _mm_or_si128(
 6891|   484k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6892|   484k|                                           _mm_cmpeq_epi8(word, mask2))),
 6893|   484k|        _mm_cmpeq_epi8(word, mask3));
 6894|   484k|  }
 6895|   488k|  return _mm_movemask_epi8(running) != 0;
 6896|   608k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6753|  1.52M|constexpr bool is_tabs_or_newline(char c) noexcept {
 6754|  1.52M|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6754:10): [True: 30, False: 1.52M]
  |  Branch (6754:23): [True: 36, False: 1.52M]
  |  Branch (6754:36): [True: 18, False: 1.52M]
  ------------------
 6755|  1.52M|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8564|    864|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8565|       |  // if this ever becomes a performance issue, we could use an approach similar
 8566|       |  // to has_tabs_or_newline
 8567|    864|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8568|    864|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7113|  73.7k|    const char c) noexcept {
 7114|  73.7k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7114:10): [True: 2.97k, False: 70.7k]
  |  Branch (7114:23): [True: 1.07k, False: 69.7k]
  |  Branch (7114:36): [True: 186, False: 69.5k]
  ------------------
 7115|  73.7k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7108|  1.08M|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7109|  1.08M|  return (unsigned char)c <= ' ';
 7110|  1.08M|}
_ZN3ada7helpers19parse_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEENS_6scheme4typeERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9266|   229k|                                           std::string& path) {
 9267|   229k|  ada_log("parse_prepared_path ", input);
 9268|   229k|  uint8_t accumulator = checkers::path_signature(input);
 9269|       |  // Let us first detect a trivial case.
 9270|       |  // If it is special, we check that we have no dot, no %,  no \ and no
 9271|       |  // character needing percent encoding. Otherwise, we check that we have no %,
 9272|       |  // no dot, and no character needing percent encoding.
 9273|   229k|  constexpr uint8_t need_encoding = 1;
 9274|   229k|  constexpr uint8_t backslash_char = 2;
 9275|   229k|  constexpr uint8_t dot_char = 4;
 9276|   229k|  constexpr uint8_t percent_char = 8;
 9277|   229k|  bool special = type != ada::scheme::NOT_SPECIAL;
 9278|   229k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (9278:39): [True: 1.37k, False: 228k]
  ------------------
 9279|  1.37k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (9279:39): [True: 39, False: 1.33k]
  ------------------
 9280|   229k|  bool trivial_path =
 9281|   229k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (9281:7): [True: 200k, False: 29.0k]
  |  Branch (9281:8): [True: 228k, False: 810]
  ------------------
 9282|   229k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
 9283|    810|                  0)) &&
 9284|   200k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (9284:7): [True: 200k, False: 17]
  ------------------
 9285|   229k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (9285:7): [True: 12.4k, False: 217k]
  |  Branch (9285:34): [True: 12.4k, False: 13]
  ------------------
 9286|       |    // '4' means that we have at least one dot, but nothing that requires
 9287|       |    // percent encoding or decoding. The only part that is not trivial is
 9288|       |    // that we may have single dots and double dots path segments.
 9289|       |    // If we have such segments, then we either have a path that begins
 9290|       |    // with '.' (easy to check), or we have the sequence './'.
 9291|       |    // Note: input cannot be empty, it must at least contain one character ('.')
 9292|       |    // Note: we know that '\' is not present.
 9293|  12.4k|    if (input[0] != '.') {
  ------------------
  |  Branch (9293:9): [True: 11.1k, False: 1.21k]
  ------------------
 9294|  11.1k|      size_t slashdot = 0;
 9295|  11.1k|      bool dot_is_file = true;
 9296|  36.4k|      for (;;) {
 9297|  36.4k|        slashdot = input.find("/.", slashdot);
 9298|  36.4k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (9298:13): [True: 11.1k, False: 25.2k]
  ------------------
 9299|  11.1k|          break;
 9300|  25.2k|        } else {  // uncommon
 9301|       |          // only three cases matter: /./, /.. or a final /
 9302|  25.2k|          slashdot += 2;
 9303|  25.2k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (9303:28): [True: 79, False: 25.2k]
  |  Branch (9303:56): [True: 12.2k, False: 12.9k]
  ------------------
 9304|  12.9k|                           input[slashdot] == '/');
  ------------------
  |  Branch (9304:28): [True: 12.0k, False: 954]
  ------------------
 9305|  25.2k|        }
 9306|  36.4k|      }
 9307|  11.1k|      trivial_path = dot_is_file;
 9308|  11.1k|    }
 9309|  12.4k|  }
 9310|   229k|  if (trivial_path) {
  ------------------
  |  Branch (9310:7): [True: 201k, False: 28.0k]
  ------------------
 9311|   201k|    ada_log("parse_path trivial");
 9312|   201k|    path += '/';
 9313|   201k|    path += input;
 9314|   201k|    return;
 9315|   201k|  }
 9316|       |  // We are going to need to look a bit at the path, but let us see if we can
 9317|       |  // ignore percent encoding *and* backslashes *and* percent characters.
 9318|       |  // Except for the trivial case, this is likely to capture 99% of paths out
 9319|       |  // there.
 9320|  28.0k|  bool fast_path =
 9321|  28.0k|      (special &&
  ------------------
  |  Branch (9321:8): [True: 27.6k, False: 435]
  ------------------
 9322|  27.6k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (9322:8): [True: 11.3k, False: 16.3k]
  ------------------
 9323|  11.3k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (9323:7): [True: 11.2k, False: 98]
  ------------------
 9324|  28.0k|  if (fast_path) {
  ------------------
  |  Branch (9324:7): [True: 11.2k, False: 16.8k]
  ------------------
 9325|  11.2k|    ada_log("parse_prepared_path fast");
 9326|       |    // Here we don't need to worry about \ or percent encoding.
 9327|       |    // We also do not have a file protocol. We might have dots, however,
 9328|       |    // but dots must as appear as '.', and they cannot be encoded because
 9329|       |    // the symbol '%' is not present.
 9330|  11.2k|    size_t previous_location = 0;  // We start at 0.
 9331|  68.9k|    do {
 9332|  68.9k|      size_t new_location = input.find('/', previous_location);
 9333|       |      // std::string_view path_view = input;
 9334|       |      //  We process the last segment separately:
 9335|  68.9k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (9335:11): [True: 11.2k, False: 57.7k]
  ------------------
 9336|  11.2k|        std::string_view path_view = input.substr(previous_location);
 9337|  11.2k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (9337:13): [True: 78, False: 11.1k]
  ------------------
 9338|       |          // e.g., if you receive ".." with an empty path, you go to "/".
 9339|     78|          if (path.empty()) {
  ------------------
  |  Branch (9339:15): [True: 18, False: 60]
  ------------------
 9340|     18|            path = '/';
 9341|     18|            return;
 9342|     18|          }
 9343|       |          // Fast case where we have nothing to do:
 9344|     60|          if (path.back() == '/') {
  ------------------
  |  Branch (9344:15): [True: 16, False: 44]
  ------------------
 9345|     16|            return;
 9346|     16|          }
 9347|       |          // If you have the path "/joe/myfriend",
 9348|       |          // then you delete 'myfriend'.
 9349|     44|          path.resize(path.rfind('/') + 1);
 9350|     44|          return;
 9351|     60|        }
 9352|  11.1k|        path += '/';
 9353|  11.1k|        if (path_view != ".") {
  ------------------
  |  Branch (9353:13): [True: 11.0k, False: 104]
  ------------------
 9354|  11.0k|          path.append(path_view);
 9355|  11.0k|        }
 9356|  11.1k|        return;
 9357|  57.7k|      } else {
 9358|       |        // This is a non-final segment.
 9359|  57.7k|        std::string_view path_view =
 9360|  57.7k|            input.substr(previous_location, new_location - previous_location);
 9361|  57.7k|        previous_location = new_location + 1;
 9362|  57.7k|        if (path_view == "..") {
  ------------------
  |  Branch (9362:13): [True: 12.7k, False: 45.0k]
  ------------------
 9363|  12.7k|          size_t last_delimiter = path.rfind('/');
 9364|  12.7k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (9364:15): [True: 10.6k, False: 2.06k]
  ------------------
 9365|  10.6k|            path.erase(last_delimiter);
 9366|  10.6k|          }
 9367|  45.0k|        } else if (path_view != ".") {
  ------------------
  |  Branch (9367:20): [True: 32.5k, False: 12.5k]
  ------------------
 9368|  32.5k|          path += '/';
 9369|  32.5k|          path.append(path_view);
 9370|  32.5k|        }
 9371|  57.7k|      }
 9372|  68.9k|    } while (true);
  ------------------
  |  Branch (9372:14): [True: 57.7k, Folded]
  ------------------
 9373|  16.8k|  } else {
 9374|  16.8k|    ada_log("parse_path slow");
 9375|       |    // we have reached the general case
 9376|  16.8k|    bool needs_percent_encoding = (accumulator & 1);
 9377|  16.8k|    std::string path_buffer_tmp;
 9378|  60.4k|    do {
 9379|  60.4k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (9379:26): [True: 58.6k, False: 1.79k]
  |  Branch (9379:37): [True: 5.54k, False: 53.0k]
  ------------------
 9380|  60.4k|                            ? input.find_first_of("/\\")
 9381|  60.4k|                            : input.find('/');
 9382|  60.4k|      std::string_view path_view = input;
 9383|  60.4k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (9383:11): [True: 43.5k, False: 16.8k]
  ------------------
 9384|  43.5k|        path_view.remove_suffix(path_view.size() - location);
 9385|  43.5k|        input.remove_prefix(location + 1);
 9386|  43.5k|      }
 9387|       |      // path_buffer is either path_view or it might point at a percent encoded
 9388|       |      // temporary file.
 9389|  60.4k|      std::string_view path_buffer =
 9390|  60.4k|          (needs_percent_encoding &&
  ------------------
  |  Branch (9390:12): [True: 13.1k, False: 47.3k]
  ------------------
 9391|  13.1k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (9391:12): [True: 4.15k, False: 8.95k]
  ------------------
 9392|  13.1k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
 9393|  60.4k|              ? path_buffer_tmp
 9394|  60.4k|              : path_view;
 9395|  60.4k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9395:11): [True: 12.7k, False: 47.6k]
  ------------------
 9396|  12.7k|        helpers::shorten_path(path, type);
 9397|  12.7k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9397:13): [True: 9.42k, False: 3.32k]
  ------------------
 9398|  9.42k|          path += '/';
 9399|  9.42k|        }
 9400|  47.6k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (9400:18): [True: 2.23k, False: 45.4k]
  ------------------
 9401|  2.23k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (9401:18): [True: 426, False: 1.81k]
  ------------------
 9402|    426|        path += '/';
 9403|    426|      }
 9404|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
 9405|  47.2k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (9405:16): [True: 45.4k, False: 1.81k]
  ------------------
 9406|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
 9407|       |        // Windows drive letter, then replace the second code point in
 9408|       |        // path_buffer with U+003A (:).
 9409|  45.4k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (9409:13): [True: 1.92k, False: 43.5k]
  |  Branch (9409:48): [True: 524, False: 1.39k]
  ------------------
 9410|    524|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (9410:13): [True: 42, False: 482]
  ------------------
 9411|     42|          path += '/';
 9412|     42|          path += path_buffer[0];
 9413|     42|          path += ':';
 9414|     42|          path_buffer.remove_prefix(2);
 9415|     42|          path.append(path_buffer);
 9416|  45.3k|        } else {
 9417|       |          // Append path_buffer to url's path.
 9418|  45.3k|          path += '/';
 9419|  45.3k|          path.append(path_buffer);
 9420|  45.3k|        }
 9421|  45.4k|      }
 9422|  60.4k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (9422:11): [True: 16.8k, False: 43.5k]
  ------------------
 9423|  16.8k|        return;
 9424|  16.8k|      }
 9425|  60.4k|    } while (true);
  ------------------
  |  Branch (9425:14): [True: 43.5k, Folded]
  ------------------
 9426|  16.8k|  }
 9427|  28.0k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   75|   458k|    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|   458k|  size_t i = 0;
   82|   458k|  uint8_t accumulator{};
   83|   617k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (83:10): [True: 158k, False: 458k]
  ------------------
   84|   158k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   85|   158k|                           path_signature_table[uint8_t(input[i + 1])] |
   86|   158k|                           path_signature_table[uint8_t(input[i + 2])] |
   87|   158k|                           path_signature_table[uint8_t(input[i + 3])] |
   88|   158k|                           path_signature_table[uint8_t(input[i + 4])] |
   89|   158k|                           path_signature_table[uint8_t(input[i + 5])] |
   90|   158k|                           path_signature_table[uint8_t(input[i + 6])] |
   91|   158k|                           path_signature_table[uint8_t(input[i + 7])]);
   92|   158k|  }
   93|   735k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (93:10): [True: 276k, False: 458k]
  ------------------
   94|   276k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   95|   276k|  }
   96|   458k|  return accumulator;
   97|   458k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7121|   120k|    std::string_view input) noexcept {
 7122|       |  // This will catch most cases:
 7123|       |  // The length must be 2,4 or 6.
 7124|       |  // We divide by two and require
 7125|       |  // that the result be between 1 and 3 inclusively.
 7126|   120k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7127|   120k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7127:7): [True: 47.2k, False: 73.5k]
  ------------------
 7128|  47.2k|    return false;
 7129|  47.2k|  }
 7130|       |  // We have a string of length 2, 4 or 6.
 7131|       |  // We now check the first character:
 7132|  73.5k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7132:7): [True: 62.7k, False: 10.8k]
  |  Branch (7132:28): [True: 24.7k, False: 38.0k]
  ------------------
 7133|  24.7k|    return false;
 7134|  24.7k|  }
 7135|       |  // We are unlikely the get beyond this point.
 7136|  48.8k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7137|  48.8k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7138|  48.8k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7138:7): [True: 15.4k, False: 33.3k]
  ------------------
 7139|  15.4k|    return false;
 7140|  15.4k|  }
 7141|       |  // We almost never get here.
 7142|       |  // Optimizing the rest is relatively unimportant.
 7143|  33.3k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|  33.3k|    uint16_t A, B;
 7145|  33.3k|    memcpy(&A, a.data(), sizeof(A));
 7146|  33.3k|    memcpy(&B, b.data(), sizeof(B));
 7147|  33.3k|    return A == B;
 7148|  33.3k|  };
 7149|  33.3k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7149:7): [True: 2.15k, False: 31.1k]
  ------------------
 7150|  2.15k|    return false;
 7151|  2.15k|  }
 7152|   113k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7152:22): [True: 87.8k, False: 25.4k]
  ------------------
 7153|  87.8k|    char c = input[i];
 7154|  87.8k|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7154:9): [True: 5.71k, False: 82.1k]
  |  Branch (7154:10): [True: 42.3k, False: 45.4k]
  ------------------
 7155|  5.71k|      return false;
 7156|  5.71k|    }
 7157|  87.8k|  }
 7158|  25.4k|  return true;
 7159|       |  // The above code might be a bit better than the code below. Compilers
 7160|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7161|       |  // 6 and other tricks.
 7162|       |  // return input == ".." ||
 7163|       |  //  input == ".%2e" || input == ".%2E" ||
 7164|       |  //  input == "%2e." || input == "%2E." ||
 7165|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7166|       |  //  "%2e%2E";
 7167|  31.1k|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7143|  33.3k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|  33.3k|    uint16_t A, B;
 7145|  33.3k|    memcpy(&A, a.data(), sizeof(A));
 7146|  33.3k|    memcpy(&B, b.data(), sizeof(B));
 7147|  33.3k|    return A == B;
 7148|  33.3k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7170|   189k|    std::string_view input) noexcept {
 7171|   189k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7171:10): [True: 4.30k, False: 185k]
  |  Branch (7171:26): [True: 3.78k, False: 181k]
  |  Branch (7171:44): [True: 12, False: 181k]
  ------------------
 7172|   189k|}
_ZN3ada7unicode28is_forbidden_host_code_pointEc:
 6991|  16.8k|    const char c) noexcept {
 6992|  16.8k|  return is_forbidden_host_code_point_table[uint8_t(c)];
 6993|  16.8k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9550|  96.2k|                              bool& is_pure_decimal) noexcept {
 9551|  96.2k|  is_pure_decimal = false;
 9552|  96.2k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9552:7): [True: 0, False: 96.2k]
  ------------------
 9553|      0|    return false;
 9554|      0|  }
 9555|  96.2k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9555:7): [True: 75.8k, False: 20.3k]
  |  Branch (9555:23): [True: 37.7k, False: 38.1k]
  |  Branch (9555:38): [True: 37.3k, False: 318]
  ------------------
 9556|  37.3k|    p += 2;
 9557|  37.3k|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9557:9): [True: 58, False: 37.3k]
  |  Branch (9557:21): [True: 30, False: 37.3k]
  ------------------
 9558|     88|      value = 0;
 9559|     88|      return true;
 9560|     88|    }
 9561|  37.3k|    uint64_t v = 0;
 9562|  37.3k|    int digits = 0;
 9563|   226k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9563:12): [True: 208k, False: 18.4k]
  |  Branch (9563:23): [True: 189k, False: 18.7k]
  ------------------
 9564|   189k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9565|   189k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9565:11): [True: 12, False: 189k]
  ------------------
 9566|     12|        return false;
 9567|     12|      }
 9568|   189k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9568:11): [True: 88, False: 189k]
  ------------------
 9569|     88|        return false;
 9570|     88|      }
 9571|   189k|      v = (v << 4) | nib;
 9572|   189k|      ++p;
 9573|   189k|      ++digits;
 9574|   189k|    }
 9575|  37.2k|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9575:9): [True: 0, False: 37.2k]
  ------------------
 9576|      0|      return false;
 9577|      0|    }
 9578|  37.2k|    value = v;
 9579|  37.2k|    return true;
 9580|  37.2k|  }
 9581|  58.8k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9581:7): [True: 38.4k, False: 20.3k]
  |  Branch (9581:23): [True: 318, False: 38.1k]
  |  Branch (9581:38): [True: 194, False: 124]
  |  Branch (9581:53): [True: 184, False: 10]
  ------------------
 9582|    184|    ++p;
 9583|    184|    uint64_t v = 0;
 9584|  2.44k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9584:12): [True: 2.37k, False: 70]
  |  Branch (9584:23): [True: 2.33k, False: 32]
  ------------------
 9585|  2.33k|      const char c = *p;
 9586|  2.33k|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9586:11): [True: 12, False: 2.32k]
  |  Branch (9586:22): [True: 18, False: 2.30k]
  ------------------
 9587|     30|        return false;
 9588|     30|      }
 9589|  2.30k|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9589:11): [True: 52, False: 2.25k]
  ------------------
 9590|     52|        return false;
 9591|     52|      }
 9592|  2.25k|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9593|  2.25k|      ++p;
 9594|  2.25k|    }
 9595|    102|    value = v;
 9596|    102|    return true;
 9597|    184|  }
 9598|  58.6k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9598:7): [True: 74, False: 58.5k]
  |  Branch (9598:19): [True: 36.4k, False: 22.1k]
  ------------------
 9599|  36.4k|    return false;
 9600|  36.4k|  }
 9601|  22.1k|  is_pure_decimal = true;
 9602|  22.1k|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9603|  22.1k|  ++p;
 9604|  29.4k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9604:10): [True: 8.50k, False: 20.9k]
  |  Branch (9604:21): [True: 7.43k, False: 1.06k]
  ------------------
 9605|  7.43k|    const char c = *p;
 9606|  7.43k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9606:9): [True: 18, False: 7.41k]
  |  Branch (9606:20): [True: 32, False: 7.38k]
  ------------------
 9607|     50|      return false;
 9608|     50|    }
 9609|  7.38k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9609:9): [True: 86, False: 7.29k]
  ------------------
 9610|     86|      return false;
 9611|     86|    }
 9612|  7.29k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9613|  7.29k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9613:9): [True: 8, False: 7.28k]
  ------------------
 9614|      8|      return false;
 9615|      8|    }
 9616|  7.28k|    ++p;
 9617|  7.28k|  }
 9618|  22.0k|  value = v;
 9619|  22.0k|  return true;
 9620|  22.1k|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9624|  1.97k|                           uint16_t& value) noexcept {
 9625|  1.97k|  if (pointer == end) {
  ------------------
  |  Branch (9625:7): [True: 0, False: 1.97k]
  ------------------
 9626|      0|    return 0;
 9627|      0|  }
 9628|  1.97k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9629|  1.97k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9629:7): [True: 40, False: 1.93k]
  ------------------
 9630|     40|    return 0;
 9631|     40|  }
 9632|  1.93k|  uint32_t v = n0;
 9633|  1.93k|  ++pointer;
 9634|  1.93k|  int length = 1;
 9635|  1.93k|  if (pointer != end) {
  ------------------
  |  Branch (9635:7): [True: 1.71k, False: 220]
  ------------------
 9636|  1.71k|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9637|  1.71k|    if (n1 != 0xff) {
  ------------------
  |  Branch (9637:9): [True: 682, False: 1.02k]
  ------------------
 9638|    682|      v = (v << 4) | n1;
 9639|    682|      ++pointer;
 9640|    682|      ++length;
 9641|    682|      if (pointer != end) {
  ------------------
  |  Branch (9641:11): [True: 604, False: 78]
  ------------------
 9642|    604|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9643|    604|        if (n2 != 0xff) {
  ------------------
  |  Branch (9643:13): [True: 394, False: 210]
  ------------------
 9644|    394|          v = (v << 4) | n2;
 9645|    394|          ++pointer;
 9646|    394|          ++length;
 9647|    394|          if (pointer != end) {
  ------------------
  |  Branch (9647:15): [True: 302, False: 92]
  ------------------
 9648|    302|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9649|    302|            if (n3 != 0xff) {
  ------------------
  |  Branch (9649:17): [True: 144, False: 158]
  ------------------
 9650|    144|              v = (v << 4) | n3;
 9651|    144|              ++pointer;
 9652|    144|              ++length;
 9653|    144|            }
 9654|    302|          }
 9655|    394|        }
 9656|    604|      }
 9657|    682|    }
 9658|  1.71k|  }
 9659|  1.93k|  value = static_cast<uint16_t>(v);
 9660|  1.93k|  return length;
 9661|  1.97k|}
_ZN3ada3url10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10233|  22.8k|ada_really_inline void url::parse_path(std::string_view input) {
10234|  22.8k|  ada_log("parse_path ", input);
10235|  22.8k|  std::string tmp_buffer;
10236|  22.8k|  std::string_view internal_input;
10237|  22.8k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (10237:7): [True: 0, False: 22.8k]
  ------------------
10238|      0|    tmp_buffer = input;
10239|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10240|       |    // just directly build the string from user_input.
10241|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10242|      0|    internal_input = tmp_buffer;
10243|  22.8k|  } else {
10244|  22.8k|    internal_input = input;
10245|  22.8k|  }
10246|       |
10247|       |  // If url is special, then:
10248|  22.8k|  if (is_special()) {
  ------------------
  |  Branch (10248:7): [True: 22.8k, False: 0]
  ------------------
10249|  22.8k|    if (internal_input.empty()) {
  ------------------
  |  Branch (10249:9): [True: 216, False: 22.6k]
  ------------------
10250|    216|      path = "/";
10251|  22.6k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (10251:16): [True: 22.6k, False: 0]
  |  Branch (10251:46): [True: 0, False: 0]
  ------------------
10252|  22.6k|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10253|  22.6k|    } else {
10254|      0|      helpers::parse_prepared_path(internal_input, type, path);
10255|      0|    }
10256|  22.8k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (10256:14): [True: 0, False: 0]
  ------------------
10257|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (10257:9): [True: 0, False: 0]
  ------------------
10258|      0|      helpers::parse_prepared_path(internal_input.substr(1), type, path);
10259|      0|    } else {
10260|      0|      helpers::parse_prepared_path(internal_input, type, path);
10261|      0|    }
10262|      0|  } else {
10263|      0|    if (!host.has_value()) {
  ------------------
  |  Branch (10263:9): [True: 0, False: 0]
  ------------------
10264|      0|      path = "/";
10265|      0|    }
10266|      0|  }
10267|  22.8k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7085|  2.24M|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7086|  2.24M|  return is_alnum_plus_table[uint8_t(c)];
 7087|       |  // A table is almost surely much faster than the
 7088|       |  // following under most compilers: return
 7089|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7090|  2.24M|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6761|  49.8k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6762|  49.8k|  uint64_t broadcast_80 = broadcast(0x80);
 6763|  49.8k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6764|  49.8k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6765|  49.8k|  uint64_t non_ascii = 0;
 6766|  49.8k|  size_t i = 0;
 6767|       |
 6768|  94.4k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6768:10): [True: 44.6k, False: 49.8k]
  ------------------
 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|  49.8k|  if (i < length) {
  ------------------
  |  Branch (6776:7): [True: 49.3k, False: 412]
  ------------------
 6777|  49.3k|    uint64_t word{};
 6778|  49.3k|    memcpy(&word, input + i, length - i);
 6779|  49.3k|    non_ascii |= (word & broadcast_80);
 6780|  49.3k|    word ^=
 6781|  49.3k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6782|  49.3k|    memcpy(input + i, &word, length - i);
 6783|  49.3k|  }
 6784|  49.8k|  return non_ascii == 0;
 6785|  49.8k|}
_ZN3ada7unicode9broadcastEh:
 6757|   149k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6758|   149k|  return 0x101010101010101ull * v;
 6759|   149k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12233|  21.1k|    auto apply_query_and_hash = [&]() {
12234|  21.1k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12234:11): [True: 1.24k, False: 19.8k]
  ------------------
12235|  1.24k|        const size_t q_end =
12236|  1.24k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12236:13): [True: 735, False: 513]
  ------------------
12237|  1.24k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|  1.24k|                                                q_end - query_start - 1),
12239|  1.24k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|  1.24k|      }
12241|  21.1k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12241:11): [True: 1.07k, False: 20.0k]
  ------------------
12242|  1.07k|        out.update_unencoded_base_hash(std::string_view(
12243|  1.07k|            input.data() + hash_start + 1, len - hash_start - 1));
12244|  1.07k|      }
12245|  21.1k|    };
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12233|  21.1k|    auto apply_query_and_hash = [&]() {
12234|  21.1k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12234:11): [True: 1.24k, False: 19.8k]
  ------------------
12235|  1.24k|        const size_t q_end =
12236|  1.24k|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12236:13): [True: 735, False: 513]
  ------------------
12237|  1.24k|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|  1.24k|                                                q_end - query_start - 1),
12239|  1.24k|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|  1.24k|      }
12241|  21.1k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12241:11): [True: 1.07k, False: 20.0k]
  ------------------
12242|  1.07k|        out.update_unencoded_base_hash(std::string_view(
12243|  1.07k|            input.data() + hash_start + 1, len - hash_start - 1));
12244|  1.07k|      }
12245|  21.1k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_3urlEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11833|  1.74k|    auto apply_query_and_hash = [&]() {
11834|  1.74k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11834:11): [True: 847, False: 893]
  ------------------
11835|    847|        const size_t q_end =
11836|    847|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11836:13): [True: 549, False: 298]
  ------------------
11837|    847|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|    847|                                                q_end - query_start - 1),
11839|    847|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|    847|      }
11841|  1.74k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11841:11): [True: 773, False: 967]
  ------------------
11842|    773|        out.update_unencoded_base_hash(std::string_view(
11843|    773|            input.data() + hash_start + 1, len - hash_start - 1));
11844|    773|      }
11845|  1.74k|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11833|  1.74k|    auto apply_query_and_hash = [&]() {
11834|  1.74k|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11834:11): [True: 847, False: 893]
  ------------------
11835|    847|        const size_t q_end =
11836|    847|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11836:13): [True: 549, False: 298]
  ------------------
11837|    847|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|    847|                                                q_end - query_start - 1),
11839|    847|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|    847|      }
11841|  1.74k|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11841:11): [True: 773, False: 967]
  ------------------
11842|    773|        out.update_unencoded_base_hash(std::string_view(
11843|    773|            input.data() + hash_start + 1, len - hash_start - 1));
11844|    773|      }
11845|  1.74k|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8504|   516k|    std::string_view& input) noexcept {
 8505|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8506|       |  // function). this function should be quite fast.
 8507|   516k|  size_t location_of_first = input.find('#');
 8508|   516k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8508:7): [True: 494k, False: 22.1k]
  ------------------
 8509|   494k|    return std::nullopt;
 8510|   494k|  }
 8511|  22.1k|  std::string_view hash = input;
 8512|  22.1k|  hash.remove_prefix(location_of_first + 1);
 8513|  22.1k|  input.remove_suffix(input.size() - location_of_first);
 8514|  22.1k|  return hash;
 8515|   516k|}
_ZZN3ada6parser14parse_url_implINS_3urlELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12556|   237k|  const auto enforce_max_input_length = [&]() {
12557|   237k|    if constexpr (store_values) {
12558|   237k|      if (url.is_valid) {
  ------------------
  |  Branch (12558:11): [True: 237k, False: 0]
  ------------------
12559|       |        if constexpr (result_type_is_ada_url_aggregator) {
12560|       |          if (url.buffer.size() > max_input_length) [[unlikely]] {
12561|       |            url.is_valid = false;
12562|       |          }
12563|   237k|        } else {
12564|   237k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12564:15): [True: 0, False: 237k]
  ------------------
12565|      0|            url.is_valid = false;
12566|      0|          }
12567|   237k|        }
12568|   237k|      }
12569|   237k|    }
12570|   237k|  };
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9462|   184k|find_authority_delimiter_special(std::string_view view) noexcept {
 9463|       |  // performance note: we might be able to gain further performance
 9464|       |  // with SIMD intrinsics.
 9465|  1.93M|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9465:33): [True: 1.92M, False: 19.0k]
  ------------------
 9466|  1.92M|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9466:9): [True: 165k, False: 1.75M]
  ------------------
 9467|   165k|      return pos - view.begin();
 9468|   165k|    }
 9469|  1.92M|  }
 9470|  19.0k|  return size_t(view.size());
 9471|   184k|}
_ZN3ada7helpers24find_authority_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9483|    308|find_authority_delimiter(std::string_view view) noexcept {
 9484|       |  // performance note: we might be able to gain further performance
 9485|       |  // with SIMD instrinsics.
 9486|  3.98k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9486:33): [True: 3.96k, False: 18]
  ------------------
 9487|  3.96k|    if (authority_delimiter[(uint8_t)*pos]) {
  ------------------
  |  Branch (9487:9): [True: 290, False: 3.67k]
  ------------------
 9488|    290|      return pos - view.begin();
 9489|    290|    }
 9490|  3.96k|  }
 9491|     18|  return size_t(view.size());
 9492|    308|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8517|  25.4k|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8518|       |  // Let path be url's path.
 8519|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8520|       |  // Windows drive letter, then return.
 8521|  25.4k|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8521:7): [True: 324, False: 25.1k]
  ------------------
 8522|    324|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8522:7): [True: 166, False: 158]
  |  Branch (8522:54): [True: 136, False: 30]
  ------------------
 8523|    136|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8523:9): [True: 20, False: 116]
  ------------------
 8524|    136|            helpers::substring(path, 1))) {
 8525|     20|      return false;
 8526|     20|    }
 8527|    136|  }
 8528|       |
 8529|       |  // Remove path's last item, if any.
 8530|  25.4k|  size_t last_delimiter = path.rfind('/');
 8531|  25.4k|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8531:7): [True: 21.5k, False: 3.93k]
  ------------------
 8532|  21.5k|    path.erase(last_delimiter);
 8533|  21.5k|    return true;
 8534|  21.5k|  }
 8535|       |
 8536|  3.93k|  return false;
 8537|  25.4k|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9175|   510k|    const bool is_special, std::string_view& view) noexcept {
 9176|       |  /**
 9177|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9178|       |   * compute a variable called insideBrackets but this variable is only used
 9179|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9180|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9181|       |   * It is conceptually simpler and arguably more efficient to just return a
 9182|       |   * Boolean indicating whether ':' was found outside brackets.
 9183|       |   */
 9184|   510k|  const size_t view_size = view.size();
 9185|   510k|  size_t location = 0;
 9186|   510k|  bool found_colon = false;
 9187|       |  /**
 9188|       |   * Performance analysis:
 9189|       |   *
 9190|       |   * We are basically seeking the end of the hostname which can be indicated
 9191|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9192|       |   * (where '\\' is only applicable for special URLs). However, these must
 9193|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9194|       |   * '?' does not count.
 9195|       |   *
 9196|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9197|       |   * the set of delimiters, and that we handle it first.
 9198|       |   *
 9199|       |   * So the trick is to have a fast function that locates the next delimiter.
 9200|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9201|       |   * function would be provided by the C++ standard library, but it seems that
 9202|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9203|       |   *
 9204|       |   * We do not break into two loops for speed, but for clarity.
 9205|       |   */
 9206|   510k|  if (is_special) {
  ------------------
  |  Branch (9206:7): [True: 508k, False: 1.48k]
  ------------------
 9207|       |    // We move to the next delimiter.
 9208|   508k|    location = find_next_host_delimiter_special(view, location);
 9209|       |    // Unless we find '[' then we are going only going to have to call
 9210|       |    // find_next_host_delimiter_special once.
 9211|   511k|    for (; location < view_size;
  ------------------
  |  Branch (9211:12): [True: 451k, False: 60.3k]
  ------------------
 9212|   508k|         location = find_next_host_delimiter_special(view, location)) {
 9213|   451k|      if (view[location] == '[') {
  ------------------
  |  Branch (9213:11): [True: 2.69k, False: 448k]
  ------------------
 9214|  2.69k|        location = view.find(']', location);
 9215|  2.69k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9215:13): [True: 182, False: 2.50k]
  ------------------
 9216|       |          // performance: view.find might get translated to a memchr, which
 9217|       |          // has no notion of std::string_view::npos, so the code does not
 9218|       |          // reflect the assembly.
 9219|    182|          location = view_size;
 9220|    182|          break;
 9221|    182|        }
 9222|   448k|      } else {
 9223|   448k|        found_colon = view[location] == ':';
 9224|   448k|        break;
 9225|   448k|      }
 9226|   451k|    }
 9227|   508k|  } else {
 9228|       |    // We move to the next delimiter.
 9229|  1.48k|    location = find_next_host_delimiter(view, location);
 9230|       |    // Unless we find '[' then we are going only going to have to call
 9231|       |    // find_next_host_delimiter_special once.
 9232|  1.60k|    for (; location < view_size;
  ------------------
  |  Branch (9232:12): [True: 1.36k, False: 242]
  ------------------
 9233|  1.48k|         location = find_next_host_delimiter(view, location)) {
 9234|  1.36k|      if (view[location] == '[') {
  ------------------
  |  Branch (9234:11): [True: 130, False: 1.23k]
  ------------------
 9235|    130|        location = view.find(']', location);
 9236|    130|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9236:13): [True: 6, False: 124]
  ------------------
 9237|       |          // performance: view.find might get translated to a memchr, which
 9238|       |          // has no notion of std::string_view::npos, so the code does not
 9239|       |          // reflect the assembly.
 9240|      6|          location = view_size;
 9241|      6|          break;
 9242|      6|        }
 9243|  1.23k|      } else {
 9244|  1.23k|        found_colon = view[location] == ':';
 9245|  1.23k|        break;
 9246|  1.23k|      }
 9247|  1.36k|    }
 9248|  1.48k|  }
 9249|       |  // performance: remove_suffix may translate into a single instruction.
 9250|   510k|  view.remove_suffix(view_size - location);
 9251|   510k|  return {location, found_colon};
 9252|   510k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8765|   511k|    std::string_view view, size_t location) noexcept {
 8766|       |  // first check for short strings in which case we do it naively.
 8767|   511k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8767:7): [True: 395k, False: 115k]
  ------------------
 8768|  4.21M|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8768:31): [True: 4.15M, False: 58.5k]
  ------------------
 8769|  4.15M|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8769:11): [True: 1.37k, False: 4.15M]
  |  Branch (8769:29): [True: 334k, False: 3.82M]
  |  Branch (8769:47): [True: 180, False: 3.82M]
  ------------------
 8770|  3.82M|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8770:11): [True: 468, False: 3.82M]
  |  Branch (8770:29): [True: 1.09k, False: 3.81M]
  ------------------
 8771|   337k|        return i;
 8772|   337k|      }
 8773|  4.15M|    }
 8774|  58.5k|    return size_t(view.size());
 8775|   395k|  }
 8776|       |  // fast path for long strings (expected to be common)
 8777|   115k|  size_t i = location;
 8778|   115k|  const __m128i mask1 = _mm_set1_epi8(':');
 8779|   115k|  const __m128i mask2 = _mm_set1_epi8('/');
 8780|   115k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8781|   115k|  const __m128i mask4 = _mm_set1_epi8('?');
 8782|   115k|  const __m128i mask5 = _mm_set1_epi8('[');
 8783|       |
 8784|   230k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8784:10): [True: 171k, False: 59.7k]
  ------------------
 8785|   171k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8786|   171k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8787|   171k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8788|   171k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8789|   171k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8790|   171k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8791|   171k|    __m128i m = _mm_or_si128(
 8792|   171k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8793|   171k|    int mask = _mm_movemask_epi8(m);
 8794|   171k|    if (mask != 0) {
  ------------------
  |  Branch (8794:9): [True: 55.7k, False: 115k]
  ------------------
 8795|  55.7k|      return i + trailing_zeroes(mask);
 8796|  55.7k|    }
 8797|   171k|  }
 8798|  59.7k|  if (i < view.size()) {
  ------------------
  |  Branch (8798:7): [True: 59.4k, False: 272]
  ------------------
 8799|  59.4k|    __m128i word =
 8800|  59.4k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8801|  59.4k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8802|  59.4k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8803|  59.4k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8804|  59.4k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8805|  59.4k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8806|  59.4k|    __m128i m = _mm_or_si128(
 8807|  59.4k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8808|  59.4k|    int mask = _mm_movemask_epi8(m);
 8809|  59.4k|    if (mask != 0) {
  ------------------
  |  Branch (8809:9): [True: 57.9k, False: 1.51k]
  ------------------
 8810|  57.9k|      return view.length() - 16 + trailing_zeroes(mask);
 8811|  57.9k|    }
 8812|  59.4k|  }
 8813|  1.78k|  return size_t(view.length());
 8814|  59.7k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8585|   114k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8586|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8587|       |  unsigned long ret;
 8588|       |  // Search the mask data from least significant bit (LSB)
 8589|       |  // to the most significant bit (MSB) for a set bit (1).
 8590|       |  _BitScanForward(&ret, input_num);
 8591|       |  return (int)ret;
 8592|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8593|   114k|  return __builtin_ctzl(input_num);
 8594|   114k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8595|   114k|}
_ZN3ada7helpers24find_next_host_delimiterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 9041|  1.60k|                                                  size_t location) noexcept {
 9042|       |  // first check for short strings in which case we do it naively.
 9043|  1.60k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (9043:7): [True: 504, False: 1.10k]
  ------------------
 9044|  3.11k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (9044:31): [True: 2.91k, False: 202]
  ------------------
 9045|  2.91k|      if (view[i] == ':' || view[i] == '/' || view[i] == '?' ||
  ------------------
  |  Branch (9045:11): [True: 52, False: 2.86k]
  |  Branch (9045:29): [True: 154, False: 2.70k]
  |  Branch (9045:47): [True: 56, False: 2.65k]
  ------------------
 9046|  2.65k|          view[i] == '[') {
  ------------------
  |  Branch (9046:11): [True: 40, False: 2.61k]
  ------------------
 9047|    302|        return i;
 9048|    302|      }
 9049|  2.91k|    }
 9050|    202|    return size_t(view.size());
 9051|    504|  }
 9052|       |  // fast path for long strings (expected to be common)
 9053|  1.10k|  size_t i = location;
 9054|  1.10k|  const __m128i mask1 = _mm_set1_epi8(':');
 9055|  1.10k|  const __m128i mask2 = _mm_set1_epi8('/');
 9056|  1.10k|  const __m128i mask4 = _mm_set1_epi8('?');
 9057|  1.10k|  const __m128i mask5 = _mm_set1_epi8('[');
 9058|       |
 9059|  1.57k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (9059:10): [True: 1.43k, False: 138]
  ------------------
 9060|  1.43k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 9061|  1.43k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9062|  1.43k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9063|  1.43k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9064|  1.43k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9065|  1.43k|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9066|  1.43k|    int mask = _mm_movemask_epi8(m);
 9067|  1.43k|    if (mask != 0) {
  ------------------
  |  Branch (9067:9): [True: 962, False: 470]
  ------------------
 9068|    962|      return i + trailing_zeroes(mask);
 9069|    962|    }
 9070|  1.43k|  }
 9071|    138|  if (i < view.size()) {
  ------------------
  |  Branch (9071:7): [True: 120, False: 18]
  ------------------
 9072|    120|    __m128i word =
 9073|    120|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 9074|    120|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 9075|    120|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 9076|    120|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 9077|    120|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 9078|    120|    __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
 9079|    120|    int mask = _mm_movemask_epi8(m);
 9080|    120|    if (mask != 0) {
  ------------------
  |  Branch (9080:9): [True: 98, False: 22]
  ------------------
 9081|     98|      return view.length() - 16 + trailing_zeroes(mask);
 9082|     98|    }
 9083|    120|  }
 9084|     40|  return size_t(view.length());
 9085|    138|}
_ZN3ada3url10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
10124|   256k|ada_really_inline bool url::parse_host(std::string_view input) {
10125|   256k|  ada_log("parse_host ", input, " [", input.size(), " bytes]");
10126|   256k|  if (input.empty()) {
  ------------------
  |  Branch (10126:7): [True: 5, False: 256k]
  ------------------
10127|      5|    return is_valid = false;
10128|      5|  }  // technically unnecessary.
10129|       |  // If input starts with U+005B ([), then:
10130|   256k|  if (input[0] == '[') {
  ------------------
  |  Branch (10130:7): [True: 682, False: 255k]
  ------------------
10131|       |    // If input does not end with U+005D (]), validation error, return failure.
10132|    682|    if (input.back() != ']') {
  ------------------
  |  Branch (10132:9): [True: 74, False: 608]
  ------------------
10133|     74|      return is_valid = false;
10134|     74|    }
10135|    608|    ada_log("parse_host ipv6");
10136|       |
10137|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
10138|       |    // trailing U+005D (]) removed.
10139|    608|    input.remove_prefix(1);
10140|    608|    input.remove_suffix(1);
10141|    608|    return parse_ipv6(input);
10142|    682|  }
10143|       |
10144|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
10145|       |  // input.
10146|   255k|  if (!is_special()) {
  ------------------
  |  Branch (10146:7): [True: 651, False: 254k]
  ------------------
10147|    651|    return parse_opaque_host(input);
10148|    651|  }
10149|       |
10150|       |  // Fast path: try to parse as pure decimal IPv4 first.
10151|   254k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
10152|   254k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (10152:7): [True: 103k, False: 150k]
  ------------------
10153|   103k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (10153:9): [True: 103k, False: 0]
  |  Branch (10153:27): [True: 11, False: 103k]
  ------------------
10154|     11|      host = input.substr(0, input.size() - 1);
10155|   103k|    } else {
10156|   103k|      host = input;
10157|   103k|    }
10158|   103k|    host_type = IPV4;
10159|   103k|    is_valid = true;
10160|   103k|    ada_log("parse_host fast path decimal ipv4");
10161|   103k|    return true;
10162|   103k|  }
10163|       |  // Let domain be the result of running UTF-8 decode without BOM on the
10164|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
10165|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
10166|       |  // which case we do not need to call the expensive 'to_ascii' if a few
10167|       |  // conditions are met: no '%' and no 'xn-' subsequence.
10168|   150k|  const uint8_t forbidden_or_upper =
10169|   150k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
10170|   150k|                                                             input.size());
10171|   150k|  static constexpr std::string_view xn_dash{"xn-", 3};
10172|   150k|  if ((forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (10172:7): [True: 129k, False: 21.3k]
  ------------------
10173|   129k|    host = std::string(input);
10174|   129k|    if ((forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (10174:9): [True: 828, False: 128k]
  ------------------
10175|    828|      unicode::to_lower_ascii(host->data(), host->size());
10176|    828|    }
10177|   129k|    if (host->find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10177:9): [True: 70.6k, False: 58.9k]
  ------------------
10178|  70.8k|        host->find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10178:9): [True: 214, False: 58.7k]
  ------------------
10179|  70.8k|      if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10179:11): [True: 37.9k, False: 32.8k]
  ------------------
10180|  37.9k|        ada_log("parse_host fast path ipv4");
10181|  37.9k|        return parse_ipv4(*host);
10182|  37.9k|      }
10183|  32.8k|      ada_log("parse_host fast path ", *host);
10184|  32.8k|      is_valid = true;
10185|  32.8k|      return true;
10186|  70.8k|    }
10187|   129k|  } else if (const size_t first_percent = input.find('%');
10188|  21.3k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (10188:14): [True: 18.7k, False: 2.51k]
  ------------------
10189|  18.7k|    std::string decoded = unicode::percent_decode(input, first_percent);
10190|  18.7k|    const uint8_t decoded_flags =
10191|  18.7k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
10192|  18.7k|                                                               decoded.size());
10193|  18.7k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (10193:9): [True: 18.4k, False: 325]
  ------------------
10194|  18.4k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (10194:11): [True: 135, False: 18.3k]
  ------------------
10195|    135|        unicode::to_lower_ascii(decoded.data(), decoded.size());
10196|    135|      }
10197|  18.4k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (10197:11): [True: 18.4k, False: 58]
  ------------------
10198|  18.4k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (10198:11): [True: 26, False: 32]
  ------------------
10199|  18.4k|        host = std::move(decoded);
10200|  18.4k|        if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10200:13): [True: 18.2k, False: 178]
  ------------------
10201|  18.2k|          return parse_ipv4(*host);
10202|  18.2k|        }
10203|    178|        is_valid = true;
10204|    178|        return true;
10205|  18.4k|      }
10206|  18.4k|    }
10207|  18.7k|  }
10208|  61.6k|  ada_log("parse_host calling to_ascii");
10209|  61.6k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
10210|  61.6k|  if (!is_valid || !host.has_value()) {
  ------------------
  |  Branch (10210:7): [True: 1.53k, False: 60.0k]
  |  Branch (10210:20): [True: 0, False: 60.0k]
  ------------------
10211|  1.53k|    ada_log("parse_host to_ascii returns false");
10212|  1.53k|    return is_valid = false;
10213|  1.53k|  }
10214|  60.0k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
10215|  60.0k|          " bytes]");
10216|       |
10217|  60.0k|  if (std::any_of(host->begin(), host->end(),
  ------------------
  |  Branch (10217:7): [True: 0, False: 60.0k]
  ------------------
10218|  60.0k|                  ada::unicode::is_forbidden_domain_code_point)) {
10219|      0|    host = std::nullopt;
10220|      0|    return is_valid = false;
10221|      0|  }
10222|       |
10223|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
10224|       |  // asciiDomain.
10225|  60.0k|  if (checkers::is_ipv4(*host)) {
  ------------------
  |  Branch (10225:7): [True: 127, False: 59.9k]
  ------------------
10226|    127|    ada_log("parse_host got ipv4 ", *host);
10227|    127|    return parse_ipv4(*host);
10228|    127|  }
10229|       |
10230|  59.9k|  return true;
10231|  60.0k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7055|   339k|                                              size_t length) noexcept {
 7056|   339k|  size_t i = 0;
 7057|   339k|  uint8_t accumulator{};
 7058|  1.34M|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7058:10): [True: 1.00M, False: 339k]
  ------------------
 7059|  1.00M|    accumulator |=
 7060|  1.00M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7061|  1.00M|    accumulator |=
 7062|  1.00M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7063|  1.00M|    accumulator |=
 7064|  1.00M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7065|  1.00M|    accumulator |=
 7066|  1.00M|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7067|  1.00M|  }
 7068|   917k|  for (; i < length; i++) {
  ------------------
  |  Branch (7068:10): [True: 577k, False: 339k]
  ------------------
 7069|   577k|    accumulator |=
 7070|   577k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7071|   577k|  }
 7072|   339k|  return accumulator;
 7073|   339k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7014|  2.22M|    const char c) noexcept {
 7015|  2.22M|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7016|  2.22M|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12556|   237k|  const auto enforce_max_input_length = [&]() {
12557|   237k|    if constexpr (store_values) {
12558|   237k|      if (url.is_valid) {
  ------------------
  |  Branch (12558:11): [True: 237k, False: 0]
  ------------------
12559|   237k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|   237k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12560:15): [True: 0, False: 237k]
  ------------------
12561|      0|            url.is_valid = false;
12562|      0|          }
12563|       |        } else {
12564|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|       |            url.is_valid = false;
12566|       |          }
12567|       |        }
12568|   237k|      }
12569|   237k|    }
12570|   237k|  };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
10886|   115k|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
10887|   115k|  uint32_t digits = 1;
10888|   348k|  while (port >= 10) {
  ------------------
  |  Branch (10888:10): [True: 232k, False: 115k]
  ------------------
10889|   232k|    port /= 10;
10890|   232k|    ++digits;
10891|   232k|  }
10892|   115k|  return digits;
10893|   115k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
10896|  10.5k|                                             uint32_t port) {
10897|  10.5k|  buffer += ':';
10898|  10.5k|  char port_buf[5];
10899|  10.5k|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
10900|  10.5k|  (void)ec;
10901|  10.5k|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
10902|  10.5k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11044|  1.18M|                                        size_t n) noexcept {
11045|  1.18M|  const size_t rem = n - host_start;
11046|  1.18M|  if (rem == 0) {
  ------------------
  |  Branch (11046:7): [True: 0, False: 1.18M]
  ------------------
11047|      0|    return false;
11048|      0|  }
11049|       |#if ADA_NEON
11050|       |  if (rem >= 16) {
11051|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11052|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11053|       |    if (at == 0) {
11054|       |      return false;
11055|       |    }
11056|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11057|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11058|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11059|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11060|       |  }
11061|       |#elif ADA_SSE2
11062|  1.18M|  if (rem >= 16) {
  ------------------
  |  Branch (11062:7): [True: 645k, False: 542k]
  ------------------
11063|   645k|    const __m128i w =
11064|   645k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11065|   645k|    const uint16_t at = static_cast<uint16_t>(
11066|   645k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11067|   645k|    if (at == 0) {
  ------------------
  |  Branch (11067:9): [True: 587k, False: 58.1k]
  ------------------
11068|   587k|      return false;
11069|   587k|    }
11070|  58.1k|    const uint16_t delim = static_cast<uint16_t>(
11071|  58.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11072|  58.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11073|  58.1k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11074|  58.1k|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11074:12): [True: 57.5k, False: 598]
  |  Branch (11074:26): [True: 136, False: 462]
  ------------------
11075|   645k|  }
11076|   542k|#endif
11077|   542k|  const size_t lim = host_start + rem;
11078|  5.72M|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11078:31): [True: 5.66M, False: 58.6k]
  ------------------
11079|  5.66M|    const uint8_t c = p[i];
11080|  5.66M|    if (c == '@') {
  ------------------
  |  Branch (11080:9): [True: 18.5k, False: 5.64M]
  ------------------
11081|  18.5k|      return true;
11082|  18.5k|    }
11083|  5.64M|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11083:9): [True: 446k, False: 5.20M]
  |  Branch (11083:21): [True: 18.5k, False: 5.18M]
  |  Branch (11083:33): [True: 402, False: 5.18M]
  ------------------
11084|   465k|      return false;
11085|   465k|    }
11086|  5.64M|  }
11087|  58.6k|  return false;
11088|   542k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11095|   837k|                                     bool& has_x) noexcept {
11096|   837k|  has_upper = false;
11097|   837k|  has_x = false;
11098|   837k|  size_t i = start;
11099|   837k|#if ADA_PARSER_SSSE3
11100|   837k|  if (len - start >= 16) {
  ------------------
  |  Branch (11100:7): [True: 536k, False: 300k]
  ------------------
11101|   536k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11102|   536k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11103|   536k|    const __m128i x_splat = _mm_set1_epi8('x');
11104|   536k|    auto visit = [&](size_t at) noexcept -> bool {
11105|   536k|      const __m128i w =
11106|   536k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|   536k|      const int up = sse2_uppercase(w);
11108|   536k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|   536k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|   536k|      if (mask == 0) {
11111|   536k|        if (up != 0) {
11112|   536k|          has_upper = true;
11113|   536k|        }
11114|   536k|        if (xs != 0) {
11115|   536k|          has_x = true;
11116|   536k|        }
11117|   536k|        return false;
11118|   536k|      }
11119|   536k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|   536k|      const int valid = (1 << hit) - 1;
11121|   536k|      if ((up & valid) != 0) {
11122|   536k|        has_upper = true;
11123|   536k|      }
11124|   536k|      if ((xs & valid) != 0) {
11125|   536k|        has_x = true;
11126|   536k|      }
11127|   536k|      end = at + static_cast<size_t>(hit);
11128|   536k|      return true;
11129|   536k|    };
11130|   555k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11130:12): [True: 89.7k, False: 465k]
  ------------------
11131|  89.7k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11131:11): [True: 69.3k, False: 20.4k]
  |  Branch (11131:23): [True: 1.50k, False: 18.9k]
  ------------------
11132|  70.8k|        return k_host_class[b[end]] == 1;
11133|  70.8k|      }
11134|  89.7k|    }
11135|   522k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11135:12): [True: 465k, False: 57.3k]
  ------------------
11136|   465k|      if (visit(i)) {
  ------------------
  |  Branch (11136:11): [True: 408k, False: 56.5k]
  ------------------
11137|   408k|        return k_host_class[b[end]] == 1;
11138|   408k|      }
11139|   465k|    }
11140|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11141|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11142|  57.3k|    if (i > start && i < len) {
  ------------------
  |  Branch (11142:9): [True: 57.3k, False: 0]
  |  Branch (11142:22): [True: 57.2k, False: 30]
  ------------------
11143|  57.2k|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11143:11): [True: 57.1k, False: 110]
  |  Branch (11143:30): [True: 57.1k, False: 0]
  ------------------
11144|  57.1k|        return k_host_class[b[end]] == 1;
11145|  57.1k|      }
11146|    110|      end = len;
11147|    110|      return true;
11148|  57.2k|    }
11149|  57.3k|  }
11150|       |#elif ADA_SSE2
11151|       |  const __m128i x_splat = _mm_set1_epi8('x');
11152|       |  for (; i + 32 <= len; i += 32) {
11153|       |    for (size_t off = 0; off < 32; off += 16) {
11154|       |      const __m128i w =
11155|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11156|       |      const int up = sse2_uppercase(w);
11157|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11158|       |      const int mask = sse2_host_stop(w);
11159|       |      if (mask != 0) {
11160|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11161|       |        const int valid = (1 << hit) - 1;
11162|       |        if ((up & valid) != 0) {
11163|       |          has_upper = true;
11164|       |        }
11165|       |        if ((xs & valid) != 0) {
11166|       |          has_x = true;
11167|       |        }
11168|       |        end = i + off + static_cast<size_t>(hit);
11169|       |        return k_host_class[b[end]] == 1;
11170|       |      }
11171|       |      if (up != 0) {
11172|       |        has_upper = true;
11173|       |      }
11174|       |      if (xs != 0) {
11175|       |        has_x = true;
11176|       |      }
11177|       |    }
11178|       |  }
11179|       |  for (; i + 16 <= len; i += 16) {
11180|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11181|       |    const int up = sse2_uppercase(w);
11182|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11183|       |    const int mask = sse2_host_stop(w);
11184|       |    if (mask != 0) {
11185|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11186|       |      const int valid = (1 << hit) - 1;
11187|       |      if ((up & valid) != 0) {
11188|       |        has_upper = true;
11189|       |      }
11190|       |      if ((xs & valid) != 0) {
11191|       |        has_x = true;
11192|       |      }
11193|       |      end = i + static_cast<size_t>(hit);
11194|       |      return k_host_class[b[end]] == 1;
11195|       |    }
11196|       |    if (up != 0) {
11197|       |      has_upper = true;
11198|       |    }
11199|       |    if (xs != 0) {
11200|       |      has_x = true;
11201|       |    }
11202|       |  }
11203|       |#elif ADA_NEON
11204|       |  if (len - start >= 16) {
11205|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11206|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11207|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11208|       |    auto visit = [&](size_t at) noexcept -> bool {
11209|       |      const uint8x16_t w = vld1q_u8(b + at);
11210|       |      const uint64_t up = neon_uppercase(w);
11211|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11212|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11213|       |      if (bits == 0) {
11214|       |        if (up != 0) {
11215|       |          has_upper = true;
11216|       |        }
11217|       |        if (xs != 0) {
11218|       |          has_x = true;
11219|       |        }
11220|       |        return false;
11221|       |      }
11222|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11223|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11224|       |      if ((up & valid) != 0) {
11225|       |        has_upper = true;
11226|       |      }
11227|       |      if ((xs & valid) != 0) {
11228|       |        has_x = true;
11229|       |      }
11230|       |      end = at + hit;
11231|       |      return true;
11232|       |    };
11233|       |    for (; i + 32 <= len; i += 32) {
11234|       |      if (visit(i) || visit(i + 16)) {
11235|       |        return k_host_class[b[end]] == 1;
11236|       |      }
11237|       |    }
11238|       |    for (; i + 16 <= len; i += 16) {
11239|       |      if (visit(i)) {
11240|       |        return k_host_class[b[end]] == 1;
11241|       |      }
11242|       |    }
11243|       |    if (i > start && i < len) {
11244|       |      if (visit(len - 16) && end >= i) {
11245|       |        return k_host_class[b[end]] == 1;
11246|       |      }
11247|       |      end = len;
11248|       |      return true;
11249|       |    }
11250|       |  }
11251|       |#endif
11252|  3.24M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11252:10): [True: 3.22M, False: 18.4k]
  ------------------
11253|  3.22M|    const uint8_t c = b[i];
11254|  3.22M|    const uint8_t cls = k_host_class[c];
11255|  3.22M|    if (cls == 1) {
  ------------------
  |  Branch (11255:9): [True: 279k, False: 2.94M]
  ------------------
11256|   279k|      end = i;
11257|   279k|      return true;
11258|   279k|    }
11259|  2.94M|    if (cls == 2) {
  ------------------
  |  Branch (11259:9): [True: 2.42k, False: 2.94M]
  ------------------
11260|  2.42k|      return false;
11261|  2.42k|    }
11262|  2.94M|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11262:9): [True: 2.54M, False: 393k]
  |  Branch (11262:21): [True: 748, False: 2.54M]
  ------------------
11263|    748|      has_upper = true;
11264|  2.93M|    } else if (c == 'x') {
  ------------------
  |  Branch (11264:16): [True: 312k, False: 2.62M]
  ------------------
11265|   312k|      has_x = true;
11266|   312k|    }
11267|  2.94M|  }
11268|  18.4k|  end = len;
11269|  18.4k|  return true;
11270|   300k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
10925|  1.21M|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
10926|  1.21M|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
10927|  1.21M|}
simple_absolute.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENK3$_0clEm:
11104|   632k|    auto visit = [&](size_t at) noexcept -> bool {
11105|   632k|      const __m128i w =
11106|   632k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|   632k|      const int up = sse2_uppercase(w);
11108|   632k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|   632k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|   632k|      if (mask == 0) {
  ------------------
  |  Branch (11110:11): [True: 96.0k, False: 536k]
  ------------------
11111|  96.0k|        if (up != 0) {
  ------------------
  |  Branch (11111:13): [True: 1.31k, False: 94.7k]
  ------------------
11112|  1.31k|          has_upper = true;
11113|  1.31k|        }
11114|  96.0k|        if (xs != 0) {
  ------------------
  |  Branch (11114:13): [True: 91.8k, False: 4.20k]
  ------------------
11115|  91.8k|          has_x = true;
11116|  91.8k|        }
11117|  96.0k|        return false;
11118|  96.0k|      }
11119|   536k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|   536k|      const int valid = (1 << hit) - 1;
11121|   536k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11121:11): [True: 19.3k, False: 517k]
  ------------------
11122|  19.3k|        has_upper = true;
11123|  19.3k|      }
11124|   536k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11124:11): [True: 467k, False: 69.2k]
  ------------------
11125|   467k|        has_x = true;
11126|   467k|      }
11127|   536k|      end = at + static_cast<size_t>(hit);
11128|   536k|      return true;
11129|   632k|    };
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11012|   632k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11013|   632k|  return _mm_movemask_epi8(_mm_and_si128(
11014|   632k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11015|   632k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11016|   632k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
10932|   738k|                                      __m128i hi_tbl) noexcept {
10933|   738k|  const __m128i nibble = _mm_set1_epi8(0x0F);
10934|   738k|  const __m128i lo = _mm_and_si128(w, nibble);
10935|   738k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
10936|   738k|  const __m128i hit =
10937|   738k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
10938|   738k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
10939|   738k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
10904|   606k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
10905|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
10906|       |  unsigned long ret;
10907|       |  _BitScanForward(&ret, input_num);
10908|       |  return static_cast<int>(ret);
10909|       |#else
10910|   606k|  return __builtin_ctz(input_num);
10911|   606k|#endif
10912|   606k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11330|   622k|                                   bool& maybe_dot_segment) noexcept {
11331|   622k|  const size_t run_start = i;
11332|   622k|#if ADA_PARSER_SSSE3
11333|   622k|  if (i + 16 <= len) {
  ------------------
  |  Branch (11333:7): [True: 67.3k, False: 555k]
  ------------------
11334|  67.3k|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11335|  67.3k|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11336|  71.8k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11336:12): [True: 11.9k, False: 59.9k]
  ------------------
11337|  11.9k|      const __m128i w0 =
11338|  11.9k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11339|  11.9k|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11340|  11.9k|      if (m0 != 0) {
  ------------------
  |  Branch (11340:11): [True: 6.81k, False: 5.11k]
  ------------------
11341|  6.81k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11342|  6.81k|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11343|  6.81k|                            maybe_dot_segment);
11344|  6.81k|        i += static_cast<size_t>(hit_bit);
11345|  6.81k|        return;
11346|  6.81k|      }
11347|  5.11k|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11348|  5.11k|      const __m128i w1 =
11349|  5.11k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11350|  5.11k|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11351|  5.11k|      if (m1 != 0) {
  ------------------
  |  Branch (11351:11): [True: 632, False: 4.48k]
  ------------------
11352|    632|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11353|    632|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11354|    632|                            maybe_dot_segment);
11355|    632|        i += 16 + static_cast<size_t>(hit_bit);
11356|    632|        return;
11357|    632|      }
11358|  4.48k|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11359|  4.48k|    }
11360|  61.1k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11360:12): [True: 59.3k, False: 1.78k]
  ------------------
11361|  59.3k|      const __m128i w =
11362|  59.3k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11363|  59.3k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11364|  59.3k|      if (mask != 0) {
  ------------------
  |  Branch (11364:11): [True: 58.1k, False: 1.18k]
  ------------------
11365|  58.1k|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11366|  58.1k|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11367|  58.1k|                            maybe_dot_segment);
11368|  58.1k|        i += static_cast<size_t>(hit_bit);
11369|  58.1k|        return;
11370|  58.1k|      }
11371|  1.18k|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11372|  1.18k|    }
11373|  1.78k|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11373:9): [True: 1.78k, False: 0]
  |  Branch (11373:26): [True: 1.43k, False: 350]
  ------------------
11374|  1.43k|      const __m128i w =
11375|  1.43k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11376|  1.43k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11377|  1.43k|      if (mask != 0) {
  ------------------
  |  Branch (11377:11): [True: 638, False: 792]
  ------------------
11378|    638|        const size_t hit =
11379|    638|            len - 16 +
11380|    638|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11381|    638|        if (hit >= i) {
  ------------------
  |  Branch (11381:13): [True: 638, False: 0]
  ------------------
11382|  3.29k|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11382:30): [True: 2.66k, False: 638]
  ------------------
11383|  2.66k|            if (b[j] == '.') {
  ------------------
  |  Branch (11383:17): [True: 508, False: 2.15k]
  ------------------
11384|    508|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11385|    508|            }
11386|  2.66k|          }
11387|    638|          i = hit;
11388|    638|          return;
11389|    638|        }
11390|    638|      }
11391|  7.16k|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11391:26): [True: 6.37k, False: 792]
  ------------------
11392|  6.37k|        if (b[j] == '.') {
  ------------------
  |  Branch (11392:13): [True: 1.52k, False: 4.84k]
  ------------------
11393|  1.52k|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11394|  1.52k|        }
11395|  6.37k|      }
11396|    792|      i = len;
11397|    792|      return;
11398|  1.43k|    }
11399|  1.78k|  }
11400|       |#elif ADA_SSE2
11401|       |  for (; i + 16 <= len; i += 16) {
11402|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11403|       |    const int mask = sse2_path_stop(w);
11404|       |    if (mask != 0) {
11405|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11406|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11407|       |                          maybe_dot_segment);
11408|       |      i += static_cast<size_t>(hit_bit);
11409|       |      return;
11410|       |    }
11411|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11412|       |  }
11413|       |#elif ADA_NEON
11414|       |  if (i + 16 <= len) {
11415|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11416|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11417|       |    for (; i + 32 <= len; i += 32) {
11418|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11419|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11420|       |      if (bits0 != 0) {
11421|       |        const size_t hit_off =
11422|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11423|       |        const uint64_t valid =
11424|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11425|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11426|       |        i += hit_off;
11427|       |        return;
11428|       |      }
11429|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11430|       |                               maybe_dot_segment);
11431|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11432|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11433|       |      if (bits1 != 0) {
11434|       |        const size_t hit_off =
11435|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11436|       |        const uint64_t valid =
11437|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11438|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11439|       |                                 maybe_dot_segment);
11440|       |        i += 16 + hit_off;
11441|       |        return;
11442|       |      }
11443|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11444|       |                               maybe_dot_segment);
11445|       |    }
11446|       |    for (; i + 16 <= len; i += 16) {
11447|       |      const uint8x16_t w = vld1q_u8(b + i);
11448|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11449|       |      if (bits != 0) {
11450|       |        const size_t hit_off =
11451|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11452|       |        const uint64_t valid =
11453|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11454|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11455|       |        i += hit_off;
11456|       |        return;
11457|       |      }
11458|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11459|       |                               maybe_dot_segment);
11460|       |    }
11461|       |    if (i > run_start && i < len) {
11462|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11463|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11464|       |      if (bits != 0) {
11465|       |        const size_t hit =
11466|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11467|       |        if (hit >= i) {
11468|       |          for (size_t j = i; j < hit; ++j) {
11469|       |            if (b[j] == '.') {
11470|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11471|       |            }
11472|       |          }
11473|       |          i = hit;
11474|       |          return;
11475|       |        }
11476|       |      }
11477|       |      for (size_t j = i; j < len; ++j) {
11478|       |        if (b[j] == '.') {
11479|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11480|       |        }
11481|       |      }
11482|       |      i = len;
11483|       |      return;
11484|       |    }
11485|       |  }
11486|       |#endif
11487|  2.08M|  for (; i < len; ++i) {
  ------------------
  |  Branch (11487:10): [True: 1.67M, False: 403k]
  ------------------
11488|  1.67M|    const uint8_t c = b[i];
11489|  1.67M|    const uint8_t cls = k_path[c];
11490|  1.67M|    if (cls != 0) {
  ------------------
  |  Branch (11490:9): [True: 152k, False: 1.52M]
  ------------------
11491|   152k|      return;
11492|   152k|    }
11493|  1.52M|    if (c == '.') {
  ------------------
  |  Branch (11493:9): [True: 164k, False: 1.35M]
  ------------------
11494|   164k|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11495|   164k|    }
11496|  1.52M|  }
11497|   555k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11287|  76.3k|                                           bool& maybe_dot_segment) noexcept {
11288|  76.3k|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11288:7): [True: 3.80k, False: 72.5k]
  |  Branch (11288:28): [True: 4.57k, False: 67.9k]
  ------------------
11289|  8.37k|    return;
11290|  8.37k|  }
11291|  67.9k|  const int dots =
11292|  67.9k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11293|  67.9k|  if (dots == 0) {
  ------------------
  |  Branch (11293:7): [True: 62.9k, False: 5.00k]
  ------------------
11294|  62.9k|    return;
11295|  62.9k|  }
11296|  5.00k|  const int slashes =
11297|  5.00k|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11298|  5.00k|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11298:8): [True: 1.63k, False: 3.36k]
  |  Branch (11298:28): [True: 968, False: 670]
  |  Branch (11298:46): [True: 130, False: 540]
  ------------------
11299|  3.90k|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11299:7): [True: 1.06k, False: 2.84k]
  ------------------
11300|  2.16k|    maybe_dot_segment = true;
11301|  2.16k|  }
11302|  5.00k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11274|   166k|    bool& maybe_dot_segment) noexcept {
11275|   166k|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11275:7): [True: 464, False: 166k]
  |  Branch (11275:27): [True: 37.7k, False: 128k]
  ------------------
11276|  38.2k|    maybe_dot_segment = true;
11277|  38.2k|  }
11278|   166k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11640|   173k|                                    size_t len) noexcept {
11641|   173k|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11503|   173k|  do {                                                                       \
  |  |11504|   173k|    const size_t scan_start = i;                                             \
  |  |11505|   173k|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 4.47k, False: 168k]
  |  |  ------------------
  |  |11506|  4.47k|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|  4.47k|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|  11.8k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 7.85k, False: 3.98k]
  |  |  ------------------
  |  |11509|  7.85k|        const __m128i w0 =                                                   \
  |  |11510|  7.85k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|  7.85k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|  7.85k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 338, False: 7.51k]
  |  |  ------------------
  |  |11513|    338|          i += static_cast<size_t>(                                          \
  |  |11514|    338|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|    338|          return;                                                            \
  |  |11516|    338|        }                                                                    \
  |  |11517|  7.85k|        const __m128i w1 =                                                   \
  |  |11518|  7.51k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|  7.51k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|  7.51k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 152, False: 7.36k]
  |  |  ------------------
  |  |11521|    152|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|    152|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|    152|          return;                                                            \
  |  |11524|    152|        }                                                                    \
  |  |11525|  7.51k|      }                                                                      \
  |  |11526|  4.47k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 1.35k, False: 2.98k]
  |  |  ------------------
  |  |11527|  1.35k|        const __m128i w =                                                    \
  |  |11528|  1.35k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|  1.35k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|  1.35k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 998, False: 352]
  |  |  ------------------
  |  |11531|    998|          i += static_cast<size_t>(                                          \
  |  |11532|    998|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|    998|          return;                                                            \
  |  |11534|    998|        }                                                                    \
  |  |11535|  1.35k|      }                                                                      \
  |  |11536|  3.98k|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 2.98k, False: 0]
  |  |  |  Branch (11536:29): [True: 2.95k, False: 36]
  |  |  ------------------
  |  |11537|  2.95k|        const __m128i w =                                                    \
  |  |11538|  2.95k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|  2.95k|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|  2.95k|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 2.03k, False: 920]
  |  |  ------------------
  |  |11541|  2.03k|          const size_t hit = len - 16 +                                      \
  |  |11542|  2.03k|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|  2.03k|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|  2.03k|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 2.03k, False: 0]
  |  |  ------------------
  |  |11545|  2.03k|            i = hit;                                                         \
  |  |11546|  2.03k|            return;                                                          \
  |  |11547|  2.03k|          }                                                                  \
  |  |11548|  2.03k|        }                                                                    \
  |  |11549|  2.95k|        i = len;                                                             \
  |  |11550|    920|        return;                                                              \
  |  |11551|  2.95k|      }                                                                      \
  |  |11552|  2.98k|    }                                                                        \
  |  |11553|  1.17M|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 1.06M, False: 110k]
  |  |  ------------------
  |  |11554|  1.06M|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 57.8k, False: 1.00M]
  |  |  ------------------
  |  |11555|  57.8k|        return;                                                              \
  |  |11556|  57.8k|      }                                                                      \
  |  |11557|  1.06M|    }                                                                        \
  |  |11558|   168k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 110k]
  |  |  ------------------
  ------------------
11642|   173k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11645|   118k|                                   size_t len) noexcept {
11646|   118k|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11503|   118k|  do {                                                                       \
  |  |11504|   118k|    const size_t scan_start = i;                                             \
  |  |11505|   118k|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 946, False: 117k]
  |  |  ------------------
  |  |11506|    946|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|    946|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|  4.66k|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 3.87k, False: 788]
  |  |  ------------------
  |  |11509|  3.87k|        const __m128i w0 =                                                   \
  |  |11510|  3.87k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|  3.87k|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|  3.87k|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 118, False: 3.75k]
  |  |  ------------------
  |  |11513|    118|          i += static_cast<size_t>(                                          \
  |  |11514|    118|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|    118|          return;                                                            \
  |  |11516|    118|        }                                                                    \
  |  |11517|  3.87k|        const __m128i w1 =                                                   \
  |  |11518|  3.75k|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|  3.75k|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|  3.75k|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 40, False: 3.71k]
  |  |  ------------------
  |  |11521|     40|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|     40|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|     40|          return;                                                            \
  |  |11524|     40|        }                                                                    \
  |  |11525|  3.75k|      }                                                                      \
  |  |11526|  1.22k|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 452, False: 772]
  |  |  ------------------
  |  |11527|    452|        const __m128i w =                                                    \
  |  |11528|    452|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|    452|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|    452|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 16, False: 436]
  |  |  ------------------
  |  |11531|     16|          i += static_cast<size_t>(                                          \
  |  |11532|     16|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|     16|          return;                                                            \
  |  |11534|     16|        }                                                                    \
  |  |11535|    452|      }                                                                      \
  |  |11536|    788|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 772, False: 0]
  |  |  |  Branch (11536:29): [True: 704, False: 68]
  |  |  ------------------
  |  |11537|    704|        const __m128i w =                                                    \
  |  |11538|    704|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|    704|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|    704|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 34, False: 670]
  |  |  ------------------
  |  |11541|     34|          const size_t hit = len - 16 +                                      \
  |  |11542|     34|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|     34|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|     34|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 34, False: 0]
  |  |  ------------------
  |  |11545|     34|            i = hit;                                                         \
  |  |11546|     34|            return;                                                          \
  |  |11547|     34|          }                                                                  \
  |  |11548|     34|        }                                                                    \
  |  |11549|    704|        i = len;                                                             \
  |  |11550|    670|        return;                                                              \
  |  |11551|    704|      }                                                                      \
  |  |11552|    772|    }                                                                        \
  |  |11553|   574k|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 457k, False: 117k]
  |  |  ------------------
  |  |11554|   457k|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 96, False: 457k]
  |  |  ------------------
  |  |11555|     96|        return;                                                              \
  |  |11556|     96|      }                                                                      \
  |  |11557|   457k|    }                                                                        \
  |  |11558|   117k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 117k]
  |  |  ------------------
  ------------------
11647|   118k|}
simple_absolute.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11651|  20.3k|bool path_has_dot_segment(std::string_view path) noexcept {
11652|  20.3k|  if (path.empty()) {
  ------------------
  |  Branch (11652:7): [True: 0, False: 20.3k]
  ------------------
11653|      0|    return false;
11654|      0|  }
11655|       |  // "." / ".." at the start, with or without a leading '/'.
11656|  20.3k|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11656:20): [True: 20.3k, False: 0]
  ------------------
11657|  20.3k|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11657:7): [True: 20.3k, False: 0]
  |  Branch (11657:26): [True: 766, False: 19.5k]
  ------------------
11658|    766|    const size_t after = i + 1;
11659|    766|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11659:9): [True: 32, False: 734]
  |  Branch (11659:33): [True: 184, False: 550]
  ------------------
11660|    550|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11660:10): [True: 550, False: 0]
  |  Branch (11660:33): [True: 324, False: 226]
  ------------------
11661|    430|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11661:11): [True: 14, False: 310]
  |  Branch (11661:39): [True: 200, False: 110]
  ------------------
11662|    430|      return true;
11663|    430|    }
11664|    766|  }
11665|  19.8k|  static constexpr std::string_view slash_dot{"/.", 2};
11666|  19.8k|  size_t p = i;
11667|  22.3k|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11667:10): [True: 21.5k, False: 830]
  ------------------
11668|  21.5k|    const size_t after = p + 2;
11669|  21.5k|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11669:9): [True: 102, False: 21.4k]
  |  Branch (11669:33): [True: 18.6k, False: 2.74k]
  ------------------
11670|  2.74k|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11670:10): [True: 2.74k, False: 0]
  |  Branch (11670:33): [True: 892, False: 1.85k]
  ------------------
11671|  19.0k|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11671:11): [True: 60, False: 832]
  |  Branch (11671:39): [True: 186, False: 646]
  ------------------
11672|  19.0k|      return true;
11673|  19.0k|    }
11674|  2.49k|    p = after;
11675|  2.49k|  }
11676|    830|  return false;
11677|  19.8k|}
simple_absolute.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13648|   258k|    ada::url_components& components, uint32_t new_difference) {
13649|   258k|  components.username_end += new_difference;
13650|   258k|  components.host_start += new_difference;
13651|   258k|  components.host_end += new_difference;
13652|   258k|  components.pathname_start += new_difference;
13653|   258k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13653:7): [True: 0, False: 258k]
  ------------------
13654|      0|    components.search_start += new_difference;
13655|      0|  }
13656|   258k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13656:7): [True: 0, False: 258k]
  ------------------
13657|      0|    components.hash_start += new_difference;
13658|      0|  }
13659|   258k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14018|  22.8k|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14019|  22.8k|  ada_log("url_aggregator::parse_path ", input);
14020|  22.8k|  ADA_ASSERT_TRUE(validate());
14021|  22.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14022|  22.8k|  std::string tmp_buffer;
14023|  22.8k|  std::string_view internal_input;
14024|  22.8k|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14024:7): [True: 0, False: 22.8k]
  ------------------
14025|      0|    tmp_buffer = input;
14026|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14027|       |    // just directly build the string from user_input.
14028|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14029|      0|    internal_input = tmp_buffer;
14030|  22.8k|  } else {
14031|  22.8k|    internal_input = input;
14032|  22.8k|  }
14033|       |
14034|       |  // If url is special, then:
14035|  22.8k|  if (is_special()) {
  ------------------
  |  Branch (14035:7): [True: 22.8k, False: 0]
  ------------------
14036|  22.8k|    if (internal_input.empty()) {
  ------------------
  |  Branch (14036:9): [True: 216, False: 22.6k]
  ------------------
14037|    216|      update_base_pathname("/");
14038|  22.6k|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14038:16): [True: 22.6k, False: 0]
  |  Branch (14038:46): [True: 0, False: 0]
  ------------------
14039|  22.6k|      consume_prepared_path(internal_input.substr(1));
14040|  22.6k|    } else {
14041|      0|      consume_prepared_path(internal_input);
14042|      0|    }
14043|  22.8k|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14043:14): [True: 0, False: 0]
  ------------------
14044|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14044:9): [True: 0, False: 0]
  ------------------
14045|      0|      consume_prepared_path(internal_input.substr(1));
14046|      0|    } else {
14047|      0|      consume_prepared_path(internal_input);
14048|      0|    }
14049|      0|  } else {
14050|       |    // Non-special URLs with an empty host can have their paths erased
14051|       |    // Path-only URLs cannot have their paths erased
14052|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14052:9): [True: 0, False: 0]
  |  Branch (14052:57): [True: 0, False: 0]
  ------------------
14053|      0|      update_base_pathname("/");
14054|      0|    }
14055|      0|  }
14056|  22.8k|  ADA_ASSERT_TRUE(validate());
14057|  22.8k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14137|   256k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14138|   256k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14139|   256k|          " bytes]");
14140|   256k|  ADA_ASSERT_TRUE(validate());
14141|   256k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14142|   256k|  if (input.empty()) {
  ------------------
  |  Branch (14142:7): [True: 5, False: 256k]
  ------------------
14143|      5|    return is_valid = false;
14144|      5|  }  // technically unnecessary.
14145|       |  // If input starts with U+005B ([), then:
14146|   256k|  if (input[0] == '[') {
  ------------------
  |  Branch (14146:7): [True: 682, False: 255k]
  ------------------
14147|       |    // If input does not end with U+005D (]), validation error, return failure.
14148|    682|    if (input.back() != ']') {
  ------------------
  |  Branch (14148:9): [True: 74, False: 608]
  ------------------
14149|     74|      return is_valid = false;
14150|     74|    }
14151|    608|    ada_log("parse_host ipv6");
14152|       |
14153|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14154|       |    // trailing U+005D (]) removed.
14155|    608|    input.remove_prefix(1);
14156|    608|    input.remove_suffix(1);
14157|    608|    return parse_ipv6(input);
14158|    682|  }
14159|       |
14160|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14161|       |  // input.
14162|   255k|  if (!is_special()) {
  ------------------
  |  Branch (14162:7): [True: 651, False: 254k]
  ------------------
14163|    651|    return parse_opaque_host(input);
14164|    651|  }
14165|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14166|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14167|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14168|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14169|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14170|       |
14171|       |  // Often, the input does not contain any forbidden code points, and no upper
14172|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14173|       |  // optimize for such a common case.
14174|       |
14175|       |  // Fast path: try to parse as pure decimal IPv4 first.
14176|   254k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14177|   254k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14177:7): [True: 103k, False: 150k]
  ------------------
14178|   103k|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14178:9): [True: 103k, False: 0]
  |  Branch (14178:27): [True: 11, False: 103k]
  ------------------
14179|     11|      update_base_hostname(input.substr(0, input.size() - 1));
14180|   103k|    } else {
14181|   103k|      update_base_hostname(input);
14182|   103k|    }
14183|   103k|    host_type = IPV4;
14184|   103k|    is_valid = true;
14185|   103k|    ada_log("parse_host fast path decimal ipv4");
14186|   103k|    ADA_ASSERT_TRUE(validate());
14187|   103k|    return true;
14188|   103k|  }
14189|   150k|  uint8_t is_forbidden_or_upper =
14190|   150k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14191|   150k|                                                             input.size());
14192|   150k|  static constexpr std::string_view xn_dash{"xn-", 3};
14193|   150k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14193:7): [True: 129k, False: 21.3k]
  ------------------
14194|   129k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14194:9): [True: 828, False: 128k]
  ------------------
14195|    828|      std::string lowered(input);
14196|    828|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14197|    828|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14197:11): [True: 576, False: 252]
  ------------------
14198|    622|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14198:11): [True: 46, False: 206]
  ------------------
14199|    622|        update_base_hostname(lowered);
14200|    622|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14200:13): [True: 138, False: 484]
  ------------------
14201|    138|          ada_log("parse_host fast path ipv4");
14202|    138|          return parse_ipv4(lowered, true);
14203|    138|        }
14204|    484|        ada_log("parse_host fast path ", get_hostname());
14205|    484|        is_valid = true;
14206|    484|        return true;
14207|    622|      }
14208|   128k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14208:16): [True: 70.0k, False: 58.7k]
  ------------------
14209|  70.2k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14209:16): [True: 168, False: 58.5k]
  ------------------
14210|  70.2k|      update_base_hostname(input);
14211|  70.2k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14211:11): [True: 37.8k, False: 32.4k]
  ------------------
14212|  37.8k|        ada_log("parse_host fast path ipv4");
14213|  37.8k|        return parse_ipv4(input, true);
14214|  37.8k|      }
14215|  32.4k|      ada_log("parse_host fast path ", get_hostname());
14216|  32.4k|      is_valid = true;
14217|  32.4k|      return true;
14218|  70.2k|    }
14219|   129k|  } else if (const size_t first_percent = input.find('%');
14220|  21.3k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14220:14): [True: 18.7k, False: 2.51k]
  ------------------
14221|  18.7k|    std::string decoded = unicode::percent_decode(input, first_percent);
14222|  18.7k|    const uint8_t decoded_flags =
14223|  18.7k|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14224|  18.7k|                                                               decoded.size());
14225|  18.7k|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14225:9): [True: 18.4k, False: 325]
  ------------------
14226|  18.4k|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14226:11): [True: 135, False: 18.3k]
  ------------------
14227|    135|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14228|    135|      }
14229|  18.4k|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14229:11): [True: 18.4k, False: 58]
  ------------------
14230|  18.4k|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14230:11): [True: 26, False: 32]
  ------------------
14231|  18.4k|        update_base_hostname(decoded);
14232|  18.4k|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14232:13): [True: 18.2k, False: 178]
  ------------------
14233|  18.2k|          return parse_ipv4(decoded, true);
14234|  18.2k|        }
14235|    178|        is_valid = true;
14236|    178|        return true;
14237|  18.4k|      }
14238|  18.4k|    }
14239|  18.7k|  }
14240|       |  // We have encountered at least one forbidden code point or the input contains
14241|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14242|       |  // conversion.
14243|       |
14244|  61.6k|  ada_log("parse_host calling to_ascii");
14245|  61.6k|  std::optional<std::string> host = std::string(get_hostname());
14246|  61.6k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14247|  61.6k|  if (!is_valid) {
  ------------------
  |  Branch (14247:7): [True: 1.53k, False: 60.0k]
  ------------------
14248|  1.53k|    ada_log("parse_host to_ascii returns false");
14249|  1.53k|    return is_valid = false;
14250|  1.53k|  }
14251|  60.0k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14252|  60.0k|          " bytes]");
14253|       |
14254|  60.0k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14254:7): [True: 0, False: 60.0k]
  ------------------
14255|  60.0k|                          ada::unicode::is_forbidden_domain_code_point)) {
14256|      0|    return is_valid = false;
14257|      0|  }
14258|       |
14259|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14260|       |  // asciiDomain.
14261|  60.0k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14261:7): [True: 127, False: 59.9k]
  ------------------
14262|    127|    ada_log("parse_host got ipv4 ", *host);
14263|    127|    return parse_ipv4(host.value(), false);
14264|    127|  }
14265|       |
14266|  59.9k|  update_base_hostname(host.value());
14267|  59.9k|  ADA_ASSERT_TRUE(validate());
14268|  59.9k|  return true;
14269|  60.0k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8571|  22.2k|                                                       size_t pos) {
 8572|  22.2k|  ADA_ASSERT_TRUE(pos <= input.size());
 8573|       |  // The following is safer but unneeded if we have the above line:
 8574|       |  // return pos > input.size() ? std::string_view() : input.substr(pos);
 8575|  22.2k|  return input.substr(pos);
 8576|  22.2k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15088|   229k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15089|   229k|  ada_log("url_aggregator::consume_prepared_path ", input);
15090|       |  /***
15091|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15092|       |   * unfortunate. This particular function is nearly identical, except that it
15093|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15094|       |   * very common) merely appends to the buffer. This is the same trivial path as
15095|       |   * with helpers::parse_prepared_path, except that we have the additional check
15096|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15097|       |   * modify it, and then insert it back into the buffer.
15098|       |   */
15099|   229k|  uint8_t accumulator = checkers::path_signature(input);
15100|       |  // Let us first detect a trivial case.
15101|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15102|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15103|       |  // no dot, and no character needing percent encoding.
15104|   229k|  constexpr uint8_t need_encoding = 1;
15105|   229k|  constexpr uint8_t backslash_char = 2;
15106|   229k|  constexpr uint8_t dot_char = 4;
15107|   229k|  constexpr uint8_t percent_char = 8;
15108|   229k|  bool special = type != ada::scheme::NOT_SPECIAL;
15109|   229k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15109:39): [True: 1.37k, False: 228k]
  ------------------
15110|  1.37k|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15110:39): [True: 39, False: 1.33k]
  ------------------
15111|   229k|  bool trivial_path =
15112|   229k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15112:7): [True: 200k, False: 29.0k]
  |  Branch (15112:8): [True: 228k, False: 810]
  ------------------
15113|   229k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15114|    810|                  0)) &&
15115|   200k|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15115:7): [True: 200k, False: 17]
  ------------------
15116|   229k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15116:7): [True: 12.4k, False: 217k]
  |  Branch (15116:34): [True: 12.4k, False: 13]
  ------------------
15117|       |    // '4' means that we have at least one dot, but nothing that requires
15118|       |    // percent encoding or decoding. The only part that is not trivial is
15119|       |    // that we may have single dots and double dots path segments.
15120|       |    // If we have such segments, then we either have a path that begins
15121|       |    // with '.' (easy to check), or we have the sequence './'.
15122|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15123|       |    // Note: we know that '\' is not present.
15124|  12.4k|    if (input[0] != '.') {
  ------------------
  |  Branch (15124:9): [True: 11.1k, False: 1.21k]
  ------------------
15125|  11.1k|      size_t slashdot = 0;
15126|  11.1k|      bool dot_is_file = true;
15127|  36.4k|      for (;;) {
15128|  36.4k|        slashdot = input.find("/.", slashdot);
15129|  36.4k|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15129:13): [True: 11.1k, False: 25.2k]
  ------------------
15130|  11.1k|          break;
15131|  25.2k|        } else {  // uncommon
15132|       |          // only three cases matter: /./, /.. or a final /
15133|  25.2k|          slashdot += 2;
15134|  25.2k|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15134:28): [True: 79, False: 25.2k]
  |  Branch (15134:56): [True: 12.2k, False: 12.9k]
  ------------------
15135|  12.9k|                           input[slashdot] == '/');
  ------------------
  |  Branch (15135:28): [True: 12.0k, False: 954]
  ------------------
15136|  25.2k|        }
15137|  36.4k|      }
15138|  11.1k|      trivial_path = dot_is_file;
15139|  11.1k|    }
15140|  12.4k|  }
15141|   229k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15141:7): [True: 201k, False: 28.0k]
  |  Branch (15141:23): [True: 201k, False: 0]
  ------------------
15142|   201k|    ada_log("parse_path trivial");
15143|   201k|    buffer += '/';
15144|   201k|    buffer += input;
15145|   201k|    return;
15146|   201k|  }
15147|  28.0k|  std::string path = std::string(get_pathname());
15148|       |  // We are going to need to look a bit at the path, but let us see if we can
15149|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15150|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15151|       |  // there.
15152|  28.0k|  bool fast_path =
15153|  28.0k|      (special &&
  ------------------
  |  Branch (15153:8): [True: 27.6k, False: 435]
  ------------------
15154|  27.6k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15154:8): [True: 11.3k, False: 16.3k]
  ------------------
15155|  11.3k|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15155:7): [True: 11.2k, False: 98]
  ------------------
15156|  28.0k|  if (fast_path) {
  ------------------
  |  Branch (15156:7): [True: 11.2k, False: 16.8k]
  ------------------
15157|  11.2k|    ada_log("parse_prepared_path fast");
15158|       |    // Here we don't need to worry about \ or percent encoding.
15159|       |    // We also do not have a file protocol. We might have dots, however,
15160|       |    // but dots must as appear as '.', and they cannot be encoded because
15161|       |    // the symbol '%' is not present.
15162|  11.2k|    size_t previous_location = 0;  // We start at 0.
15163|  68.9k|    do {
15164|  68.9k|      size_t new_location = input.find('/', previous_location);
15165|       |      // std::string_view path_view = input;
15166|       |      //  We process the last segment separately:
15167|  68.9k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15167:11): [True: 11.2k, False: 57.7k]
  ------------------
15168|  11.2k|        std::string_view path_view = input.substr(previous_location);
15169|  11.2k|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15169:13): [True: 78, False: 11.1k]
  ------------------
15170|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15171|     78|          if (path.empty()) {
  ------------------
  |  Branch (15171:15): [True: 18, False: 60]
  ------------------
15172|     18|            path = '/';
15173|     18|            update_base_pathname(path);
15174|     18|            return;
15175|     18|          }
15176|       |          // Fast case where we have nothing to do:
15177|     60|          if (path.back() == '/') {
  ------------------
  |  Branch (15177:15): [True: 16, False: 44]
  ------------------
15178|     16|            update_base_pathname(path);
15179|     16|            return;
15180|     16|          }
15181|       |          // If you have the path "/joe/myfriend",
15182|       |          // then you delete 'myfriend'.
15183|     44|          path.resize(path.rfind('/') + 1);
15184|     44|          update_base_pathname(path);
15185|     44|          return;
15186|     60|        }
15187|  11.1k|        path += '/';
15188|  11.1k|        if (path_view != ".") {
  ------------------
  |  Branch (15188:13): [True: 11.0k, False: 104]
  ------------------
15189|  11.0k|          path.append(path_view);
15190|  11.0k|        }
15191|  11.1k|        update_base_pathname(path);
15192|  11.1k|        return;
15193|  57.7k|      } else {
15194|       |        // This is a non-final segment.
15195|  57.7k|        std::string_view path_view =
15196|  57.7k|            input.substr(previous_location, new_location - previous_location);
15197|  57.7k|        previous_location = new_location + 1;
15198|  57.7k|        if (path_view == "..") {
  ------------------
  |  Branch (15198:13): [True: 12.7k, False: 45.0k]
  ------------------
15199|  12.7k|          size_t last_delimiter = path.rfind('/');
15200|  12.7k|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15200:15): [True: 10.6k, False: 2.06k]
  ------------------
15201|  10.6k|            path.erase(last_delimiter);
15202|  10.6k|          }
15203|  45.0k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15203:20): [True: 32.5k, False: 12.5k]
  ------------------
15204|  32.5k|          path += '/';
15205|  32.5k|          path.append(path_view);
15206|  32.5k|        }
15207|  57.7k|      }
15208|  68.9k|    } while (true);
  ------------------
  |  Branch (15208:14): [True: 57.7k, Folded]
  ------------------
15209|  16.8k|  } else {
15210|  16.8k|    ada_log("parse_path slow");
15211|       |    // we have reached the general case
15212|  16.8k|    bool needs_percent_encoding = (accumulator & 1);
15213|  16.8k|    std::string path_buffer_tmp;
15214|  60.4k|    do {
15215|  60.4k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15215:26): [True: 58.6k, False: 1.79k]
  |  Branch (15215:37): [True: 5.54k, False: 53.0k]
  ------------------
15216|  60.4k|                            ? input.find_first_of("/\\")
15217|  60.4k|                            : input.find('/');
15218|  60.4k|      std::string_view path_view = input;
15219|  60.4k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15219:11): [True: 43.5k, False: 16.8k]
  ------------------
15220|  43.5k|        path_view.remove_suffix(path_view.size() - location);
15221|  43.5k|        input.remove_prefix(location + 1);
15222|  43.5k|      }
15223|       |      // path_buffer is either path_view or it might point at a percent encoded
15224|       |      // temporary string.
15225|  60.4k|      std::string_view path_buffer =
15226|  60.4k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15226:12): [True: 13.1k, False: 47.3k]
  ------------------
15227|  13.1k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15227:12): [True: 4.15k, False: 8.95k]
  ------------------
15228|  13.1k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15229|  60.4k|              ? path_buffer_tmp
15230|  60.4k|              : path_view;
15231|  60.4k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15231:11): [True: 12.7k, False: 47.6k]
  ------------------
15232|  12.7k|        helpers::shorten_path(path, type);
15233|  12.7k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15233:13): [True: 9.42k, False: 3.32k]
  ------------------
15234|  9.42k|          path += '/';
15235|  9.42k|        }
15236|  47.6k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15236:18): [True: 2.23k, False: 45.4k]
  ------------------
15237|  2.23k|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15237:18): [True: 426, False: 1.81k]
  ------------------
15238|    426|        path += '/';
15239|    426|      }
15240|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15241|  47.2k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15241:16): [True: 45.4k, False: 1.81k]
  ------------------
15242|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15243|       |        // Windows drive letter, then replace the second code point in
15244|       |        // path_buffer with U+003A (:).
15245|  45.4k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15245:13): [True: 1.92k, False: 43.5k]
  |  Branch (15245:48): [True: 524, False: 1.39k]
  ------------------
15246|    524|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15246:13): [True: 42, False: 482]
  ------------------
15247|     42|          path += '/';
15248|     42|          path += path_buffer[0];
15249|     42|          path += ':';
15250|     42|          path_buffer.remove_prefix(2);
15251|     42|          path.append(path_buffer);
15252|  45.3k|        } else {
15253|       |          // Append path_buffer to url's path.
15254|  45.3k|          path += '/';
15255|  45.3k|          path.append(path_buffer);
15256|  45.3k|        }
15257|  45.4k|      }
15258|  60.4k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15258:11): [True: 16.8k, False: 43.5k]
  ------------------
15259|  16.8k|        update_base_pathname(path);
15260|  16.8k|        return;
15261|  16.8k|      }
15262|  60.4k|    } while (true);
  ------------------
  |  Branch (15262:14): [True: 43.5k, Folded]
  ------------------
15263|  16.8k|  }
15264|  28.0k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|   298k|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|   298k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (14:7): [True: 183k, False: 114k]
  ------------------
   15|   183k|    return false;
   16|   183k|  }
   17|       |  // If the address ends with a dot, we need to prune it (special case).
   18|   114k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (18:7): [True: 54.5k, False: 60.3k]
  ------------------
   19|  54.5k|    view.remove_suffix(1);
   20|  54.5k|  }
   21|       |  // From the last character, find the last dot.
   22|   114k|  size_t last_dot = view.rfind('.');
   23|   114k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (23:7): [True: 92.9k, False: 21.9k]
  ------------------
   24|       |    // We have at least one dot.
   25|  92.9k|    view.remove_prefix(last_dot + 1);
   26|  92.9k|  }
   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|   114k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (30:7): [True: 57.8k, False: 56.9k]
  ------------------
   31|  57.8k|    return true;
   32|  57.8k|  }
   33|       |  // It could be hex (0x), but not if there is a single character.
   34|  56.9k|  if (view.size() == 1) {
  ------------------
  |  Branch (34:7): [True: 0, False: 56.9k]
  ------------------
   35|      0|    return false;
   36|      0|  }
   37|       |  // It must start with 0x.
   38|  56.9k|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (38:7): [True: 1.30k, False: 55.6k]
  ------------------
   39|  1.30k|    return false;
   40|  1.30k|  }
   41|       |  // We must allow "0x".
   42|  55.6k|  if (view.size() == 2) {
  ------------------
  |  Branch (42:7): [True: 18.1k, False: 37.5k]
  ------------------
   43|  18.1k|    return true;
   44|  18.1k|  }
   45|       |  // We have 0x followed by some characters, we need to check that they are
   46|       |  // hexadecimals.
   47|  37.5k|  view.remove_prefix(2);
   48|  37.5k|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   49|  55.6k|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7174|   325k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7175|   325k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7175:11): [True: 325k, False: 0]
  |  Branch (7175:23): [True: 11.2k, False: 314k]
  |  Branch (7175:37): [True: 314k, False: 0]
  |  Branch (7175:49): [True: 313k, False: 828]
  ------------------
 7176|   325k|}
_ZN3ada3url12parse_schemeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
10026|   258k|ada_really_inline bool url::parse_scheme(const std::string_view input) {
10027|   258k|  auto parsed_type = ada::scheme::get_scheme_type(input);
10028|   258k|  bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
10029|       |  /**
10030|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
10031|       |   *http, https), in which case, we can go really fast.
10032|       |   **/
10033|   258k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (10033:7): [True: 253k, False: 4.71k]
  ------------------
10034|       |    if constexpr (has_state_override) {
10035|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
10036|       |      // then return.
10037|       |      if (is_special() != is_input_special) {
10038|       |        return false;
10039|       |      }
10040|       |
10041|       |      // If url includes credentials or has a non-null port, and buffer is
10042|       |      // "file", then return.
10043|       |      if ((has_credentials() || port.has_value()) &&
10044|       |          parsed_type == ada::scheme::type::FILE) {
10045|       |        return false;
10046|       |      }
10047|       |
10048|       |      // If url's scheme is "file" and its host is an empty host, then return.
10049|       |      // An empty host is the empty string.
10050|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10051|       |          host->empty()) {
10052|       |        return false;
10053|       |      }
10054|       |    }
10055|       |
10056|   253k|    type = parsed_type;
10057|       |
10058|       |    if constexpr (has_state_override) {
10059|       |      // This is uncommon.
10060|       |      uint16_t urls_scheme_port = get_special_port();
10061|       |
10062|       |      if (urls_scheme_port) {
10063|       |        // If url's port is url's scheme's default port, then set url's port to
10064|       |        // null.
10065|       |        if (port.has_value() && *port == urls_scheme_port) {
10066|       |          port = std::nullopt;
10067|       |        }
10068|       |      }
10069|       |    }
10070|   253k|  } else {  // slow path
10071|  4.71k|    std::string _buffer(input);
10072|       |    // Next function is only valid if the input is ASCII and returns false
10073|       |    // otherwise, but it seems that we always have ascii content so we do not
10074|       |    // need to check the return value.
10075|       |    // bool is_ascii =
10076|  4.71k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
10077|       |
10078|       |    if constexpr (has_state_override) {
10079|       |      // The state-override validation errors below ("return" in the WHATWG URL
10080|       |      // parser) leave the URL unchanged. The setter contract is
10081|       |      // "true on success, false if the scheme is invalid" -- the fast path
10082|       |      // above already returns false here, so the slow path must agree.
10083|       |
10084|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
10085|       |      // then return. If url's scheme is not a special scheme and buffer is a
10086|       |      // special scheme, then return.
10087|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
10088|       |        return false;
10089|       |      }
10090|       |
10091|       |      // If url includes credentials or has a non-null port, and buffer is
10092|       |      // "file", then return.
10093|       |      if ((has_credentials() || port.has_value()) && _buffer == "file") {
10094|       |        return false;
10095|       |      }
10096|       |
10097|       |      // If url's scheme is "file" and its host is an empty host, then return.
10098|       |      // An empty host is the empty string.
10099|       |      if (type == ada::scheme::type::FILE && host.has_value() &&
10100|       |          host->empty()) {
10101|       |        return false;
10102|       |      }
10103|       |    }
10104|       |
10105|  4.71k|    set_scheme(std::move(_buffer));
10106|       |
10107|       |    if constexpr (has_state_override) {
10108|       |      // This is uncommon.
10109|       |      uint16_t urls_scheme_port = get_special_port();
10110|       |
10111|       |      if (urls_scheme_port) {
10112|       |        // If url's port is url's scheme's default port, then set url's port to
10113|       |        // null.
10114|       |        if (port.has_value() && *port == urls_scheme_port) {
10115|       |          port = std::nullopt;
10116|       |        }
10117|       |      }
10118|       |    }
10119|  4.71k|  }
10120|       |
10121|   258k|  return true;
10122|   258k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13666|   258k|    const std::string_view input_with_colon) {
13667|   258k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13668|   258k|  ADA_ASSERT_TRUE(validate());
13669|   258k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13670|   258k|  std::string_view input{input_with_colon};
13671|   258k|  input.remove_suffix(1);
13672|   258k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13673|   258k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13674|       |  /**
13675|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13676|       |   *http, https), in which case, we can go really fast.
13677|       |   **/
13678|   258k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13678:7): [True: 253k, False: 4.71k]
  ------------------
13679|       |    if constexpr (has_state_override) {
13680|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13681|       |      // then return.
13682|       |      if (is_special() != is_input_special) {
13683|       |        return false;
13684|       |      }
13685|       |
13686|       |      // If url includes credentials or has a non-null port, and buffer is
13687|       |      // "file", then return.
13688|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13689|       |          parsed_type == ada::scheme::type::FILE) {
13690|       |        return false;
13691|       |      }
13692|       |
13693|       |      // If url's scheme is "file" and its host is an empty host, then return.
13694|       |      // An empty host is the empty string.
13695|       |      if (type == ada::scheme::type::FILE &&
13696|       |          components.host_start == components.host_end) {
13697|       |        return false;
13698|       |      }
13699|       |    }
13700|       |
13701|   253k|    type = parsed_type;
13702|   253k|    set_scheme_from_view_with_colon(input_with_colon);
13703|       |
13704|       |    if constexpr (has_state_override) {
13705|       |      // This is uncommon.
13706|       |      uint16_t urls_scheme_port = get_special_port();
13707|       |
13708|       |      if (urls_scheme_port) {
13709|       |        // If url's port is url's scheme's default port, then set url's port to
13710|       |        // null.
13711|       |        if (components.port == urls_scheme_port) {
13712|       |          clear_port();
13713|       |        }
13714|       |      }
13715|       |    }
13716|   253k|  } else {  // slow path
13717|  4.71k|    std::string _buffer(input);
13718|       |    // Next function is only valid if the input is ASCII and returns false
13719|       |    // otherwise, but it seems that we always have ascii content so we do not
13720|       |    // need to check the return value.
13721|  4.71k|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
13722|       |
13723|       |    if constexpr (has_state_override) {
13724|       |      // The state-override validation errors below ("return" in the WHATWG URL
13725|       |      // parser) leave the URL unchanged. The setter contract is
13726|       |      // "true on success, false if the scheme is invalid" -- the fast path
13727|       |      // above already returns false here, so the slow path must agree.
13728|       |
13729|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
13730|       |      // then return. If url's scheme is not a special scheme and buffer is a
13731|       |      // special scheme, then return.
13732|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
13733|       |        return false;
13734|       |      }
13735|       |
13736|       |      // If url includes credentials or has a non-null port, and buffer is
13737|       |      // "file", then return.
13738|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13739|       |          _buffer == "file") {
13740|       |        return false;
13741|       |      }
13742|       |
13743|       |      // If url's scheme is "file" and its host is an empty host, then return.
13744|       |      // An empty host is the empty string.
13745|       |      if (type == ada::scheme::type::FILE &&
13746|       |          components.host_start == components.host_end) {
13747|       |        return false;
13748|       |      }
13749|       |    }
13750|       |
13751|  4.71k|    set_scheme(_buffer);
13752|       |
13753|       |    if constexpr (has_state_override) {
13754|       |      // This is uncommon.
13755|       |      uint16_t urls_scheme_port = get_special_port();
13756|       |
13757|       |      if (urls_scheme_port) {
13758|       |        // If url's port is url's scheme's default port, then set url's port to
13759|       |        // null.
13760|       |        if (components.port == urls_scheme_port) {
13761|       |          clear_port();
13762|       |        }
13763|       |      }
13764|       |    }
13765|  4.71k|  }
13766|   258k|  ADA_ASSERT_TRUE(validate());
13767|   258k|  return true;
13768|   258k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13792|   253k|    std::string_view new_scheme_with_colon) {
13793|   253k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
13794|   253k|          new_scheme_with_colon);
13795|   253k|  ADA_ASSERT_TRUE(validate());
13796|   253k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
13797|   253k|                  new_scheme_with_colon.back() == ':');
13798|       |  // next line could overflow but unsigned arithmetic has well-defined
13799|       |  // overflows.
13800|   253k|  uint32_t new_difference =
13801|   253k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
13802|       |
13803|   253k|  if (buffer.empty()) {
  ------------------
  |  Branch (13803:7): [True: 253k, False: 0]
  ------------------
13804|   253k|    buffer.append(new_scheme_with_colon);
13805|   253k|  } else {
13806|      0|    buffer.erase(0, components.protocol_end);
13807|      0|    buffer.insert(0, new_scheme_with_colon);
13808|      0|  }
13809|   253k|  components.protocol_end += new_difference;
13810|       |
13811|   253k|  apply_shifted_non_scheme_offsets(components, new_difference);
13812|   253k|  ADA_ASSERT_TRUE(validate());
13813|   253k|}
_ZN3ada14url_aggregator10set_schemeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13815|  4.71k|inline void url_aggregator::set_scheme(std::string_view new_scheme) {
13816|  4.71k|  ada_log("url_aggregator::set_scheme ", new_scheme);
13817|  4.71k|  ADA_ASSERT_TRUE(validate());
13818|  4.71k|  ADA_ASSERT_TRUE(new_scheme.empty() || new_scheme.back() != ':');
13819|       |  // next line could overflow but unsigned arithmetic has well-defined
13820|       |  // overflows.
13821|  4.71k|  uint32_t new_difference =
13822|  4.71k|      uint32_t(new_scheme.size()) - components.protocol_end + 1;
13823|       |
13824|  4.71k|  type = ada::scheme::get_scheme_type(new_scheme);
13825|  4.71k|  if (buffer.empty()) {
  ------------------
  |  Branch (13825:7): [True: 4.71k, False: 0]
  ------------------
13826|  4.71k|    buffer.append(helpers::concat(new_scheme, ":"));
13827|  4.71k|  } else {
13828|      0|    buffer.erase(0, components.protocol_end);
13829|      0|    buffer.insert(0, helpers::concat(new_scheme, ":"));
13830|      0|  }
13831|  4.71k|  components.protocol_end = uint32_t(new_scheme.size() + 1);
13832|       |
13833|  4.71k|  apply_shifted_non_scheme_offsets(components, new_difference);
13834|  4.71k|  ADA_ASSERT_TRUE(validate());
13835|  4.71k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5809|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1081|  1.44M|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1082|  1.44M|  return !!(a[i >> 3] & (1 << (i & 7)));
 1083|  1.44M|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2196|  84.2k|  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:
 3682|  21.0k|      : impl_base(unexpect, std::move(e.value())),
 3683|  21.0k|        ctor_base(detail::default_constructor_tag{}) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2210|  42.1k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2668|  21.0k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada3urlENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3286|   597k|  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_:
 3768|   576k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3641|   576k|      : impl_base(in_place, std::forward<Args>(args)...),
 3642|   576k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2656|   576k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada3urlC2EOS0_:
 5051|   576k|  url(url&& u) noexcept = default;
_ZN3ada8url_baseD2Ev:
 1700|  2.34M|  virtual ~url_base() = default;
_ZN3ada3urlD2Ev:
 5054|  1.17M|  ~url() override = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3682|  21.0k|      : impl_base(unexpect, std::move(e.value())),
 3683|  21.0k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2668|  21.0k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3286|   597k|  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_:
 3768|   576k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3641|   576k|      : impl_base(in_place, std::forward<Args>(args)...),
 3642|   576k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2656|   576k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7831|   576k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7834|  1.17M|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6846|   525k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6847|   525k|  if (scheme.empty()) {
  ------------------
  |  Branch (6847:7): [True: 0, False: 525k]
  ------------------
 6848|      0|    return ada::scheme::NOT_SPECIAL;
 6849|      0|  }
 6850|   525k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6851|   525k|  const std::string_view target = details::is_special_list[hash_value];
 6852|   525k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6852:7): [True: 520k, False: 5.20k]
  ------------------
 6853|   520k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6853:7): [True: 512k, False: 8.09k]
  ------------------
 6854|   520k|          details::scheme_keys[hash_value]) {
 6855|   512k|    return ada::scheme::type(hash_value);
 6856|   512k|  } else {
 6857|  13.2k|    return ada::scheme::NOT_SPECIAL;
 6858|  13.2k|  }
 6859|   525k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6787|   520k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6788|   520k|  uint64_t input = (uint8_t)p[0];
 6789|   520k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6790|   520k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6791|   520k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6792|   520k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6793|   520k|  return input;
 6794|   520k|}
_ZN3ada14url_aggregatorC2Ev:
 7829|   597k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4960|   597k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1453|   622k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1454|   622k|  const size_t len = input.size();
 1455|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1456|   622k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1456:7): [True: 104k, False: 517k]
  |  Branch (1456:18): [True: 6.42k, False: 511k]
  ------------------
 1457|   110k|    return ipv4_fast_fail;
 1458|   110k|  }
 1459|   511k|  const char* data = input.data();
 1460|       |
 1461|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1462|       |  return detail::try_parse_ipv4_avx512(data, len);
 1463|       |#else
 1464|   511k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1465|   622k|#endif
 1466|   622k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1294|   511k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1295|   511k|  uint32_t ipv4 = 0;
 1296|  1.48M|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1296:19): [True: 1.24M, False: 244k]
  ------------------
 1297|  1.24M|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1297:9): [True: 16, False: 1.24M]
  ------------------
 1298|     16|      return ipv4_fast_fail;
 1299|     16|    }
 1300|  1.24M|    uint32_t val;
 1301|  1.24M|    char c = *p;
 1302|  1.24M|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1302:9): [True: 1.24M, False: 882]
  |  Branch (1302:21): [True: 1.05M, False: 191k]
  ------------------
 1303|  1.05M|      val = static_cast<uint32_t>(c - '0');
 1304|  1.05M|      ++p;
 1305|  1.05M|    } else {
 1306|   192k|      return ipv4_fast_fail;
 1307|   192k|    }
 1308|  1.05M|    if (p < pend) {
  ------------------
  |  Branch (1308:9): [True: 954k, False: 98.2k]
  ------------------
 1309|   954k|      c = *p;
 1310|   954k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1310:11): [True: 701k, False: 252k]
  |  Branch (1310:23): [True: 664k, False: 37.0k]
  ------------------
 1311|   664k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1311:13): [True: 250, False: 664k]
  ------------------
 1312|    250|          return ipv4_fast_fail;
 1313|    250|        }
 1314|   664k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1315|   664k|        ++p;
 1316|   664k|        if (p < pend) {
  ------------------
  |  Branch (1316:13): [True: 555k, False: 108k]
  ------------------
 1317|   555k|          c = *p;
 1318|   555k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1318:15): [True: 301k, False: 254k]
  |  Branch (1318:27): [True: 300k, False: 122]
  ------------------
 1319|   300k|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1320|   300k|            ++p;
 1321|   300k|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1321:17): [True: 1.29k, False: 299k]
  ------------------
 1322|  1.29k|              return ipv4_fast_fail;
 1323|  1.29k|            }
 1324|   300k|          }
 1325|   555k|        }
 1326|   664k|      }
 1327|   954k|    }
 1328|  1.05M|    ipv4 = (ipv4 << 8) | val;
 1329|  1.05M|    if (i < 3) {
  ------------------
  |  Branch (1329:9): [True: 806k, False: 244k]
  ------------------
 1330|   806k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1330:11): [True: 96, False: 806k]
  |  Branch (1330:24): [True: 73.4k, False: 733k]
  ------------------
 1331|  73.5k|        return ipv4_fast_fail;
 1332|  73.5k|      }
 1333|   733k|      ++p;
 1334|   733k|    }
 1335|  1.05M|  }
 1336|   244k|  if (p != pend) {
  ------------------
  |  Branch (1336:7): [True: 304, False: 243k]
  ------------------
 1337|    304|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1337:9): [True: 146, False: 158]
  |  Branch (1337:26): [True: 22, False: 124]
  ------------------
 1338|     22|      return ipv4;
 1339|     22|    }
 1340|    282|    return ipv4_fast_fail;
 1341|    304|  }
 1342|   243k|  return ipv4;
 1343|   244k|}
_ZNK3ada3url15has_credentialsEv:
 7364|  1.22M|[[nodiscard]] ada_really_inline bool url::has_credentials() const noexcept {
 7365|  1.22M|  return !username.empty() || !password.empty();
  ------------------
  |  Branch (7365:10): [True: 197k, False: 1.03M]
  |  Branch (7365:31): [True: 720, False: 1.03M]
  ------------------
 7366|  1.22M|}
_ZNK3ada8url_base10is_specialEv:
 7329|  5.55M|    const noexcept {
 7330|  5.55M|  return type != ada::scheme::NOT_SPECIAL;
 7331|  5.55M|}
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEEcvbEv:
 4081|   597k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEEptEv:
 4050|   960k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4051|   960k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|   960k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4051:5): [True: 960k, False: 0]
  ------------------
 4052|   960k|    return valptr();
 4053|   960k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE6valptrEv:
 3346|   960k|  T* valptr() { return std::addressof(this->m_val); }
_ZN2tl6detail21expected_storage_baseIN3ada3urlENS2_6errorsELb0ELb1EED2Ev:
 2678|   597k|  ~expected_storage_base() {
 2679|   597k|    if (m_has_val) {
  ------------------
  |  Branch (2679:9): [True: 576k, False: 21.0k]
  ------------------
 2680|   576k|      m_val.~T();
 2681|   576k|    }
 2682|   597k|  }
_ZNK3ada3url13get_href_sizeEv:
 7622|  1.02M|[[nodiscard]] inline size_t url::get_href_size() const noexcept {
 7623|  1.02M|  size_t size = 0;
 7624|  1.02M|  if (is_special()) {
  ------------------
  |  Branch (7624:7): [True: 1.01M, False: 8.09k]
  ------------------
 7625|  1.01M|    size += ada::scheme::details::is_special_list[type].size() + 1;
 7626|  1.01M|  } else {
 7627|  8.09k|    size += non_special_scheme.size() + 1;
 7628|  8.09k|  }
 7629|  1.02M|  if (host.has_value()) {
  ------------------
  |  Branch (7629:7): [True: 1.02M, False: 5.14k]
  ------------------
 7630|  1.02M|    size += host->size();
 7631|  1.02M|    size += 2;
 7632|  1.02M|    if (has_credentials()) {
  ------------------
  |  Branch (7632:9): [True: 128k, False: 891k]
  ------------------
 7633|   128k|      size += username.size();
 7634|   128k|      if (!password.empty()) {
  ------------------
  |  Branch (7634:11): [True: 123k, False: 5.13k]
  ------------------
 7635|   123k|        size += 1 + password.size();
 7636|   123k|      }
 7637|   128k|      size += 1;
 7638|   128k|    }
 7639|  1.02M|    if (port.has_value()) {
  ------------------
  |  Branch (7639:9): [True: 200k, False: 820k]
  ------------------
 7640|   200k|      size += 1;
 7641|   200k|      uint16_t p = *port;
 7642|   200k|      size += (p >= 10000)  ? 5
  ------------------
  |  Branch (7642:15): [True: 5.70k, False: 194k]
  ------------------
 7643|   200k|              : (p >= 1000) ? 4
  ------------------
  |  Branch (7643:17): [True: 94.8k, False: 99.7k]
  ------------------
 7644|   194k|              : (p >= 100)  ? 3
  ------------------
  |  Branch (7644:17): [True: 331, False: 99.3k]
  ------------------
 7645|  99.7k|              : (p >= 10)   ? 2
  ------------------
  |  Branch (7645:17): [True: 90.8k, False: 8.51k]
  ------------------
 7646|  99.3k|                            : 1;
 7647|   200k|    }
 7648|  1.02M|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7648:14): [True: 1.59k, False: 3.54k]
  |  Branch (7648:34): [True: 117, False: 1.48k]
  ------------------
 7649|    117|    size += 2;
 7650|    117|  }
 7651|  1.02M|  size += path.size();
 7652|  1.02M|  if (query.has_value()) {
  ------------------
  |  Branch (7652:7): [True: 120k, False: 904k]
  ------------------
 7653|   120k|    size += 1 + query->size();
 7654|   120k|  }
 7655|  1.02M|  if (hash.has_value()) {
  ------------------
  |  Branch (7655:7): [True: 93.1k, False: 932k]
  ------------------
 7656|  93.1k|    size += 1 + hash->size();
 7657|  93.1k|  }
 7658|  1.02M|  return size;
 7659|  1.02M|}
_ZN3ada8checkers8is_alphaEc:
 1274|   521k|constexpr bool is_alpha(char x) noexcept {
 1275|   521k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1275:10): [True: 519k, False: 2.04k]
  |  Branch (1275:34): [True: 519k, False: 68]
  ------------------
 1276|   521k|}
_ZN3ada8checkers8to_lowerEc:
 1272|  1.04M|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZNR2tl8expectedIN3ada3urlENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4063|   960k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4064|   960k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|   960k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4064:5): [True: 960k, False: 0]
  ------------------
 4065|   960k|    return val();
 4066|   960k|  }
_ZN2tl8expectedIN3ada3urlENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3355|   960k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3356|   960k|    return this->m_val;
 3357|   960k|  }
_ZN3ada3urlaSERKS0_:
 5053|   192k|  url& operator=(const url& u) = default;
_ZNK2tl8expectedIN3ada3urlENS1_6errorsEE9has_valueEv:
 4080|  2.32M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1247|  1.12M|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1248|  1.12M|  if (view.empty()) {
  ------------------
  |  Branch (1248:7): [True: 0, False: 1.12M]
  ------------------
 1249|      0|    return false;
 1250|      0|  }
 1251|  1.12M|  const char* start = view.data();
 1252|  1.12M|  const char* end = start + view.size();
 1253|  1.12M|  if (end[-1] == '.') {
  ------------------
  |  Branch (1253:7): [True: 57.2k, False: 1.07M]
  ------------------
 1254|  57.2k|    --end;
 1255|  57.2k|    if (end == start) {
  ------------------
  |  Branch (1255:9): [True: 1.78k, False: 55.4k]
  ------------------
 1256|  1.78k|      return false;
 1257|  1.78k|    }
 1258|  57.2k|  }
 1259|  1.12M|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1259:7): [True: 848k, False: 279k]
  ------------------
 1260|   848k|    return false;
 1261|   848k|  }
 1262|   279k|  const char* label = end;
 1263|  1.26M|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1263:10): [True: 1.23M, False: 26.8k]
  |  Branch (1263:28): [True: 982k, False: 252k]
  ------------------
 1264|   982k|    --label;
 1265|   982k|  }
 1266|   279k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1266:7): [True: 252k, False: 26.8k]
  |  Branch (1266:25): [True: 120k, False: 131k]
  ------------------
 1267|   120k|    return false;
 1268|   120k|  }
 1269|   158k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1269:10): [True: 158k, False: 0]
  |  Branch (1269:26): [True: 151k, False: 7.04k]
  ------------------
 1270|   279k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1241|  2.36M|constexpr bool is_ipv4_number_char(char x) noexcept {
 1242|  2.36M|  const unsigned char c = static_cast<unsigned char>(x);
 1243|  2.36M|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1243:11): [True: 2.11M, False: 248k]
  |  Branch (1243:23): [True: 305k, False: 1.80M]
  |  Branch (1243:37): [True: 1.80M, False: 249k]
  |  Branch (1243:49): [True: 802k, False: 1.00M]
  ------------------
 1244|  1.25M|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1244:11): [True: 1.00M, False: 248k]
  |  Branch (1244:23): [True: 0, False: 1.00M]
  |  Branch (1244:36): [True: 153k, False: 1.10M]
  |  Branch (1244:48): [True: 0, False: 1.10M]
  ------------------
 1245|  2.36M|}
_ZN3ada8checkers8is_digitEc:
 1239|   388k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6843|   120k|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6844|   120k|  return details::special_ports[int(type)];
 6845|   120k|}
_ZN3ada14url_aggregatoraSERKS0_:
 7833|   192k|  url_aggregator& operator=(const url_aggregator& u) = default;
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8554|  58.4k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8555|  58.4k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8556|  58.4k|          " bytes] \n", to_diagram());
 8557|  58.4k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8558|  58.4k|  ADA_ASSERT_TRUE(validate());
 8559|       |
 8560|  58.4k|  const bool begins_with_dashdash = input.starts_with("//");
 8561|  58.4k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8561:7): [True: 57.7k, False: 757]
  |  Branch (8561:32): [True: 0, False: 57.7k]
  ------------------
 8562|       |    // We must delete the ./
 8563|      0|    delete_dash_dot();
 8564|      0|  }
 8565|       |
 8566|  58.4k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8566:7): [True: 757, False: 57.7k]
  |  Branch (8566:31): [True: 757, False: 0]
  |  Branch (8566:51): [True: 27, False: 730]
  ------------------
 8567|     27|      !has_dash_dot()) {
  ------------------
  |  Branch (8567:7): [True: 27, False: 0]
  ------------------
 8568|       |    // If url's host is null, url does not have an opaque path, url's path's
 8569|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8570|       |    // output.
 8571|     27|    buffer.insert(components.pathname_start, "/.");
 8572|     27|    components.pathname_start += 2;
 8573|     27|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8573:9): [True: 0, False: 27]
  ------------------
 8574|      0|      components.search_start += 2;
 8575|      0|    }
 8576|     27|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8576:9): [True: 0, False: 27]
  ------------------
 8577|      0|      components.hash_start += 2;
 8578|      0|    }
 8579|     27|  }
 8580|       |
 8581|  58.4k|  uint32_t difference = replace_and_resize(
 8582|  58.4k|      components.pathname_start,
 8583|  58.4k|      components.pathname_start + get_pathname_length(), input);
 8584|  58.4k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8584:7): [True: 0, False: 58.4k]
  ------------------
 8585|      0|    components.search_start += difference;
 8586|      0|  }
 8587|  58.4k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8587:7): [True: 0, False: 58.4k]
  ------------------
 8588|      0|    components.hash_start += difference;
 8589|      0|  }
 8590|  58.4k|  ADA_ASSERT_TRUE(validate());
 8591|  58.4k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8396|   352k|    uint32_t start, uint32_t end, std::string_view input) {
 8397|   352k|  uint32_t current_length = end - start;
 8398|   352k|  uint32_t input_size = uint32_t(input.size());
 8399|   352k|  uint32_t new_difference = input_size - current_length;
 8400|       |
 8401|   352k|  if (current_length == 0) {
  ------------------
  |  Branch (8401:7): [True: 284k, False: 67.4k]
  ------------------
 8402|   284k|    buffer.insert(start, input);
 8403|   284k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8403:14): [True: 553, False: 66.9k]
  ------------------
 8404|    553|    if (input_size != 0) {
  ------------------
  |  Branch (8404:9): [True: 553, False: 0]
  ------------------
 8405|    553|      std::memmove(buffer.data() + start, input.data(), input_size);
 8406|    553|    }
 8407|  66.9k|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8407:14): [True: 18.1k, False: 48.7k]
  ------------------
 8408|  18.1k|    buffer.erase(start, current_length - input_size);
 8409|  18.1k|    buffer.replace(start, input_size, input);
 8410|  48.7k|  } else {
 8411|  48.7k|    buffer.replace(start, current_length, input.substr(0, current_length));
 8412|  48.7k|    buffer.insert(start + current_length, input.substr(current_length));
 8413|  48.7k|  }
 8414|       |
 8415|   352k|  return new_difference;
 8416|   352k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8447|  58.4k|url_aggregator::get_pathname_length() const noexcept {
 8448|  58.4k|  ada_log("url_aggregator::get_pathname_length");
 8449|  58.4k|  uint32_t ending_index = uint32_t(buffer.size());
 8450|  58.4k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8450:7): [True: 0, False: 58.4k]
  ------------------
 8451|      0|    ending_index = components.search_start;
 8452|  58.4k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8452:14): [True: 0, False: 58.4k]
  ------------------
 8453|      0|    ending_index = components.hash_start;
 8454|      0|  }
 8455|  58.4k|  return ending_index - components.pathname_start;
 8456|  58.4k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9389|   220k|    ada_lifetime_bound {
 9390|   220k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9391|   220k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9392|   220k|          " components.search_start = ", components.search_start,
 9393|   220k|          " components.hash_start = ", components.hash_start);
 9394|   220k|  auto ending_index = uint32_t(buffer.size());
 9395|   220k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9395:7): [True: 32.6k, False: 187k]
  ------------------
 9396|  32.6k|    ending_index = components.search_start;
 9397|   187k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9397:14): [True: 10.5k, False: 176k]
  ------------------
 9398|  10.5k|    ending_index = components.hash_start;
 9399|  10.5k|  }
 9400|   220k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9401|   220k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8372|  11.8k|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8373|  11.8k|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8374|  11.8k|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8375|  11.8k|          " bytes] components.hash_start = ", components.hash_start);
 8376|  11.8k|  ADA_ASSERT_TRUE(validate());
 8377|  11.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8378|  11.8k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8378:7): [True: 0, False: 11.8k]
  ------------------
 8379|      0|    buffer.resize(components.hash_start);
 8380|      0|  }
 8381|  11.8k|  components.hash_start = uint32_t(buffer.size());
 8382|  11.8k|  buffer += "#";
 8383|  11.8k|  bool encoding_required = unicode::percent_encode<true>(
 8384|  11.8k|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8385|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8386|       |  // encoding was not deemed required.
 8387|  11.8k|  if (!encoding_required) {
  ------------------
  |  Branch (8387:7): [True: 11.6k, False: 258]
  ------------------
 8388|  11.6k|    buffer.append(input);
 8389|  11.6k|  }
 8390|  11.8k|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8391|  11.8k|          buffer, "' [", buffer.size(), " bytes]");
 8392|  11.8k|  ADA_ASSERT_TRUE(validate());
 8393|  11.8k|}
_ZN3ada3urlC2Ev:
 5049|   597k|  url() = default;
_ZN3ada3url26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7472|  11.8k|inline void url::update_unencoded_base_hash(std::string_view input) {
 7473|       |  // We do the percent encoding
 7474|  11.8k|  hash = unicode::percent_encode(input,
 7475|  11.8k|                                 ada::character_sets::FRAGMENT_PERCENT_ENCODE);
 7476|  11.8k|}
_ZN3ada3url18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7479|  12.0k|                                    const uint8_t query_percent_encode_set[]) {
 7480|  12.0k|  query = ada::unicode::percent_encode(input, query_percent_encode_set);
 7481|  12.0k|}
_ZN3ada3url20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7470|     60|inline void url::update_base_hostname(std::string_view input) { host = input; }
_ZN3ada3url20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7487|  30.2k|inline void url::update_base_pathname(const std::string_view input) {
 7488|  30.2k|  path = input;
 7489|  30.2k|}
_ZN3ada3url10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 7662|  2.24k|                                         bool check_trailing_content) noexcept {
 7663|  2.24k|  ada_log("parse_port('", view, "') ", view.size());
 7664|  2.24k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (7664:7): [True: 2.03k, False: 201]
  |  Branch (7664:24): [True: 5, False: 2.03k]
  ------------------
 7665|      5|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 7666|      5|    is_valid = false;
 7667|      5|    return 0;
 7668|      5|  }
 7669|  2.23k|  uint16_t parsed_port{};
 7670|  2.23k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 7671|  2.23k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (7671:7): [True: 24, False: 2.21k]
  ------------------
 7672|     24|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 7673|     24|    is_valid = false;
 7674|     24|    return 0;
 7675|     24|  }
 7676|  2.21k|  ada_log("parse_port: ", parsed_port);
 7677|  2.21k|  const auto consumed = size_t(r.ptr - view.data());
 7678|  2.21k|  ada_log("parse_port: consumed ", consumed);
 7679|  2.21k|  if (check_trailing_content) {
  ------------------
  |  Branch (7679:7): [True: 2.21k, False: 0]
  ------------------
 7680|  2.21k|    is_valid &=
 7681|  2.21k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (7681:10): [True: 432, False: 1.77k]
  |  Branch (7681:37): [True: 1.42k, False: 355]
  ------------------
 7682|    355|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (7682:10): [True: 121, False: 234]
  |  Branch (7682:36): [True: 224, False: 10]
  |  Branch (7682:52): [True: 55, False: 169]
  ------------------
 7683|  2.21k|  }
 7684|  2.21k|  ada_log("parse_port: is_valid = ", is_valid);
 7685|  2.21k|  if (is_valid) {
  ------------------
  |  Branch (7685:7): [True: 2.03k, False: 179]
  ------------------
 7686|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 7687|  2.03k|    auto default_port = scheme_default_port();
 7688|  2.03k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (7688:27): [True: 182, False: 1.85k]
  |  Branch (7688:48): [True: 68, False: 114]
  ------------------
 7689|  1.96k|                         (default_port != parsed_port);
  ------------------
  |  Branch (7689:26): [True: 1.96k, False: 3]
  ------------------
 7690|  2.03k|    port = (r.ec == std::errc() && is_port_valid) ? std::optional(parsed_port)
  ------------------
  |  Branch (7690:13): [True: 1.68k, False: 350]
  |  Branch (7690:36): [True: 1.67k, False: 3]
  ------------------
 7691|  2.03k|                                                  : std::nullopt;
 7692|  2.03k|  }
 7693|  2.21k|  return consumed;
 7694|  2.23k|}
_ZNK3ada8url_base19scheme_default_portEv:
 7338|  4.06k|url_base::scheme_default_port() const noexcept {
 7339|  4.06k|  return scheme::get_special_port(type);
 7340|  4.06k|}
_ZNK3ada3url12get_pathnameEv:
 7390|   192k|[[nodiscard]] constexpr std::string_view url::get_pathname() const noexcept {
 7391|   192k|  return path;
 7392|   192k|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1278|  6.50k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1279|  6.50k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1279:10): [True: 4.99k, False: 1.50k]
  ------------------
 1280|  4.99k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1280:11): [True: 3.17k, False: 1.82k]
  |  Branch (1280:34): [True: 246, False: 2.93k]
  |  Branch (1280:55): [True: 108, False: 2.82k]
  ------------------
 1281|    354|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1281:11): [True: 100, False: 254]
  |  Branch (1281:35): [True: 62, False: 192]
  |  Branch (1281:54): [True: 2, False: 190]
  ------------------
 1282|    190|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1282:35): [True: 0, False: 190]
  |  Branch (1282:54): [True: 0, False: 190]
  ------------------
 1283|  6.50k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1286|    136|    std::string_view input) noexcept {
 1287|    136|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1287:10): [True: 44, False: 92]
  |  Branch (1287:32): [True: 28, False: 16]
  |  Branch (1287:54): [True: 20, False: 8]
  ------------------
 1288|    136|}
_ZN3ada3url20set_protocol_as_fileEv:
 7515|  1.48k|constexpr void url::set_protocol_as_file() { type = ada::scheme::type::FILE; }
_ZN3ada7helpers14leading_zeroesEj:
 1985|   278k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1986|       |#if ADA_REGULAR_VISUAL_STUDIO
 1987|       |  unsigned long leading_zero(0);
 1988|       |  unsigned long in(input_num);
 1989|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1990|       |#else
 1991|   278k|  return __builtin_clz(input_num);
 1992|   278k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1993|   278k|}
_ZN3ada14url_aggregator7reserveEj:
 9062|   258k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9063|   258k|  buffer.reserve(capacity);
 9064|   258k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8780|  37.8k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8781|  37.8k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8782|  37.8k|          "\n", to_diagram());
 8783|  37.8k|  ADA_ASSERT_TRUE(validate());
 8784|  37.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8785|       |#if ADA_DEVELOPMENT_CHECKS
 8786|       |  // computing the expected password.
 8787|       |  std::string password_expected = std::string(get_password());
 8788|       |  password_expected.append(input);
 8789|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8790|  37.8k|  add_authority_slashes_if_needed();
 8791|       |
 8792|       |  // If input is empty, do nothing.
 8793|  37.8k|  if (input.empty()) {
  ------------------
  |  Branch (8793:7): [True: 4.11k, False: 33.7k]
  ------------------
 8794|  4.11k|    return;
 8795|  4.11k|  }
 8796|       |
 8797|  33.7k|  uint32_t difference = uint32_t(input.size());
 8798|  33.7k|  if (has_password()) {
  ------------------
  |  Branch (8798:7): [True: 5.19k, False: 28.5k]
  ------------------
 8799|  5.19k|    buffer.insert(components.host_start, input);
 8800|  28.5k|  } else {
 8801|  28.5k|    difference++;  // Increment for ":"
 8802|  28.5k|    buffer.insert(components.username_end, ":");
 8803|  28.5k|    buffer.insert(components.username_end + 1, input);
 8804|  28.5k|  }
 8805|  33.7k|  components.host_start += difference;
 8806|       |
 8807|       |  // The following line is required to add "@" to hostname. When updating
 8808|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8809|       |  // responsibility to set it.
 8810|  33.7k|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8810:7): [True: 172, False: 33.6k]
  ------------------
 8811|    172|    buffer.insert(components.host_start, "@");
 8812|    172|    difference++;
 8813|    172|  }
 8814|       |
 8815|  33.7k|  components.host_end += difference;
 8816|  33.7k|  components.pathname_start += difference;
 8817|  33.7k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8817:7): [True: 0, False: 33.7k]
  ------------------
 8818|      0|    components.search_start += difference;
 8819|      0|  }
 8820|  33.7k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8820:7): [True: 0, False: 33.7k]
  ------------------
 8821|      0|    components.hash_start += difference;
 8822|      0|  }
 8823|       |#if ADA_DEVELOPMENT_CHECKS
 8824|       |  std::string password_after(get_password());
 8825|       |  ADA_ASSERT_EQUAL(
 8826|       |      password_expected, password_after,
 8827|       |      "append_base_password problem after inserting " + std::string(input));
 8828|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8829|  33.7k|  ADA_ASSERT_TRUE(validate());
 8830|  33.7k|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9036|   389k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9037|   389k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9038|   389k|  ADA_ASSERT_TRUE(validate());
 9039|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9040|       |  // to insert
 9041|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9042|   389k|  if (has_authority()) {
  ------------------
  |  Branch (9042:7): [True: 134k, False: 255k]
  ------------------
 9043|   134k|    return;
 9044|   134k|  }
 9045|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9046|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9047|       |  // the insert could be fused with another insert.
 9048|   255k|  buffer.insert(components.protocol_end, "//");
 9049|   255k|  components.username_end += 2;
 9050|   255k|  components.host_start += 2;
 9051|   255k|  components.host_end += 2;
 9052|   255k|  components.pathname_start += 2;
 9053|   255k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9053:7): [True: 0, False: 255k]
  ------------------
 9054|      0|    components.search_start += 2;
 9055|      0|  }
 9056|   255k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9056:7): [True: 0, False: 255k]
  ------------------
 9057|      0|    components.hash_start += 2;
 9058|      0|  }
 9059|   255k|  ADA_ASSERT_TRUE(validate());
 9060|   255k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8664|  57.8k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8665|  57.8k|  ada_log("url_aggregator::append_base_username ", input);
 8666|  57.8k|  ADA_ASSERT_TRUE(validate());
 8667|  57.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8668|       |#if ADA_DEVELOPMENT_CHECKS
 8669|       |  // computing the expected password.
 8670|       |  std::string username_expected(get_username());
 8671|       |  username_expected.append(input);
 8672|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8673|  57.8k|  add_authority_slashes_if_needed();
 8674|       |
 8675|       |  // If input is empty, do nothing.
 8676|  57.8k|  if (input.empty()) {
  ------------------
  |  Branch (8676:7): [True: 17.6k, False: 40.2k]
  ------------------
 8677|  17.6k|    return;
 8678|  17.6k|  }
 8679|       |
 8680|  40.2k|  uint32_t difference = uint32_t(input.size());
 8681|  40.2k|  buffer.insert(components.username_end, input);
 8682|  40.2k|  components.username_end += difference;
 8683|  40.2k|  components.host_start += difference;
 8684|       |
 8685|  40.2k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8685:7): [True: 29.7k, False: 10.4k]
  ------------------
 8686|  29.7k|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8686:7): [True: 29.7k, False: 0]
  ------------------
 8687|  29.7k|    buffer.insert(components.host_start, "@");
 8688|  29.7k|    difference++;
 8689|  29.7k|  }
 8690|       |
 8691|  40.2k|  components.host_end += difference;
 8692|  40.2k|  components.pathname_start += difference;
 8693|  40.2k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8693:7): [True: 0, False: 40.2k]
  ------------------
 8694|      0|    components.search_start += difference;
 8695|      0|  }
 8696|  40.2k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8696:7): [True: 0, False: 40.2k]
  ------------------
 8697|      0|    components.hash_start += difference;
 8698|      0|  }
 8699|       |#if ADA_DEVELOPMENT_CHECKS
 8700|       |  std::string username_after(get_username());
 8701|       |  ADA_ASSERT_EQUAL(
 8702|       |      username_expected, username_after,
 8703|       |      "append_base_username problem after inserting " + std::string(input));
 8704|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8705|  40.2k|  ADA_ASSERT_TRUE(validate());
 8706|  40.2k|}
_ZNK3ada14url_aggregator8get_hrefEv:
 9140|  1.15M|    const noexcept ada_lifetime_bound {
 9141|  1.15M|  ada_log("url_aggregator::get_href");
 9142|  1.15M|  return buffer;
 9143|  1.15M|}
_ZN3ada14url_aggregator16update_base_portEj:
 8832|  1.67k|inline void url_aggregator::update_base_port(uint32_t input) {
 8833|  1.67k|  ada_log("url_aggregator::update_base_port");
 8834|  1.67k|  ADA_ASSERT_TRUE(validate());
 8835|  1.67k|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8835:7): [True: 0, False: 1.67k]
  ------------------
 8836|      0|    clear_port();
 8837|      0|    return;
 8838|      0|  }
 8839|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8840|       |  // value is probably already available as a string.
 8841|  1.67k|  std::string value = helpers::concat(":", std::to_string(input));
 8842|  1.67k|  uint32_t difference = uint32_t(value.size());
 8843|       |
 8844|  1.67k|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8844:7): [True: 0, False: 1.67k]
  ------------------
 8845|      0|    difference -= components.pathname_start - components.host_end;
 8846|      0|    buffer.erase(components.host_end,
 8847|      0|                 components.pathname_start - components.host_end);
 8848|      0|  }
 8849|       |
 8850|  1.67k|  buffer.insert(components.host_end, value);
 8851|  1.67k|  components.pathname_start += difference;
 8852|  1.67k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8852:7): [True: 0, False: 1.67k]
  ------------------
 8853|      0|    components.search_start += difference;
 8854|      0|  }
 8855|  1.67k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8855:7): [True: 0, False: 1.67k]
  ------------------
 8856|      0|    components.hash_start += difference;
 8857|      0|  }
 8858|  1.67k|  components.port = input;
 8859|  1.67k|  ADA_ASSERT_TRUE(validate());
 8860|  1.67k|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1975|  1.67k|std::string concat(Args... args) {
 1976|  1.67k|  std::string answer;
 1977|  1.67k|  inner_concat(answer, args...);
 1978|  1.67k|  return answer;
 1979|  1.67k|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1964|  1.67k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1965|  1.67k|  buffer.append(t);
 1966|  1.67k|  return inner_concat(buffer, args...);
 1967|  1.67k|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1956|  1.67k|inline void inner_concat(std::string& buffer, T t) {
 1957|  1.67k|  buffer.append(t);
 1958|  1.67k|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8503|  12.0k|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8504|  12.0k|  ada_log("url_aggregator::update_base_search ", input,
 8505|  12.0k|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8506|  12.0k|  ADA_ASSERT_TRUE(validate());
 8507|  12.0k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8508|       |
 8509|  12.0k|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8509:7): [True: 12.0k, False: 0]
  ------------------
 8510|  12.0k|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8510:9): [True: 12.0k, False: 0]
  ------------------
 8511|  12.0k|      components.search_start = uint32_t(buffer.size());
 8512|  12.0k|      buffer += "?";
 8513|  12.0k|    } else {
 8514|      0|      buffer.resize(components.search_start + 1);
 8515|      0|    }
 8516|       |
 8517|  12.0k|    bool encoding_required =
 8518|  12.0k|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8519|       |    // When encoding_required is false, then buffer is left unchanged, and
 8520|       |    // percent encoding was not deemed required.
 8521|  12.0k|    if (!encoding_required) {
  ------------------
  |  Branch (8521:9): [True: 11.7k, False: 340]
  ------------------
 8522|  11.7k|      buffer.append(input);
 8523|  11.7k|    }
 8524|  12.0k|  } else {
 8525|      0|    const size_t idx =
 8526|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8527|      0|    std::string encoded;
 8528|      0|    std::string_view replacement = input;
 8529|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8529:9): [True: 0, False: 0]
  ------------------
 8530|      0|      encoded =
 8531|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8532|      0|      replacement = encoded;
 8533|      0|    }
 8534|       |
 8535|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8535:9): [True: 0, False: 0]
  ------------------
 8536|      0|      const uint32_t difference = replace_and_resize(
 8537|      0|          components.search_start + 1, components.hash_start, replacement);
 8538|      0|      components.hash_start += difference;
 8539|      0|    } else {
 8540|      0|      components.search_start = components.hash_start;
 8541|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8542|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8542:11): [True: 0, False: 0]
  ------------------
 8543|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8544|      0|                     replacement.data(), replacement.size());
 8545|      0|      }
 8546|      0|      components.hash_start +=
 8547|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8548|      0|    }
 8549|      0|  }
 8550|       |
 8551|  12.0k|  ADA_ASSERT_TRUE(validate());
 8552|  12.0k|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8418|   293k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8419|   293k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8420|   293k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8421|   293k|  ADA_ASSERT_TRUE(validate());
 8422|   293k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8423|       |
 8424|       |  // This next line is required for when parsing a URL like `foo://`
 8425|   293k|  add_authority_slashes_if_needed();
 8426|       |
 8427|   293k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8428|   293k|  uint32_t new_difference =
 8429|   293k|      replace_and_resize(components.host_start, components.host_end, input);
 8430|       |
 8431|   293k|  if (has_credentials) {
  ------------------
  |  Branch (8431:7): [True: 29.7k, False: 264k]
  ------------------
 8432|  29.7k|    buffer.insert(components.host_start, "@");
 8433|  29.7k|    new_difference++;
 8434|  29.7k|  }
 8435|   293k|  components.host_end += new_difference;
 8436|   293k|  components.pathname_start += new_difference;
 8437|   293k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8437:7): [True: 0, False: 293k]
  ------------------
 8438|      0|    components.search_start += new_difference;
 8439|      0|  }
 8440|   293k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8440:7): [True: 0, False: 293k]
  ------------------
 8441|      0|    components.hash_start += new_difference;
 8442|      0|  }
 8443|   293k|  ADA_ASSERT_TRUE(validate());
 8444|   293k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9150|  2.24k|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9151|  2.24k|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9152|  2.24k|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9152:7): [True: 2.03k, False: 201]
  |  Branch (9152:24): [True: 5, False: 2.03k]
  ------------------
 9153|      5|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9154|      5|    is_valid = false;
 9155|      5|    return 0;
 9156|      5|  }
 9157|  2.23k|  uint16_t parsed_port{};
 9158|  2.23k|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9159|  2.23k|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9159:7): [True: 24, False: 2.21k]
  ------------------
 9160|     24|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9161|     24|    is_valid = false;
 9162|     24|    return 0;
 9163|     24|  }
 9164|  2.21k|  ada_log("parse_port: ", parsed_port);
 9165|  2.21k|  const size_t consumed = size_t(r.ptr - view.data());
 9166|  2.21k|  ada_log("parse_port: consumed ", consumed);
 9167|  2.21k|  if (check_trailing_content) {
  ------------------
  |  Branch (9167:7): [True: 2.21k, False: 0]
  ------------------
 9168|  2.21k|    is_valid &=
 9169|  2.21k|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9169:10): [True: 432, False: 1.77k]
  |  Branch (9169:37): [True: 1.42k, False: 355]
  ------------------
 9170|    355|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9170:10): [True: 121, False: 234]
  |  Branch (9170:36): [True: 224, False: 10]
  |  Branch (9170:52): [True: 55, False: 169]
  ------------------
 9171|  2.21k|  }
 9172|  2.21k|  ada_log("parse_port: is_valid = ", is_valid);
 9173|  2.21k|  if (is_valid) {
  ------------------
  |  Branch (9173:7): [True: 2.03k, False: 179]
  ------------------
 9174|  2.03k|    ada_log("parse_port", r.ec == std::errc());
 9175|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9176|  2.03k|    auto default_port = scheme_default_port();
 9177|  2.03k|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9177:27): [True: 182, False: 1.85k]
  |  Branch (9177:48): [True: 68, False: 114]
  ------------------
 9178|  1.96k|                         (default_port != parsed_port);
  ------------------
  |  Branch (9178:26): [True: 1.96k, False: 3]
  ------------------
 9179|  2.03k|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9179:9): [True: 1.68k, False: 350]
  |  Branch (9179:32): [True: 1.67k, False: 3]
  ------------------
 9180|  1.67k|      update_base_port(parsed_port);
 9181|  1.67k|    } else {
 9182|    353|      clear_port();
 9183|    353|    }
 9184|  2.03k|  }
 9185|  2.21k|  return consumed;
 9186|  2.23k|}
_ZN3ada14url_aggregator20set_protocol_as_fileEv:
 9188|  1.48k|constexpr void url_aggregator::set_protocol_as_file() {
 9189|  1.48k|  ada_log("url_aggregator::set_protocol_as_file ");
 9190|  1.48k|  ADA_ASSERT_TRUE(validate());
 9191|  1.48k|  type = ada::scheme::type::FILE;
 9192|       |  // next line could overflow but unsigned arithmetic has well-defined
 9193|       |  // overflows.
 9194|  1.48k|  uint32_t new_difference = 5 - components.protocol_end;
 9195|       |
 9196|  1.48k|  if (buffer.empty()) {
  ------------------
  |  Branch (9196:7): [True: 0, False: 1.48k]
  ------------------
 9197|      0|    buffer.append("file:");
 9198|  1.48k|  } else {
 9199|  1.48k|    buffer.erase(0, components.protocol_end);
 9200|  1.48k|    buffer.insert(0, "file:");
 9201|  1.48k|  }
 9202|  1.48k|  components.protocol_end = 5;
 9203|       |
 9204|       |  // Update the rest of the components.
 9205|  1.48k|  components.username_end += new_difference;
 9206|  1.48k|  components.host_start += new_difference;
 9207|  1.48k|  components.host_end += new_difference;
 9208|  1.48k|  components.pathname_start += new_difference;
 9209|  1.48k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9209:7): [True: 0, False: 1.48k]
  ------------------
 9210|      0|    components.search_start += new_difference;
 9211|      0|  }
 9212|  1.48k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9212:7): [True: 0, False: 1.48k]
  ------------------
 9213|      0|    components.hash_start += new_difference;
 9214|      0|  }
 9215|  1.48k|  ADA_ASSERT_TRUE(validate());
 9216|  1.48k|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8273|    619|                                              const uint8_t character_set[]) {
 8274|    619|  const char* data = input.data();
 8275|    619|  const size_t size = input.size();
 8276|       |
 8277|       |  // Process 8 bytes at a time using unrolled loop
 8278|    619|  size_t i = 0;
 8279|  1.29k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8279:10): [True: 710, False: 586]
  ------------------
 8280|    710|    unsigned char chunk[8];
 8281|    710|    std::memcpy(&chunk, data + i,
 8282|    710|                8);  // entices compiler to unconditionally process 8 characters
 8283|       |
 8284|       |    // Check 8 characters at once
 8285|  6.22k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8285:24): [True: 5.55k, False: 677]
  ------------------
 8286|  5.55k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8286:11): [True: 33, False: 5.51k]
  ------------------
 8287|     33|        return i + j;
 8288|     33|      }
 8289|  5.55k|    }
 8290|    710|  }
 8291|       |
 8292|       |  // Handle remaining bytes
 8293|  2.51k|  for (; i < size; i++) {
  ------------------
  |  Branch (8293:10): [True: 1.93k, False: 578]
  ------------------
 8294|  1.93k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8294:9): [True: 8, False: 1.92k]
  ------------------
 8295|      8|      return i;
 8296|      8|    }
 8297|  1.93k|  }
 8298|       |
 8299|    578|  return size;
 8300|    586|}
_ZN3ada14url_aggregator10clear_portEv:
 8862|    353|inline void url_aggregator::clear_port() {
 8863|    353|  ada_log("url_aggregator::clear_port");
 8864|    353|  ADA_ASSERT_TRUE(validate());
 8865|    353|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8865:7): [True: 353, False: 0]
  ------------------
 8866|    353|    return;
 8867|    353|  }
 8868|      0|  uint32_t length = components.pathname_start - components.host_end;
 8869|      0|  buffer.erase(components.host_end, length);
 8870|      0|  components.pathname_start -= length;
 8871|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8871:7): [True: 0, False: 0]
  ------------------
 8872|      0|    components.search_start -= length;
 8873|      0|  }
 8874|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8874:7): [True: 0, False: 0]
  ------------------
 8875|      0|    components.hash_start -= length;
 8876|      0|  }
 8877|      0|  components.port = url_components::omitted;
 8878|      0|  ADA_ASSERT_TRUE(validate());
 8879|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9027|   390k|    const noexcept {
 9028|   390k|  ada_log("url_aggregator::has_authority");
 9029|       |  // Performance: instead of doing this potentially expensive check, we could
 9030|       |  // have a boolean in the struct.
 9031|   390k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9031:10): [True: 135k, False: 255k]
  ------------------
 9032|   135k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9032:10): [True: 135k, False: 0]
  ------------------
 9033|   135k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9033:10): [True: 135k, False: 0]
  ------------------
 9034|   390k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9107|  57.7k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9108|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9109|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9110|       |  // U+002F (/) followed by U+002E (.) to output.
 9111|  57.7k|  ada_log("url_aggregator::has_dash_dot");
 9112|       |#if ADA_DEVELOPMENT_CHECKS
 9113|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9114|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9115|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9116|       |  if (components.pathname_start == components.host_end + 2) {
 9117|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9118|       |                     buffer[components.host_end + 1] == '.') ||
 9119|       |                    (buffer[components.host_end] == ':' &&
 9120|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9121|       |  }
 9122|       |  if (components.pathname_start == components.host_end + 2 &&
 9123|       |      buffer[components.host_end] == '/' &&
 9124|       |      buffer[components.host_end + 1] == '.') {
 9125|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9126|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9127|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9128|       |  }
 9129|       |#endif
 9130|       |  // Performance: it should be uncommon for components.pathname_start ==
 9131|       |  // components.host_end + 2 to be true. So we put this check first in the
 9132|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9133|       |  // more expensive, but should be uncommon.
 9134|  57.7k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9134:10): [True: 977, False: 56.7k]
  ------------------
 9135|    977|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9135:10): [True: 977, False: 0]
  |  Branch (9135:30): [True: 0, False: 977]
  ------------------
 9136|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9136:10): [True: 0, False: 0]
  ------------------
 9137|  57.7k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4081|   384k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4050|   960k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4051|   960k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|   960k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4051:5): [True: 960k, False: 0]
  ------------------
 4052|   960k|    return valptr();
 4053|   960k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3346|   960k|  T* valptr() { return std::addressof(this->m_val); }
_ZNR2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEdeIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 4063|   960k|  TL_EXPECTED_11_CONSTEXPR U& operator*() & {
 4064|   960k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|   960k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4064:5): [True: 960k, False: 0]
  ------------------
 4065|   960k|    return val();
 4066|   960k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE3valIS2_TnPNSt3__19enable_ifIXntsr3std7is_voidIT_EE5valueEvE4typeELPv0EEERS8_v:
 3355|   960k|  TL_EXPECTED_11_CONSTEXPR U& val() {
 3356|   960k|    return this->m_val;
 3357|   960k|  }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4080|  2.32M|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2678|   597k|  ~expected_storage_base() {
 2679|   597k|    if (m_has_val) {
  ------------------
  |  Branch (2679:9): [True: 576k, False: 21.0k]
  ------------------
 2680|   576k|      m_val.~T();
 2681|   576k|    }
 2682|   597k|  }
_ZNK3ada14url_aggregator22has_non_empty_usernameEv:
 9066|   192k|constexpr bool url_aggregator::has_non_empty_username() const noexcept {
 9067|   192k|  ada_log("url_aggregator::has_non_empty_username");
 9068|   192k|  return components.protocol_end + 2 < components.username_end;
 9069|   192k|}
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1897|   929k|                                                       size_t pos2) {
 1898|       |#if ADA_DEVELOPMENT_CHECKS
 1899|       |  if (pos2 < pos1) {
 1900|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1901|       |              << std::endl;
 1902|       |    abort();
 1903|       |  }
 1904|       |#endif
 1905|   929k|  return input.substr(pos1, pos2 - pos1);
 1906|   929k|}
_ZNK3ada14url_aggregator22has_non_empty_passwordEv:
 9071|   192k|constexpr bool url_aggregator::has_non_empty_password() const noexcept {
 9072|   192k|  ada_log("url_aggregator::has_non_empty_password");
 9073|   192k|  return components.host_start > components.username_end;
 9074|   192k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8459|   201k|    const noexcept {
 8460|   201k|  return buffer.size() == components.pathname_start;
 8461|   201k|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9076|  33.7k|constexpr bool url_aggregator::has_password() const noexcept {
 9077|  33.7k|  ada_log("url_aggregator::has_password");
 9078|       |  // This function does not care about the length of the password
 9079|  33.7k|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9079:10): [True: 5.19k, False: 28.5k]
  ------------------
 9080|  5.19k|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9080:10): [True: 5.19k, False: 0]
  ------------------
 9081|  33.7k|}
_ZNK3ada14url_aggregator13get_href_sizeEv:
 9145|   384k|[[nodiscard]] constexpr size_t url_aggregator::get_href_size() const noexcept {
 9146|   384k|  return buffer.size();
 9147|   384k|}
_ZNK3ada3url8get_hrefEv:
 7535|  1.34M|[[nodiscard]] ada_really_inline std::string url::get_href() const {
 7536|  1.34M|  if (is_special() && host.has_value() && username.empty() &&
  ------------------
  |  Branch (7536:7): [True: 1.34M, False: 4.36k]
  |  Branch (7536:23): [True: 1.34M, False: 0]
  |  Branch (7536:43): [True: 1.27M, False: 68.8k]
  ------------------
 7537|  1.27M|      password.empty() && !port.has_value()) [[likely]] {
  ------------------
  |  Branch (7537:7): [True: 1.27M, False: 252]
  |  Branch (7537:27): [True: 1.13M, False: 138k]
  ------------------
 7538|  1.13M|    const std::string_view scheme = ada::scheme::details::is_special_list[type];
 7539|  1.13M|    const size_t host_size = host->size();
 7540|  1.13M|    const size_t path_size = path.size();
 7541|  1.13M|    const size_t query_size = query.has_value() ? query->size() : 0;
  ------------------
  |  Branch (7541:31): [True: 215k, False: 917k]
  ------------------
 7542|  1.13M|    const size_t hash_size = hash.has_value() ? hash->size() : 0;
  ------------------
  |  Branch (7542:30): [True: 152k, False: 981k]
  ------------------
 7543|  1.13M|    const size_t total = scheme.size() + 3 + host_size + path_size +
 7544|  1.13M|                         (query.has_value() ? query_size + 1 : 0) +
  ------------------
  |  Branch (7544:27): [True: 215k, False: 917k]
  ------------------
 7545|  1.13M|                         (hash.has_value() ? hash_size + 1 : 0);
  ------------------
  |  Branch (7545:27): [True: 152k, False: 981k]
  ------------------
 7546|  1.13M|    std::string output(total, '\0');
 7547|  1.13M|    char* p = output.data();
 7548|  1.13M|    std::memcpy(p, scheme.data(), scheme.size());
 7549|  1.13M|    p += scheme.size();
 7550|  1.13M|    p[0] = ':';
 7551|  1.13M|    p[1] = '/';
 7552|  1.13M|    p[2] = '/';
 7553|  1.13M|    p += 3;
 7554|       |    // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7555|  1.13M|    std::memcpy(p, host->data(), host_size);
 7556|  1.13M|    p += host_size;
 7557|  1.13M|    std::memcpy(p, path.data(), path_size);
 7558|  1.13M|    p += path_size;
 7559|  1.13M|    if (query.has_value()) {
  ------------------
  |  Branch (7559:9): [True: 215k, False: 917k]
  ------------------
 7560|   215k|      *p++ = '?';
 7561|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7562|   215k|      std::memcpy(p, query->data(), query_size);
 7563|   215k|      p += query_size;
 7564|   215k|    }
 7565|  1.13M|    if (hash.has_value()) {
  ------------------
  |  Branch (7565:9): [True: 152k, False: 981k]
  ------------------
 7566|   152k|      *p++ = '#';
 7567|       |      // NOLINTNEXTLINE(bugprone-not-null-terminated-result)
 7568|   152k|      std::memcpy(p, hash->data(), hash_size);
 7569|   152k|    }
 7570|  1.13M|    return output;
 7571|  1.13M|  }
 7572|       |
 7573|   211k|  std::string output;
 7574|   211k|  output.reserve(get_href_size());
 7575|       |
 7576|   211k|  if (is_special()) {
  ------------------
  |  Branch (7576:7): [True: 207k, False: 4.36k]
  ------------------
 7577|   207k|    output.append(ada::scheme::details::is_special_list[type]);
 7578|   207k|    output += ':';
 7579|   207k|  } else {
 7580|  4.36k|    output.append(non_special_scheme);
 7581|  4.36k|    output += ':';
 7582|  4.36k|  }
 7583|       |
 7584|   211k|  if (host.has_value()) {
  ------------------
  |  Branch (7584:7): [True: 209k, False: 2.77k]
  ------------------
 7585|   209k|    output += '/';
 7586|   209k|    output += '/';
 7587|   209k|    if (has_credentials()) {
  ------------------
  |  Branch (7587:9): [True: 69.2k, False: 139k]
  ------------------
 7588|  69.2k|      output.append(username);
 7589|  69.2k|      if (!password.empty()) {
  ------------------
  |  Branch (7589:11): [True: 66.4k, False: 2.76k]
  ------------------
 7590|  66.4k|        output += ':';
 7591|  66.4k|        output.append(password);
 7592|  66.4k|      }
 7593|  69.2k|      output += '@';
 7594|  69.2k|    }
 7595|   209k|    output.append(*host);
 7596|   209k|    if (port.has_value()) {
  ------------------
  |  Branch (7596:9): [True: 138k, False: 70.1k]
  ------------------
 7597|   138k|      output += ':';
 7598|   138k|      char port_buf[5];
 7599|   138k|      auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, *port);
 7600|   138k|      (void)ec;
 7601|   138k|      output.append(port_buf, static_cast<size_t>(ptr - port_buf));
 7602|   138k|    }
 7603|   209k|  } else if (!has_opaque_path && path.starts_with("//")) {
  ------------------
  |  Branch (7603:14): [True: 861, False: 1.91k]
  |  Branch (7603:34): [True: 63, False: 798]
  ------------------
 7604|       |    // If url's host is null, url does not have an opaque path, url's path's
 7605|       |    // size is greater than 1, and url's path[0] is the empty string, then
 7606|       |    // append U+002F (/) followed by U+002E (.) to output.
 7607|     63|    output += '/';
 7608|     63|    output += '.';
 7609|     63|  }
 7610|   211k|  output.append(path);
 7611|   211k|  if (query.has_value()) {
  ------------------
  |  Branch (7611:7): [True: 12.7k, False: 199k]
  ------------------
 7612|  12.7k|    output += '?';
 7613|  12.7k|    output.append(*query);
 7614|  12.7k|  }
 7615|   211k|  if (hash.has_value()) {
  ------------------
  |  Branch (7615:7): [True: 12.5k, False: 199k]
  ------------------
 7616|  12.5k|    output += '#';
 7617|  12.5k|    output.append(*hash);
 7618|  12.5k|  }
 7619|   211k|  return output;
 7620|  1.34M|}
_ZNK3ada14url_aggregator8validateEv:
 9218|   192k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9219|   192k|  if (!is_valid) {
  ------------------
  |  Branch (9219:7): [True: 0, False: 192k]
  ------------------
 9220|      0|    return true;
 9221|      0|  }
 9222|   192k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9222:7): [True: 0, False: 192k]
  ------------------
 9223|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9224|      0|            to_diagram());
 9225|      0|    return false;
 9226|      0|  }
 9227|       |  // We have a credible components struct, but let us investivate more
 9228|       |  // carefully:
 9229|       |  /**
 9230|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9231|       |   *       |     |    |          | ^^^^|       |   |
 9232|       |   *       |     |    |          | |   |       |   `----- hash_start
 9233|       |   *       |     |    |          | |   |       `--------- search_start
 9234|       |   *       |     |    |          | |   `----------------- pathname_start
 9235|       |   *       |     |    |          | `--------------------- port
 9236|       |   *       |     |    |          `----------------------- host_end
 9237|       |   *       |     |    `---------------------------------- host_start
 9238|       |   *       |     `--------------------------------------- username_end
 9239|       |   *       `--------------------------------------------- protocol_end
 9240|       |   */
 9241|   192k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9241:7): [True: 0, False: 192k]
  ------------------
 9242|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9243|      0|    return false;
 9244|      0|  }
 9245|   192k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9245:7): [True: 0, False: 192k]
  ------------------
 9246|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9247|      0|    return false;
 9248|      0|  }
 9249|   192k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9249:7): [True: 0, False: 192k]
  ------------------
 9250|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9251|      0|    return false;
 9252|      0|  }
 9253|   192k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9253:7): [True: 0, False: 192k]
  ------------------
 9254|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9255|      0|    return false;
 9256|      0|  }
 9257|   192k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9257:7): [True: 0, False: 192k]
  ------------------
 9258|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9259|      0|    return false;
 9260|      0|  }
 9261|       |
 9262|   192k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9262:7): [True: 0, False: 192k]
  ------------------
 9263|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9264|      0|    return false;
 9265|      0|  }
 9266|   192k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9266:7): [True: 0, False: 192k]
  ------------------
 9267|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9268|      0|    return false;
 9269|      0|  }
 9270|   192k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9270:7): [True: 0, False: 192k]
  ------------------
 9271|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9272|      0|    return false;
 9273|      0|  }
 9274|   192k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9274:7): [True: 0, False: 192k]
  ------------------
 9275|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9276|      0|    return false;
 9277|      0|  }
 9278|   192k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9278:7): [True: 0, False: 192k]
  ------------------
 9279|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9280|      0|            to_diagram());
 9281|      0|    return false;
 9282|      0|  }
 9283|       |
 9284|   192k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9284:7): [True: 192k, False: 0]
  ------------------
 9285|   192k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9285:9): [True: 0, False: 192k]
  ------------------
 9286|      0|      ada_log(
 9287|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9288|      0|          to_diagram());
 9289|      0|      return false;
 9290|      0|    }
 9291|   192k|  }
 9292|       |
 9293|   192k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9293:7): [True: 192k, False: 24]
  ------------------
 9294|   192k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9294:7): [True: 9.85k, False: 182k]
  ------------------
 9295|  9.85k|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9295:9): [True: 395, False: 9.45k]
  ------------------
 9296|    395|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9296:9): [True: 0, False: 395]
  ------------------
 9297|      0|      ada_log(
 9298|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9299|      0|          "\n",
 9300|      0|          to_diagram());
 9301|      0|      return false;
 9302|      0|    }
 9303|  9.85k|  }
 9304|       |
 9305|   192k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9305:7): [True: 192k, False: 24]
  ------------------
 9306|   192k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9306:9): [True: 9.49k, False: 182k]
  ------------------
 9307|  9.49k|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9307:11): [True: 0, False: 9.49k]
  ------------------
 9308|      0|        ada_log(
 9309|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9310|      0|            to_diagram());
 9311|      0|        return false;
 9312|      0|      }
 9313|   182k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9313:16): [True: 182k, False: 0]
  ------------------
 9314|   182k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9314:16): [True: 182k, False: 528]
  ------------------
 9315|   182k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9315:11): [True: 181k, False: 395]
  ------------------
 9316|   181k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9316:13): [True: 0, False: 181k]
  ------------------
 9317|   181k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9317:13): [True: 0, False: 181k]
  ------------------
 9318|      0|          ada_log(
 9319|      0|              "url_aggregator::validate missing // between protocol and host "
 9320|      0|              "\n",
 9321|      0|              to_diagram());
 9322|      0|          return false;
 9323|      0|        }
 9324|   181k|      } else {
 9325|    395|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9325:13): [True: 395, False: 0]
  ------------------
 9326|    395|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9326:13): [True: 0, False: 395]
  ------------------
 9327|      0|          ada_log(
 9328|      0|              "url_aggregator::validate missing @ at the end of the username "
 9329|      0|              "\n",
 9330|      0|              to_diagram());
 9331|      0|          return false;
 9332|      0|        }
 9333|    395|      }
 9334|   182k|    } else {
 9335|    528|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9335:11): [True: 0, False: 528]
  ------------------
 9336|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9337|      0|                to_diagram());
 9338|      0|        return false;
 9339|      0|      }
 9340|    528|    }
 9341|   192k|  }
 9342|   192k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9342:7): [True: 192k, False: 31]
  ------------------
 9343|   192k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9343:7): [True: 19.8k, False: 172k]
  ------------------
 9344|  19.8k|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9344:9): [True: 774, False: 19.0k]
  ------------------
 9345|    774|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9345:9): [True: 9, False: 765]
  ------------------
 9346|      9|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9346:9): [True: 9, False: 0]
  ------------------
 9347|      9|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9347:11): [True: 0, False: 9]
  ------------------
 9348|      9|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9348:11): [True: 0, False: 9]
  ------------------
 9349|      9|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9349:11): [True: 0, False: 9]
  ------------------
 9350|      0|        ada_log(
 9351|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9352|      0|            to_diagram());
 9353|      0|        return false;
 9354|      0|      }
 9355|  19.8k|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9355:16): [True: 0, False: 19.8k]
  ------------------
 9356|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9357|      0|              to_diagram());
 9358|      0|      return false;
 9359|      0|    }
 9360|  19.8k|  }
 9361|   192k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9361:7): [True: 192k, False: 35]
  ------------------
 9362|   192k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9362:7): [True: 192k, False: 53]
  ------------------
 9363|   192k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9363:7): [True: 191k, False: 82]
  |  Branch (9363:60): [True: 191k, False: 183]
  ------------------
 9364|   191k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9364:9): [True: 0, False: 191k]
  ------------------
 9365|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9366|      0|              to_diagram());
 9367|      0|      return false;
 9368|      0|    }
 9369|   191k|  }
 9370|   192k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9370:7): [True: 32.6k, False: 159k]
  ------------------
 9371|  32.6k|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9371:9): [True: 0, False: 32.6k]
  ------------------
 9372|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9373|      0|              to_diagram());
 9374|      0|      return false;
 9375|      0|    }
 9376|  32.6k|  }
 9377|   192k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9377:7): [True: 23.5k, False: 168k]
  ------------------
 9378|  23.5k|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9378:9): [True: 0, False: 23.5k]
  ------------------
 9379|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9380|      0|              to_diagram());
 9381|      0|      return false;
 9382|      0|    }
 9383|  23.5k|  }
 9384|       |
 9385|   192k|  return true;
 9386|   192k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7712|   192k|    const noexcept {
 7713|       |  /**
 7714|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7715|       |   *       |     |    |          | ^^^^|       |   |
 7716|       |   *       |     |    |          | |   |       |   `----- hash_start
 7717|       |   *       |     |    |          | |   |       `--------- search_start
 7718|       |   *       |     |    |          | |   `----------------- pathname_start
 7719|       |   *       |     |    |          | `--------------------- port
 7720|       |   *       |     |    |          `----------------------- host_end
 7721|       |   *       |     |    `---------------------------------- host_start
 7722|       |   *       |     `--------------------------------------- username_end
 7723|       |   *       `--------------------------------------------- protocol_end
 7724|       |   */
 7725|       |  // These conditions can be made more strict.
 7726|   192k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7726:7): [True: 0, False: 192k]
  ------------------
 7727|      0|    return false;
 7728|      0|  }
 7729|   192k|  uint32_t index = protocol_end;
 7730|       |
 7731|   192k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7731:7): [True: 0, False: 192k]
  ------------------
 7732|      0|    return false;
 7733|      0|  }
 7734|   192k|  if (username_end < index) {
  ------------------
  |  Branch (7734:7): [True: 0, False: 192k]
  ------------------
 7735|      0|    return false;
 7736|      0|  }
 7737|   192k|  index = username_end;
 7738|       |
 7739|   192k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7739:7): [True: 0, False: 192k]
  ------------------
 7740|      0|    return false;
 7741|      0|  }
 7742|   192k|  if (host_start < index) {
  ------------------
  |  Branch (7742:7): [True: 0, False: 192k]
  ------------------
 7743|      0|    return false;
 7744|      0|  }
 7745|   192k|  index = host_start;
 7746|       |
 7747|   192k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7747:7): [True: 19.8k, False: 172k]
  ------------------
 7748|  19.8k|    if (port > 0xffff) {
  ------------------
  |  Branch (7748:9): [True: 0, False: 19.8k]
  ------------------
 7749|      0|      return false;
 7750|      0|    }
 7751|  19.8k|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7752|  19.8k|    if (index + port_length < index) {
  ------------------
  |  Branch (7752:9): [True: 0, False: 19.8k]
  ------------------
 7753|      0|      return false;
 7754|      0|    }
 7755|  19.8k|    index += port_length;
 7756|  19.8k|  }
 7757|       |
 7758|   192k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7758:7): [True: 0, False: 192k]
  ------------------
 7759|      0|    return false;
 7760|      0|  }
 7761|   192k|  if (pathname_start < index) {
  ------------------
  |  Branch (7761:7): [True: 0, False: 192k]
  ------------------
 7762|      0|    return false;
 7763|      0|  }
 7764|   192k|  index = pathname_start;
 7765|       |
 7766|   192k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7766:7): [True: 32.6k, False: 159k]
  ------------------
 7767|  32.6k|    if (search_start < index) {
  ------------------
  |  Branch (7767:9): [True: 0, False: 32.6k]
  ------------------
 7768|      0|      return false;
 7769|      0|    }
 7770|  32.6k|    index = search_start;
 7771|  32.6k|  }
 7772|       |
 7773|   192k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7773:7): [True: 23.5k, False: 168k]
  ------------------
 7774|  23.5k|    if (hash_start < index) {
  ------------------
  |  Branch (7774:9): [True: 0, False: 23.5k]
  ------------------
 7775|      0|      return false;
 7776|      0|    }
 7777|  23.5k|  }
 7778|       |
 7779|   192k|  return true;
 7780|   192k|}
_ZN3ada7helpers16fast_digit_countEj:
 2001|  19.8k|inline int fast_digit_count(uint32_t x) noexcept {
 2002|  19.8k|  auto int_log2 = [](uint32_t z) -> int {
 2003|  19.8k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|  19.8k|  };
 2005|       |  // Compiles to very few instructions. Note that the
 2006|       |  // table is static and thus effectively a constant.
 2007|       |  // We leave it inside the function because it is meaningless
 2008|       |  // outside of it (this comes at no performance cost).
 2009|  19.8k|  const static uint64_t table[] = {
 2010|  19.8k|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2011|  19.8k|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2012|  19.8k|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2013|  19.8k|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2014|  19.8k|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2015|  19.8k|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2016|  19.8k|      42949672960, 42949672960};
 2017|  19.8k|  return int((x + table[int_log2(x)]) >> 32);
 2018|  19.8k|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2002|  19.8k|  auto int_log2 = [](uint32_t z) -> int {
 2003|  19.8k|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|  19.8k|  };
_ZN3ada7helpers6concatIJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKcEEENS2_12basic_stringIcS5_NS2_9allocatorIcEEEEDpT_:
 1975|   196k|std::string concat(Args... args) {
 1976|   196k|  std::string answer;
 1977|   196k|  inner_concat(answer, args...);
 1978|   196k|  return answer;
 1979|   196k|}
_ZN3ada7helpers12inner_concatINSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEJPKcEEEvRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEET_DpT0_:
 1964|   196k|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1965|   196k|  buffer.append(t);
 1966|   196k|  return inner_concat(buffer, args...);
 1967|   196k|}
_ZN3ada7helpers12inner_concatIPKcJEEEvRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEET_:
 1956|   196k|inline void inner_concat(std::string& buffer, T t) {
 1957|   196k|  buffer.append(t);
 1958|   196k|}
_ZN3ada7helpers6concatIJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcEEES8_DpT_:
 1975|    623|std::string concat(Args... args) {
 1976|    623|  std::string answer;
 1977|    623|  inner_concat(answer, args...);
 1978|    623|  return answer;
 1979|    623|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJPKcEEEvRS8_T_DpT0_:
 1964|    623|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1965|    623|  buffer.append(t);
 1966|    623|  return inner_concat(buffer, args...);
 1967|    623|}
_ZN3ada3url10set_schemeEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7517|  4.71k|inline void url::set_scheme(std::string&& new_scheme) noexcept {
 7518|  4.71k|  type = ada::scheme::get_scheme_type(new_scheme);
 7519|       |  // We only move the 'scheme' if it is non-special.
 7520|  4.71k|  if (!is_special()) {
  ------------------
  |  Branch (7520:7): [True: 1.92k, False: 2.78k]
  ------------------
 7521|  1.92k|    non_special_scheme = std::move(new_scheme);
 7522|  1.92k|  }
 7523|  4.71k|}

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

