_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  172|  1.16k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  173|  1.16k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  174|  1.16k|  size_t pos = 0;
  175|  1.16k|  const char32_t* start{utf32_output};
  176|  19.8k|  while (pos < len) {
  ------------------
  |  Branch (176:10): [True: 18.8k, False: 998]
  ------------------
  177|       |    // try to convert the next block of 16 ASCII bytes
  178|  18.8k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (178:9): [True: 9.22k, False: 9.60k]
  ------------------
  179|       |                            // bytes, check that they are ascii
  180|  9.22k|      uint64_t v1;
  181|  9.22k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  182|  9.22k|      uint64_t v2;
  183|  9.22k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  184|  9.22k|      uint64_t v{v1 | v2};
  185|  9.22k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (185:11): [True: 833, False: 8.38k]
  ------------------
  186|    833|        size_t final_pos = pos + 16;
  187|  14.1k|        while (pos < final_pos) {
  ------------------
  |  Branch (187:16): [True: 13.3k, False: 833]
  ------------------
  188|  13.3k|          *utf32_output++ = char32_t(buf[pos]);
  189|  13.3k|          pos++;
  190|  13.3k|        }
  191|    833|        continue;
  192|    833|      }
  193|  9.22k|    }
  194|  17.9k|    uint8_t leading_byte = data[pos];  // leading byte
  195|  17.9k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (195:9): [True: 15.3k, False: 2.60k]
  ------------------
  196|       |      // converting one ASCII byte !!!
  197|  15.3k|      *utf32_output++ = char32_t(leading_byte);
  198|  15.3k|      pos++;
  199|  15.3k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (199:16): [True: 870, False: 1.73k]
  ------------------
  200|       |      // We have a two-byte UTF-8
  201|    870|      if (pos + 1 >= len) {
  ------------------
  |  Branch (201:11): [True: 1, False: 869]
  ------------------
  202|      1|        return 0;
  203|      1|      }  // minimal bound checking
  204|    869|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (204:11): [True: 37, False: 832]
  ------------------
  205|     37|        return 0;
  206|     37|      }
  207|       |      // range check
  208|    832|      uint32_t code_point =
  209|    832|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  210|    832|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (210:11): [True: 6, False: 826]
  |  Branch (210:32): [True: 0, False: 826]
  ------------------
  211|      6|        return 0;
  212|      6|      }
  213|    826|      *utf32_output++ = char32_t(code_point);
  214|    826|      pos += 2;
  215|  1.73k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (215:16): [True: 1.37k, False: 357]
  ------------------
  216|       |      // We have a three-byte UTF-8
  217|  1.37k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (217:11): [True: 3, False: 1.37k]
  ------------------
  218|      3|        return 0;
  219|      3|      }  // minimal bound checking
  220|       |
  221|  1.37k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (221:11): [True: 15, False: 1.35k]
  ------------------
  222|     15|        return 0;
  223|     15|      }
  224|  1.35k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (224:11): [True: 5, False: 1.35k]
  ------------------
  225|      5|        return 0;
  226|      5|      }
  227|       |      // range check
  228|  1.35k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  229|  1.35k|                            (data[pos + 1] & 0b00111111) << 6 |
  230|  1.35k|                            (data[pos + 2] & 0b00111111);
  231|  1.35k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (231:11): [True: 4, False: 1.34k]
  |  Branch (231:33): [True: 0, False: 1.34k]
  ------------------
  232|  1.34k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (232:12): [True: 407, False: 941]
  |  Branch (232:35): [True: 1, False: 406]
  ------------------
  233|      5|        return 0;
  234|      5|      }
  235|  1.34k|      *utf32_output++ = char32_t(code_point);
  236|  1.34k|      pos += 3;
  237|  1.34k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (237:16): [True: 280, False: 77]
  ------------------
  238|       |      // we have a 4-byte UTF-8 word.
  239|    280|      if (pos + 3 >= len) {
  ------------------
  |  Branch (239:11): [True: 3, False: 277]
  ------------------
  240|      3|        return 0;
  241|      3|      }  // minimal bound checking
  242|    277|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (242:11): [True: 5, False: 272]
  ------------------
  243|      5|        return 0;
  244|      5|      }
  245|    272|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (245:11): [True: 3, False: 269]
  ------------------
  246|      3|        return 0;
  247|      3|      }
  248|    269|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (248:11): [True: 2, False: 267]
  ------------------
  249|      2|        return 0;
  250|      2|      }
  251|       |
  252|       |      // range check
  253|    267|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  254|    267|                            (data[pos + 1] & 0b00111111) << 12 |
  255|    267|                            (data[pos + 2] & 0b00111111) << 6 |
  256|    267|                            (data[pos + 3] & 0b00111111);
  257|    267|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (257:11): [True: 1, False: 266]
  |  Branch (257:35): [True: 1, False: 265]
  ------------------
  258|      2|        return 0;
  259|      2|      }
  260|    265|      *utf32_output++ = char32_t(code_point);
  261|    265|      pos += 4;
  262|    265|    } else {
  263|     77|      return 0;
  264|     77|    }
  265|  17.9k|  }
  266|    998|  return utf32_output - start;
  267|  1.16k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  282|  1.16k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  283|  1.16k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  284|  1.16k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|  1.16k|    return c > -65;
  288|  1.16k|  });
  289|  1.16k|}
_ZN3ada4idna9ascii_mapEPcm:
 5133|    346|void ascii_map(char* input, size_t length) {
 5134|    346|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|    346|    return 0x101010101010101ull * v;
 5136|    346|  };
 5137|    346|  uint64_t broadcast_80 = broadcast(0x80);
 5138|    346|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5139|    346|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5140|    346|  size_t i = 0;
 5141|       |
 5142|    688|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5142:10): [True: 342, False: 346]
  ------------------
 5143|    342|    uint64_t word{};
 5144|    342|    std::memcpy(&word, input + i, sizeof(word));
 5145|    342|    word ^=
 5146|    342|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|    342|    std::memcpy(input + i, &word, sizeof(word));
 5148|    342|  }
 5149|    346|  if (i < length) {
  ------------------
  |  Branch (5149:7): [True: 322, False: 24]
  ------------------
 5150|    322|    uint64_t word{};
 5151|    322|    std::memcpy(&word, input + i, length - i);
 5152|    322|    word ^=
 5153|    322|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5154|    322|    std::memcpy(input + i, &word, length - i);
 5155|    322|  }
 5156|    346|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5160|  1.18k|bool map(std::u32string_view input, std::u32string& out) {
 5161|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5162|  1.18k|  out.clear();
 5163|  1.18k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5163:7): [True: 0, False: 1.18k]
  ------------------
 5164|      0|    return false;
 5165|      0|  }
 5166|       |
 5167|       |  // Pass 1: validate and compute exact output length.
 5168|  1.18k|  size_t out_size = 0;
 5169|  32.1k|  for (char32_t x : input) {
  ------------------
  |  Branch (5169:19): [True: 32.1k, False: 1.08k]
  ------------------
 5170|  32.1k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5171|  32.1k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5171:9): [True: 95, False: 32.0k]
  ------------------
 5172|     95|      return false;
 5173|     95|    }
 5174|  32.0k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5174:9): [True: 27.8k, False: 4.21k]
  ------------------
 5175|  27.8k|      ++out_size;
 5176|  27.8k|      continue;
 5177|  27.8k|    }
 5178|  4.21k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5178:9): [True: 0, False: 4.21k]
  ------------------
 5179|      0|      return false;
 5180|      0|    }
 5181|  4.21k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5182|  4.21k|  }
 5183|       |
 5184|       |  // Pass 2: write into a single allocation.
 5185|  1.08k|  out.resize(out_size);
 5186|  1.08k|  size_t w = 0;
 5187|  31.3k|  for (char32_t x : input) {
  ------------------
  |  Branch (5187:19): [True: 31.3k, False: 1.08k]
  ------------------
 5188|  31.3k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5189|  31.3k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5189:9): [True: 27.1k, False: 4.18k]
  ------------------
 5190|  27.1k|      out[w++] = x;
 5191|  27.1k|      continue;
 5192|  27.1k|    }
 5193|       |    // IGNORED or mapped (status already validated in pass 1).
 5194|  4.18k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5195|  10.0k|    while (*ptr != 0) {
  ------------------
  |  Branch (5195:12): [True: 5.82k, False: 4.18k]
  ------------------
 5196|  5.82k|      out[w++] = utf8_next(ptr);
 5197|  5.82k|    }
 5198|  4.18k|  }
 5199|  1.08k|  return true;
 5200|  1.18k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5293|     60|    const std::u32string_view input) noexcept {
 5294|     60|  bool decomposition_needed{false};
 5295|     60|  size_t additional_elements{0};
 5296|  2.64k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5296:35): [True: 2.64k, False: 60]
  ------------------
 5297|  2.64k|    size_t decomposition_length{0};
 5298|       |
 5299|  2.64k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5299:9): [True: 12, False: 2.62k]
  ------------------
 5300|     12|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5300:9): [True: 0, False: 12]
  ------------------
 5301|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5302|      0|      decomposition_length = 2;
 5303|      0|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5303:11): [True: 0, False: 0]
  ------------------
 5304|      0|        decomposition_length = 3;
 5305|      0|      }
 5306|  2.64k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5306:16): [True: 2.64k, False: 0]
  ------------------
 5307|  2.64k|      const uint8_t di = decomposition_index[current_character >> 8];
 5308|  2.64k|      const uint16_t* const decomposition =
 5309|  2.64k|          decomposition_block_row(di) + (current_character % 256);
 5310|  2.64k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5311|  2.64k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5311:11): [True: 10, False: 2.63k]
  |  Branch (5311:41): [True: 0, False: 10]
  ------------------
 5312|      0|        decomposition_length = 0;
 5313|      0|      }
 5314|  2.64k|    }
 5315|  2.64k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5315:9): [True: 10, False: 2.63k]
  ------------------
 5316|     10|      decomposition_needed = true;
 5317|     10|      additional_elements += decomposition_length - 1;
 5318|     10|    }
 5319|  2.64k|  }
 5320|     60|  return {decomposition_needed, additional_elements};
 5321|     60|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5323|      9|void decompose(std::u32string& input, size_t additional_elements) {
 5324|      9|  input.resize(input.size() + additional_elements);
 5325|      9|  for (size_t descending_idx = input.size(),
 5326|      9|              input_count = descending_idx - additional_elements;
 5327|    978|       input_count--;) {
  ------------------
  |  Branch (5327:8): [True: 969, False: 9]
  ------------------
 5328|    969|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5328:9): [True: 1, False: 968]
  ------------------
 5329|      1|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5329:9): [True: 0, False: 1]
  ------------------
 5330|       |      // Hangul decomposition.
 5331|      0|      char32_t s_index = input[input_count] - hangul_sbase;
 5332|      0|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5332:11): [True: 0, False: 0]
  ------------------
 5333|      0|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5334|      0|      }
 5335|      0|      input[--descending_idx] =
 5336|      0|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5337|      0|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5338|    969|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5338:16): [True: 969, False: 0]
  ------------------
 5339|    969|      const uint16_t* decomposition =
 5340|    969|          decomposition_block_row(
 5341|    969|              decomposition_index[input[input_count] >> 8]) +
 5342|    969|          (input[input_count] % 256);
 5343|    969|      uint16_t decomposition_length =
 5344|    969|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5345|    969|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5345:11): [True: 10, False: 959]
  |  Branch (5345:39): [True: 0, False: 10]
  ------------------
 5346|      0|        decomposition_length = 0;
 5347|      0|      }
 5348|    969|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5348:11): [True: 10, False: 959]
  ------------------
 5349|     10|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5350|     10|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5350:13): [True: 0, False: 10]
  ------------------
 5351|      0|          input[--descending_idx] = input[input_count];
 5352|     10|        } else {
 5353|     34|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5353:18): [True: 24, False: 10]
  ------------------
 5354|     24|            input[--descending_idx] =
 5355|     24|                decomposition_data[base + decomposition_length];
 5356|     24|          }
 5357|     10|        }
 5358|    959|      } else {
 5359|    959|        input[--descending_idx] = input[input_count];
 5360|    959|      }
 5361|    969|    } else {
 5362|      0|      input[--descending_idx] = input[input_count];
 5363|      0|    }
 5364|    969|  }
 5365|      9|}
_ZN3ada4idna7get_cccEDi:
 5367|  52.3k|uint8_t get_ccc(char32_t c) noexcept {
 5368|  52.3k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5368:7): [True: 0, False: 52.3k]
  ------------------
 5369|      0|    return 0;
 5370|      0|  }
 5371|  52.3k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5372|  52.3k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5374|     60|void sort_marks(std::u32string& input) {
 5375|  2.65k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5375:24): [True: 2.59k, False: 60]
  ------------------
 5376|  2.59k|    uint8_t ccc = get_ccc(input[idx]);
 5377|  2.59k|    if (ccc == 0) {
  ------------------
  |  Branch (5377:9): [True: 2.29k, False: 303]
  ------------------
 5378|  2.29k|      continue;
 5379|  2.29k|    }
 5380|    303|    auto current_character = input[idx];
 5381|    303|    size_t back_idx = idx;
 5382|    459|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5382:12): [True: 447, False: 12]
  |  Branch (5382:29): [True: 156, False: 291]
  ------------------
 5383|    156|      input[back_idx] = input[back_idx - 1];
 5384|    156|      back_idx--;
 5385|    156|    }
 5386|    303|    input[back_idx] = current_character;
 5387|    303|  }
 5388|     60|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5390|     60|void decompose_nfc(std::u32string& input) {
 5391|       |  /**
 5392|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5393|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5394|       |   */
 5395|     60|  auto [decomposition_needed, additional_elements] =
 5396|     60|      compute_decomposition_length(input);
 5397|     60|  if (decomposition_needed) {
  ------------------
  |  Branch (5397:7): [True: 9, False: 51]
  ------------------
 5398|      9|    decompose(input, additional_elements);
 5399|      9|  }
 5400|     60|  sort_marks(input);
 5401|     60|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5468|    850|bool is_already_nfc(std::u32string_view input) noexcept {
 5469|    850|  if (input.empty()) {
  ------------------
  |  Branch (5469:7): [True: 0, False: 850]
  ------------------
 5470|      0|    return true;
 5471|      0|  }
 5472|    850|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5472:7): [True: 0, False: 850]
  |  Branch (5472:30): [True: 0, False: 0]
  ------------------
 5473|      0|    return false;
 5474|      0|  }
 5475|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5476|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5477|  27.6k|  for (char32_t c : input) {
  ------------------
  |  Branch (5477:19): [True: 27.6k, False: 850]
  ------------------
 5478|  27.6k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5478:9): [True: 0, False: 27.6k]
  ------------------
 5479|      0|      return false;
 5480|      0|    }
 5481|  27.6k|  }
 5482|       |  // 2) Combining marks already in canonical order.
 5483|    850|  uint8_t prev_ccc = 0;
 5484|  25.1k|  for (char32_t c : input) {
  ------------------
  |  Branch (5484:19): [True: 25.1k, False: 740]
  ------------------
 5485|  25.1k|    uint8_t ccc = get_ccc(c);
 5486|  25.1k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5486:9): [True: 734, False: 24.4k]
  |  Branch (5486:21): [True: 110, False: 624]
  ------------------
 5487|    110|      return false;
 5488|    110|    }
 5489|  25.0k|    prev_ccc = ccc;
 5490|  25.0k|  }
 5491|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5492|    740|  return !would_compose(input);
 5493|    850|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5495|     60|void compose(std::u32string& input) {
 5496|       |  /**
 5497|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5498|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5499|       |   */
 5500|     60|  size_t input_count{0};
 5501|     60|  size_t composition_count{0};
 5502|  2.41k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5502:10): [True: 2.35k, False: 60]
  ------------------
 5503|  2.35k|    input[composition_count] = input[input_count];
 5504|  2.35k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5504:9): [True: 93, False: 2.25k]
  ------------------
 5505|     93|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5505:9): [True: 9, False: 84]
  ------------------
 5506|      9|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5506:11): [True: 9, False: 0]
  ------------------
 5507|      9|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5507:11): [True: 7, False: 2]
  ------------------
 5508|      7|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5508:11): [True: 0, False: 7]
  ------------------
 5509|      0|        input[composition_count] =
 5510|      0|            hangul_sbase +
 5511|      0|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5512|      0|             input[input_count + 1] - hangul_vbase) *
 5513|      0|                hangul_tcount;
 5514|      0|        input_count++;
 5515|      0|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5515:13): [True: 0, False: 0]
  ------------------
 5516|      0|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5516:13): [True: 0, False: 0]
  ------------------
 5517|      0|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5517:13): [True: 0, False: 0]
  ------------------
 5518|      0|          input[composition_count] += input[++input_count] - hangul_tbase;
 5519|      0|        }
 5520|      0|      }
 5521|  2.34k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5521:16): [True: 12, False: 2.33k]
  ------------------
 5522|     12|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5522:16): [True: 0, False: 12]
  ------------------
 5523|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5523:11): [True: 0, False: 0]
  ------------------
 5524|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5524:11): [True: 0, False: 0]
  ------------------
 5525|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5525:11): [True: 0, False: 0]
  ------------------
 5526|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5526:11): [True: 0, False: 0]
  ------------------
 5527|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5528|      0|      }
 5529|  2.34k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5529:16): [True: 2.34k, False: 0]
  ------------------
 5530|  2.34k|      const uint16_t* composition =
 5531|  2.34k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5532|  2.34k|          (input[input_count] % 256);
 5533|  2.34k|      size_t initial_composition_count = composition_count;
 5534|  2.64k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5534:39): [True: 2.58k, False: 60]
  ------------------
 5535|  2.58k|           input_count++) {
 5536|  2.58k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5537|       |
 5538|  2.58k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5538:13): [True: 1.23k, False: 1.35k]
  |  Branch (5538:49): [True: 1.22k, False: 6]
  ------------------
 5539|  1.22k|          int left = composition[0];
 5540|  1.22k|          int right = composition[1];
 5541|  1.22k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5541:15): [True: 0, False: 1.22k]
  |  Branch (5541:27): [True: 0, False: 1.22k]
  ------------------
 5542|  1.22k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5542:15): [True: 0, False: 1.22k]
  ------------------
 5543|      0|            break;
 5544|      0|          }
 5545|  4.38k|          while (left + 2 < right) {
  ------------------
  |  Branch (5545:18): [True: 3.15k, False: 1.22k]
  ------------------
 5546|  3.15k|            int middle = left + (((right - left) >> 1) & ~1);
 5547|  3.15k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5547:17): [True: 109, False: 3.04k]
  ------------------
 5548|  3.15k|                input[input_count + 1]) {
 5549|    109|              left = middle;
 5550|    109|            }
 5551|  3.15k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5551:17): [True: 3.05k, False: 99]
  ------------------
 5552|  3.15k|                input[input_count + 1]) {
 5553|  3.05k|              right = middle;
 5554|  3.05k|            }
 5555|  3.15k|          }
 5556|  1.22k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5556:15): [True: 1.22k, False: 0]
  ------------------
 5557|  1.22k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5557:15): [True: 19, False: 1.21k]
  ------------------
 5558|  1.22k|                  input[input_count + 1]) {
 5559|     19|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5560|     19|            input[initial_composition_count] = composed;
 5561|     19|            composition =
 5562|     19|                composition_block_row(composition_index[composed >> 8]) +
 5563|     19|                (composed % 256);
 5564|     19|            continue;
 5565|     19|          }
 5566|  1.22k|        }
 5567|       |
 5568|  2.56k|        if (ccc == 0) {
  ------------------
  |  Branch (5568:13): [True: 2.28k, False: 284]
  ------------------
 5569|  2.28k|          break;
 5570|  2.28k|        }
 5571|    284|        previous_ccc = ccc;
 5572|    284|        input[++composition_count] = input[input_count + 1];
 5573|    284|      }
 5574|  2.34k|    }
 5575|  2.35k|  }
 5576|       |
 5577|     60|  if (composition_count < input_count) {
  ------------------
  |  Branch (5577:7): [True: 14, False: 46]
  ------------------
 5578|     14|    input.resize(composition_count);
 5579|     14|  }
 5580|     60|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5582|     60|bool normalize(std::u32string& input) {
 5583|       |  /**
 5584|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5585|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5586|       |   */
 5587|     60|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5587:7): [True: 0, False: 60]
  |  Branch (5587:27): [True: 0, False: 60]
  ------------------
 5588|     60|      composition_index == nullptr) {
  ------------------
  |  Branch (5588:7): [True: 0, False: 60]
  ------------------
 5589|      0|    return false;
 5590|      0|  }
 5591|     60|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5591:7): [True: 0, False: 60]
  ------------------
 5592|      0|    return true;
 5593|      0|  }
 5594|     60|  decompose_nfc(input);
 5595|     60|  compose(input);
 5596|     60|  return true;
 5597|     60|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5657|    231|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5658|    231|  int32_t written_out{0};
 5659|    231|  out.reserve(out.size() + input.size());
 5660|    231|  uint32_t n = initial_n;
 5661|    231|  int32_t i = 0;
 5662|    231|  int32_t bias = initial_bias;
 5663|       |  // grab ascii content
 5664|    231|  size_t end_of_ascii = input.find_last_of('-');
 5665|    231|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5665:7): [True: 134, False: 97]
  ------------------
 5666|  1.66k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5666:20): [True: 1.66k, False: 134]
  ------------------
 5667|  1.66k|      if (c >= 0x80) {
  ------------------
  |  Branch (5667:11): [True: 0, False: 1.66k]
  ------------------
 5668|      0|        return false;
 5669|      0|      }
 5670|  1.66k|      out.push_back(c);
 5671|  1.66k|      written_out++;
 5672|  1.66k|    }
 5673|    134|    input.remove_prefix(end_of_ascii + 1);
 5674|    134|  }
 5675|  1.66k|  while (!input.empty()) {
  ------------------
  |  Branch (5675:10): [True: 1.47k, False: 188]
  ------------------
 5676|  1.47k|    int32_t oldi = i;
 5677|  1.47k|    int32_t w = 1;
 5678|  2.99k|    for (int32_t k = base;; k += base) {
 5679|  2.99k|      if (input.empty()) {
  ------------------
  |  Branch (5679:11): [True: 21, False: 2.97k]
  ------------------
 5680|     21|        return false;
 5681|     21|      }
 5682|  2.97k|      uint8_t code_point = input.front();
 5683|  2.97k|      input.remove_prefix(1);
 5684|  2.97k|      int32_t digit = char_to_digit_value(code_point);
 5685|  2.97k|      if (digit < 0) {
  ------------------
  |  Branch (5685:11): [True: 12, False: 2.96k]
  ------------------
 5686|     12|        return false;
 5687|     12|      }
 5688|  2.96k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5688:11): [True: 10, False: 2.95k]
  ------------------
 5689|     10|        return false;
 5690|     10|      }
 5691|  2.95k|      i = i + digit * w;
 5692|  2.95k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5692:19): [True: 688, False: 2.26k]
  |  Branch (5692:38): [True: 1.85k, False: 418]
  ------------------
 5693|  2.95k|      if (digit < t) {
  ------------------
  |  Branch (5693:11): [True: 1.43k, False: 1.52k]
  ------------------
 5694|  1.43k|        break;
 5695|  1.43k|      }
 5696|  1.52k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5696:11): [True: 0, False: 1.52k]
  ------------------
 5697|      0|        return false;
 5698|      0|      }
 5699|  1.52k|      w = w * (base - t);
 5700|  1.52k|    }
 5701|  1.43k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5702|  1.43k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5702:9): [True: 0, False: 1.43k]
  ------------------
 5703|      0|      return false;
 5704|      0|    }
 5705|  1.43k|    n = n + i / (written_out + 1);
 5706|  1.43k|    i = i % (written_out + 1);
 5707|  1.43k|    if (n < 0x80) {
  ------------------
  |  Branch (5707:9): [True: 0, False: 1.43k]
  ------------------
 5708|      0|      return false;
 5709|      0|    }
 5710|  1.43k|    out.insert(out.begin() + i, n);
 5711|  1.43k|    written_out++;
 5712|  1.43k|    ++i;
 5713|  1.43k|  }
 5714|       |  // See https://github.com/whatwg/url/issues/803
 5715|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5716|    188|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5716:7): [True: 166, False: 22]
  |  Branch (5716:26): [True: 12, False: 154]
  |  Branch (5716:44): [True: 8, False: 4]
  |  Branch (5716:62): [True: 2, False: 6]
  ------------------
 5717|      2|      out[3] == U'-') {
  ------------------
  |  Branch (5717:7): [True: 1, False: 1]
  ------------------
 5718|      1|    return false;
 5719|      1|  }
 5720|    187|  return true;
 5721|    188|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5801|    809|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5802|    809|  out.reserve(input.size() + out.size());
 5803|    809|  uint32_t n = initial_n;
 5804|    809|  int32_t d = 0;
 5805|    809|  int32_t bias = initial_bias;
 5806|    809|  size_t h = 0;
 5807|       |  // first push the ascii content
 5808|  8.42k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5808:19): [True: 8.42k, False: 809]
  ------------------
 5809|  8.42k|    if (c < 0x80) {
  ------------------
  |  Branch (5809:9): [True: 6.79k, False: 1.62k]
  ------------------
 5810|  6.79k|      ++h;
 5811|  6.79k|      out.push_back(char(c));
 5812|  6.79k|    }
 5813|  8.42k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5813:9): [True: 0, False: 8.42k]
  |  Branch (5813:26): [True: 526, False: 7.90k]
  |  Branch (5813:41): [True: 0, False: 526]
  ------------------
 5814|      0|      return false;
 5815|      0|    }
 5816|  8.42k|  }
 5817|    809|  size_t b = h;
 5818|    809|  if (b > 0) {
  ------------------
  |  Branch (5818:7): [True: 744, False: 65]
  ------------------
 5819|    744|    out.push_back('-');
 5820|    744|  }
 5821|  2.23k|  while (h < input.size()) {
  ------------------
  |  Branch (5821:10): [True: 1.42k, False: 809]
  ------------------
 5822|  1.42k|    uint32_t m = 0x10FFFF;
 5823|  26.7k|    for (auto code_point : input) {
  ------------------
  |  Branch (5823:26): [True: 26.7k, False: 1.42k]
  ------------------
 5824|  26.7k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5824:11): [True: 3.71k, False: 23.0k]
  |  Branch (5824:30): [True: 1.91k, False: 1.80k]
  ------------------
 5825|  26.7k|    }
 5826|       |
 5827|  1.42k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5827:9): [True: 0, False: 1.42k]
  ------------------
 5828|      0|      return false;
 5829|      0|    }
 5830|  1.42k|    d = d + int32_t((m - n) * (h + 1));
 5831|  1.42k|    n = m;
 5832|  26.7k|    for (auto c : input) {
  ------------------
  |  Branch (5832:17): [True: 26.7k, False: 1.42k]
  ------------------
 5833|  26.7k|      if (c < n) {
  ------------------
  |  Branch (5833:11): [True: 23.0k, False: 3.71k]
  ------------------
 5834|  23.0k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5834:13): [True: 0, False: 23.0k]
  ------------------
 5835|      0|          return false;
 5836|      0|        }
 5837|  23.0k|        ++d;
 5838|  23.0k|      }
 5839|  26.7k|      if (c == n) {
  ------------------
  |  Branch (5839:11): [True: 1.62k, False: 25.1k]
  ------------------
 5840|  1.62k|        int32_t q = d;
 5841|  5.10k|        for (int32_t k = base;; k += base) {
 5842|  5.10k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5842:23): [True: 1.92k, False: 3.17k]
  |  Branch (5842:42): [True: 2.76k, False: 408]
  ------------------
 5843|       |
 5844|  5.10k|          if (q < t) {
  ------------------
  |  Branch (5844:15): [True: 1.62k, False: 3.47k]
  ------------------
 5845|  1.62k|            break;
 5846|  1.62k|          }
 5847|  3.47k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5848|  3.47k|          q = (q - t) / (base - t);
 5849|  3.47k|        }
 5850|  1.62k|        out.push_back(digit_to_char(q));
 5851|  1.62k|        bias = adapt(d, int32_t(h + 1), h == b);
 5852|  1.62k|        d = 0;
 5853|  1.62k|        ++h;
 5854|  1.62k|      }
 5855|  26.7k|    }
 5856|  1.42k|    ++d;
 5857|  1.42k|    ++n;
 5858|  1.42k|  }
 5859|    809|  return true;
 5860|    809|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  1.11k|bool is_label_valid(const std::u32string_view label) {
 5945|  1.11k|  if (label.empty()) {
  ------------------
  |  Branch (5945:7): [True: 0, False: 1.11k]
  ------------------
 5946|      0|    return true;
 5947|      0|  }
 5948|  1.11k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5948:7): [True: 0, False: 1.11k]
  |  Branch (5948:27): [True: 0, False: 1.11k]
  |  Branch (5948:58): [True: 0, False: 1.11k]
  ------------------
 5949|  1.11k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5949:7): [True: 0, False: 1.11k]
  |  Branch (5949:31): [True: 0, False: 1.11k]
  ------------------
 5950|      0|    return false;
 5951|      0|  }
 5952|       |
 5953|       |  ///////////////
 5954|       |  // We have a normalization step which ensures that we are in NFC.
 5955|       |  // If we receive punycode, we normalize and check that the normalized
 5956|       |  // version matches the original.
 5957|       |  // --------------------------------------
 5958|       |  // The label must be in Unicode Normalization Form NFC.
 5959|       |
 5960|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5961|       |  // ---------------------------------------
 5962|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5963|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5964|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5965|       |
 5966|       |  // This is not necessary because we segment the
 5967|       |  // labels by '.'.
 5968|       |  // ---------------------------------------
 5969|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5970|       |  // if (label.find('.') != std::string_view::npos) return false;
 5971|       |
 5972|       |  // The label must not begin with a combining mark.
 5973|       |  // Range membership via lower_bound on range end.
 5974|  1.11k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5975|  1.11k|                                               combining_range_count};
 5976|  1.11k|  const auto comb_it = std::ranges::lower_bound(
 5977|  1.11k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5978|  1.11k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5978:7): [True: 1.11k, False: 0]
  |  Branch (5978:7): [True: 3, False: 1.11k]
  |  Branch (5978:37): [True: 3, False: 1.11k]
  ------------------
 5979|      3|    return false;
 5980|      3|  }
 5981|       |  // We verify this next step as part of the mapping:
 5982|       |  // ---------------------------------------------
 5983|       |  // Each code point in the label must only have certain status values
 5984|       |  // according to Section 5, IDNA Mapping Table:
 5985|       |  // - For Transitional Processing, each value must be valid.
 5986|       |  // - For Nontransitional Processing, each value must be either valid or
 5987|       |  // deviation.
 5988|       |
 5989|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 5990|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 5991|       |  // Applications (IDNA) [IDNA2008].
 5992|  1.11k|  constexpr static uint32_t virama[] = {
 5993|  1.11k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 5994|  1.11k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 5995|  1.11k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 5996|  1.11k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 5997|  1.11k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 5998|  1.11k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 5999|  1.11k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6000|  1.11k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6001|  1.11k|  constexpr static uint32_t R[] = {
 6002|  1.11k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6003|  1.11k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6004|  1.11k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6005|  1.11k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6006|  1.11k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6007|  1.11k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6008|  1.11k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6009|  1.11k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6010|  1.11k|  constexpr static uint32_t L[] = {0xa872};
 6011|  1.11k|  constexpr static uint32_t D[] = {
 6012|  1.11k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6013|  1.11k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6014|  1.11k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6015|  1.11k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6016|  1.11k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6017|  1.11k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6018|  1.11k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6019|  1.11k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6020|  1.11k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6021|  1.11k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6022|  1.11k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6023|  1.11k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6024|  1.11k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6025|  1.11k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6026|  1.11k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6027|  1.11k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6028|  1.11k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6029|  1.11k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6030|  1.11k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6031|  1.11k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6032|  1.11k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6033|  1.11k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6034|  1.11k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6035|  1.11k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6036|  1.11k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6037|  1.11k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6038|  1.11k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6039|  1.11k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6040|  1.11k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6041|  1.11k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6042|  1.11k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6043|  1.11k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6044|  1.11k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6045|  1.11k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6046|  1.11k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6047|  1.11k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6048|  1.11k|      0xa870, 0xa871};
 6049|       |
 6050|  16.1k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6050:22): [True: 15.0k, False: 1.01k]
  ------------------
 6051|  15.0k|    uint32_t c = label[i];
 6052|  15.0k|    if (c == 0x200c) {
  ------------------
  |  Branch (6052:9): [True: 83, False: 15.0k]
  ------------------
 6053|     83|      if (i > 0) {
  ------------------
  |  Branch (6053:11): [True: 82, False: 1]
  ------------------
 6054|     82|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6054:13): [True: 1, False: 81]
  ------------------
 6055|      1|          return true;
 6056|      1|        }
 6057|     82|      }
 6058|     82|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6058:11): [True: 1, False: 81]
  |  Branch (6058:23): [True: 2, False: 79]
  ------------------
 6059|      3|        return false;
 6060|      3|      }
 6061|       |      // we go backward looking for L or D
 6062|     79|      auto is_l_or_d = [](uint32_t code) {
 6063|     79|        return std::ranges::binary_search(L, code) ||
 6064|     79|               std::ranges::binary_search(D, code);
 6065|     79|      };
 6066|     79|      auto is_r_or_d = [](uint32_t code) {
 6067|     79|        return std::ranges::binary_search(R, code) ||
 6068|     79|               std::ranges::binary_search(D, code);
 6069|     79|      };
 6070|     79|      std::u32string_view before = label.substr(0, i);
 6071|     79|      std::u32string_view after = label.substr(i + 1);
 6072|     79|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6072:14): [True: 52, False: 27]
  ------------------
 6073|     79|              before.end()) &&
 6074|     52|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6074:14): [True: 14, False: 38]
  ------------------
 6075|     52|              after.end());
 6076|  15.0k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6076:16): [True: 12, False: 14.9k]
  ------------------
 6077|     12|      if (i > 0) {
  ------------------
  |  Branch (6077:11): [True: 11, False: 1]
  ------------------
 6078|     11|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6078:13): [True: 0, False: 11]
  ------------------
 6079|      0|          return true;
 6080|      0|        }
 6081|     11|      }
 6082|     12|      return false;
 6083|     12|    }
 6084|  15.0k|  }
 6085|       |
 6086|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6087|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6088|       |  // Section 2.
 6089|       |
 6090|       |  // The following rule, consisting of six conditions, applies to labels
 6091|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6092|       |  // described in Section 3.  All of the conditions must be satisfied for
 6093|       |  // the rule to be satisfied.
 6094|       |  //
 6095|       |  //  1.  The first character must be a character with Bidi property L, R,
 6096|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6097|       |  //     has the L property, it is an LTR label.
 6098|       |  //
 6099|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6100|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6101|       |  //
 6102|       |  //   3.  In an RTL label, the end of the label must be a character with
 6103|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6104|       |  //       characters with Bidi property NSM.
 6105|       |  //
 6106|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6107|       |  //       vice versa.
 6108|       |  //
 6109|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6110|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6111|       |  //
 6112|       |  //   6.  In an LTR label, the end of the label must be a character with
 6113|       |  //       Bidi property L or EN, followed by zero or more characters with
 6114|       |  //       Bidi property NSM.
 6115|       |
 6116|  1.01k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6117|  1.01k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6117:7): [True: 0, False: 1.01k]
  ------------------
 6118|      0|    return false;
 6119|      0|  }
 6120|       |
 6121|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6122|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6123|       |  // domain names.
 6124|  1.01k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6124:7): [True: 226, False: 793]
  ------------------
 6125|       |    // The first character must be a character with Bidi property L, R,
 6126|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6127|       |    // has the L property, it is an LTR label.
 6128|       |
 6129|    226|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6129:9): [True: 79, False: 147]
  ------------------
 6130|       |      // Eval as LTR
 6131|       |
 6132|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6133|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6134|  1.89k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6134:26): [True: 1.89k, False: 0]
  ------------------
 6135|  1.89k|        const direction d = find_direction(label[i]);
 6136|  1.89k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6136:15): [True: 799, False: 1.09k]
  |  Branch (6136:36): [True: 316, False: 782]
  |  Branch (6136:58): [True: 221, False: 561]
  ------------------
 6137|    561|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6137:15): [True: 110, False: 451]
  |  Branch (6137:37): [True: 76, False: 375]
  |  Branch (6137:59): [True: 150, False: 225]
  ------------------
 6138|    225|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6138:15): [True: 131, False: 94]
  |  Branch (6138:37): [True: 15, False: 79]
  ------------------
 6139|     79|          return false;
 6140|     79|        }
 6141|  1.89k|      }
 6142|       |
 6143|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6144|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6144:13): [True: 0, False: 0]
  |  Branch (6144:41): [True: 0, False: 0]
  ------------------
 6145|      0|        return false;
 6146|      0|      }
 6147|       |
 6148|      0|      return true;
 6149|       |
 6150|    147|    } else {
 6151|       |      // Eval as RTL
 6152|       |
 6153|       |      // The first character must be R or AL; a leading AN (or any other
 6154|       |      // direction) does not start a valid RTL label.
 6155|    147|      const direction first_dir = find_direction(label[0]);
 6156|    147|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6156:11): [True: 101, False: 46]
  |  Branch (6156:40): [True: 22, False: 79]
  ------------------
 6157|     22|        return false;
 6158|     22|      }
 6159|       |
 6160|    125|      bool has_an = false;
 6161|    125|      bool has_en = false;
 6162|  1.56k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6162:26): [True: 1.50k, False: 63]
  ------------------
 6163|  1.50k|        const direction d = find_direction(label[i]);
 6164|       |
 6165|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6166|       |        // versa.
 6167|  1.50k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6167:14): [True: 377, False: 1.12k]
  |  Branch (6167:37): [True: 377, False: 0]
  |  Branch (6167:56): [True: 1, False: 376]
  ------------------
 6168|  1.50k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6168:14): [True: 2, False: 1.49k]
  |  Branch (6168:37): [True: 2, False: 0]
  |  Branch (6168:56): [True: 0, False: 2]
  ------------------
 6169|      1|          return false;
 6170|      1|        }
 6171|       |
 6172|  1.50k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6172:15): [True: 58, False: 1.44k]
  |  Branch (6172:36): [True: 153, False: 1.28k]
  |  Branch (6172:58): [True: 2, False: 1.28k]
  ------------------
 6173|  1.28k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6173:15): [True: 376, False: 911]
  |  Branch (6173:37): [True: 227, False: 684]
  |  Branch (6173:59): [True: 157, False: 527]
  ------------------
 6174|    527|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6174:15): [True: 114, False: 413]
  |  Branch (6174:37): [True: 198, False: 215]
  |  Branch (6174:59): [True: 124, False: 91]
  ------------------
 6175|     91|              d == direction::NSM)) {
  ------------------
  |  Branch (6175:15): [True: 45, False: 46]
  ------------------
 6176|     46|          return false;
 6177|     46|        }
 6178|       |
 6179|  1.45k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6179:13): [True: 78, False: 1.37k]
  ------------------
 6180|     78|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6180:15): [True: 2, False: 76]
  |  Branch (6180:36): [True: 4, False: 72]
  |  Branch (6180:58): [True: 1, False: 71]
  ------------------
 6181|     71|              d == direction::EN)) {
  ------------------
  |  Branch (6181:15): [True: 56, False: 15]
  ------------------
 6182|     15|          return false;
 6183|     15|        }
 6184|  1.45k|      }
 6185|       |
 6186|     63|      return true;
 6187|    125|    }
 6188|    226|  }
 6189|       |
 6190|    793|  return true;
 6191|  1.01k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6348|  1.51k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6349|  1.51k|  out.clear();
 6350|  1.51k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6350:7): [True: 0, False: 1.51k]
  ------------------
 6351|      0|    return false;
 6352|      0|  }
 6353|  1.51k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6353:7): [True: 346, False: 1.16k]
  ------------------
 6354|    346|    from_ascii_to_ascii(ut8_string, out);
 6355|    346|    return true;
 6356|    346|  }
 6357|       |
 6358|       |#ifdef ADA_USE_SIMDUTF
 6359|       |  size_t utf32_length =
 6360|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6361|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6362|       |    return false;
 6363|       |  }
 6364|       |  std::u32string working(utf32_length, U'\0');
 6365|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6366|       |      ut8_string.data(), ut8_string.size(), working.data());
 6367|       |#else
 6368|  1.16k|  size_t utf32_length =
 6369|  1.16k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6370|  1.16k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6370:7): [True: 3, False: 1.16k]
  |  Branch (6370:28): [True: 3, False: 0]
  ------------------
 6371|      3|    return false;
 6372|      3|  }
 6373|  1.16k|  std::u32string working(utf32_length, U'\0');
 6374|  1.16k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6375|  1.16k|      ut8_string.data(), ut8_string.size(), working.data());
 6376|  1.16k|#endif
 6377|  1.16k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6377:7): [True: 164, False: 998]
  |  Branch (6377:35): [True: 0, False: 998]
  ------------------
 6378|    164|    return false;
 6379|    164|  }
 6380|    998|  working.resize(actual_utf32_length);
 6381|       |
 6382|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6383|    998|  std::u32string mapped;
 6384|    998|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6384:7): [True: 37, False: 961]
  ------------------
 6385|     37|    return false;
 6386|     37|  }
 6387|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6388|    961|  working.clear();
 6389|       |
 6390|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6391|    961|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6391:7): [True: 679, False: 282]
  |  Branch (6391:28): [True: 25, False: 654]
  ------------------
 6392|     25|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6392:9): [True: 0, False: 25]
  ------------------
 6393|      0|      return false;
 6394|      0|    }
 6395|     25|  }
 6396|       |
 6397|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6398|    961|  out.reserve(mapped.size() + 8);
 6399|       |
 6400|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6401|    961|  const char32_t* p = mapped.data();
 6402|    961|  const char32_t* const end = p + mapped.size();
 6403|    961|  std::u32string post_map;
 6404|       |
 6405|  3.31k|  while (p < end) {
  ------------------
  |  Branch (6405:10): [True: 2.75k, False: 555]
  ------------------
 6406|  2.75k|    const char32_t* label_begin = p;
 6407|  29.4k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6407:12): [True: 28.8k, False: 585]
  |  Branch (6407:23): [True: 26.6k, False: 2.17k]
  ------------------
 6408|  26.6k|      ++p;
 6409|  26.6k|    }
 6410|  2.75k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6411|  2.75k|    std::u32string_view label_view(label_begin, label_size);
 6412|  2.75k|    const bool is_last_label = (p == end);
 6413|  2.75k|    if (p < end) {
  ------------------
  |  Branch (6413:9): [True: 2.17k, False: 585]
  ------------------
 6414|  2.17k|      ++p;  // skip dot
 6415|  2.17k|    }
 6416|       |
 6417|  2.75k|    if (label_size == 0) {
  ------------------
  |  Branch (6417:9): [True: 298, False: 2.46k]
  ------------------
 6418|       |      // empty label
 6419|  2.46k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6419:16): [True: 236, False: 2.22k]
  ------------------
 6420|  5.97k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6420:23): [True: 5.97k, False: 231]
  ------------------
 6421|  5.97k|        if (c >= 0x80) {
  ------------------
  |  Branch (6421:13): [True: 5, False: 5.96k]
  ------------------
 6422|      5|          out.clear();
 6423|      5|          return false;
 6424|      5|        }
 6425|  5.97k|      }
 6426|    231|      append_ascii_label(out, label_view);
 6427|    231|      std::string_view puny_segment_ascii(
 6428|    231|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6429|    231|      working.clear();
 6430|    231|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6430:11): [True: 44, False: 187]
  ------------------
 6431|     44|        out.clear();
 6432|     44|        return false;
 6433|     44|      }
 6434|    187|      if (is_ascii(working)) {
  ------------------
  |  Branch (6434:11): [True: 4, False: 183]
  ------------------
 6435|      4|        out.clear();
 6436|      4|        return false;
 6437|      4|      }
 6438|    183|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6438:11): [True: 58, False: 125]
  |  Branch (6438:49): [True: 14, False: 111]
  ------------------
 6439|     72|        out.clear();
 6440|     72|        return false;
 6441|     72|      }
 6442|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6443|    111|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6443:11): [True: 111, False: 0]
  |  Branch (6443:34): [True: 35, False: 76]
  ------------------
 6444|     35|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6444:13): [True: 0, False: 35]
  |  Branch (6444:37): [True: 35, False: 0]
  ------------------
 6445|     35|          out.clear();
 6446|     35|          return false;
 6447|     35|        }
 6448|     35|      }
 6449|     76|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6449:11): [True: 0, False: 76]
  |  Branch (6449:31): [True: 14, False: 62]
  ------------------
 6450|     14|        out.clear();
 6451|     14|        return false;
 6452|     14|      }
 6453|  2.22k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6453:16): [True: 1.18k, False: 1.04k]
  ------------------
 6454|  1.18k|      append_ascii_label(out, label_view);
 6455|  1.18k|    } else {
 6456|  1.04k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6456:11): [True: 232, False: 809]
  ------------------
 6457|    232|        out.clear();
 6458|    232|        return false;
 6459|    232|      }
 6460|    809|      out.append("xn--");
 6461|    809|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6461:11): [True: 0, False: 809]
  ------------------
 6462|      0|        out.clear();
 6463|      0|        return false;
 6464|      0|      }
 6465|    809|    }
 6466|  2.35k|    if (!is_last_label) {
  ------------------
  |  Branch (6466:9): [True: 1.83k, False: 514]
  ------------------
 6467|  1.83k|      out.push_back('.');
 6468|  1.83k|    }
 6469|  2.35k|  }
 6470|    555|  return true;
 6471|    961|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6473|  1.51k|std::string to_ascii(std::string_view ut8_string) {
 6474|  1.51k|  std::string out;
 6475|  1.51k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6475:7): [True: 610, False: 901]
  ------------------
 6476|    610|    return {};
 6477|    610|  }
 6478|    901|  return out;
 6479|  1.51k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7169|  1.27k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7170|       |  // next line is for safety only, we expect users to avoid calling
 7171|       |  // percent_decode when first_percent is outside the range.
 7172|  1.27k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7172:7): [True: 0, False: 1.27k]
  ------------------
 7173|      0|    return std::string(input);
 7174|      0|  }
 7175|       |
 7176|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7177|  1.27k|  const char* const src = input.data();
 7178|  1.27k|  const char* const end = src + input.size();
 7179|       |
 7180|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7181|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7182|       |  // byte-at-a-time appends of the naive version.
 7183|  1.27k|  std::string out(input.size(), '\0');
 7184|  1.27k|  char* d = out.data();
 7185|  1.27k|  char* const d0 = d;
 7186|       |
 7187|  1.27k|  std::memcpy(d, src, first_percent);
 7188|  1.27k|  d += first_percent;
 7189|       |
 7190|  1.27k|  const char* p = src + first_percent;
 7191|  6.16k|  while (p < end) {
  ------------------
  |  Branch (7191:10): [True: 4.89k, False: 1.27k]
  ------------------
 7192|  4.89k|    if (*p == '%') {
  ------------------
  |  Branch (7192:9): [True: 3.04k, False: 1.84k]
  ------------------
 7193|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7194|  9.44k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7194:14): [True: 8.55k, False: 892]
  |  Branch (7194:29): [True: 7.81k, False: 737]
  ------------------
 7195|  7.81k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7195:13): [True: 1.03k, False: 6.77k]
  |  Branch (7195:42): [True: 383, False: 6.39k]
  ------------------
 7196|  1.41k|          break;
 7197|  1.41k|        }
 7198|  6.39k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7199|  6.39k|                                 convert_hex_to_binary(p[2]));
 7200|  6.39k|        p += 3;
 7201|  6.39k|      }
 7202|  3.04k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7202:11): [True: 2.63k, False: 411]
  |  Branch (7202:22): [True: 1.53k, False: 1.10k]
  ------------------
 7203|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7204|       |        // literally and keep scanning after it.
 7205|  1.53k|        *d++ = *p++;
 7206|  1.53k|      }
 7207|  3.04k|    } else {
 7208|  1.84k|      const char* q = static_cast<const char*>(
 7209|  1.84k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7210|  1.84k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7210:29): [True: 1.04k, False: 795]
  ------------------
 7211|  1.84k|      const size_t n = static_cast<size_t>(run_end - p);
 7212|  1.84k|      std::memcpy(d, p, n);
 7213|  1.84k|      d += n;
 7214|  1.84k|      p = run_end;
 7215|  1.84k|    }
 7216|  4.89k|  }
 7217|       |
 7218|  1.27k|  out.resize(static_cast<size_t>(d - d0));
 7219|  1.27k|  return out;
 7220|  1.27k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7305|  26.3k|                           const uint8_t character_set[]) {
 7306|  26.3k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7307|  26.3k|    return character_sets::bit_at(character_set, c);
 7308|  26.3k|  });
 7309|       |  // Optimization: Don't iterate if percent encode is not required
 7310|  26.3k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7310:7): [True: 19.6k, False: 6.65k]
  ------------------
 7311|  19.6k|    return std::string(input);
 7312|  19.6k|  }
 7313|       |
 7314|  6.65k|  std::string result;
 7315|  6.65k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7316|       |                                   // produce 3 characters.
 7317|  6.65k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7318|       |
 7319|  78.8k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7319:10): [True: 72.1k, False: 6.65k]
  ------------------
 7320|  72.1k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7320:9): [True: 44.9k, False: 27.2k]
  ------------------
 7321|  44.9k|      result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7322|  44.9k|    } else {
 7323|  27.2k|      result += *pointer;
 7324|  27.2k|    }
 7325|  72.1k|  }
 7326|       |
 7327|  6.65k|  return result;
 7328|  26.3k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7366|  1.51k|              size_t first_percent) {
 7367|  1.51k|  std::string percent_decoded_buffer;
 7368|  1.51k|  std::string_view input = plain;
 7369|  1.51k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7369:7): [True: 231, False: 1.28k]
  ------------------
 7370|    231|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7371|    231|    input = percent_decoded_buffer;
 7372|    231|  }
 7373|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7374|  1.51k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7375|  1.51k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7375:7): [True: 611, False: 900]
  |  Branch (7375:29): [True: 243, False: 657]
  ------------------
 7376|    900|                                idna_ascii.data(), idna_ascii.size())) {
 7377|    854|    return false;
 7378|    854|  }
 7379|    657|  out = std::move(idna_ascii);
 7380|    657|  return true;
 7381|  1.51k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7384|  21.2k|                           const uint8_t character_set[], size_t index) {
 7385|  21.2k|  std::string out;
 7386|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7387|  21.2k|  out.append(input.data(), index);
 7388|  21.2k|  auto pointer = input.begin() + index;
 7389|  89.8k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7389:10): [True: 68.5k, False: 21.2k]
  ------------------
 7390|  68.5k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7390:9): [True: 27.1k, False: 41.4k]
  ------------------
 7391|  27.1k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7392|  41.4k|    } else {
 7393|  41.4k|      out += *pointer;
 7394|  41.4k|    }
 7395|  68.5k|  }
 7396|  21.2k|  return out;
 7397|  21.2k|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7461|  7.09k|    size_t& compress_length) noexcept {
 7462|  7.09k|  compress = 0;
 7463|  7.09k|  compress_length = 0;
 7464|  7.09k|  size_t i = 0;
 7465|  60.3k|  while (i < 8) {
  ------------------
  |  Branch (7465:10): [True: 53.2k, False: 7.09k]
  ------------------
 7466|  53.2k|    if (address[i] != 0) {
  ------------------
  |  Branch (7466:9): [True: 51.8k, False: 1.37k]
  ------------------
 7467|  51.8k|      ++i;
 7468|  51.8k|      continue;
 7469|  51.8k|    }
 7470|  1.37k|    size_t next = i + 1;
 7471|  4.89k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7471:12): [True: 4.28k, False: 614]
  |  Branch (7471:24): [True: 3.52k, False: 759]
  ------------------
 7472|  3.52k|      ++next;
 7473|  3.52k|    }
 7474|  1.37k|    const size_t count = next - i;
 7475|  1.37k|    if (count > compress_length) {
  ------------------
  |  Branch (7475:9): [True: 1.27k, False: 100]
  ------------------
 7476|  1.27k|      compress_length = count;
 7477|  1.27k|      compress = i;
 7478|  1.27k|    }
 7479|  1.37k|    i = next;
 7480|  1.37k|  }
 7481|  7.09k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7483|  3.55k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7484|  3.55k|  size_t compress = 0;
 7485|  3.55k|  size_t compress_length = 0;
 7486|  3.55k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7487|       |
 7488|       |  // Skip compression when the longest zero run is a single piece.
 7489|  3.55k|  if (compress_length <= 1) {
  ------------------
  |  Branch (7489:7): [True: 3.17k, False: 377]
  ------------------
 7490|  3.17k|    compress = compress_length = 8;
 7491|  3.17k|  }
 7492|       |
 7493|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7494|  3.55k|  std::string output(4 * 8 + 7 + 2, '\0');
 7495|  3.55k|  char* point = output.data();
 7496|  3.55k|  *point++ = '[';
 7497|  3.55k|  size_t piece_index = 0;
 7498|  26.5k|  while (true) {
  ------------------
  |  Branch (7498:10): [True: 26.5k, Folded]
  ------------------
 7499|  26.5k|    if (piece_index == compress) {
  ------------------
  |  Branch (7499:9): [True: 377, False: 26.1k]
  ------------------
 7500|    377|      *point++ = ':';
 7501|       |      // If we skip a value initially, we need to write '::'.
 7502|    377|      if (piece_index == 0) {
  ------------------
  |  Branch (7502:11): [True: 197, False: 180]
  ------------------
 7503|    197|        *point++ = ':';
 7504|    197|      }
 7505|    377|      piece_index += compress_length;
 7506|    377|      if (piece_index == 8) {
  ------------------
  |  Branch (7506:11): [True: 270, False: 107]
  ------------------
 7507|    270|        break;
 7508|    270|      }
 7509|    377|    }
 7510|  26.2k|    point = write_hex_u16(point, address[piece_index]);
 7511|  26.2k|    ++piece_index;
 7512|  26.2k|    if (piece_index == 8) {
  ------------------
  |  Branch (7512:9): [True: 3.28k, False: 22.9k]
  ------------------
 7513|  3.28k|      break;
 7514|  3.28k|    }
 7515|  22.9k|    *point++ = ':';
 7516|  22.9k|  }
 7517|  3.55k|  *point++ = ']';
 7518|  3.55k|  output.resize(static_cast<size_t>(point - output.data()));
 7519|  3.55k|  return output;
 7520|  3.55k|}
_ZN3ada11serializers4ipv4Em:
 7522|  4.00k|std::string ipv4(const uint64_t address) {
 7523|  4.00k|  std::string output(15, '\0');
 7524|  4.00k|  char* point = output.data();
 7525|  4.00k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7526|  4.00k|  *point++ = '.';
 7527|  4.00k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7528|  4.00k|  *point++ = '.';
 7529|  4.00k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7530|  4.00k|  *point++ = '.';
 7531|  4.00k|  point = write_u8(point, static_cast<uint8_t>(address));
 7532|  4.00k|  output.resize(static_cast<size_t>(point - output.data()));
 7533|  4.00k|  return output;
 7534|  4.00k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 7884|  6.41k|    std::string_view input, const result_type* base_url) {
 7885|  6.41k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 7886|  6.41k|  if (!u.is_valid) {
  ------------------
  |  Branch (7886:7): [True: 5.22k, False: 1.19k]
  ------------------
 7887|  5.22k|    return tl::unexpected(errors::type_error);
 7888|  5.22k|  }
 7889|  1.19k|  return u;
 7890|  6.41k|}
_ZN3ada20get_max_input_lengthEv:
 7556|  6.41k|uint32_t get_max_input_length() {
 7557|  6.41k|  return max_input_length_.load(std::memory_order_relaxed);
 7558|  6.41k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8859|  6.30k|void trim_c0_whitespace(std::string_view& input) noexcept {
 8860|  6.30k|  while (!input.empty() &&
  ------------------
  |  Branch (8860:10): [True: 6.30k, False: 0]
  ------------------
 8861|  6.30k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (8861:10): [True: 0, False: 6.30k]
  ------------------
 8862|      0|    input.remove_prefix(1);
 8863|      0|  }
 8864|  6.30k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (8864:10): [True: 6.30k, False: 0]
  |  Branch (8864:28): [True: 0, False: 6.30k]
  ------------------
 8865|      0|    input.remove_suffix(1);
 8866|      0|  }
 8867|  6.30k|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
10503|  6.41k|                           const result_type* base_url) {
10504|       |  // We can specialize the implementation per type.
10505|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
10506|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
10507|       |  // something else } is free (at runtime). This means that ada::url_aggregator
10508|       |  // and ada::url **do not have to support the exact same API**.
10509|  6.41k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
10510|  6.41k|  constexpr bool result_type_is_ada_url_aggregator =
10511|  6.41k|      std::is_same_v<url_aggregator, result_type>;
10512|  6.41k|  static_assert(result_type_is_ada_url ||
10513|  6.41k|                result_type_is_ada_url_aggregator);  // We don't support
10514|       |                                                     // anything else for now.
10515|       |
10516|  6.41k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
10517|  6.41k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
10518|  6.41k|          ")");
10519|       |
10520|  6.41k|  state state = state::SCHEME_START;
10521|  6.41k|  result_type url{};
10522|       |
10523|  6.41k|  const uint32_t max_input_length = ada::get_max_input_length();
10524|       |
10525|       |  // We refuse to parse URL strings that exceed the maximum input length.
10526|       |  // By default, this is 4GB but can be configured via
10527|       |  // ada::set_max_input_length().
10528|  6.41k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10528:7): [True: 0, False: 6.41k]
  ------------------
10529|      0|    url.is_valid = false;
10530|      0|  }
10531|       |  // Going forward, user_input.size() is in [0,
10532|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
10533|       |  // base, or the optional_url was invalid, we must return.
10534|  6.41k|  if (base_url != nullptr) {
  ------------------
  |  Branch (10534:7): [True: 0, False: 6.41k]
  ------------------
10535|      0|    url.is_valid &= base_url->is_valid;
10536|      0|  }
10537|  6.41k|  if (!url.is_valid) {
  ------------------
  |  Branch (10537:7): [True: 0, False: 6.41k]
  ------------------
10538|      0|    return url;
10539|      0|  }
10540|       |
10541|       |  // Simple absolute http(s) fast path (before tabs/newline scan).
10542|       |  // Skip digit-led hosts (IPv4) with a cheap peek.
10543|  6.41k|  if constexpr (store_values) {
10544|  6.41k|    if (base_url == nullptr) {
  ------------------
  |  Branch (10544:9): [True: 6.41k, False: 0]
  ------------------
10545|  6.41k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
10546|  6.41k|      const size_t n = user_input.size();
10547|  6.41k|      const bool digit_led_host = (n >= 8 && p[4] == ':' && p[5] == '/' &&
  ------------------
  |  Branch (10547:36): [True: 6.41k, False: 0]
  |  Branch (10547:46): [True: 6.41k, False: 0]
  |  Branch (10547:61): [True: 6.41k, False: 0]
  ------------------
10548|  6.41k|                                   p[6] == '/' && p[7] >= '0' && p[7] <= '9') ||
  ------------------
  |  Branch (10548:36): [True: 6.41k, False: 0]
  |  Branch (10548:51): [True: 5.88k, False: 527]
  |  Branch (10548:66): [True: 962, False: 4.92k]
  ------------------
10549|  5.45k|                                  (n >= 9 && p[5] == ':' && p[6] == '/' &&
  ------------------
  |  Branch (10549:36): [True: 5.45k, False: 0]
  |  Branch (10549:46): [True: 0, False: 5.45k]
  |  Branch (10549:61): [True: 0, False: 0]
  ------------------
10550|      0|                                   p[7] == '/' && p[8] >= '0' && p[8] <= '9');
  ------------------
  |  Branch (10550:36): [True: 0, False: 0]
  |  Branch (10550:51): [True: 0, False: 0]
  |  Branch (10550:66): [True: 0, False: 0]
  ------------------
10551|  6.41k|      if (!digit_led_host && try_parse_simple_absolute(user_input, url)) {
  ------------------
  |  Branch (10551:11): [True: 5.45k, False: 962]
  |  Branch (10551:30): [True: 106, False: 5.34k]
  ------------------
10552|    106|        if constexpr (result_type_is_ada_url_aggregator) {
10553|    106|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (10553:15): [True: 0, False: 106]
  ------------------
10554|      0|            url.is_valid = false;
10555|      0|          }
10556|       |        } else {
10557|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
10558|       |            url.is_valid = false;
10559|       |          }
10560|       |        }
10561|    106|        return url;
10562|    106|      }
10563|  6.41k|    }
10564|  6.41k|  }
10565|       |
10566|  6.30k|  std::string tmp_buffer;
10567|  6.41k|  std::string_view url_data;
10568|  6.41k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (10568:7): [True: 211, False: 6.20k]
  ------------------
10569|    211|    tmp_buffer = user_input;
10570|       |    // Optimization opportunity: Instead of copying and then pruning, we could
10571|       |    // just directly build the string from user_input.
10572|    211|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
10573|    211|    url_data = tmp_buffer;
10574|  6.20k|  } else [[likely]] {
10575|  6.20k|    url_data = user_input;
10576|  6.20k|  }
10577|       |
10578|       |  // Leading and trailing control characters are uncommon and easy to deal with
10579|       |  // (no performance concern).
10580|  6.41k|  helpers::trim_c0_whitespace(url_data);
10581|       |
10582|  6.41k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
10583|       |    // Most of the time, we just need user_input.size().
10584|       |    // In some instances, we may need a bit more.
10585|       |    ///////////////////////////
10586|       |    // This is *very* important. This line should *not* be removed
10587|       |    // hastily. There are principled reasons why reserve is important
10588|       |    // for performance. If you have a benchmark with small inputs,
10589|       |    // it may not matter, but in other instances, it could.
10590|       |    ////
10591|       |    // This rounds up to the next power of two.
10592|       |    // We know that user_input.size() is in [0,
10593|       |    // std::numeric_limits<uint32_t>::max).
10594|  6.41k|    uint32_t reserve_capacity =
10595|  6.41k|        (0xFFFFFFFF >>
10596|  6.41k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
10597|  6.41k|        1;
10598|  6.41k|    url.reserve(reserve_capacity);
10599|  6.41k|  }
10600|       |
10601|       |  // Optimization opportunity. Most websites do not have fragment.
10602|  6.41k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
10603|       |  // We add it last so that an implementation like ada::url_aggregator
10604|       |  // can append it last to its internal buffer, thus improving performance.
10605|       |
10606|       |  // Here url_data no longer has its fragment.
10607|       |  // We are going to access the data from url_data (it is immutable).
10608|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
10609|       |  // The input_position variable should range from 0 to input_size.
10610|       |  // It is illegal to access url_data at input_size.
10611|  6.41k|  size_t input_position = 0;
10612|  6.41k|  const size_t input_size = url_data.size();
10613|       |  // Keep running the following state machine by switching on state.
10614|       |  // If after a run pointer points to the EOF code point, go to the next step.
10615|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
10616|       |  // We never decrement input_position.
10617|  35.0k|  while (input_position <= input_size) {
  ------------------
  |  Branch (10617:10): [True: 34.2k, False: 811]
  ------------------
10618|  34.2k|    ada_log("In parsing at ", input_position, " out of ", input_size,
10619|  34.2k|            " in state ", ada::to_string(state));
10620|  34.2k|    switch (state) {
10621|  6.30k|      case state::SCHEME_START: {
  ------------------
  |  Branch (10621:7): [True: 6.30k, False: 27.8k]
  ------------------
10622|  6.30k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
10623|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
10624|       |        // state to scheme state.
10625|  6.30k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10625:13): [True: 6.30k, False: 0]
  ------------------
10626|  6.30k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (10626:13): [True: 6.30k, False: 0]
  ------------------
10627|  6.30k|          state = state::SCHEME;
10628|  6.30k|          input_position++;
10629|  6.30k|        } else {
10630|       |          // Otherwise, if state override is not given, set state to no scheme
10631|       |          // state and decrease pointer by 1.
10632|      0|          state = state::NO_SCHEME;
10633|      0|        }
10634|  6.30k|        break;
10635|      0|      }
10636|  6.30k|      case state::SCHEME: {
  ------------------
  |  Branch (10636:7): [True: 6.30k, False: 27.8k]
  ------------------
10637|  6.30k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
10638|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
10639|       |        // append c, lowercased, to buffer.
10640|  25.2k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (10640:16): [True: 25.2k, False: 0]
  ------------------
10641|  25.2k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (10641:16): [True: 18.9k, False: 6.30k]
  ------------------
10642|  18.9k|          input_position++;
10643|  18.9k|        }
10644|       |        // Otherwise, if c is U+003A (:), then:
10645|  6.30k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10645:13): [True: 6.30k, False: 0]
  ------------------
10646|  6.30k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (10646:13): [True: 6.30k, False: 0]
  ------------------
10647|  6.30k|          ada_log("SCHEME the scheme should be ",
10648|  6.30k|                  url_data.substr(0, input_position));
10649|       |          if constexpr (result_type_is_ada_url) {
10650|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
10651|       |              return url;
10652|       |            }
10653|  6.30k|          } else {
10654|       |            // we pass the colon along instead of painfully adding it back.
10655|  6.30k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (10655:17): [True: 0, False: 6.30k]
  ------------------
10656|  6.30k|                    url_data.substr(0, input_position + 1))) {
10657|      0|              return url;
10658|      0|            }
10659|  6.30k|          }
10660|  6.30k|          ada_log("SCHEME the scheme is ", url.get_protocol());
10661|       |
10662|       |          // If url's scheme is "file", then:
10663|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
10664|  6.30k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (10664:15): [True: 0, False: 6.30k]
  ------------------
10665|       |            // Set state to file state.
10666|      0|            state = state::FILE;
10667|      0|          }
10668|       |          // Otherwise, if url is special, base is non-null, and base's scheme
10669|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
10670|       |          // != nullptr is false.
10671|  6.30k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (10671:20): [True: 6.30k, False: 0]
  |  Branch (10671:40): [True: 0, False: 6.30k]
  ------------------
10672|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (10672:20): [True: 0, False: 0]
  ------------------
10673|       |            // Set state to special relative or authority state.
10674|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
10675|      0|          }
10676|       |          // Otherwise, if url is special, set state to special authority
10677|       |          // slashes state.
10678|  6.30k|          else if (url.is_special()) {
  ------------------
  |  Branch (10678:20): [True: 6.30k, False: 0]
  ------------------
10679|  6.30k|            state = state::SPECIAL_AUTHORITY_SLASHES;
10680|  6.30k|          }
10681|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
10682|       |          // path or authority state and increase pointer by 1.
10683|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (10683:20): [True: 0, False: 0]
  ------------------
10684|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (10684:20): [True: 0, False: 0]
  ------------------
10685|      0|            state = state::PATH_OR_AUTHORITY;
10686|      0|            input_position++;
10687|      0|          }
10688|       |          // Otherwise, set url's path to the empty string and set state to
10689|       |          // opaque path state.
10690|      0|          else {
10691|      0|            state = state::OPAQUE_PATH;
10692|      0|          }
10693|  6.30k|        }
10694|       |        // Otherwise, if state override is not given, set buffer to the empty
10695|       |        // string, state to no scheme state, and start over (from the first code
10696|       |        // point in input).
10697|      0|        else {
10698|      0|          state = state::NO_SCHEME;
10699|      0|          input_position = 0;
10700|      0|          break;
10701|      0|        }
10702|  6.30k|        input_position++;
10703|  6.30k|        break;
10704|  6.30k|      }
10705|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (10705:7): [True: 0, False: 34.2k]
  ------------------
10706|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
10707|       |        // The fragment was pruned from url_data before the state machine ran,
10708|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
10709|       |        // nothing else remains in front of it.
10710|      0|        const bool c_is_hash =
10711|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (10711:13): [True: 0, False: 0]
  |  Branch (10711:37): [True: 0, False: 0]
  ------------------
10712|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
10713|       |        // validation error, return failure.
10714|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (10714:13): [True: 0, False: 0]
  |  Branch (10714:37): [True: 0, False: 0]
  |  Branch (10714:66): [True: 0, False: 0]
  ------------------
10715|      0|          ada_log("NO_SCHEME validation error");
10716|      0|          url.is_valid = false;
10717|      0|          return url;
10718|      0|        }
10719|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
10720|       |        // set url's scheme to base's scheme, url's path to base's path, url's
10721|       |        // query to base's query, and set state to fragment state.
10722|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (10722:18): [True: 0, False: 0]
  |  Branch (10722:47): [True: 0, False: 0]
  ------------------
10723|      0|          ada_log("NO_SCHEME opaque base with fragment");
10724|      0|          url.copy_scheme(*base_url);
10725|      0|          url.has_opaque_path = base_url->has_opaque_path;
10726|       |
10727|       |          if constexpr (result_type_is_ada_url) {
10728|       |            url.path = base_url->path;
10729|       |            url.query = base_url->query;
10730|      0|          } else {
10731|      0|            url.update_base_pathname(base_url->get_pathname());
10732|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (10732:17): [True: 0, False: 0]
  ------------------
10733|       |              // get_search() returns "" for an empty query string (URL ends
10734|       |              // with '?'). update_base_search("") would incorrectly clear the
10735|       |              // query, so pass "?" to preserve the empty query distinction.
10736|      0|              auto s = base_url->get_search();
10737|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (10737:38): [True: 0, False: 0]
  ------------------
10738|      0|            }
10739|      0|          }
10740|      0|          url.update_unencoded_base_hash(*fragment);
10741|      0|          return url;
10742|      0|        }
10743|       |        // Otherwise, if base's scheme is not "file", set state to relative
10744|       |        // state and decrease pointer by 1.
10745|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
10746|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (10746:18): [True: 0, False: 0]
  ------------------
10747|      0|          ada_log("NO_SCHEME non-file relative path");
10748|      0|          state = state::RELATIVE_SCHEME;
10749|      0|        }
10750|       |        // Otherwise, set state to file state and decrease pointer by 1.
10751|      0|        else {
10752|      0|          ada_log("NO_SCHEME file base type");
10753|      0|          state = state::FILE;
10754|      0|        }
10755|      0|        break;
10756|      0|      }
10757|  6.30k|      case state::AUTHORITY: {
  ------------------
  |  Branch (10757:7): [True: 6.30k, False: 27.8k]
  ------------------
10758|  6.30k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
10759|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
10760|       |        // about AUTHORITY. Of course, we could have @ and still not have to
10761|       |        // worry about AUTHORITY.
10762|       |        // TODO: Instead of just collecting a bool, collect the location of the
10763|       |        // '@' and do something useful with it.
10764|       |        // TODO: We could do various processing early on, using a single pass
10765|       |        // over the string to collect information about it, e.g., telling us
10766|       |        // whether there is a @ and if so, where (or how many).
10767|       |
10768|       |        // Check if url data contains an @.
10769|  6.30k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (10769:13): [True: 6.05k, False: 259]
  ------------------
10770|  6.05k|          state = state::HOST;
10771|  6.05k|          break;
10772|  6.05k|        }
10773|    259|        bool at_sign_seen{false};
10774|    259|        bool password_token_seen{false};
10775|       |        /**
10776|       |         * We expect something of the sort...
10777|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
10778|       |         * --------^
10779|       |         */
10780|  1.66k|        do {
10781|  1.66k|          std::string_view view = url_data.substr(input_position);
10782|       |          // The delimiters are @, /, ? \\.
10783|  1.66k|          size_t location =
10784|  1.66k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (10784:15): [True: 1.66k, False: 0]
  ------------------
10785|  1.66k|                               : helpers::find_authority_delimiter(view);
10786|  1.66k|          std::string_view authority_view = view.substr(0, location);
10787|  1.66k|          size_t end_of_authority = input_position + authority_view.size();
10788|       |          // If c is U+0040 (@), then:
10789|  1.66k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (10789:15): [True: 1.65k, False: 8]
  ------------------
10790|  1.65k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (10790:15): [True: 1.40k, False: 251]
  ------------------
10791|       |            // If atSignSeen is true, then prepend "%40" to buffer.
10792|  1.40k|            if (at_sign_seen) {
  ------------------
  |  Branch (10792:17): [True: 1.17k, False: 228]
  ------------------
10793|  1.17k|              if (password_token_seen) {
  ------------------
  |  Branch (10793:19): [True: 678, False: 497]
  ------------------
10794|       |                if constexpr (result_type_is_ada_url) {
10795|       |                  url.password += "%40";
10796|    678|                } else {
10797|    678|                  url.append_base_password("%40");
10798|    678|                }
10799|    678|              } else {
10800|       |                if constexpr (result_type_is_ada_url) {
10801|       |                  url.username += "%40";
10802|    497|                } else {
10803|    497|                  url.append_base_username("%40");
10804|    497|                }
10805|    497|              }
10806|  1.17k|            }
10807|       |
10808|  1.40k|            at_sign_seen = true;
10809|       |
10810|  1.40k|            if (!password_token_seen) {
  ------------------
  |  Branch (10810:17): [True: 725, False: 678]
  ------------------
10811|    725|              size_t password_token_location = authority_view.find(':');
10812|    725|              password_token_seen =
10813|    725|                  password_token_location != std::string_view::npos;
10814|       |
10815|    725|              if constexpr (store_values) {
10816|    725|                if (!password_token_seen) {
  ------------------
  |  Branch (10816:21): [True: 625, False: 100]
  ------------------
10817|       |                  if constexpr (result_type_is_ada_url) {
10818|       |                    url.username += unicode::percent_encode(
10819|       |                        authority_view,
10820|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10821|    625|                  } else {
10822|    625|                    url.append_base_username(unicode::percent_encode(
10823|    625|                        authority_view,
10824|    625|                        character_sets::USERINFO_PERCENT_ENCODE));
10825|    625|                  }
10826|    625|                } else {
10827|       |                  if constexpr (result_type_is_ada_url) {
10828|       |                    url.username += unicode::percent_encode(
10829|       |                        authority_view.substr(0, password_token_location),
10830|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10831|       |                    url.password += unicode::percent_encode(
10832|       |                        authority_view.substr(password_token_location + 1),
10833|       |                        character_sets::USERINFO_PERCENT_ENCODE);
10834|    100|                  } else {
10835|    100|                    url.append_base_username(unicode::percent_encode(
10836|    100|                        authority_view.substr(0, password_token_location),
10837|    100|                        character_sets::USERINFO_PERCENT_ENCODE));
10838|    100|                    url.append_base_password(unicode::percent_encode(
10839|    100|                        authority_view.substr(password_token_location + 1),
10840|    100|                        character_sets::USERINFO_PERCENT_ENCODE));
10841|    100|                  }
10842|    100|                }
10843|    725|              }
10844|    725|            } else if constexpr (store_values) {
10845|       |              if constexpr (result_type_is_ada_url) {
10846|       |                url.password += unicode::percent_encode(
10847|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
10848|    678|              } else {
10849|    678|                url.append_base_password(unicode::percent_encode(
10850|    678|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
10851|    678|              }
10852|    678|            }
10853|  1.40k|          }
10854|       |          // Otherwise, if one of the following is true:
10855|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
10856|       |          // - url is special and c is U+005C (\)
10857|    259|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (10857:20): [True: 8, False: 251]
  ------------------
10858|    251|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (10858:20): [True: 242, False: 9]
  ------------------
10859|      9|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (10859:20): [True: 4, False: 5]
  ------------------
10860|    259|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (10860:21): [True: 5, False: 0]
  |  Branch (10860:41): [True: 5, False: 0]
  ------------------
10861|       |            // If atSignSeen is true and authority_view is the empty string,
10862|       |            // validation error, return failure.
10863|    259|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (10863:17): [True: 228, False: 31]
  |  Branch (10863:33): [True: 5, False: 223]
  ------------------
10864|      5|              url.is_valid = false;
10865|      5|              return url;
10866|      5|            }
10867|    254|            state = state::HOST;
10868|    254|            break;
10869|    259|          }
10870|  1.40k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (10870:15): [True: 0, False: 1.40k]
  ------------------
10871|      0|            if constexpr (store_values) {
10872|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (10872:19): [True: 0, False: 0]
  ------------------
10873|      0|                url.update_unencoded_base_hash(*fragment);
10874|      0|              }
10875|      0|            }
10876|      0|            return url;
10877|      0|          }
10878|  1.40k|          input_position = end_of_authority + 1;
10879|  1.40k|        } while (true);
  ------------------
  |  Branch (10879:18): [True: 1.40k, Folded]
  ------------------
10880|       |
10881|    254|        break;
10882|    259|      }
10883|    254|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (10883:7): [True: 0, False: 34.2k]
  ------------------
10884|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
10885|      0|                helpers::substring(url_data, input_position));
10886|       |
10887|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
10888|       |        // then set state to special authority ignore slashes state and increase
10889|       |        // pointer by 1.
10890|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (10890:13): [True: 0, False: 0]
  ------------------
10891|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
10892|      0|          input_position += 2;
10893|      0|        } else {
10894|       |          // Otherwise, validation error, set state to relative state and
10895|       |          // decrease pointer by 1.
10896|      0|          state = state::RELATIVE_SCHEME;
10897|      0|        }
10898|       |
10899|      0|        break;
10900|    259|      }
10901|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (10901:7): [True: 0, False: 34.2k]
  ------------------
10902|      0|        ada_log("PATH_OR_AUTHORITY ",
10903|      0|                helpers::substring(url_data, input_position));
10904|       |
10905|       |        // If c is U+002F (/), then set state to authority state.
10906|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10906:13): [True: 0, False: 0]
  ------------------
10907|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10907:13): [True: 0, False: 0]
  ------------------
10908|      0|          state = state::AUTHORITY;
10909|      0|          input_position++;
10910|      0|        } else {
10911|       |          // Otherwise, set state to path state, and decrease pointer by 1.
10912|      0|          state = state::PATH;
10913|      0|        }
10914|       |
10915|      0|        break;
10916|    259|      }
10917|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (10917:7): [True: 0, False: 34.2k]
  ------------------
10918|      0|        ada_log("RELATIVE_SCHEME ",
10919|      0|                helpers::substring(url_data, input_position));
10920|       |
10921|       |        // Set url's scheme to base's scheme.
10922|      0|        url.copy_scheme(*base_url);
10923|       |
10924|       |        // If c is U+002F (/), then set state to relative slash state.
10925|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (10925:13): [True: 0, False: 0]
  ------------------
10926|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
10927|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (10927:13): [True: 0, False: 0]
  ------------------
10928|      0|          ada_log(
10929|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
10930|      0|              "slash state");
10931|      0|          state = state::RELATIVE_SLASH;
10932|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (10932:20): [True: 0, False: 0]
  |  Branch (10932:40): [True: 0, False: 0]
  ------------------
10933|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (10933:20): [True: 0, False: 0]
  ------------------
10934|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
10935|       |          // set state to relative slash state.
10936|      0|          ada_log(
10937|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
10938|      0|              "error, set state to relative slash state");
10939|      0|          state = state::RELATIVE_SLASH;
10940|      0|        } else {
10941|      0|          ada_log("RELATIVE_SCHEME otherwise");
10942|       |          // Set url's username to base's username, url's password to base's
10943|       |          // password, url's host to base's host, url's port to base's port,
10944|       |          // url's path to a clone of base's path, and url's query to base's
10945|       |          // query.
10946|       |          if constexpr (result_type_is_ada_url) {
10947|       |            url.username = base_url->username;
10948|       |            url.password = base_url->password;
10949|       |            url.host = base_url->host;
10950|       |            url.port = base_url->port;
10951|       |            // cloning the base path includes cloning the has_opaque_path flag
10952|       |            url.has_opaque_path = base_url->has_opaque_path;
10953|       |            url.path = base_url->path;
10954|       |            url.query = base_url->query;
10955|      0|          } else {
10956|      0|            url.update_base_authority(base_url->get_href(),
10957|      0|                                      base_url->get_components());
10958|      0|            url.update_host_to_base_host(base_url->get_hostname());
10959|      0|            url.update_base_port(base_url->retrieve_base_port());
10960|       |            // cloning the base path includes cloning the has_opaque_path flag
10961|      0|            url.has_opaque_path = base_url->has_opaque_path;
10962|      0|            url.update_base_pathname(base_url->get_pathname());
10963|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (10963:17): [True: 0, False: 0]
  ------------------
10964|       |              // get_search() returns "" for an empty query string (URL ends
10965|       |              // with '?'). update_base_search("") would incorrectly clear the
10966|       |              // query, so pass "?" to preserve the empty query distinction.
10967|      0|              auto s = base_url->get_search();
10968|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (10968:38): [True: 0, False: 0]
  ------------------
10969|      0|            }
10970|      0|          }
10971|       |
10972|      0|          url.has_opaque_path = base_url->has_opaque_path;
10973|       |
10974|       |          // If c is U+003F (?), then set url's query to the empty string, and
10975|       |          // state to query state.
10976|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (10976:15): [True: 0, False: 0]
  ------------------
10977|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (10977:15): [True: 0, False: 0]
  ------------------
10978|      0|            state = state::QUERY;
10979|      0|          }
10980|       |          // Otherwise, if c is not the EOF code point:
10981|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (10981:20): [True: 0, False: 0]
  ------------------
10982|       |            // Set url's query to null.
10983|      0|            url.clear_search();
10984|       |            if constexpr (result_type_is_ada_url) {
10985|       |              // Shorten url's path.
10986|       |              helpers::shorten_path(url.path, url.type);
10987|      0|            } else {
10988|      0|              std::string_view path = url.get_pathname();
10989|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (10989:19): [True: 0, False: 0]
  ------------------
10990|      0|                url.update_base_pathname(std::move(std::string(path)));
10991|      0|              }
10992|      0|            }
10993|       |            // Set state to path state and decrease pointer by 1.
10994|      0|            state = state::PATH;
10995|      0|            break;
10996|      0|          }
10997|      0|        }
10998|      0|        input_position++;
10999|      0|        break;
11000|      0|      }
11001|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (11001:7): [True: 0, False: 34.2k]
  ------------------
11002|      0|        ada_log("RELATIVE_SLASH ",
11003|      0|                helpers::substring(url_data, input_position));
11004|       |
11005|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
11006|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
11007|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (11007:13): [True: 0, False: 0]
  |  Branch (11007:33): [True: 0, False: 0]
  ------------------
11008|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11008:14): [True: 0, False: 0]
  ------------------
11009|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11009:14): [True: 0, False: 0]
  ------------------
11010|       |          // Set state to special authority ignore slashes state.
11011|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
11012|      0|        }
11013|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
11014|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (11014:18): [True: 0, False: 0]
  ------------------
11015|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (11015:18): [True: 0, False: 0]
  ------------------
11016|      0|          state = state::AUTHORITY;
11017|      0|        }
11018|       |        // Otherwise, set
11019|       |        // - url's username to base's username,
11020|       |        // - url's password to base's password,
11021|       |        // - url's host to base's host,
11022|       |        // - url's port to base's port,
11023|       |        // - state to path state, and then, decrease pointer by 1.
11024|      0|        else {
11025|       |          if constexpr (result_type_is_ada_url) {
11026|       |            url.username = base_url->username;
11027|       |            url.password = base_url->password;
11028|       |            url.host = base_url->host;
11029|       |            url.port = base_url->port;
11030|      0|          } else {
11031|      0|            url.update_base_authority(base_url->get_href(),
11032|      0|                                      base_url->get_components());
11033|      0|            url.update_host_to_base_host(base_url->get_hostname());
11034|      0|            url.update_base_port(base_url->retrieve_base_port());
11035|      0|          }
11036|      0|          state = state::PATH;
11037|      0|          break;
11038|      0|        }
11039|       |
11040|      0|        input_position++;
11041|      0|        break;
11042|      0|      }
11043|  6.30k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (11043:7): [True: 6.30k, False: 27.8k]
  ------------------
11044|  6.30k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
11045|  6.30k|                helpers::substring(url_data, input_position));
11046|       |
11047|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
11048|       |        // then set state to special authority ignore slashes state and increase
11049|       |        // pointer by 1.
11050|  6.30k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (11050:13): [True: 6.30k, False: 0]
  ------------------
11051|  6.30k|          input_position += 2;
11052|  6.30k|        }
11053|       |
11054|  6.30k|        [[fallthrough]];
11055|  6.30k|      }
11056|  6.30k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (11056:7): [True: 0, False: 34.2k]
  ------------------
11057|  6.30k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
11058|  6.30k|                helpers::substring(url_data, input_position));
11059|       |
11060|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
11061|       |        // authority state and decrease pointer by 1.
11062|  6.48k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (11062:16): [True: 6.48k, False: 1]
  ------------------
11063|  6.48k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (11063:17): [True: 87, False: 6.39k]
  ------------------
11064|  6.39k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (11064:17): [True: 87, False: 6.30k]
  ------------------
11065|    174|          input_position++;
11066|    174|        }
11067|  6.30k|        state = state::AUTHORITY;
11068|       |
11069|  6.30k|        break;
11070|  6.30k|      }
11071|    338|      case state::QUERY: {
  ------------------
  |  Branch (11071:7): [True: 338, False: 33.8k]
  ------------------
11072|    338|        ada_log("QUERY ", helpers::substring(url_data, input_position));
11073|    338|        if constexpr (store_values) {
11074|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
11075|       |          // if url is special; otherwise the query percent-encode set.
11076|    338|          const uint8_t* query_percent_encode_set =
11077|    338|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (11077:15): [True: 338, False: 0]
  ------------------
11078|    338|                               : character_sets::QUERY_PERCENT_ENCODE;
11079|       |
11080|       |          // Percent-encode after encoding, with encoding, buffer, and
11081|       |          // queryPercentEncodeSet, and append the result to url's query.
11082|    338|          url.update_base_search(url_data.substr(input_position),
11083|    338|                                 query_percent_encode_set);
11084|    338|          ada_log("QUERY update_base_search completed ");
11085|    338|          if (fragment.has_value()) {
  ------------------
  |  Branch (11085:15): [True: 8, False: 330]
  ------------------
11086|      8|            url.update_unencoded_base_hash(*fragment);
11087|      8|          }
11088|    338|        }
11089|    338|        return url;
11090|  6.30k|      }
11091|  6.30k|      case state::HOST: {
  ------------------
  |  Branch (11091:7): [True: 6.30k, False: 27.8k]
  ------------------
11092|  6.30k|        ada_log("HOST ", helpers::substring(url_data, input_position));
11093|       |
11094|  6.30k|        std::string_view host_view = url_data.substr(input_position);
11095|  6.30k|        auto [location, found_colon] =
11096|  6.30k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
11097|  6.30k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (11097:26): [True: 6.30k, False: 0]
  ------------------
11098|  6.30k|                             ? input_position + location
11099|  6.30k|                             : input_size;
11100|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
11101|       |        // Note: the 'found_colon' value is true if and only if a colon was
11102|       |        // encountered while not inside brackets.
11103|  6.30k|        if (found_colon) {
  ------------------
  |  Branch (11103:13): [True: 488, False: 5.81k]
  ------------------
11104|       |          // If buffer is the empty string, validation error, return failure.
11105|       |          // Let host be the result of host parsing buffer with url is not
11106|       |          // special.
11107|    488|          ada_log("HOST parsing ", host_view);
11108|    488|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (11108:15): [True: 219, False: 269]
  ------------------
11109|    219|            return url;
11110|    219|          }
11111|    269|          ada_log("HOST parsing results in ", url.get_hostname());
11112|       |          // Set url's host to host, buffer to the empty string, and state to
11113|       |          // port state.
11114|    269|          state = state::PORT;
11115|    269|          input_position++;
11116|    269|        }
11117|       |        // Otherwise, if one of the following is true:
11118|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
11119|       |        // - url is special and c is U+005C (\)
11120|       |        // The get_host_delimiter_location function either brings us to
11121|       |        // the colon outside of the bracket, or to one of those characters.
11122|  5.81k|        else {
11123|       |          // If url is special and host_view is the empty string, validation
11124|       |          // error, return failure.
11125|  5.81k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (11125:15): [True: 1, False: 5.81k]
  |  Branch (11125:36): [True: 1, False: 0]
  ------------------
11126|      1|            url.is_valid = false;
11127|      1|            return url;
11128|      1|          }
11129|  5.81k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
11130|       |          // Let host be the result of host parsing host_view with url is not
11131|       |          // special.
11132|  5.81k|          if (host_view.empty()) {
  ------------------
  |  Branch (11132:15): [True: 0, False: 5.81k]
  ------------------
11133|      0|            url.update_base_hostname("");
11134|  5.81k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (11134:22): [True: 4.80k, False: 1.01k]
  ------------------
11135|  4.80k|            return url;
11136|  4.80k|          }
11137|  1.01k|          ada_log("HOST parsing results in ", url.get_hostname(),
11138|  1.01k|                  " href=", url.get_href());
11139|       |
11140|       |          // Set url's host to host, and state to path start state.
11141|  1.01k|          state = state::PATH_START;
11142|  1.01k|        }
11143|       |
11144|  1.27k|        break;
11145|  6.30k|      }
11146|  1.27k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (11146:7): [True: 0, False: 34.2k]
  ------------------
11147|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
11148|       |        // Opaque path, query, and fragment are structurally always valid:
11149|       |        // the parser would just percent-encode whatever is there. When we
11150|       |        // are not storing values (can_parse), we can return immediately.
11151|       |        // We must set has_opaque_path = true before returning so that when
11152|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
11153|       |        // correctly rejects relative inputs against an opaque-path base
11154|       |        // (e.g. can_parse("", &"W:") must return false).
11155|       |        if constexpr (!store_values) {
11156|       |          url.has_opaque_path = true;
11157|       |          return url;
11158|       |        }
11159|      0|        std::string_view view = url_data.substr(input_position);
11160|       |        // If c is U+003F (?), then set url's query to the empty string and
11161|       |        // state to query state.
11162|      0|        size_t location = view.find('?');
11163|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (11163:13): [True: 0, False: 0]
  ------------------
11164|      0|          view.remove_suffix(view.size() - location);
11165|      0|          state = state::QUERY;
11166|      0|          input_position += location + 1;
11167|      0|        } else {
11168|      0|          input_position = input_size + 1;
11169|      0|        }
11170|      0|        url.has_opaque_path = true;
11171|       |
11172|       |        // This is a really unlikely scenario in real world. We should not seek
11173|       |        // to optimize it.
11174|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (11174:13): [True: 0, False: 0]
  ------------------
11175|      0|          std::string modified_view =
11176|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
11177|      0|          url.update_base_pathname(unicode::percent_encode(
11178|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11179|      0|        } else {
11180|      0|          url.update_base_pathname(unicode::percent_encode(
11181|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
11182|      0|        }
11183|      0|        break;
11184|  6.30k|      }
11185|    269|      case state::PORT: {
  ------------------
  |  Branch (11185:7): [True: 269, False: 33.9k]
  ------------------
11186|    269|        ada_log("PORT ", helpers::substring(url_data, input_position));
11187|    269|        std::string_view port_view = url_data.substr(input_position);
11188|    269|        input_position += url.parse_port(port_view, true);
11189|    269|        if (!url.is_valid) {
  ------------------
  |  Branch (11189:13): [True: 190, False: 79]
  ------------------
11190|    190|          return url;
11191|    190|        }
11192|     79|        state = state::PATH_START;
11193|     79|        [[fallthrough]];
11194|     79|      }
11195|  1.08k|      case state::PATH_START: {
  ------------------
  |  Branch (11195:7): [True: 1.01k, False: 33.1k]
  ------------------
11196|  1.08k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
11197|       |        // Path, query, and fragment are structurally always valid: the
11198|       |        // parser would just percent-encode whatever is there. When we are
11199|       |        // not storing values (can_parse), we can return immediately since
11200|       |        // no subsequent state can invalidate the URL.
11201|       |        if constexpr (!store_values) {
11202|       |          return url;
11203|       |        }
11204|       |
11205|       |        // If url is special, then:
11206|  1.08k|        if (url.is_special()) {
  ------------------
  |  Branch (11206:13): [True: 1.08k, False: 0]
  ------------------
11207|       |          // Set state to path state.
11208|  1.08k|          state = state::PATH;
11209|       |
11210|       |          // Optimization: Avoiding going into PATH state improves the
11211|       |          // performance of urls ending with /.
11212|  1.08k|          if (input_position == input_size) {
  ------------------
  |  Branch (11212:15): [True: 46, False: 1.04k]
  ------------------
11213|     46|            if constexpr (store_values) {
11214|     46|              url.update_base_pathname("/");
11215|     46|              if (fragment.has_value()) {
  ------------------
  |  Branch (11215:19): [True: 46, False: 0]
  ------------------
11216|     46|                url.update_unencoded_base_hash(*fragment);
11217|     46|              }
11218|     46|            }
11219|     46|            return url;
11220|     46|          }
11221|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
11222|       |          // by 1. We know that (input_position == input_size) is impossible
11223|       |          // here, because of the previous if-check.
11224|  1.04k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (11224:15): [True: 90, False: 953]
  ------------------
11225|     90|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (11225:15): [True: 52, False: 38]
  ------------------
11226|     52|            break;
11227|     52|          }
11228|  1.04k|        }
11229|       |        // Otherwise, if state override is not given and c is U+003F (?),
11230|       |        // set url's query to the empty string and state to query state.
11231|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (11231:18): [True: 0, False: 0]
  ------------------
11232|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (11232:18): [True: 0, False: 0]
  ------------------
11233|      0|          state = state::QUERY;
11234|      0|        }
11235|       |        // Otherwise, if c is not the EOF code point:
11236|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (11236:18): [True: 0, False: 0]
  ------------------
11237|       |          // Set state to path state.
11238|      0|          state = state::PATH;
11239|       |
11240|       |          // If c is not U+002F (/), then decrease pointer by 1.
11241|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (11241:15): [True: 0, False: 0]
  ------------------
11242|      0|            break;
11243|      0|          }
11244|      0|        }
11245|       |
11246|    991|        input_position++;
11247|    991|        break;
11248|  1.08k|      }
11249|  1.04k|      case state::PATH: {
  ------------------
  |  Branch (11249:7): [True: 1.04k, False: 33.1k]
  ------------------
11250|  1.04k|        ada_log("PATH ", helpers::substring(url_data, input_position));
11251|       |        // Path, query, and fragment are structurally always valid: the
11252|       |        // parser would just percent-encode whatever is there. When we are
11253|       |        // not storing values (can_parse), we can return immediately since
11254|       |        // no subsequent state can invalidate the URL.
11255|       |        if constexpr (!store_values) {
11256|       |          return url;
11257|       |        }
11258|  1.04k|        std::string_view view = url_data.substr(input_position);
11259|       |
11260|       |        // Most time, we do not need percent encoding.
11261|       |        // Furthermore, we can immediately locate the '?'.
11262|  1.04k|        size_t locofquestionmark = view.find('?');
11263|  1.04k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (11263:13): [True: 338, False: 705]
  ------------------
11264|    338|          state = state::QUERY;
11265|    338|          view.remove_suffix(view.size() - locofquestionmark);
11266|    338|          input_position += locofquestionmark + 1;
11267|    705|        } else {
11268|    705|          input_position = input_size + 1;
11269|    705|        }
11270|  1.04k|        if constexpr (store_values) {
11271|       |          if constexpr (result_type_is_ada_url) {
11272|       |            helpers::parse_prepared_path(view, url.type, url.path);
11273|  1.04k|          } else {
11274|  1.04k|            url.consume_prepared_path(view);
11275|  1.04k|            ADA_ASSERT_TRUE(url.validate());
11276|  1.04k|          }
11277|  1.04k|        }
11278|  1.04k|        break;
11279|  1.08k|      }
11280|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (11280:7): [True: 0, False: 34.2k]
  ------------------
11281|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
11282|       |
11283|       |        // If c is U+002F (/) or U+005C (\), then:
11284|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (11284:13): [True: 0, False: 0]
  ------------------
11285|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11285:14): [True: 0, False: 0]
  ------------------
11286|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11286:14): [True: 0, False: 0]
  ------------------
11287|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
11288|       |          // Set state to file host state.
11289|      0|          state = state::FILE_HOST;
11290|      0|          input_position++;
11291|      0|        } else {
11292|      0|          ada_log("FILE_SLASH otherwise");
11293|       |          // If base is non-null and base's scheme is "file", then:
11294|       |          // Note: it is unsafe to do base_url->scheme unless you know that
11295|       |          // base_url_has_value() is true.
11296|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11296:15): [True: 0, False: 0]
  |  Branch (11296:38): [True: 0, False: 0]
  ------------------
11297|       |            // Set url's host to base's host.
11298|       |            if constexpr (result_type_is_ada_url) {
11299|       |              url.host = base_url->host;
11300|      0|            } else {
11301|      0|              url.update_host_to_base_host(base_url->get_host());
11302|      0|            }
11303|       |            // If the code point substring from pointer to the end of input does
11304|       |            // not start with a Windows drive letter and base's path[0] is a
11305|       |            // normalized Windows drive letter, then append base's path[0] to
11306|       |            // url's path.
11307|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (11307:17): [True: 0, False: 0]
  ------------------
11308|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (11308:19): [True: 0, False: 0]
  ------------------
11309|      0|                      url_data.substr(input_position))) {
11310|      0|                std::string_view first_base_url_path =
11311|      0|                    base_url->get_pathname().substr(1);
11312|      0|                size_t loc = first_base_url_path.find('/');
11313|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (11313:21): [True: 0, False: 0]
  ------------------
11314|      0|                  helpers::resize(first_base_url_path, loc);
11315|      0|                }
11316|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (11316:21): [True: 0, False: 0]
  ------------------
11317|      0|                        first_base_url_path)) {
11318|       |                  if constexpr (result_type_is_ada_url) {
11319|       |                    url.path += '/';
11320|       |                    url.path += first_base_url_path;
11321|      0|                  } else {
11322|      0|                    url.append_base_pathname(
11323|      0|                        helpers::concat("/", first_base_url_path));
11324|      0|                  }
11325|      0|                }
11326|      0|              }
11327|      0|            }
11328|      0|          }
11329|       |
11330|       |          // Set state to path state, and decrease pointer by 1.
11331|      0|          state = state::PATH;
11332|      0|        }
11333|       |
11334|      0|        break;
11335|  1.08k|      }
11336|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (11336:7): [True: 0, False: 34.2k]
  ------------------
11337|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
11338|      0|        std::string_view view = url_data.substr(input_position);
11339|       |
11340|      0|        size_t location = view.find_first_of("/\\?");
11341|      0|        std::string_view file_host_buffer = view.substr(
11342|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (11342:16): [True: 0, False: 0]
  ------------------
11343|       |
11344|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (11344:13): [True: 0, False: 0]
  ------------------
11345|      0|          state = state::PATH;
11346|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (11346:20): [True: 0, False: 0]
  ------------------
11347|       |          // Set url's host to the empty string.
11348|       |          if constexpr (result_type_is_ada_url) {
11349|       |            url.host = "";
11350|      0|          } else {
11351|      0|            url.update_base_hostname("");
11352|      0|          }
11353|       |          // Set state to path start state.
11354|      0|          state = state::PATH_START;
11355|      0|        } else {
11356|      0|          size_t consumed_bytes = file_host_buffer.size();
11357|      0|          input_position += consumed_bytes;
11358|       |          // Let host be the result of host parsing buffer with url is not
11359|       |          // special.
11360|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (11360:15): [True: 0, False: 0]
  ------------------
11361|      0|            return url;
11362|      0|          }
11363|       |
11364|       |          if constexpr (result_type_is_ada_url) {
11365|       |            // If host is "localhost", then set host to the empty string.
11366|       |            if (url.host.has_value() && url.host.value() == "localhost") {
11367|       |              url.host = "";
11368|       |            }
11369|      0|          } else {
11370|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (11370:17): [True: 0, False: 0]
  ------------------
11371|      0|              url.update_base_hostname("");
11372|      0|            }
11373|      0|          }
11374|       |
11375|       |          // Set buffer to the empty string and state to path start state.
11376|      0|          state = state::PATH_START;
11377|      0|        }
11378|       |
11379|      0|        break;
11380|      0|      }
11381|      0|      case state::FILE: {
  ------------------
  |  Branch (11381:7): [True: 0, False: 34.2k]
  ------------------
11382|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
11383|      0|        std::string_view file_view = url_data.substr(input_position);
11384|       |
11385|      0|        url.set_protocol_as_file();
11386|       |        if constexpr (result_type_is_ada_url) {
11387|       |          // Set url's host to the empty string.
11388|       |          url.host = "";
11389|      0|        } else {
11390|      0|          url.update_base_hostname("");
11391|      0|        }
11392|       |        // If c is U+002F (/) or U+005C (\), then:
11393|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (11393:13): [True: 0, False: 0]
  ------------------
11394|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (11394:14): [True: 0, False: 0]
  ------------------
11395|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (11395:14): [True: 0, False: 0]
  ------------------
11396|      0|          ada_log("FILE c is U+002F or U+005C");
11397|       |          // Set state to file slash state.
11398|      0|          state = state::FILE_SLASH;
11399|      0|        }
11400|       |        // Otherwise, if base is non-null and base's scheme is "file":
11401|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (11401:18): [True: 0, False: 0]
  |  Branch (11401:41): [True: 0, False: 0]
  ------------------
11402|       |          // Set url's host to base's host, url's path to a clone of base's
11403|       |          // path, and url's query to base's query.
11404|      0|          ada_log("FILE base non-null");
11405|       |          if constexpr (result_type_is_ada_url) {
11406|       |            url.host = base_url->host;
11407|       |            url.path = base_url->path;
11408|       |            url.query = base_url->query;
11409|      0|          } else {
11410|      0|            url.update_host_to_base_host(base_url->get_hostname());
11411|      0|            url.update_base_pathname(base_url->get_pathname());
11412|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (11412:17): [True: 0, False: 0]
  ------------------
11413|       |              // get_search() returns "" for an empty query string (URL ends
11414|       |              // with '?'). update_base_search("") would incorrectly clear the
11415|       |              // query, so pass "?" to preserve the empty query distinction.
11416|      0|              auto s = base_url->get_search();
11417|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (11417:38): [True: 0, False: 0]
  ------------------
11418|      0|            }
11419|      0|          }
11420|      0|          url.has_opaque_path = base_url->has_opaque_path;
11421|       |
11422|       |          // If c is U+003F (?), then set url's query to the empty string and
11423|       |          // state to query state.
11424|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (11424:15): [True: 0, False: 0]
  |  Branch (11424:47): [True: 0, False: 0]
  ------------------
11425|      0|            state = state::QUERY;
11426|      0|          }
11427|       |          // Otherwise, if c is not the EOF code point:
11428|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (11428:20): [True: 0, False: 0]
  ------------------
11429|       |            // Set url's query to null.
11430|      0|            url.clear_search();
11431|       |            // If the code point substring from pointer to the end of input does
11432|       |            // not start with a Windows drive letter, then shorten url's path.
11433|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (11433:17): [True: 0, False: 0]
  ------------------
11434|       |              if constexpr (result_type_is_ada_url) {
11435|       |                helpers::shorten_path(url.path, url.type);
11436|      0|              } else {
11437|      0|                std::string_view path = url.get_pathname();
11438|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (11438:21): [True: 0, False: 0]
  ------------------
11439|      0|                  url.update_base_pathname(std::move(std::string(path)));
11440|      0|                }
11441|      0|              }
11442|      0|            }
11443|       |            // Otherwise:
11444|      0|            else {
11445|       |              // Set url's path to an empty list.
11446|      0|              url.clear_pathname();
11447|      0|              url.has_opaque_path = true;
11448|      0|            }
11449|       |
11450|       |            // Set state to path state and decrease pointer by 1.
11451|      0|            state = state::PATH;
11452|      0|            break;
11453|      0|          }
11454|      0|        }
11455|       |        // Otherwise, set state to path state, and decrease pointer by 1.
11456|      0|        else {
11457|      0|          ada_log("FILE go to path");
11458|      0|          state = state::PATH;
11459|      0|          break;
11460|      0|        }
11461|       |
11462|      0|        input_position++;
11463|      0|        break;
11464|      0|      }
11465|      0|      default:
  ------------------
  |  Branch (11465:7): [True: 0, False: 34.2k]
  ------------------
11466|      0|        unreachable();
11467|  34.2k|    }
11468|  34.2k|  }
11469|    811|  if constexpr (store_values) {
11470|    811|    if (fragment.has_value()) {
  ------------------
  |  Branch (11470:9): [True: 30, False: 781]
  ------------------
11471|     30|      url.update_unencoded_base_hash(*fragment);
11472|     30|    }
11473|    811|  }
11474|       |  // Check the resulting (normalized) URL size against the maximum input length.
11475|       |  // Normalization (percent-encoding, IDNA, etc.) can expand the URL beyond the
11476|       |  // original input size.
11477|    811|  if constexpr (store_values) {
11478|    811|    if (url.is_valid) {
  ------------------
  |  Branch (11478:9): [True: 705, False: 106]
  ------------------
11479|    705|      if constexpr (result_type_is_ada_url_aggregator) {
11480|    705|        if (url.buffer.size() > max_input_length) {
  ------------------
  |  Branch (11480:13): [True: 0, False: 705]
  ------------------
11481|      0|          url.is_valid = false;
11482|      0|        }
11483|       |      } else {
11484|       |        if (url.get_href_size() > max_input_length) {
11485|       |          url.is_valid = false;
11486|       |        }
11487|       |      }
11488|    705|    }
11489|    811|  }
11490|    811|  return url;
11491|  6.41k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
12417|  3.32k|    ada_lifetime_bound {
12418|  3.32k|  ada_log("url_aggregator::get_hostname");
12419|       |  // Technically, we should check if there is a hostname, but
12420|       |  // the code below works even if there isn't.
12421|       |  // if(!has_hostname()) { return ""; }
12422|  3.32k|  size_t start = components.host_start;
12423|       |  // So host_start is not where the host begins.
12424|  3.32k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (12424:7): [True: 1.85k, False: 1.46k]
  ------------------
12425|  1.85k|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (12425:7): [True: 323, False: 1.53k]
  ------------------
12426|    323|    start++;
12427|    323|  }
12428|  3.32k|  return helpers::substring(buffer, start, components.host_end);
12429|  3.32k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
12562|    960|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
12563|    960|  ada_log("parse_ipv4 ", input, " [", input.size(),
12564|    960|          " bytes], overlaps with buffer: ",
12565|    960|          helpers::overlaps(input, buffer) ? "yes" : "no");
12566|    960|  ADA_ASSERT_TRUE(validate());
12567|    960|  if (input.empty()) {
  ------------------
  |  Branch (12567:7): [True: 0, False: 960]
  ------------------
12568|      0|    return is_valid = false;
12569|      0|  }
12570|    960|  const bool trailing_dot = (input.back() == '.');
12571|    960|  if (trailing_dot) {
  ------------------
  |  Branch (12571:7): [True: 72, False: 888]
  ------------------
12572|     72|    input.remove_suffix(1);
12573|     72|    if (input.empty()) {
  ------------------
  |  Branch (12573:9): [True: 0, False: 72]
  ------------------
12574|      0|      return is_valid = false;
12575|      0|    }
12576|     72|  }
12577|       |
12578|    960|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
12579|    960|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (12579:7): [True: 3, False: 957]
  ------------------
12580|       |    // Pure decimal: keep the buffer when it already holds the address.
12581|       |    // Otherwise write the (trailing-dot-stripped) input.
12582|      3|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (12582:11): [True: 0, False: 3]
  |  Branch (12582:23): [True: 0, False: 0]
  ------------------
12583|      3|      update_base_hostname(input);
12584|      3|    }
12585|      3|    host_type = IPV4;
12586|      3|    ADA_ASSERT_TRUE(validate());
12587|      3|    return true;
12588|      3|  }
12589|       |
12590|    957|  const char* p = input.data();
12591|    957|  const char* end = p + input.size();
12592|    957|  uint64_t ipv4 = 0;
12593|    957|  int digit_count = 0;
12594|    957|  int pure_decimal_count = 0;
12595|       |
12596|  1.24k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (12596:10): [True: 1.23k, False: 12]
  |  Branch (12596:29): [True: 1.23k, False: 0]
  ------------------
12597|  1.23k|    uint64_t segment = 0;
12598|  1.23k|    bool pure = false;
12599|  1.23k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (12599:9): [True: 493, False: 742]
  ------------------
12600|    493|      return is_valid = false;
12601|    493|    }
12602|    742|    if (pure) {
  ------------------
  |  Branch (12602:9): [True: 566, False: 176]
  ------------------
12603|    566|      ++pure_decimal_count;
12604|    566|    }
12605|    742|    if (p >= end) {
  ------------------
  |  Branch (12605:9): [True: 423, False: 319]
  ------------------
12606|    423|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
12607|    423|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (12607:11): [True: 13, False: 410]
  ------------------
12608|     13|        return is_valid = false;
12609|     13|      }
12610|    410|      ipv4 = (ipv4 << shift) | segment;
12611|    410|      goto ipv4_done;
12612|    423|    }
12613|    319|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (12613:9): [True: 29, False: 290]
  |  Branch (12613:26): [True: 0, False: 290]
  ------------------
12614|     29|      return is_valid = false;
12615|     29|    }
12616|    290|    ipv4 = (ipv4 << 8) | segment;
12617|    290|    ++p;
12618|    290|  }
12619|     12|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (12619:7): [True: 0, False: 12]
  |  Branch (12619:27): [True: 12, False: 0]
  ------------------
12620|     12|    return is_valid = false;
12621|     12|  }
12622|    410|ipv4_done:
12623|    410|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
12624|    410|          " host: ", get_host());
12625|    410|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (12625:7): [True: 403, False: 7]
  |  Branch (12625:19): [True: 0, False: 403]
  |  Branch (12625:46): [True: 0, False: 0]
  ------------------
12626|      0|    ada_log(
12627|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
12628|      0|        "buffer");
12629|    410|  } else {
12630|    410|    update_base_hostname(ada::serializers::ipv4(ipv4));
12631|    410|  }
12632|    410|  host_type = IPV4;
12633|    410|  ADA_ASSERT_TRUE(validate());
12634|    410|  return true;
12635|     12|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12637|  3.61k|bool url_aggregator::parse_ipv6(std::string_view input) {
12638|  3.61k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
12639|  3.61k|  ADA_ASSERT_TRUE(validate());
12640|  3.61k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
12641|  3.61k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (12641:7): [True: 1, False: 3.61k]
  |  Branch (12641:24): [True: 2, False: 3.61k]
  ------------------
12642|      3|    return is_valid = false;
12643|      3|  }
12644|       |#if defined(ADA_AVX512)
12645|       |  if (!detail::ipv6_structure_plausible(input.data(), input.size()))
12646|       |      [[unlikely]] {
12647|       |    return is_valid = false;
12648|       |  }
12649|       |#endif
12650|       |
12651|  3.61k|  std::array<uint16_t, 8> address{};
12652|  3.61k|  const char* pointer = input.data();
12653|  3.61k|  const char* const end = pointer + input.size();
12654|  3.61k|  int piece_index = 0;
12655|  3.61k|  int compress = -1;
12656|       |
12657|  3.61k|  if (*pointer == ':') {
  ------------------
  |  Branch (12657:7): [True: 5, False: 3.60k]
  ------------------
12658|      5|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (12658:9): [True: 1, False: 4]
  |  Branch (12658:30): [True: 1, False: 3]
  ------------------
12659|      2|      return is_valid = false;
12660|      2|    }
12661|      3|    pointer += 2;
12662|      3|    compress = ++piece_index;
12663|      3|  }
12664|       |
12665|  3.78k|  while (pointer != end) {
  ------------------
  |  Branch (12665:10): [True: 3.77k, False: 9]
  ------------------
12666|  3.77k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (12666:9): [True: 3, False: 3.77k]
  ------------------
12667|      3|      return is_valid = false;
12668|      3|    }
12669|  3.77k|    if (*pointer == ':') {
  ------------------
  |  Branch (12669:9): [True: 24, False: 3.74k]
  ------------------
12670|     24|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (12670:11): [True: 1, False: 23]
  ------------------
12671|      1|        return is_valid = false;
12672|      1|      }
12673|     23|      ++pointer;
12674|     23|      compress = ++piece_index;
12675|     23|      continue;
12676|     24|    }
12677|       |
12678|  3.74k|    uint16_t value = 0;
12679|  3.74k|    const int length = detail::parse_hex_piece(pointer, end, value);
12680|       |
12681|  3.74k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (12681:9): [True: 3.74k, False: 7]
  |  Branch (12681:27): [True: 36, False: 3.70k]
  ------------------
12682|     36|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (12682:11): [True: 1, False: 35]
  ------------------
12683|      1|        return is_valid = false;
12684|      1|      }
12685|     35|      pointer -= length;
12686|     35|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (12686:11): [True: 3, False: 32]
  ------------------
12687|      3|        return is_valid = false;
12688|      3|      }
12689|       |
12690|     32|      int numbers_seen = 0;
12691|    101|      while (pointer != end) {
  ------------------
  |  Branch (12691:14): [True: 91, False: 10]
  ------------------
12692|     91|        int ipv4_piece = -1;
12693|     91|        if (numbers_seen > 0) {
  ------------------
  |  Branch (12693:13): [True: 59, False: 32]
  ------------------
12694|     59|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (12694:15): [True: 51, False: 8]
  |  Branch (12694:34): [True: 49, False: 2]
  ------------------
12695|     49|            ++pointer;
12696|     49|          } else {
12697|     10|            return is_valid = false;
12698|     10|          }
12699|     59|        }
12700|     81|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (12700:13): [True: 1, False: 80]
  |  Branch (12700:31): [True: 4, False: 76]
  |  Branch (12700:49): [True: 4, False: 72]
  ------------------
12701|      9|          return is_valid = false;
12702|      9|        }
12703|     72|        ipv4_piece = *pointer - '0';
12704|     72|        ++pointer;
12705|     72|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (12705:13): [True: 68, False: 4]
  |  Branch (12705:31): [True: 48, False: 20]
  |  Branch (12705:50): [True: 46, False: 2]
  ------------------
12706|     46|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (12706:15): [True: 1, False: 45]
  ------------------
12707|      1|            return is_valid = false;
12708|      1|          }
12709|     45|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
12710|     45|          ++pointer;
12711|     45|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (12711:15): [True: 40, False: 5]
  |  Branch (12711:33): [True: 28, False: 12]
  |  Branch (12711:52): [True: 28, False: 0]
  ------------------
12712|     28|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
12713|     28|            ++pointer;
12714|     28|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (12714:17): [True: 2, False: 26]
  ------------------
12715|      2|              return is_valid = false;
12716|      2|            }
12717|     28|          }
12718|     45|        }
12719|     69|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
12720|     69|            address[static_cast<size_t>(piece_index)] * 0x100 +
12721|     69|            static_cast<uint16_t>(ipv4_piece));
12722|     69|        ++numbers_seen;
12723|     69|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (12723:13): [True: 21, False: 48]
  |  Branch (12723:34): [True: 7, False: 41]
  ------------------
12724|     28|          ++piece_index;
12725|     28|        }
12726|     69|      }
12727|     10|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (12727:11): [True: 6, False: 4]
  ------------------
12728|      6|        return is_valid = false;
12729|      6|      }
12730|      4|      break;
12731|     10|    }
12732|       |
12733|  3.71k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (12733:9): [True: 3.55k, False: 163]
  ------------------
12734|  3.55k|      return is_valid = false;
12735|  3.55k|    }
12736|       |
12737|    163|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (12737:9): [True: 156, False: 7]
  |  Branch (12737:27): [True: 147, False: 9]
  ------------------
12738|    147|      ++pointer;
12739|    147|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (12739:11): [True: 1, False: 146]
  ------------------
12740|      1|        return is_valid = false;
12741|      1|      }
12742|    147|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (12742:16): [True: 9, False: 7]
  ------------------
12743|      9|      return is_valid = false;
12744|      9|    }
12745|       |
12746|    153|    address[static_cast<size_t>(piece_index)] = value;
12747|    153|    ++piece_index;
12748|    153|  }
12749|       |
12750|     13|  if (compress != -1) {
  ------------------
  |  Branch (12750:7): [True: 6, False: 7]
  ------------------
12751|      6|    const int right = piece_index - compress;
12752|      6|    if (right > 0) {
  ------------------
  |  Branch (12752:9): [True: 4, False: 2]
  ------------------
12753|      4|      const size_t dest = static_cast<size_t>(8 - right);
12754|      4|      const size_t src = static_cast<size_t>(compress);
12755|      4|      if (dest != src) {
  ------------------
  |  Branch (12755:11): [True: 3, False: 1]
  ------------------
12756|     12|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (12756:53): [True: 9, False: 3]
  ------------------
12757|      9|          address[dest + i] = address[src + i];
12758|      9|          address[src + i] = 0;
12759|      9|        }
12760|      3|      }
12761|      4|    }
12762|      7|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (12762:14): [True: 6, False: 1]
  ------------------
12763|      6|    return is_valid = false;
12764|      6|  }
12765|       |
12766|       |  // Serialize once; skip rewrite when hostname is already canonical.
12767|      7|  const std::string serialized = ada::serializers::ipv6(address);
12768|      7|  const std::string_view current = get_hostname();
12769|      7|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (12769:7): [True: 0, False: 7]
  ------------------
12770|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (12770:7): [True: 0, False: 0]
  ------------------
12771|      0|    ada_log("parse_ipv6 in-place canonical match");
12772|      7|  } else {
12773|      7|    update_base_hostname(serialized);
12774|      7|  }
12775|      7|  ada_log("parse_ipv6 ", get_hostname());
12776|      7|  ADA_ASSERT_TRUE(validate());
12777|      7|  host_type = IPV6;
12778|      7|  return true;
12779|     13|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  284|  38.2k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  285|       |    // -65 is 0b10111111, anything larger in two-complement's
  286|       |    // should start a new code point.
  287|  38.2k|    return c > -65;
  288|  38.2k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  490|      2|inline Huff make_fixed_litlen_huff() {
  491|      2|  Huff h;
  492|      2|  uint8_t lens[288];
  493|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  494|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (494:19): [True: 288, False: 2]
  ------------------
  495|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (495:21): [True: 224, False: 2]
  ------------------
  496|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (496:21): [True: 48, False: 2]
  ------------------
  497|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (497:21): [True: 16, False: 2]
  ------------------
  498|      2|  h.build(lens, 288);
  499|      2|  return h;
  500|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  439|     16|  bool build(const uint8_t* lens, int n) {
  440|     16|    std::memset(counts, 0, sizeof(counts));
  441|     16|    std::memset(first_code, 0, sizeof(first_code));
  442|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  443|     16|    nsymbols = n;
  444|     16|    max_bits = 0;
  445|  1.98k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (445:21): [True: 1.96k, False: 16]
  ------------------
  446|  1.96k|      lengths[i] = lens[i];
  447|  1.96k|      if (lens[i]) {
  ------------------
  |  Branch (447:11): [True: 1.91k, False: 49]
  ------------------
  448|  1.91k|        counts[lens[i]]++;
  449|  1.91k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (449:13): [True: 46, False: 1.87k]
  ------------------
  450|  1.91k|      }
  451|  1.96k|    }
  452|       |    // Canonical first code for each bit length (RFC 1951).
  453|     16|    int code = 0;
  454|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (454:24): [True: 240, False: 16]
  ------------------
  455|    240|      code = (code + counts[bits - 1]) << 1;
  456|    240|      first_code[bits] = code;
  457|    240|    }
  458|     16|    int idx = 0;
  459|    158|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (459:24): [True: 142, False: 16]
  ------------------
  460|    142|      base_idx[bits] = idx;
  461|       |      // assign symbols in symbol order for codes of this length
  462|  21.6k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (462:25): [True: 21.5k, False: 142]
  ------------------
  463|  21.5k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (463:13): [True: 1.91k, False: 19.6k]
  ------------------
  464|  1.91k|          symbols[idx++] = static_cast<int16_t>(sym);
  465|  1.91k|        }
  466|  21.5k|      }
  467|    142|    }
  468|     16|    return true;
  469|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  502|      2|inline Huff make_fixed_dist_huff() {
  503|      2|  Huff h;
  504|      2|  uint8_t lens[32];
  505|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (505:19): [True: 64, False: 2]
  ------------------
  506|      2|  h.build(lens, 32);
  507|      2|  return h;
  508|      2|}
serializers.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5134|  1.03k|  auto broadcast = [](uint8_t v) -> uint64_t {
 5135|  1.03k|    return 0x101010101010101ull * v;
 5136|  1.03k|  };
_ZN3ada4idna13ensure_tablesEv:
 4885|  2.35k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4886|  2.35k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4887|  2.35k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4887:7): [True: 2.35k, False: 1]
  ------------------
 4888|  2.35k|    return true;
 4889|  2.35k|  }
 4890|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4890:7): [True: 0, False: 1]
  ------------------
 4891|      0|    return false;
 4892|      0|  }
 4893|       |
 4894|      1|  uint8_t expected = kTablesUninit;
 4895|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4895:7): [True: 1, False: 0]
  ------------------
 4896|      1|                                                std::memory_order_acq_rel,
 4897|      1|                                                std::memory_order_acquire)) {
 4898|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4899|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4899:9): [True: 0, False: 1]
  ------------------
 4900|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4901|      0|      return false;
 4902|      0|    }
 4903|       |
 4904|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4905|      1|                                          table_blob::compressed_size, buffer,
 4906|      1|                                          table_blob::uncompressed_size);
 4907|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4907:9): [True: 0, False: 1]
  ------------------
 4908|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4908:9): [True: 0, False: 1]
  ------------------
 4909|      0|      delete[] buffer;
 4910|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4911|      0|      return false;
 4912|      0|    }
 4913|       |
 4914|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4915|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4916|       |
 4917|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|      1|      return buffer + off;
 4919|      1|    };
 4920|       |
 4921|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4922|       |    // acquire on tables_init_state and then observe these writes.
 4923|      1|    idna_stage1 =
 4924|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4925|      1|    idna_stage2 =
 4926|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4927|      1|    idna_bool_blocks =
 4928|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4929|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4930|       |
 4931|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4932|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_decomposition_block));
 4934|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4935|      1|        at(table_blob::off_decomposition_data));
 4936|      1|    ccc_index = at(table_blob::off_ccc_index);
 4937|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4938|      1|    composition_index = at(table_blob::off_composition_index);
 4939|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4940|      1|        at(table_blob::off_composition_block));
 4941|      1|    composition_data =
 4942|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4943|       |
 4944|      1|    id_continue =
 4945|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4946|      1|    id_start =
 4947|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4948|       |
 4949|      1|    dir_start =
 4950|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4951|      1|    dir_final =
 4952|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4953|      1|    dir_value = at(table_blob::off_dir_value);
 4954|      1|    combining_ranges =
 4955|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4956|       |
 4957|      1|    tables_buffer = buffer;
 4958|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4959|      1|    return true;
 4960|      1|  }
 4961|       |
 4962|       |  // Another thread owns init (or finished between our loads).
 4963|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4963:28): [True: 0, False: 0]
  ------------------
 4964|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4965|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4965:9): [True: 0, False: 0]
  ------------------
 4966|      0|      return true;
 4967|      0|    }
 4968|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4968:9): [True: 0, False: 0]
  ------------------
 4969|      0|      return false;
 4970|      0|    }
 4971|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4972|      0|    defined(_M_IX86)
 4973|      0|#if defined(__GNUC__) || defined(__clang__)
 4974|      0|    __builtin_ia32_pause();
 4975|      0|#endif
 4976|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4977|       |#if defined(__GNUC__) || defined(__clang__)
 4978|       |    asm volatile("yield" ::: "memory");
 4979|       |#endif
 4980|       |#endif
 4981|      0|  }
 4982|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4983|      0|  return false;
 4984|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  535|      1|                          size_t dst_cap) {
  536|      1|  BitReader br(src, src_len);
  537|      1|  size_t out = 0;
  538|      4|  for (;;) {
  539|      4|    uint32_t bfinal = br.get(1);
  540|      4|    uint32_t btype = br.get(2);
  541|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (541:9): [True: 0, False: 4]
  |  Branch (541:33): [True: 0, False: 4]
  ------------------
  542|      4|    if (btype == 0) {
  ------------------
  |  Branch (542:9): [True: 0, False: 4]
  ------------------
  543|       |      // stored
  544|      0|      br.align_byte();
  545|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // read 16+16 from bit buffer awkwardly - use byte path
  547|       |      // Align: bits is multiple of 8
  548|       |      // Get len from remaining bits then bytes
  549|      0|      uint32_t len = br.get(16);
  550|      0|      uint32_t nlen = br.get(16);
  551|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  |  Branch (551:32): [True: 0, False: 0]
  ------------------
  552|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|       |      // After get, may have bits in acc from previous - for stored, should be
  554|       |      // byte aligned Copy len bytes from p
  555|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (555:11): [True: 0, False: 0]
  ------------------
  556|       |        // leftover bits should be 0 if aligned
  557|      0|      }
  558|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (558:11): [True: 0, False: 0]
  ------------------
  559|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (559:11): [True: 0, False: 0]
  ------------------
  560|      0|      std::memcpy(dst + out, br.p, len);
  561|      0|      br.p += len;
  562|      0|      out += len;
  563|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (563:16): [True: 0, False: 4]
  |  Branch (563:30): [True: 4, False: 0]
  ------------------
  564|      4|      Huff lit, dist;
  565|      4|      if (btype == 1) {
  ------------------
  |  Branch (565:11): [True: 0, False: 4]
  ------------------
  566|       |        // use fixed via functions
  567|      4|      } else {
  568|       |        // dynamic
  569|      4|        uint32_t hlit = br.get(5);
  570|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (570:13): [True: 0, False: 4]
  ------------------
  571|      4|        hlit += 257;
  572|      4|        uint32_t hdist = br.get(5);
  573|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (573:13): [True: 0, False: 4]
  ------------------
  574|      4|        hdist += 1;
  575|      4|        uint32_t hclen = br.get(4);
  576|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:13): [True: 0, False: 4]
  ------------------
  577|      4|        hclen += 4;
  578|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  579|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  580|      4|        uint8_t clen[19]{};
  581|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (581:30): [True: 65, False: 4]
  ------------------
  582|     65|          uint32_t v = br.get(3);
  583|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (583:15): [True: 0, False: 65]
  ------------------
  584|     65|          clen[order[i]] = uint8_t(v);
  585|     65|        }
  586|      4|        Huff cl;
  587|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (587:13): [True: 0, False: 4]
  ------------------
  588|      4|        uint8_t lens[288 + 32]{};
  589|      4|        uint32_t n = hlit + hdist;
  590|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (590:30): [True: 1.08k, False: 4]
  ------------------
  591|  1.08k|          int sym = cl.decode(br);
  592|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (592:15): [True: 0, False: 1.08k]
  ------------------
  593|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (593:15): [True: 1.03k, False: 49]
  ------------------
  594|  1.03k|            lens[i++] = uint8_t(sym);
  595|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (595:22): [True: 49, False: 0]
  ------------------
  596|     49|            uint32_t rep = br.get(2);
  597|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 49]
  ------------------
  598|     49|            rep += 3;
  599|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (599:17): [True: 0, False: 49]
  ------------------
  600|     49|            uint8_t v = lens[i - 1];
  601|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (601:20): [True: 214, False: 49]
  ------------------
  602|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (602:22): [True: 0, False: 0]
  ------------------
  603|      0|            uint32_t rep = br.get(3);
  604|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|            rep += 3;
  606|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (606:20): [True: 0, False: 0]
  ------------------
  607|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (607:22): [True: 0, False: 0]
  ------------------
  608|      0|            uint32_t rep = br.get(7);
  609|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|            rep += 11;
  611|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (611:20): [True: 0, False: 0]
  ------------------
  612|      0|          } else
  613|      0|            return 0;
  614|  1.08k|        }
  615|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (615:13): [True: 0, False: 4]
  ------------------
  616|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (616:13): [True: 0, False: 4]
  ------------------
  617|      4|      }
  618|  52.2k|      for (;;) {
  619|  52.2k|        int sym;
  620|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (620:13): [True: 0, False: 52.2k]
  ------------------
  621|      0|          sym = fixed_litlen(br);
  622|  52.2k|        else
  623|  52.2k|          sym = lit.decode(br);
  624|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (624:13): [True: 0, False: 52.2k]
  ------------------
  625|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (625:13): [True: 37.2k, False: 14.9k]
  ------------------
  626|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (626:15): [True: 0, False: 37.2k]
  ------------------
  627|  37.2k|          dst[out++] = uint8_t(sym);
  628|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (628:20): [True: 4, False: 14.9k]
  ------------------
  629|      4|          break;
  630|  14.9k|        } else {
  631|  14.9k|          int len_code = sym - 257;
  632|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (632:15): [True: 0, False: 14.9k]
  |  Branch (632:31): [True: 0, False: 14.9k]
  ------------------
  633|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  634|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (634:15): [True: 2.03k, False: 12.9k]
  |  Branch (634:38): [True: 0, False: 2.03k]
  ------------------
  635|  14.9k|          uint32_t length =
  636|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (636:37): [True: 2.03k, False: 12.9k]
  ------------------
  637|  14.9k|          int dsym;
  638|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (638:15): [True: 0, False: 14.9k]
  ------------------
  639|      0|            dsym = fixed_dist(br);
  640|  14.9k|          else
  641|  14.9k|            dsym = dist.decode(br);
  642|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (642:15): [True: 0, False: 14.9k]
  |  Branch (642:27): [True: 0, False: 14.9k]
  ------------------
  643|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  644|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (644:15): [True: 9.97k, False: 5.01k]
  |  Branch (644:35): [True: 0, False: 9.97k]
  ------------------
  645|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (645:50): [True: 9.97k, False: 5.01k]
  ------------------
  646|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (646:15): [True: 0, False: 14.9k]
  |  Branch (646:33): [True: 0, False: 14.9k]
  ------------------
  647|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (647:32): [True: 187k, False: 14.9k]
  ------------------
  648|   187k|            dst[out] = dst[out - distance];
  649|   187k|            out++;
  650|   187k|          }
  651|  14.9k|        }
  652|  52.2k|      }
  653|      4|    } else {
  654|      0|      return 0;  // reserved
  655|      0|    }
  656|      4|    if (bfinal) break;
  ------------------
  |  Branch (656:9): [True: 1, False: 3]
  ------------------
  657|      4|  }
  658|      1|  return out;
  659|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  402|      1|      : p(data), end(data + len) {}
_ZN3ada4idna7deflate9BitReader3getEi:
  412|   457k|  uint32_t get(int n) {
  413|   457k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (413:9): [True: 0, False: 457k]
  ------------------
  414|   457k|    uint32_t v = acc & ((1u << n) - 1);
  415|   457k|    acc >>= n;
  416|   457k|    bits -= n;
  417|   457k|    return v;
  418|   457k|  }
_ZN3ada4idna7deflate9BitReader6ensureEi:
  404|   457k|  bool ensure(int n) {
  405|   520k|    while (bits < n) {
  ------------------
  |  Branch (405:12): [True: 62.3k, False: 457k]
  ------------------
  406|  62.3k|      if (p >= end) return false;
  ------------------
  |  Branch (406:11): [True: 0, False: 62.3k]
  ------------------
  407|  62.3k|      acc |= uint32_t(*p++) << bits;
  408|  62.3k|      bits += 8;
  409|  62.3k|    }
  410|   457k|    return true;
  411|   457k|  }
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  471|  68.3k|  int decode(BitReader& br) const {
  472|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (472:9): [True: 0, False: 68.3k]
  ------------------
  473|  68.3k|    int code = 0;
  474|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (474:23): [True: 427k, False: 0]
  ------------------
  475|   427k|      uint32_t b = br.get(1);
  476|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (476:11): [True: 0, False: 427k]
  ------------------
  477|   427k|      code = (code << 1) | int(b);
  478|   427k|      int first = first_code[len];
  479|   427k|      int cnt = counts[len];
  480|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (480:11): [True: 263k, False: 164k]
  |  Branch (480:18): [True: 68.3k, False: 195k]
  ------------------
  481|  68.3k|        return symbols[base_idx[len] + (code - first)];
  482|  68.3k|      }
  483|   427k|    }
  484|      0|    return -1;
  485|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4868|      1|                                         size_t len) noexcept {
 4869|      1|  uint32_t c = 0xFFFFFFFFu;
 4870|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4870:22): [True: 224k, False: 1]
  ------------------
 4871|   224k|    c ^= data[i];
 4872|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4872:21): [True: 1.79M, False: 224k]
  ------------------
 4873|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4874|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4875|  1.79M|    }
 4876|   224k|  }
 4877|      1|  return ~c;
 4878|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4691|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4692|      1|  if constexpr (std::endian::native == std::endian::little) {
 4693|      1|    (void)buffer;
 4694|      1|    return;
 4695|      1|  }
 4696|      0|  auto u16 = [&](size_t off, size_t count) {
 4697|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4698|      1|  };
 4699|      1|  auto u32 = [&](size_t off, size_t count) {
 4700|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4701|      1|  };
 4702|      1|  auto u64 = [&](size_t off, size_t count) {
 4703|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4704|      1|  };
 4705|       |
 4706|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4707|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4708|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4709|      1|  u16(table_blob::off_decomposition_block,
 4710|      1|      table_blob::count_decomposition_block);
 4711|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4712|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4713|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4714|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4715|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4716|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4717|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4718|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4719|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4917|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4918|     18|      return buffer + off;
 4919|     18|    };
serializers.cc:_ZN3ada4idnaL11idna_lookupEj:
 5072|  63.4k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5073|  63.4k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5073:7): [True: 63.3k, False: 84]
  ------------------
 5074|  63.3k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5075|  63.3k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5075:9): [True: 37.3k, False: 26.0k]
  ------------------
 5076|  37.3k|      uint32_t bit_idx =
 5077|  37.3k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5078|  37.3k|          (cp & IDNA_BLOCK_MASK);
 5079|  37.3k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5080|  37.3k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5080:14): [True: 37.3k, False: 10]
  ------------------
 5081|  37.3k|    }
 5082|  26.0k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5083|  63.3k|  }
 5084|       |
 5085|     84|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5085:7): [True: 50, False: 34]
  |  Branch (5085:40): [True: 24, False: 26]
  ------------------
 5086|     24|    return IDNA_IGNORED;
 5087|     24|  }
 5088|       |
 5089|     60|  return IDNA_DISALLOWED;
 5090|     84|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5115|  4.21k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5116|  4.21k|  size_t n = 0;
 5117|  10.0k|  while (*ptr != 0) {
  ------------------
  |  Branch (5117:10): [True: 5.85k, False: 4.21k]
  ------------------
 5118|  5.85k|    ++n;
 5119|  5.85k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5119:9): [True: 3.57k, False: 2.28k]
  ------------------
 5120|  3.57k|      ++ptr;
 5121|  3.57k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5121:16): [True: 1.74k, False: 544]
  ------------------
 5122|  1.74k|      ptr += 2;
 5123|  1.74k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5123:16): [True: 202, False: 342]
  ------------------
 5124|    202|      ptr += 3;
 5125|    342|    } else {
 5126|    342|      ptr += 4;
 5127|    342|    }
 5128|  5.85k|  }
 5129|  4.21k|  return n;
 5130|  4.21k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5093|  5.82k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5094|  5.82k|  uint8_t b0 = *ptr++;
 5095|  5.82k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5095:7): [True: 3.55k, False: 2.27k]
  ------------------
 5096|  2.27k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5096:7): [True: 1.72k, False: 544]
  ------------------
 5097|  1.72k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5098|  1.72k|    cp |= (*ptr++ & 0x3Fu);
 5099|  1.72k|    return static_cast<char32_t>(cp);
 5100|  1.72k|  }
 5101|    544|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5101:7): [True: 202, False: 342]
  ------------------
 5102|    202|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5103|    202|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5104|    202|    cp |= (*ptr++ & 0x3Fu);
 5105|    202|    return static_cast<char32_t>(cp);
 5106|    202|  }
 5107|    342|  uint32_t cp = (b0 & 0x07u) << 18;
 5108|    342|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5109|    342|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5110|    342|  cp |= (*ptr++ & 0x3Fu);
 5111|    342|  return static_cast<char32_t>(cp);
 5112|    544|}
_ZN3ada4idna23decomposition_block_rowEh:
 4989|  31.1k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4990|  31.1k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 31.1k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|  31.1k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4994|  31.1k|}
_ZN3ada4idna13ccc_block_rowEh:
 4996|  52.3k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4997|  52.3k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 52.3k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|  52.3k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 5001|  52.3k|}
_ZN3ada4idna16tables_are_readyEv:
 4880|    850|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4881|    850|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4882|    850|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5272|  27.6k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5273|  27.6k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5273:7): [True: 791, False: 26.8k]
  ------------------
 5274|    791|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5274:7): [True: 162, False: 629]
  ------------------
 5275|       |    // Hangul precomposed syllables are NFC.
 5276|    162|    return 0;
 5277|    162|  }
 5278|  27.5k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5278:7): [True: 0, False: 27.5k]
  ------------------
 5279|      0|    return 0;
 5280|      0|  }
 5281|  27.5k|  const uint8_t di = decomposition_index[current_character >> 8];
 5282|  27.5k|  const uint16_t* const decomposition =
 5283|  27.5k|      decomposition_block_row(di) + (current_character % 256);
 5284|  27.5k|  size_t decomposition_length =
 5285|  27.5k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5286|  27.5k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5286:7): [True: 365, False: 27.1k]
  |  Branch (5286:37): [True: 0, False: 365]
  ------------------
 5287|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5288|      0|  }
 5289|  27.5k|  return decomposition_length;
 5290|  27.5k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5404|    740|static bool would_compose(std::u32string_view input) noexcept {
 5405|  22.7k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5405:32): [True: 22.0k, False: 730]
  ------------------
 5406|  22.0k|    const char32_t current = input[input_count];
 5407|  22.0k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5407:9): [True: 1.18k, False: 20.8k]
  |  Branch (5407:36): [True: 5, False: 1.18k]
  ------------------
 5408|      5|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5408:11): [True: 4, False: 1]
  ------------------
 5409|      4|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5409:11): [True: 2, False: 2]
  ------------------
 5410|      2|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5410:11): [True: 0, False: 2]
  ------------------
 5411|      0|        return true;
 5412|      0|      }
 5413|      5|      ++input_count;
 5414|      5|      continue;
 5415|      5|    }
 5416|  22.0k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5416:9): [True: 540, False: 21.4k]
  |  Branch (5416:36): [True: 162, False: 378]
  ------------------
 5417|    162|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5417:11): [True: 142, False: 20]
  ------------------
 5418|    142|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5418:11): [True: 133, False: 9]
  ------------------
 5419|    133|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5419:11): [True: 78, False: 55]
  ------------------
 5420|     78|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5420:11): [True: 0, False: 78]
  ------------------
 5421|      0|        return true;
 5422|      0|      }
 5423|    162|      ++input_count;
 5424|    162|      continue;
 5425|    162|    }
 5426|  21.8k|    if (current < 0x110000) {
  ------------------
  |  Branch (5426:9): [True: 21.8k, False: 0]
  ------------------
 5427|  21.8k|      const uint16_t* composition =
 5428|  21.8k|          composition_block_row(composition_index[current >> 8]) +
 5429|  21.8k|          (current % 256);
 5430|  21.8k|      int32_t previous_ccc = -1;
 5431|  21.8k|      size_t j = input_count;
 5432|  22.2k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5432:14): [True: 21.5k, False: 720]
  ------------------
 5433|  21.5k|        uint8_t ccc = get_ccc(input[j + 1]);
 5434|  21.5k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5434:13): [True: 6.23k, False: 15.2k]
  |  Branch (5434:49): [True: 6.20k, False: 31]
  ------------------
 5435|  6.20k|          int left = composition[0];
 5436|  6.20k|          int right = composition[1];
 5437|  6.20k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5437:15): [True: 0, False: 6.20k]
  |  Branch (5437:27): [True: 0, False: 6.20k]
  ------------------
 5438|  6.20k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5438:15): [True: 0, False: 6.20k]
  ------------------
 5439|      0|            break;
 5440|      0|          }
 5441|  19.2k|          while (left + 2 < right) {
  ------------------
  |  Branch (5441:18): [True: 13.0k, False: 6.20k]
  ------------------
 5442|  13.0k|            int middle = left + (((right - left) >> 1) & ~1);
 5443|  13.0k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5443:17): [True: 1.10k, False: 11.9k]
  ------------------
 5444|  1.10k|              left = middle;
 5445|  1.10k|            }
 5446|  13.0k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5446:17): [True: 11.9k, False: 1.10k]
  ------------------
 5447|  11.9k|              right = middle;
 5448|  11.9k|            }
 5449|  13.0k|          }
 5450|  6.20k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5450:15): [True: 6.20k, False: 0]
  ------------------
 5451|  6.20k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5451:15): [True: 10, False: 6.19k]
  ------------------
 5452|     10|            return true;
 5453|     10|          }
 5454|  6.20k|        }
 5455|  21.5k|        if (ccc == 0) {
  ------------------
  |  Branch (5455:13): [True: 21.1k, False: 368]
  ------------------
 5456|  21.1k|          break;
 5457|  21.1k|        }
 5458|    368|        previous_ccc = ccc;
 5459|    368|      }
 5460|  21.8k|      input_count = j + 1;
 5461|  21.8k|      continue;
 5462|  21.8k|    }
 5463|      0|    ++input_count;
 5464|      0|  }
 5465|    730|  return false;
 5466|    740|}
_ZN3ada4idna21composition_block_rowEh:
 5003|  24.2k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 5004|  24.2k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (5004:7): [True: 0, False: 24.2k]
  ------------------
 5005|      0|    bi = 0;
 5006|      0|  }
 5007|  24.2k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5008|  24.2k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5632|  2.97k|static constexpr int32_t char_to_digit_value(char value) {
 5633|  2.97k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5633:7): [True: 2.15k, False: 821]
  |  Branch (5633:23): [True: 2.15k, False: 2]
  ------------------
 5634|    823|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5634:7): [True: 816, False: 7]
  |  Branch (5634:23): [True: 811, False: 5]
  ------------------
 5635|     12|  return -1;
 5636|    823|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5642|  3.06k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5643|  3.06k|  if (firsttime) {
  ------------------
  |  Branch (5643:7): [True: 1.02k, False: 2.04k]
  ------------------
 5644|  1.02k|    d = d / damp;
 5645|  2.04k|  } else {
 5646|  2.04k|    d = d / 2;
 5647|  2.04k|  }
 5648|  3.06k|  d += d / n;
 5649|  3.06k|  int32_t k = 0;
 5650|  4.09k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5650:10): [True: 1.03k, False: 3.06k]
  ------------------
 5651|  1.03k|    d /= base - tmin;
 5652|  1.03k|    k += base;
 5653|  1.03k|  }
 5654|  3.06k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5655|  3.06k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5638|  5.10k|static constexpr char digit_to_char(int32_t digit) {
 5639|  5.10k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5639:10): [True: 3.18k, False: 1.91k]
  ------------------
 5640|  5.10k|}
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5977|  9.84k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6062|  1.69k|      auto is_l_or_d = [](uint32_t code) {
 6063|  1.69k|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6063:16): [True: 0, False: 1.69k]
  ------------------
 6064|  1.69k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6064:16): [True: 52, False: 1.64k]
  ------------------
 6065|  1.69k|      };
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6066|  1.31k|      auto is_r_or_d = [](uint32_t code) {
 6067|  1.31k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6067:16): [True: 1, False: 1.31k]
  ------------------
 6068|  1.31k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6068:16): [True: 13, False: 1.29k]
  ------------------
 6069|  1.31k|      };
serializers.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5924|  1.01k|    const std::u32string_view label) noexcept {
 5925|  1.04k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5925:52): [True: 1.04k, False: 0]
  ------------------
 5926|  1.04k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5926:9): [True: 1.01k, False: 21]
  ------------------
 5927|       |
 5928|      0|  return std::u32string_view::npos;
 5929|  1.01k|}
serializers.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5933|  1.01k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5934|  1.01k|  const size_t mask =
 5935|  1.01k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5936|       |
 5937|  1.01k|  size_t directions = 0;
 5938|  14.0k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5938:22): [True: 13.0k, False: 1.01k]
  ------------------
 5939|  13.0k|    directions |= 1u << find_direction(label[i]);
 5940|  13.0k|  }
 5941|  1.01k|  return (directions & mask) != 0;
 5942|  1.01k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 5905|  17.8k|inline static direction find_direction(uint32_t code_point) noexcept {
 5906|       |  // Binary search on dir_final (sorted upper bounds).
 5907|  17.8k|  size_t lo = 0, hi = dir_table_count;
 5908|   202k|  while (lo < hi) {
  ------------------
  |  Branch (5908:10): [True: 184k, False: 17.8k]
  ------------------
 5909|   184k|    size_t mid = lo + (hi - lo) / 2;
 5910|   184k|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5910:9): [True: 57.9k, False: 126k]
  ------------------
 5911|  57.9k|      lo = mid + 1;
 5912|   126k|    } else {
 5913|   126k|      hi = mid;
 5914|   126k|    }
 5915|   184k|  }
 5916|  17.8k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5916:7): [True: 0, False: 17.8k]
  ------------------
 5917|      0|    return direction::NONE;
 5918|      0|  }
 5919|  17.8k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5919:10): [True: 17.5k, False: 300]
  ------------------
 5920|  17.8k|                                     : direction::NONE;
 5921|  17.8k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6290|  1.51k|bool constexpr is_ascii(std::string_view view) {
 6291|  14.5k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6291:18): [True: 14.5k, False: 346]
  ------------------
 6292|  14.5k|    if (c >= 0x80) {
  ------------------
  |  Branch (6292:9): [True: 1.16k, False: 13.3k]
  ------------------
 6293|  1.16k|      return false;
 6294|  1.16k|    }
 6295|  14.5k|  }
 6296|    346|  return true;
 6297|  1.51k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6327|    346|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6328|    346|  out.assign(ut8_string);
 6329|    346|  ascii_map(out.data(), out.size());
 6330|    346|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6281|  3.48k|bool constexpr is_ascii(std::u32string_view view) {
 6282|  27.7k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6282:19): [True: 27.7k, False: 1.46k]
  ------------------
 6283|  27.7k|    if (c >= 0x80) {
  ------------------
  |  Branch (6283:9): [True: 2.01k, False: 25.7k]
  ------------------
 6284|  2.01k|      return false;
 6285|  2.01k|    }
 6286|  27.7k|  }
 6287|  1.46k|  return true;
 6288|  3.48k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6343|  2.46k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6344|  2.46k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6344:10): [True: 1.29k, False: 1.16k]
  |  Branch (6344:31): [True: 264, False: 1.03k]
  |  Branch (6344:51): [True: 259, False: 5]
  ------------------
 6345|    259|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6345:10): [True: 248, False: 11]
  |  Branch (6345:30): [True: 236, False: 12]
  ------------------
 6346|  2.46k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6333|  1.41k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6334|  1.41k|  const size_t old = out.size();
 6335|  1.41k|  out.resize(old + label.size());
 6336|  1.41k|  char* dest = out.data() + old;
 6337|  10.5k|  for (char32_t c : label) {
  ------------------
  |  Branch (6337:19): [True: 10.5k, False: 1.41k]
  ------------------
 6338|  10.5k|    *dest++ = static_cast<char>(c);
 6339|  10.5k|  }
 6340|  1.41k|}
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7075|  14.5k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7076|  14.5k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7076:11): [True: 13.5k, False: 1.08k]
  |  Branch (7076:23): [True: 7.21k, False: 6.29k]
  |  Branch (7076:37): [True: 6.23k, False: 1.13k]
  |  Branch (7076:49): [True: 5.16k, False: 1.06k]
  ------------------
 7077|  2.20k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7077:11): [True: 1.00k, False: 1.20k]
  |  Branch (7077:23): [True: 788, False: 218]
  ------------------
 7078|  14.5k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7165|  12.7k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7166|  12.7k|  return hex_to_binary_table[c - '0'];
 7167|  12.7k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7306|  53.4k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7307|  53.4k|    return character_sets::bit_at(character_set, c);
 7308|  53.4k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7002|  4.44k|    const char* input, size_t length) noexcept {
 7003|  4.44k|  size_t i = 0;
 7004|  4.44k|  uint8_t accumulator{};
 7005|  33.8k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7005:10): [True: 29.4k, False: 4.44k]
  ------------------
 7006|  29.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7007|  29.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7008|  29.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7009|  29.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7010|  29.4k|  }
 7011|  9.99k|  for (; i < length; i++) {
  ------------------
  |  Branch (7011:10): [True: 5.55k, False: 4.44k]
  ------------------
 7012|  5.55k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7013|  5.55k|  }
 7014|  4.44k|  return accumulator;
 7015|  4.44k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7437|  26.2k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7438|  26.2k|  static constexpr char kHex[] = "0123456789abcdef";
 7439|  26.2k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7439:7): [True: 25.0k, False: 1.21k]
  ------------------
 7440|  25.0k|    *p++ = kHex[(v >> 12) & 0xf];
 7441|  25.0k|    *p++ = kHex[(v >> 8) & 0xf];
 7442|  25.0k|    *p++ = kHex[(v >> 4) & 0xf];
 7443|  25.0k|    *p++ = kHex[v & 0xf];
 7444|  25.0k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7444:14): [True: 404, False: 811]
  ------------------
 7445|    404|    *p++ = kHex[(v >> 8) & 0xf];
 7446|    404|    *p++ = kHex[(v >> 4) & 0xf];
 7447|    404|    *p++ = kHex[v & 0xf];
 7448|    811|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7448:14): [True: 339, False: 472]
  ------------------
 7449|    339|    *p++ = kHex[(v >> 4) & 0xf];
 7450|    339|    *p++ = kHex[v & 0xf];
 7451|    472|  } else {
 7452|    472|    *p++ = kHex[v & 0xf];
 7453|    472|  }
 7454|  26.2k|  return p;
 7455|  26.2k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7423|  16.0k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7424|  16.0k|  if (v < 10) {
  ------------------
  |  Branch (7424:7): [True: 2.49k, False: 13.5k]
  ------------------
 7425|  2.49k|    *p++ = static_cast<char>('0' + v);
 7426|  13.5k|  } else if (v < 100) {
  ------------------
  |  Branch (7426:14): [True: 8.97k, False: 4.53k]
  ------------------
 7427|  8.97k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7428|  8.97k|    p += 2;
 7429|  8.97k|  } else {
 7430|  4.53k|    *p++ = static_cast<char>('0' + v / 100);
 7431|  4.53k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7432|  4.53k|    p += 2;
 7433|  4.53k|  }
 7434|  16.0k|  return p;
 7435|  16.0k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6851|  9.85k|    std::string_view user_input) noexcept {
 6852|       |  // first check for short strings in which case we do it naively.
 6853|  9.85k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6853:7): [True: 1.94k, False: 7.90k]
  ------------------
 6854|  1.94k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6855|  1.94k|  }
 6856|       |  // fast path for long strings (expected to be common)
 6857|  7.90k|  size_t i = 0;
 6858|  7.90k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6859|  7.90k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6860|  7.90k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6861|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6862|  7.90k|  __m128i running{0};
 6863|  28.5k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6863:10): [True: 20.6k, False: 7.90k]
  ------------------
 6864|  20.6k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6865|  20.6k|    running = _mm_or_si128(
 6866|  20.6k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6867|  20.6k|                                           _mm_cmpeq_epi8(word, mask2))),
 6868|  20.6k|        _mm_cmpeq_epi8(word, mask3));
 6869|  20.6k|  }
 6870|  7.90k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6870:7): [True: 7.49k, False: 408]
  ------------------
 6871|  7.49k|    __m128i word = _mm_loadu_si128(
 6872|  7.49k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6873|  7.49k|    running = _mm_or_si128(
 6874|  7.49k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6875|  7.49k|                                           _mm_cmpeq_epi8(word, mask2))),
 6876|  7.49k|        _mm_cmpeq_epi8(word, mask3));
 6877|  7.49k|  }
 6878|  7.90k|  return _mm_movemask_epi8(running) != 0;
 6879|  9.85k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6742|  11.4k|constexpr bool is_tabs_or_newline(char c) noexcept {
 6743|  11.4k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6743:10): [True: 50, False: 11.3k]
  |  Branch (6743:23): [True: 14, False: 11.3k]
  |  Branch (6743:36): [True: 17, False: 11.3k]
  ------------------
 6744|  11.4k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8174|    211|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8175|       |  // if this ever becomes a performance issue, we could use an approach similar
 8176|       |  // to has_tabs_or_newline
 8177|    211|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8178|    211|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7096|  9.17k|    const char c) noexcept {
 7097|  9.17k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7097:10): [True: 138, False: 9.03k]
  |  Branch (7097:23): [True: 235, False: 8.79k]
  |  Branch (7097:36): [True: 295, False: 8.50k]
  ------------------
 7098|  9.17k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7091|  12.6k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7092|  12.6k|  return (unsigned char)c <= ' ';
 7093|  12.6k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7104|  3.25k|    std::string_view input) noexcept {
 7105|       |  // This will catch most cases:
 7106|       |  // The length must be 2,4 or 6.
 7107|       |  // We divide by two and require
 7108|       |  // that the result be between 1 and 3 inclusively.
 7109|  3.25k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7110|  3.25k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7110:7): [True: 2.13k, False: 1.12k]
  ------------------
 7111|  2.13k|    return false;
 7112|  2.13k|  }
 7113|       |  // We have a string of length 2, 4 or 6.
 7114|       |  // We now check the first character:
 7115|  1.12k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7115:7): [True: 644, False: 479]
  |  Branch (7115:28): [True: 312, False: 332]
  ------------------
 7116|    312|    return false;
 7117|    312|  }
 7118|       |  // We are unlikely the get beyond this point.
 7119|    811|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7120|    811|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7121|    811|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7121:7): [True: 279, False: 532]
  ------------------
 7122|    279|    return false;
 7123|    279|  }
 7124|       |  // We almost never get here.
 7125|       |  // Optimizing the rest is relatively unimportant.
 7126|    532|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7127|    532|    uint16_t A, B;
 7128|    532|    memcpy(&A, a.data(), sizeof(A));
 7129|    532|    memcpy(&B, b.data(), sizeof(B));
 7130|    532|    return A == B;
 7131|    532|  };
 7132|    532|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7132:7): [True: 244, False: 288]
  ------------------
 7133|    244|    return false;
 7134|    244|  }
 7135|    460|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7135:22): [True: 237, False: 223]
  ------------------
 7136|    237|    char c = input[i];
 7137|    237|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7137:9): [True: 65, False: 172]
  |  Branch (7137:10): [True: 128, False: 109]
  ------------------
 7138|     65|      return false;
 7139|     65|    }
 7140|    237|  }
 7141|    223|  return true;
 7142|       |  // The above code might be a bit better than the code below. Compilers
 7143|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7144|       |  // 6 and other tricks.
 7145|       |  // return input == ".." ||
 7146|       |  //  input == ".%2e" || input == ".%2E" ||
 7147|       |  //  input == "%2e." || input == "%2E." ||
 7148|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7149|       |  //  "%2e%2E";
 7150|    288|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7126|    532|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7127|    532|    uint16_t A, B;
 7128|    532|    memcpy(&A, a.data(), sizeof(A));
 7129|    532|    memcpy(&B, b.data(), sizeof(B));
 7130|    532|    return A == B;
 7131|    532|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7153|  6.04k|    std::string_view input) noexcept {
 7154|  6.04k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7154:10): [True: 225, False: 5.82k]
  |  Branch (7154:26): [True: 26, False: 5.79k]
  |  Branch (7154:44): [True: 0, False: 5.79k]
  ------------------
 7155|  6.04k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9149|  1.23k|                              bool& is_pure_decimal) noexcept {
 9150|  1.23k|  is_pure_decimal = false;
 9151|  1.23k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9151:7): [True: 0, False: 1.23k]
  ------------------
 9152|      0|    return false;
 9153|      0|  }
 9154|  1.23k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9154:7): [True: 1.04k, False: 192]
  |  Branch (9154:23): [True: 295, False: 748]
  |  Branch (9154:38): [True: 151, False: 144]
  ------------------
 9155|    151|    p += 2;
 9156|    151|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9156:9): [True: 14, False: 137]
  |  Branch (9156:21): [True: 3, False: 134]
  ------------------
 9157|     17|      value = 0;
 9158|     17|      return true;
 9159|     17|    }
 9160|    134|    uint64_t v = 0;
 9161|    134|    int digits = 0;
 9162|    700|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9162:12): [True: 649, False: 51]
  |  Branch (9162:23): [True: 603, False: 46]
  ------------------
 9163|    603|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9164|    603|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9164:11): [True: 6, False: 597]
  ------------------
 9165|      6|        return false;
 9166|      6|      }
 9167|    597|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9167:11): [True: 31, False: 566]
  ------------------
 9168|     31|        return false;
 9169|     31|      }
 9170|    566|      v = (v << 4) | nib;
 9171|    566|      ++p;
 9172|    566|      ++digits;
 9173|    566|    }
 9174|     97|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9174:9): [True: 0, False: 97]
  ------------------
 9175|      0|      return false;
 9176|      0|    }
 9177|     97|    value = v;
 9178|     97|    return true;
 9179|     97|  }
 9180|  1.08k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9180:7): [True: 892, False: 192]
  |  Branch (9180:23): [True: 144, False: 748]
  |  Branch (9180:38): [True: 77, False: 67]
  |  Branch (9180:53): [True: 72, False: 5]
  ------------------
 9181|     72|    ++p;
 9182|     72|    uint64_t v = 0;
 9183|    674|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9183:12): [True: 643, False: 31]
  |  Branch (9183:23): [True: 612, False: 31]
  ------------------
 9184|    612|      const char c = *p;
 9185|    612|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9185:11): [True: 1, False: 611]
  |  Branch (9185:22): [True: 3, False: 608]
  ------------------
 9186|      4|        return false;
 9187|      4|      }
 9188|    608|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9188:11): [True: 6, False: 602]
  ------------------
 9189|      6|        return false;
 9190|      6|      }
 9191|    602|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9192|    602|      ++p;
 9193|    602|    }
 9194|     62|    value = v;
 9195|     62|    return true;
 9196|     72|  }
 9197|  1.01k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9197:7): [True: 119, False: 893]
  |  Branch (9197:19): [True: 261, False: 632]
  ------------------
 9198|    380|    return false;
 9199|    380|  }
 9200|    632|  is_pure_decimal = true;
 9201|    632|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9202|    632|  ++p;
 9203|  1.68k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9203:10): [True: 1.36k, False: 327]
  |  Branch (9203:21): [True: 1.12k, False: 239]
  ------------------
 9204|  1.12k|    const char c = *p;
 9205|  1.12k|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9205:9): [True: 12, False: 1.11k]
  |  Branch (9205:20): [True: 25, False: 1.08k]
  ------------------
 9206|     37|      return false;
 9207|     37|    }
 9208|  1.08k|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9208:9): [True: 25, False: 1.06k]
  ------------------
 9209|     25|      return false;
 9210|     25|    }
 9211|  1.06k|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9212|  1.06k|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9212:9): [True: 4, False: 1.05k]
  ------------------
 9213|      4|      return false;
 9214|      4|    }
 9215|  1.05k|    ++p;
 9216|  1.05k|  }
 9217|    566|  value = v;
 9218|    566|  return true;
 9219|    632|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9223|  3.74k|                           uint16_t& value) noexcept {
 9224|  3.74k|  if (pointer == end) {
  ------------------
  |  Branch (9224:7): [True: 0, False: 3.74k]
  ------------------
 9225|      0|    return 0;
 9226|      0|  }
 9227|  3.74k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9228|  3.74k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9228:7): [True: 3.55k, False: 198]
  ------------------
 9229|  3.55k|    return 0;
 9230|  3.55k|  }
 9231|    198|  uint32_t v = n0;
 9232|    198|  ++pointer;
 9233|    198|  int length = 1;
 9234|    198|  if (pointer != end) {
  ------------------
  |  Branch (9234:7): [True: 194, False: 4]
  ------------------
 9235|    194|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9236|    194|    if (n1 != 0xff) {
  ------------------
  |  Branch (9236:9): [True: 135, False: 59]
  ------------------
 9237|    135|      v = (v << 4) | n1;
 9238|    135|      ++pointer;
 9239|    135|      ++length;
 9240|    135|      if (pointer != end) {
  ------------------
  |  Branch (9240:11): [True: 134, False: 1]
  ------------------
 9241|    134|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9242|    134|        if (n2 != 0xff) {
  ------------------
  |  Branch (9242:13): [True: 92, False: 42]
  ------------------
 9243|     92|          v = (v << 4) | n2;
 9244|     92|          ++pointer;
 9245|     92|          ++length;
 9246|     92|          if (pointer != end) {
  ------------------
  |  Branch (9246:15): [True: 91, False: 1]
  ------------------
 9247|     91|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9248|     91|            if (n3 != 0xff) {
  ------------------
  |  Branch (9248:17): [True: 46, False: 45]
  ------------------
 9249|     46|              v = (v << 4) | n3;
 9250|     46|              ++pointer;
 9251|     46|              ++length;
 9252|     46|            }
 9253|     91|          }
 9254|     92|        }
 9255|    134|      }
 9256|    135|    }
 9257|    194|  }
 9258|    198|  value = static_cast<uint16_t>(v);
 9259|    198|  return length;
 9260|  3.74k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  112|  3.54k|    std::string_view input) noexcept {
  113|  3.54k|  if (input.empty()) return false;
  ------------------
  |  Branch (113:7): [True: 673, False: 2.87k]
  ------------------
  114|  2.87k|  if (input.back() == '.') {
  ------------------
  |  Branch (114:7): [True: 220, False: 2.65k]
  ------------------
  115|    220|    if (input.size() > 254) return false;
  ------------------
  |  Branch (115:9): [True: 0, False: 220]
  ------------------
  116|  2.65k|  } else if (input.size() > 253)
  ------------------
  |  Branch (116:14): [True: 0, False: 2.65k]
  ------------------
  117|      0|    return false;
  118|       |
  119|  2.87k|  size_t start = 0;
  120|  10.7k|  while (start < input.size()) {
  ------------------
  |  Branch (120:10): [True: 8.42k, False: 2.32k]
  ------------------
  121|  8.42k|    auto dot_location = input.find('.', start);
  122|       |    // If not found, it's likely the end of the domain
  123|  8.42k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (123:9): [True: 2.17k, False: 6.24k]
  ------------------
  124|       |
  125|  8.42k|    auto label_size = dot_location - start;
  126|  8.42k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (126:9): [True: 181, False: 8.24k]
  |  Branch (126:28): [True: 362, False: 7.88k]
  ------------------
  127|       |
  128|  7.88k|    start = dot_location + 1;
  129|  7.88k|  }
  130|       |
  131|  2.32k|  return true;
  132|  2.87k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7068|  25.2k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7069|  25.2k|  return is_alnum_plus_table[uint8_t(c)];
 7070|       |  // A table is almost surely much faster than the
 7071|       |  // following under most compilers: return
 7072|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7073|  25.2k|}
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8114|  6.30k|    std::string_view& input) noexcept {
 8115|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8116|       |  // function). this function should be quite fast.
 8117|  6.30k|  size_t location_of_first = input.find('#');
 8118|  6.30k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8118:7): [True: 6.18k, False: 125]
  ------------------
 8119|  6.18k|    return std::nullopt;
 8120|  6.18k|  }
 8121|    125|  std::string_view hash = input;
 8122|    125|  hash.remove_prefix(location_of_first + 1);
 8123|    125|  input.remove_suffix(input.size() - location_of_first);
 8124|    125|  return hash;
 8125|  6.30k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9067|  1.66k|find_authority_delimiter_special(std::string_view view) noexcept {
 9068|       |  // performance note: we might be able to gain further performance
 9069|       |  // with SIMD intrinsics.
 9070|  9.94k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9070:33): [True: 9.93k, False: 8]
  ------------------
 9071|  9.93k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9071:9): [True: 1.65k, False: 8.28k]
  ------------------
 9072|  1.65k|      return pos - view.begin();
 9073|  1.65k|    }
 9074|  9.93k|  }
 9075|      8|  return size_t(view.size());
 9076|  1.66k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8127|    223|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8128|       |  // Let path be url's path.
 8129|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8130|       |  // Windows drive letter, then return.
 8131|    223|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8131:7): [True: 0, False: 223]
  ------------------
 8132|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8132:7): [True: 0, False: 0]
  |  Branch (8132:54): [True: 0, False: 0]
  ------------------
 8133|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8133:9): [True: 0, False: 0]
  ------------------
 8134|      0|            helpers::substring(path, 1))) {
 8135|      0|      return false;
 8136|      0|    }
 8137|      0|  }
 8138|       |
 8139|       |  // Remove path's last item, if any.
 8140|    223|  size_t last_delimiter = path.rfind('/');
 8141|    223|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8141:7): [True: 144, False: 79]
  ------------------
 8142|    144|    path.erase(last_delimiter);
 8143|    144|    return true;
 8144|    144|  }
 8145|       |
 8146|     79|  return false;
 8147|    223|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8780|  6.30k|    const bool is_special, std::string_view& view) noexcept {
 8781|       |  /**
 8782|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 8783|       |   * compute a variable called insideBrackets but this variable is only used
 8784|       |   * once, to check whether a ':' character was found outside brackets. Exact
 8785|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 8786|       |   * It is conceptually simpler and arguably more efficient to just return a
 8787|       |   * Boolean indicating whether ':' was found outside brackets.
 8788|       |   */
 8789|  6.30k|  const size_t view_size = view.size();
 8790|  6.30k|  size_t location = 0;
 8791|  6.30k|  bool found_colon = false;
 8792|       |  /**
 8793|       |   * Performance analysis:
 8794|       |   *
 8795|       |   * We are basically seeking the end of the hostname which can be indicated
 8796|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 8797|       |   * (where '\\' is only applicable for special URLs). However, these must
 8798|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 8799|       |   * '?' does not count.
 8800|       |   *
 8801|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 8802|       |   * the set of delimiters, and that we handle it first.
 8803|       |   *
 8804|       |   * So the trick is to have a fast function that locates the next delimiter.
 8805|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 8806|       |   * function would be provided by the C++ standard library, but it seems that
 8807|       |   * find_first_of is not very fast, so we are forced to roll our own.
 8808|       |   *
 8809|       |   * We do not break into two loops for speed, but for clarity.
 8810|       |   */
 8811|  6.30k|  if (is_special) {
  ------------------
  |  Branch (8811:7): [True: 6.30k, False: 0]
  ------------------
 8812|       |    // We move to the next delimiter.
 8813|  6.30k|    location = find_next_host_delimiter_special(view, location);
 8814|       |    // Unless we find '[' then we are going only going to have to call
 8815|       |    // find_next_host_delimiter_special once.
 8816|  10.1k|    for (; location < view_size;
  ------------------
  |  Branch (8816:12): [True: 10.0k, False: 46]
  ------------------
 8817|  10.0k|         location = find_next_host_delimiter_special(view, location)) {
 8818|  10.0k|      if (view[location] == '[') {
  ------------------
  |  Branch (8818:11): [True: 3.87k, False: 6.19k]
  ------------------
 8819|  3.87k|        location = view.find(']', location);
 8820|  3.87k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (8820:13): [True: 60, False: 3.81k]
  ------------------
 8821|       |          // performance: view.find might get translated to a memchr, which
 8822|       |          // has no notion of std::string_view::npos, so the code does not
 8823|       |          // reflect the assembly.
 8824|     60|          location = view_size;
 8825|     60|          break;
 8826|     60|        }
 8827|  6.19k|      } else {
 8828|  6.19k|        found_colon = view[location] == ':';
 8829|  6.19k|        break;
 8830|  6.19k|      }
 8831|  10.0k|    }
 8832|  6.30k|  } else {
 8833|       |    // We move to the next delimiter.
 8834|      0|    location = find_next_host_delimiter(view, location);
 8835|       |    // Unless we find '[' then we are going only going to have to call
 8836|       |    // find_next_host_delimiter_special once.
 8837|      0|    for (; location < view_size;
  ------------------
  |  Branch (8837:12): [True: 0, False: 0]
  ------------------
 8838|      0|         location = find_next_host_delimiter(view, location)) {
 8839|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (8839:11): [True: 0, False: 0]
  ------------------
 8840|      0|        location = view.find(']', location);
 8841|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (8841:13): [True: 0, False: 0]
  ------------------
 8842|       |          // performance: view.find might get translated to a memchr, which
 8843|       |          // has no notion of std::string_view::npos, so the code does not
 8844|       |          // reflect the assembly.
 8845|      0|          location = view_size;
 8846|      0|          break;
 8847|      0|        }
 8848|      0|      } else {
 8849|      0|        found_colon = view[location] == ':';
 8850|      0|        break;
 8851|      0|      }
 8852|      0|    }
 8853|      0|  }
 8854|       |  // performance: remove_suffix may translate into a single instruction.
 8855|  6.30k|  view.remove_suffix(view_size - location);
 8856|  6.30k|  return {location, found_colon};
 8857|  6.30k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8370|  10.1k|    std::string_view view, size_t location) noexcept {
 8371|       |  // first check for short strings in which case we do it naively.
 8372|  10.1k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8372:7): [True: 4.77k, False: 5.33k]
  ------------------
 8373|  17.5k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8373:31): [True: 17.4k, False: 33]
  ------------------
 8374|  17.4k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8374:11): [True: 180, False: 17.2k]
  |  Branch (8374:29): [True: 4.27k, False: 13.0k]
  |  Branch (8374:47): [True: 21, False: 12.9k]
  ------------------
 8375|  12.9k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8375:11): [True: 18, False: 12.9k]
  |  Branch (8375:29): [True: 246, False: 12.7k]
  ------------------
 8376|  4.74k|        return i;
 8377|  4.74k|      }
 8378|  17.4k|    }
 8379|     33|    return size_t(view.size());
 8380|  4.77k|  }
 8381|       |  // fast path for long strings (expected to be common)
 8382|  5.33k|  size_t i = location;
 8383|  5.33k|  const __m128i mask1 = _mm_set1_epi8(':');
 8384|  5.33k|  const __m128i mask2 = _mm_set1_epi8('/');
 8385|  5.33k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8386|  5.33k|  const __m128i mask4 = _mm_set1_epi8('?');
 8387|  5.33k|  const __m128i mask5 = _mm_set1_epi8('[');
 8388|       |
 8389|  7.35k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8389:10): [True: 6.56k, False: 790]
  ------------------
 8390|  6.56k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8391|  6.56k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8392|  6.56k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8393|  6.56k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8394|  6.56k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8395|  6.56k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8396|  6.56k|    __m128i m = _mm_or_si128(
 8397|  6.56k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8398|  6.56k|    int mask = _mm_movemask_epi8(m);
 8399|  6.56k|    if (mask != 0) {
  ------------------
  |  Branch (8399:9): [True: 4.54k, False: 2.02k]
  ------------------
 8400|  4.54k|      return i + trailing_zeroes(mask);
 8401|  4.54k|    }
 8402|  6.56k|  }
 8403|    790|  if (i < view.size()) {
  ------------------
  |  Branch (8403:7): [True: 788, False: 2]
  ------------------
 8404|    788|    __m128i word =
 8405|    788|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8406|    788|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8407|    788|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8408|    788|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8409|    788|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8410|    788|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8411|    788|    __m128i m = _mm_or_si128(
 8412|    788|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8413|    788|    int mask = _mm_movemask_epi8(m);
 8414|    788|    if (mask != 0) {
  ------------------
  |  Branch (8414:9): [True: 777, False: 11]
  ------------------
 8415|    777|      return view.length() - 16 + trailing_zeroes(mask);
 8416|    777|    }
 8417|    788|  }
 8418|     13|  return size_t(view.length());
 8419|    790|}
_ZN3ada7helpers15trailing_zeroesEj:
 8195|  5.32k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8196|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8197|       |  unsigned long ret;
 8198|       |  // Search the mask data from least significant bit (LSB)
 8199|       |  // to the most significant bit (MSB) for a set bit (1).
 8200|       |  _BitScanForward(&ret, input_num);
 8201|       |  return (int)ret;
 8202|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8203|  5.32k|  return __builtin_ctzl(input_num);
 8204|  5.32k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8205|  5.32k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 6997|  15.7k|    const char c) noexcept {
 6998|  15.7k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 6999|  15.7k|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
11575|  6.30k|    ada::url_components& components, uint32_t new_difference) {
11576|  6.30k|  components.username_end += new_difference;
11577|  6.30k|  components.host_start += new_difference;
11578|  6.30k|  components.host_end += new_difference;
11579|  6.30k|  components.pathname_start += new_difference;
11580|  6.30k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (11580:7): [True: 0, False: 6.30k]
  ------------------
11581|      0|    components.search_start += new_difference;
11582|      0|  }
11583|  6.30k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (11583:7): [True: 0, False: 6.30k]
  ------------------
11584|      0|    components.hash_start += new_difference;
11585|      0|  }
11586|  6.30k|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12064|  6.30k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
12065|  6.30k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
12066|  6.30k|          " bytes]");
12067|  6.30k|  ADA_ASSERT_TRUE(validate());
12068|  6.30k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
12069|  6.30k|  if (input.empty()) {
  ------------------
  |  Branch (12069:7): [True: 3, False: 6.30k]
  ------------------
12070|      3|    return is_valid = false;
12071|      3|  }  // technically unnecessary.
12072|       |  // If input starts with U+005B ([), then:
12073|  6.30k|  if (input[0] == '[') {
  ------------------
  |  Branch (12073:7): [True: 3.62k, False: 2.67k]
  ------------------
12074|       |    // If input does not end with U+005D (]), validation error, return failure.
12075|  3.62k|    if (input.back() != ']') {
  ------------------
  |  Branch (12075:9): [True: 13, False: 3.61k]
  ------------------
12076|     13|      return is_valid = false;
12077|     13|    }
12078|  3.61k|    ada_log("parse_host ipv6");
12079|       |
12080|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
12081|       |    // trailing U+005D (]) removed.
12082|  3.61k|    input.remove_prefix(1);
12083|  3.61k|    input.remove_suffix(1);
12084|  3.61k|    return parse_ipv6(input);
12085|  3.62k|  }
12086|       |
12087|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
12088|       |  // input.
12089|  2.67k|  if (!is_special()) {
  ------------------
  |  Branch (12089:7): [True: 0, False: 2.67k]
  ------------------
12090|      0|    return parse_opaque_host(input);
12091|      0|  }
12092|       |  // Let domain be the result of running UTF-8 decode without BOM on the
12093|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
12094|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
12095|       |  // which case we do not need to call the expensive 'to_ascii' if a few
12096|       |  // conditions are met: no '%' and no 'xn-' subsequence.
12097|       |
12098|       |  // Often, the input does not contain any forbidden code points, and no upper
12099|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
12100|       |  // optimize for such a common case.
12101|       |
12102|       |  // Fast path: try to parse as pure decimal IPv4(a.b.c.d) first.
12103|  2.67k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
12104|  2.67k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (12104:7): [True: 194, False: 2.47k]
  ------------------
12105|       |    // Fast path succeeded - input is pure decimal IPv4
12106|    194|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (12106:9): [True: 194, False: 0]
  |  Branch (12106:27): [True: 2, False: 192]
  ------------------
12107|      2|      update_base_hostname(input.substr(0, input.size() - 1));
12108|    192|    } else {
12109|    192|      update_base_hostname(input);
12110|    192|    }
12111|    194|    host_type = IPV4;
12112|    194|    is_valid = true;
12113|    194|    ada_log("parse_host fast path decimal ipv4");
12114|    194|    ADA_ASSERT_TRUE(validate());
12115|    194|    return true;
12116|    194|  }
12117|  2.47k|  uint8_t is_forbidden_or_upper =
12118|  2.47k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
12119|  2.47k|                                                             input.size());
12120|       |  // Minor optimization opportunity:
12121|       |  // contains_forbidden_domain_code_point_or_upper could be extend to check for
12122|       |  // the presence of characters that cannot appear in the ipv4 address and we
12123|       |  // could also check whether x and n and - are present, and so we could skip
12124|       |  // some of the checks below. However, the gains are likely to be small, and
12125|       |  // the code would be more complex.
12126|  2.47k|  static constexpr std::string_view xn_dash{"xn-", 3};
12127|  2.47k|  if (is_forbidden_or_upper == 0 &&
  ------------------
  |  Branch (12127:7): [True: 986, False: 1.49k]
  ------------------
12128|    986|      input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (12128:7): [True: 968, False: 18]
  ------------------
12129|       |    // fast path
12130|    968|    update_base_hostname(input);
12131|       |
12132|       |    // Check for other IPv4 formats (hex, octal, etc.)
12133|    968|    if (checkers::is_ipv4(get_hostname())) {
  ------------------
  |  Branch (12133:9): [True: 648, False: 320]
  ------------------
12134|    648|      ada_log("parse_host fast path ipv4");
12135|    648|      return parse_ipv4(get_hostname(), true);
12136|    648|    }
12137|    320|    ada_log("parse_host fast path ", get_hostname());
12138|    320|    is_valid = true;
12139|    320|    return true;
12140|    968|  }
12141|       |  // We have encountered at least one forbidden code point or the input contains
12142|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
12143|       |  // conversion.
12144|       |
12145|  1.51k|  ada_log("parse_host calling to_ascii");
12146|  1.51k|  std::optional<std::string> host = std::string(get_hostname());
12147|  1.51k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
12148|  1.51k|  if (!is_valid) {
  ------------------
  |  Branch (12148:7): [True: 854, False: 657]
  ------------------
12149|    854|    ada_log("parse_host to_ascii returns false");
12150|    854|    return is_valid = false;
12151|    854|  }
12152|    657|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
12153|    657|          " bytes]");
12154|       |
12155|    657|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (12155:7): [True: 0, False: 657]
  ------------------
12156|    657|                          ada::unicode::is_forbidden_domain_code_point)) {
12157|      0|    return is_valid = false;
12158|      0|  }
12159|       |
12160|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
12161|       |  // asciiDomain.
12162|    657|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (12162:7): [True: 312, False: 345]
  ------------------
12163|    312|    ada_log("parse_host got ipv4 ", *host);
12164|    312|    return parse_ipv4(host.value(), false);
12165|    312|  }
12166|       |
12167|    345|  update_base_hostname(host.value());
12168|    345|  ADA_ASSERT_TRUE(validate());
12169|    345|  return true;
12170|    657|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
12977|  1.04k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
12978|  1.04k|  ada_log("url_aggregator::consume_prepared_path ", input);
12979|       |  /***
12980|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
12981|       |   * unfortunate. This particular function is nearly identical, except that it
12982|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
12983|       |   * very common) merely appends to the buffer. This is the same trivial path as
12984|       |   * with helpers::parse_prepared_path, except that we have the additional check
12985|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
12986|       |   * modify it, and then insert it back into the buffer.
12987|       |   */
12988|  1.04k|  uint8_t accumulator = checkers::path_signature(input);
12989|       |  // Let us first detect a trivial case.
12990|       |  // If it is special, we check that we have no dot, no %,  no \ and no
12991|       |  // character needing percent encoding. Otherwise, we check that we have no %,
12992|       |  // no dot, and no character needing percent encoding.
12993|  1.04k|  constexpr uint8_t need_encoding = 1;
12994|  1.04k|  constexpr uint8_t backslash_char = 2;
12995|  1.04k|  constexpr uint8_t dot_char = 4;
12996|  1.04k|  constexpr uint8_t percent_char = 8;
12997|  1.04k|  bool special = type != ada::scheme::NOT_SPECIAL;
12998|  1.04k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (12998:39): [True: 0, False: 1.04k]
  ------------------
12999|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (12999:39): [True: 0, False: 0]
  ------------------
13000|  1.04k|  bool trivial_path =
13001|  1.04k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (13001:7): [True: 465, False: 578]
  |  Branch (13001:8): [True: 1.04k, False: 0]
  ------------------
13002|  1.04k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
13003|      0|                  0)) &&
13004|    465|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (13004:7): [True: 465, False: 0]
  ------------------
13005|  1.04k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (13005:7): [True: 242, False: 801]
  |  Branch (13005:34): [True: 242, False: 0]
  ------------------
13006|       |    // '4' means that we have at least one dot, but nothing that requires
13007|       |    // percent encoding or decoding. The only part that is not trivial is
13008|       |    // that we may have single dots and double dots path segments.
13009|       |    // If we have such segments, then we either have a path that begins
13010|       |    // with '.' (easy to check), or we have the sequence './'.
13011|       |    // Note: input cannot be empty, it must at least contain one character ('.')
13012|       |    // Note: we know that '\' is not present.
13013|    242|    if (input[0] != '.') {
  ------------------
  |  Branch (13013:9): [True: 140, False: 102]
  ------------------
13014|    140|      size_t slashdot = 0;
13015|    140|      bool dot_is_file = true;
13016|    630|      for (;;) {
13017|    630|        slashdot = input.find("/.", slashdot);
13018|    630|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (13018:13): [True: 140, False: 490]
  ------------------
13019|    140|          break;
13020|    490|        } else {  // uncommon
13021|       |          // only three cases matter: /./, /.. or a final /
13022|    490|          slashdot += 2;
13023|    490|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (13023:28): [True: 1, False: 489]
  |  Branch (13023:56): [True: 172, False: 317]
  ------------------
13024|    317|                           input[slashdot] == '/');
  ------------------
  |  Branch (13024:28): [True: 134, False: 183]
  ------------------
13025|    490|        }
13026|    630|      }
13027|    140|      trivial_path = dot_is_file;
13028|    140|    }
13029|    242|  }
13030|  1.04k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (13030:7): [True: 515, False: 528]
  |  Branch (13030:23): [True: 515, False: 0]
  ------------------
13031|    515|    ada_log("parse_path trivial");
13032|    515|    buffer += '/';
13033|    515|    buffer += input;
13034|    515|    return;
13035|    515|  }
13036|    528|  std::string path = std::string(get_pathname());
13037|       |  // We are going to need to look a bit at the path, but let us see if we can
13038|       |  // ignore percent encoding *and* backslashes *and* percent characters.
13039|       |  // Except for the trivial case, this is likely to capture 99% of paths out
13040|       |  // there.
13041|    528|  bool fast_path =
13042|    528|      (special &&
  ------------------
  |  Branch (13042:8): [True: 528, False: 0]
  ------------------
13043|    528|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (13043:8): [True: 192, False: 336]
  ------------------
13044|    192|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (13044:7): [True: 192, False: 0]
  ------------------
13045|    528|  if (fast_path) {
  ------------------
  |  Branch (13045:7): [True: 192, False: 336]
  ------------------
13046|    192|    ada_log("parse_prepared_path fast");
13047|       |    // Here we don't need to worry about \ or percent encoding.
13048|       |    // We also do not have a file protocol. We might have dots, however,
13049|       |    // but dots must as appear as '.', and they cannot be encoded because
13050|       |    // the symbol '%' is not present.
13051|    192|    size_t previous_location = 0;  // We start at 0.
13052|  1.88k|    do {
13053|  1.88k|      size_t new_location = input.find('/', previous_location);
13054|       |      // std::string_view path_view = input;
13055|       |      //  We process the last segment separately:
13056|  1.88k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (13056:11): [True: 192, False: 1.68k]
  ------------------
13057|    192|        std::string_view path_view = input.substr(previous_location);
13058|    192|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (13058:13): [True: 24, False: 168]
  ------------------
13059|       |          // e.g., if you receive ".." with an empty path, you go to "/".
13060|     24|          if (path.empty()) {
  ------------------
  |  Branch (13060:15): [True: 7, False: 17]
  ------------------
13061|      7|            path = '/';
13062|      7|            update_base_pathname(path);
13063|      7|            return;
13064|      7|          }
13065|       |          // Fast case where we have nothing to do:
13066|     17|          if (path.back() == '/') {
  ------------------
  |  Branch (13066:15): [True: 2, False: 15]
  ------------------
13067|      2|            update_base_pathname(path);
13068|      2|            return;
13069|      2|          }
13070|       |          // If you have the path "/joe/myfriend",
13071|       |          // then you delete 'myfriend'.
13072|     15|          path.resize(path.rfind('/') + 1);
13073|     15|          update_base_pathname(path);
13074|     15|          return;
13075|     17|        }
13076|    168|        path += '/';
13077|    168|        if (path_view != ".") {
  ------------------
  |  Branch (13077:13): [True: 165, False: 3]
  ------------------
13078|    165|          path.append(path_view);
13079|    165|        }
13080|    168|        update_base_pathname(path);
13081|    168|        return;
13082|  1.68k|      } else {
13083|       |        // This is a non-final segment.
13084|  1.68k|        std::string_view path_view =
13085|  1.68k|            input.substr(previous_location, new_location - previous_location);
13086|  1.68k|        previous_location = new_location + 1;
13087|  1.68k|        if (path_view == "..") {
  ------------------
  |  Branch (13087:13): [True: 153, False: 1.53k]
  ------------------
13088|    153|          size_t last_delimiter = path.rfind('/');
13089|    153|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (13089:15): [True: 106, False: 47]
  ------------------
13090|    106|            path.erase(last_delimiter);
13091|    106|          }
13092|  1.53k|        } else if (path_view != ".") {
  ------------------
  |  Branch (13092:20): [True: 1.32k, False: 210]
  ------------------
13093|  1.32k|          path += '/';
13094|  1.32k|          path.append(path_view);
13095|  1.32k|        }
13096|  1.68k|      }
13097|  1.88k|    } while (true);
  ------------------
  |  Branch (13097:14): [True: 1.68k, Folded]
  ------------------
13098|    336|  } else {
13099|    336|    ada_log("parse_path slow");
13100|       |    // we have reached the general case
13101|    336|    bool needs_percent_encoding = (accumulator & 1);
13102|    336|    std::string path_buffer_tmp;
13103|  3.25k|    do {
13104|  3.25k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (13104:26): [True: 3.25k, False: 0]
  |  Branch (13104:37): [True: 554, False: 2.69k]
  ------------------
13105|  3.25k|                            ? input.find_first_of("/\\")
13106|  3.25k|                            : input.find('/');
13107|  3.25k|      std::string_view path_view = input;
13108|  3.25k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (13108:11): [True: 2.91k, False: 336]
  ------------------
13109|  2.91k|        path_view.remove_suffix(path_view.size() - location);
13110|  2.91k|        input.remove_prefix(location + 1);
13111|  2.91k|      }
13112|       |      // path_buffer is either path_view or it might point at a percent encoded
13113|       |      // temporary string.
13114|  3.25k|      std::string_view path_buffer =
13115|  3.25k|          (needs_percent_encoding &&
  ------------------
  |  Branch (13115:12): [True: 3.06k, False: 193]
  ------------------
13116|  3.06k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (13116:12): [True: 776, False: 2.28k]
  ------------------
13117|  3.06k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
13118|  3.25k|              ? path_buffer_tmp
13119|  3.25k|              : path_view;
13120|  3.25k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (13120:11): [True: 223, False: 3.03k]
  ------------------
13121|    223|        helpers::shorten_path(path, type);
13122|    223|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (13122:13): [True: 13, False: 210]
  ------------------
13123|     13|          path += '/';
13124|     13|        }
13125|  3.03k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (13125:18): [True: 131, False: 2.89k]
  ------------------
13126|    131|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (13126:18): [True: 11, False: 120]
  ------------------
13127|     11|        path += '/';
13128|     11|      }
13129|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
13130|  3.01k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (13130:16): [True: 2.89k, False: 120]
  ------------------
13131|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
13132|       |        // Windows drive letter, then replace the second code point in
13133|       |        // path_buffer with U+003A (:).
13134|  2.89k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (13134:13): [True: 0, False: 2.89k]
  |  Branch (13134:48): [True: 0, False: 0]
  ------------------
13135|      0|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (13135:13): [True: 0, False: 0]
  ------------------
13136|      0|          path += '/';
13137|      0|          path += path_buffer[0];
13138|      0|          path += ':';
13139|      0|          path_buffer.remove_prefix(2);
13140|      0|          path.append(path_buffer);
13141|  2.89k|        } else {
13142|       |          // Append path_buffer to url's path.
13143|  2.89k|          path += '/';
13144|  2.89k|          path.append(path_buffer);
13145|  2.89k|        }
13146|  2.89k|      }
13147|  3.25k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (13147:11): [True: 336, False: 2.91k]
  ------------------
13148|    336|        update_base_pathname(path);
13149|    336|        return;
13150|    336|      }
13151|  3.25k|    } while (true);
  ------------------
  |  Branch (13151:14): [True: 2.91k, Folded]
  ------------------
13152|    336|  }
13153|    528|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6750|  3.79k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6751|  3.79k|  uint64_t broadcast_80 = broadcast(0x80);
 6752|  3.79k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6753|  3.79k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6754|  3.79k|  uint64_t non_ascii = 0;
 6755|  3.79k|  size_t i = 0;
 6756|       |
 6757|  14.8k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6757:10): [True: 11.0k, False: 3.79k]
  ------------------
 6758|  11.0k|    uint64_t word{};
 6759|  11.0k|    memcpy(&word, input + i, sizeof(word));
 6760|  11.0k|    non_ascii |= (word & broadcast_80);
 6761|  11.0k|    word ^=
 6762|  11.0k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6763|  11.0k|    memcpy(input + i, &word, sizeof(word));
 6764|  11.0k|  }
 6765|  3.79k|  if (i < length) {
  ------------------
  |  Branch (6765:7): [True: 2.71k, False: 1.07k]
  ------------------
 6766|  2.71k|    uint64_t word{};
 6767|  2.71k|    memcpy(&word, input + i, length - i);
 6768|  2.71k|    non_ascii |= (word & broadcast_80);
 6769|  2.71k|    word ^=
 6770|  2.71k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6771|  2.71k|    memcpy(input + i, &word, length - i);
 6772|  2.71k|  }
 6773|  3.79k|  return non_ascii == 0;
 6774|  3.79k|}
_ZN3ada7unicode9broadcastEh:
 6746|  11.3k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6747|  11.3k|  return 0x101010101010101ull * v;
 6748|  11.3k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|  5.03k|ada_really_inline constexpr bool is_ipv4(std::string_view view) noexcept {
   13|       |  // The string is not empty and does not contain upper case ASCII characters.
   14|       |  //
   15|       |  // Optimization. To be considered as a possible ipv4, the string must end
   16|       |  // with 'x' or a lowercase hex character.
   17|       |  // Most of the time, this will be false so this simple check will save a lot
   18|       |  // of effort.
   19|       |  // If the address ends with a dot, we need to prune it (special case).
   20|  5.03k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (20:7): [True: 554, False: 4.48k]
  ------------------
   21|    554|    view.remove_suffix(1);
   22|    554|    if (view.empty()) {
  ------------------
  |  Branch (22:9): [True: 98, False: 456]
  ------------------
   23|     98|      return false;
   24|     98|    }
   25|    554|  }
   26|  4.93k|  char last_char = view.back();
   27|  4.93k|  bool possible_ipv4 = (last_char >= '0' && last_char <= '9') ||
  ------------------
  |  Branch (27:25): [True: 4.66k, False: 272]
  |  Branch (27:45): [True: 3.75k, False: 913]
  ------------------
   28|  1.18k|                       (last_char >= 'a' && last_char <= 'f') ||
  ------------------
  |  Branch (28:25): [True: 824, False: 361]
  |  Branch (28:45): [True: 499, False: 325]
  ------------------
   29|    686|                       last_char == 'x';
  ------------------
  |  Branch (29:24): [True: 84, False: 602]
  ------------------
   30|  4.93k|  if (!possible_ipv4) {
  ------------------
  |  Branch (30:7): [True: 602, False: 4.33k]
  ------------------
   31|    602|    return false;
   32|    602|  }
   33|       |  // From the last character, find the last dot.
   34|  4.33k|  size_t last_dot = view.rfind('.');
   35|  4.33k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (35:7): [True: 3.32k, False: 1.01k]
  ------------------
   36|       |    // We have at least one dot.
   37|  3.32k|    view.remove_prefix(last_dot + 1);
   38|  3.32k|  }
   39|       |  /** Optimization opportunity: we have basically identified the last number of
   40|       |     the ipv4 if we return true here. We might as well parse it and have at
   41|       |     least one number parsed when we get to parse_ipv4. */
   42|  4.33k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (42:7): [True: 3.40k, False: 931]
  ------------------
   43|  3.40k|    return true;
   44|  3.40k|  }
   45|       |  // It could be hex (0x), but not if there is a single character.
   46|    931|  if (view.size() == 1) {
  ------------------
  |  Branch (46:7): [True: 291, False: 640]
  ------------------
   47|    291|    return false;
   48|    291|  }
   49|       |  // It must start with 0x.
   50|    640|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (50:7): [True: 278, False: 362]
  ------------------
   51|    278|    return false;
   52|    278|  }
   53|       |  // We must allow "0x".
   54|    362|  if (view.size() == 2) {
  ------------------
  |  Branch (54:7): [True: 61, False: 301]
  ------------------
   55|     61|    return true;
   56|     61|  }
   57|       |  // We have 0x followed by some characters, we need to check that they are
   58|       |  // hexadecimals.
   59|    301|  view.remove_prefix(2);
   60|    301|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   61|    362|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7157|  3.54k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7158|  3.54k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7158:11): [True: 3.53k, False: 14]
  |  Branch (7158:23): [True: 2.58k, False: 948]
  |  Branch (7158:37): [True: 943, False: 19]
  |  Branch (7158:49): [True: 923, False: 20]
  ------------------
 7159|  3.54k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   87|  4.58k|    std::string_view input) noexcept {
   88|       |  // The path percent-encode set is the query percent-encode set and U+003F (?),
   89|       |  // U+0060 (`), U+007B ({), and U+007D (}). The query percent-encode set is the
   90|       |  // C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#),
   91|       |  // U+003C (<), and U+003E (>). The C0 control percent-encode set are the C0
   92|       |  // controls and all code points greater than U+007E (~).
   93|  4.58k|  size_t i = 0;
   94|  4.58k|  uint8_t accumulator{};
   95|  17.8k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (95:10): [True: 13.2k, False: 4.58k]
  ------------------
   96|  13.2k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   97|  13.2k|                           path_signature_table[uint8_t(input[i + 1])] |
   98|  13.2k|                           path_signature_table[uint8_t(input[i + 2])] |
   99|  13.2k|                           path_signature_table[uint8_t(input[i + 3])] |
  100|  13.2k|                           path_signature_table[uint8_t(input[i + 4])] |
  101|  13.2k|                           path_signature_table[uint8_t(input[i + 5])] |
  102|  13.2k|                           path_signature_table[uint8_t(input[i + 6])] |
  103|  13.2k|                           path_signature_table[uint8_t(input[i + 7])]);
  104|  13.2k|  }
  105|  17.0k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (105:10): [True: 12.5k, False: 4.58k]
  ------------------
  106|  12.5k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
  107|  12.5k|  }
  108|  4.58k|  return accumulator;
  109|  4.58k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7038|  6.02k|                                              size_t length) noexcept {
 7039|  6.02k|  size_t i = 0;
 7040|  6.02k|  uint8_t accumulator{};
 7041|  40.6k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7041:10): [True: 34.6k, False: 6.02k]
  ------------------
 7042|  34.6k|    accumulator |=
 7043|  34.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7044|  34.6k|    accumulator |=
 7045|  34.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7046|  34.6k|    accumulator |=
 7047|  34.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7048|  34.6k|    accumulator |=
 7049|  34.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7050|  34.6k|  }
 7051|  13.9k|  for (; i < length; i++) {
  ------------------
  |  Branch (7051:10): [True: 7.96k, False: 6.02k]
  ------------------
 7052|  7.96k|    accumulator |=
 7053|  7.96k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7054|  7.96k|  }
 7055|  6.02k|  return accumulator;
 7056|  6.02k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7332|  21.6k|                    std::string& out) {
 7333|  21.6k|  ada_log("percent_encode ", input, " to output string while ",
 7334|  21.6k|          append ? "appending" : "overwriting");
 7335|  21.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7336|  21.6k|    return character_sets::bit_at(character_set, c);
 7337|  21.6k|  });
 7338|  21.6k|  ada_log("percent_encode done checking, moved to ",
 7339|  21.6k|          std::distance(input.begin(), pointer));
 7340|       |
 7341|       |  // Optimization: Don't iterate if percent encode is not required
 7342|  21.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7342:7): [True: 16.1k, False: 5.49k]
  ------------------
 7343|  16.1k|    ada_log("percent_encode encoding not needed.");
 7344|  16.1k|    return false;
 7345|  16.1k|  }
 7346|       |  if constexpr (!append) {
 7347|       |    out.clear();
 7348|       |  }
 7349|  5.49k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7350|  5.49k|          " bytes");
 7351|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7352|  5.49k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7353|  5.49k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7354|  5.49k|          " bytes");
 7355|  64.9k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7355:10): [True: 59.5k, False: 5.49k]
  ------------------
 7356|  59.5k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7356:9): [True: 36.4k, False: 23.0k]
  ------------------
 7357|  36.4k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7358|  36.4k|    } else {
 7359|  23.0k|      out += *pointer;
 7360|  23.0k|    }
 7361|  59.5k|  }
 7362|  5.49k|  return true;
 7363|  21.6k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7335|  47.4k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7336|  47.4k|    return character_sets::bit_at(character_set, c);
 7337|  47.4k|  });
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7332|  24.3k|                    std::string& out) {
 7333|  24.3k|  ada_log("percent_encode ", input, " to output string while ",
 7334|  24.3k|          append ? "appending" : "overwriting");
 7335|  24.3k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7336|  24.3k|    return character_sets::bit_at(character_set, c);
 7337|  24.3k|  });
 7338|  24.3k|  ada_log("percent_encode done checking, moved to ",
 7339|  24.3k|          std::distance(input.begin(), pointer));
 7340|       |
 7341|       |  // Optimization: Don't iterate if percent encode is not required
 7342|  24.3k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7342:7): [True: 18.1k, False: 6.19k]
  ------------------
 7343|  18.1k|    ada_log("percent_encode encoding not needed.");
 7344|  18.1k|    return false;
 7345|  18.1k|  }
 7346|  6.19k|  if constexpr (!append) {
 7347|  6.19k|    out.clear();
 7348|  6.19k|  }
 7349|  6.19k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7350|  6.19k|          " bytes");
 7351|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7352|  6.19k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7353|  6.19k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7354|  6.19k|          " bytes");
 7355|  71.1k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7355:10): [True: 64.9k, False: 6.19k]
  ------------------
 7356|  64.9k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7356:9): [True: 40.6k, False: 24.2k]
  ------------------
 7357|  40.6k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7358|  40.6k|    } else {
 7359|  24.2k|      out += *pointer;
 7360|  24.2k|    }
 7361|  64.9k|  }
 7362|  6.19k|  return true;
 7363|  24.3k|}
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7335|  48.8k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7336|  48.8k|    return character_sets::bit_at(character_set, c);
 7337|  48.8k|  });
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
10248|  5.45k|                                                result_type& out) {
10249|  5.45k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
10250|  5.45k|  constexpr bool is_aggregator =
10251|  5.45k|      std::is_same_v<result_type, ada::url_aggregator>;
10252|  5.45k|  static_assert(is_ada_url || is_aggregator);
10253|       |
10254|  5.45k|  const size_t len = input.size();
10255|  5.45k|  if (len < 8) [[unlikely]] {
  ------------------
  |  Branch (10255:7): [True: 0, False: 5.45k]
  ------------------
10256|      0|    return false;
10257|      0|  }
10258|  5.45k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
10259|       |
10260|  5.45k|  size_t pos;
10261|  5.45k|  ada::scheme::type scheme_type;
10262|  5.45k|  uint32_t protocol_end;
10263|  5.45k|  if (b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p') {
  ------------------
  |  Branch (10263:7): [True: 5.45k, False: 0]
  |  Branch (10263:22): [True: 5.45k, False: 0]
  |  Branch (10263:37): [True: 5.45k, False: 0]
  |  Branch (10263:52): [True: 5.45k, False: 0]
  ------------------
10264|  5.45k|    if (b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (10264:9): [True: 5.45k, False: 0]
  |  Branch (10264:24): [True: 5.45k, False: 0]
  |  Branch (10264:39): [True: 5.45k, False: 0]
  ------------------
10265|  5.45k|      pos = 7;
10266|  5.45k|      scheme_type = ada::scheme::type::HTTP;
10267|  5.45k|      protocol_end = 5;
10268|  5.45k|    } else if (len >= 8 && b[4] == 's' && b[5] == ':' && b[6] == '/' &&
  ------------------
  |  Branch (10268:16): [True: 0, False: 0]
  |  Branch (10268:28): [True: 0, False: 0]
  |  Branch (10268:43): [True: 0, False: 0]
  |  Branch (10268:58): [True: 0, False: 0]
  ------------------
10269|      0|               b[7] == '/') {
  ------------------
  |  Branch (10269:16): [True: 0, False: 0]
  ------------------
10270|      0|      pos = 8;
10271|      0|      scheme_type = ada::scheme::type::HTTPS;
10272|      0|      protocol_end = 6;
10273|      0|    } else {
10274|      0|      return false;
10275|      0|    }
10276|  5.45k|  } else {
10277|      0|    return false;
10278|      0|  }
10279|  5.45k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (10279:7): [True: 5.45k, False: 0]
  |  Branch (10279:21): [True: 25, False: 5.42k]
  |  Branch (10279:38): [True: 24, False: 5.40k]
  ------------------
10280|     49|    return false;
10281|     49|  }
10282|       |
10283|       |  // Digit-led hosts are IPv4/numeric; skip before scanning.
10284|  5.40k|  if (pos < len && b[pos] >= '0' && b[pos] <= '9') {
  ------------------
  |  Branch (10284:7): [True: 5.40k, False: 0]
  |  Branch (10284:20): [True: 4.90k, False: 502]
  |  Branch (10284:37): [True: 0, False: 4.90k]
  ------------------
10285|      0|    return false;
10286|      0|  }
10287|       |
10288|  5.40k|  const size_t host_start = pos;
10289|  5.40k|  bool has_upper = false;
10290|  5.40k|  size_t i = pos;
10291|  15.4k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10291:10): [True: 15.4k, False: 0]
  ------------------
10292|  15.4k|    const uint8_t c = b[i];
10293|  15.4k|    const uint8_t cls = k_host_class[c];
10294|  15.4k|    if (cls == 1) {
  ------------------
  |  Branch (10294:9): [True: 543, False: 14.8k]
  ------------------
10295|    543|      break;
10296|    543|    }
10297|  14.8k|    if (cls == 2) [[unlikely]] {
  ------------------
  |  Branch (10297:9): [True: 4.86k, False: 10.0k]
  ------------------
10298|  4.86k|      return false;
10299|  4.86k|    }
10300|  10.0k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (10300:9): [True: 5.35k, False: 4.68k]
  |  Branch (10300:21): [True: 1.48k, False: 3.86k]
  ------------------
10301|  1.48k|      has_upper = true;
10302|  1.48k|    }
10303|  10.0k|  }
10304|    543|  const size_t host_end = i;
10305|    543|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (10305:7): [True: 1, False: 542]
  ------------------
10306|      1|    return false;
10307|      1|  }
10308|    542|  const size_t host_len = host_end - host_start;
10309|    542|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (10309:7): [True: 0, False: 542]
  ------------------
10310|      0|    return false;
10311|      0|  }
10312|    542|  {
10313|    542|    std::string_view hv(input.data() + host_start, host_len);
10314|    542|    char host_buf[256];
10315|    542|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (10315:9): [True: 225, False: 317]
  ------------------
10316|    225|      std::memcpy(host_buf, input.data() + host_start, host_len);
10317|    225|      unicode::to_lower_ascii(host_buf, host_len);
10318|    225|      hv = std::string_view(host_buf, host_len);
10319|    225|    }
10320|    542|    if (checkers::is_ipv4(hv)) [[unlikely]] {
  ------------------
  |  Branch (10320:9): [True: 83, False: 459]
  ------------------
10321|     83|      return false;
10322|     83|    }
10323|    459|    static constexpr std::string_view xn{"xn-", 3};
10324|    459|    if (hv.find(xn) != std::string_view::npos) [[unlikely]] {
  ------------------
  |  Branch (10324:9): [True: 4, False: 455]
  ------------------
10325|      4|      return false;
10326|      4|    }
10327|    459|  }
10328|       |
10329|    455|  size_t path_start = host_end;
10330|    455|  size_t path_end = host_end;
10331|    455|  size_t query_start = std::string_view::npos;
10332|    455|  size_t hash_start = std::string_view::npos;
10333|    455|  bool has_path = false;
10334|    455|  bool path_has_dot = false;
10335|       |
10336|    455|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (10336:7): [True: 455, False: 0]
  |  Branch (10336:18): [True: 378, False: 77]
  ------------------
10337|    378|    has_path = true;
10338|    378|    path_start = i;
10339|    378|    ++i;
10340|  6.05k|    for (; i < len; ++i) {
  ------------------
  |  Branch (10340:12): [True: 5.96k, False: 84]
  ------------------
10341|  5.96k|      const uint8_t c = b[i];
10342|  5.96k|      const uint8_t cls = k_rest[c];
10343|  5.96k|      if (cls == 0) {
  ------------------
  |  Branch (10343:11): [True: 5.67k, False: 294]
  ------------------
10344|  5.67k|        path_has_dot |= (c == '.');
10345|  5.67k|        continue;
10346|  5.67k|      }
10347|    294|      if (cls == 1) {
  ------------------
  |  Branch (10347:11): [True: 54, False: 240]
  ------------------
10348|     54|        path_end = i;
10349|     54|        if (c == '?') {
  ------------------
  |  Branch (10349:13): [True: 49, False: 5]
  ------------------
10350|     49|          query_start = i;
10351|     49|          ++i;
10352|     49|          goto scan_query;
10353|     49|        }
10354|      5|        hash_start = i;
10355|      5|        ++i;
10356|      5|        goto scan_hash;
10357|     54|      }
10358|    240|      return false;
10359|    294|    }
10360|     84|    path_end = i;
10361|     84|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (10361:14): [True: 77, False: 0]
  |  Branch (10361:25): [True: 49, False: 28]
  ------------------
10362|     49|    query_start = i;
10363|     49|    ++i;
10364|     49|    goto scan_query;
10365|     49|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (10365:14): [True: 28, False: 0]
  |  Branch (10365:25): [True: 28, False: 0]
  ------------------
10366|     28|    hash_start = i;
10367|     28|    ++i;
10368|     28|    goto scan_hash;
10369|     28|  }
10370|     84|  goto after_rest;
10371|       |
10372|     98|scan_query:
10373|  1.33k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10373:10): [True: 1.28k, False: 57]
  ------------------
10374|  1.28k|    const uint8_t c = b[i];
10375|  1.28k|    if (c == '#') {
  ------------------
  |  Branch (10375:9): [True: 19, False: 1.26k]
  ------------------
10376|     19|      hash_start = i;
10377|     19|      ++i;
10378|     19|      goto scan_hash;
10379|     19|    }
10380|  1.26k|    if (c == '?' || c == '%') {
  ------------------
  |  Branch (10380:9): [True: 128, False: 1.13k]
  |  Branch (10380:21): [True: 27, False: 1.10k]
  ------------------
10381|    155|      continue;
10382|    155|    }
10383|  1.10k|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10383:9): [True: 22, False: 1.08k]
  ------------------
10384|     22|      return false;
10385|     22|    }
10386|  1.10k|  }
10387|     57|  goto after_rest;
10388|       |
10389|     57|scan_hash:
10390|  1.04k|  for (; i < len; ++i) {
  ------------------
  |  Branch (10390:10): [True: 1.00k, False: 42]
  ------------------
10391|  1.00k|    const uint8_t c = b[i];
10392|  1.00k|    if (c == '?' || c == '#' || c == '%') {
  ------------------
  |  Branch (10392:9): [True: 23, False: 977]
  |  Branch (10392:21): [True: 98, False: 879]
  |  Branch (10392:33): [True: 38, False: 841]
  ------------------
10393|    159|      continue;
10394|    159|    }
10395|    841|    if (k_rest[c] == 2) [[unlikely]] {
  ------------------
  |  Branch (10395:9): [True: 10, False: 831]
  ------------------
10396|     10|      return false;
10397|     10|    }
10398|    841|  }
10399|       |
10400|    183|after_rest:
10401|    183|  if (path_has_dot) [[unlikely]] {
  ------------------
  |  Branch (10401:7): [True: 132, False: 51]
  ------------------
10402|    132|    const std::string_view path_body(input.data() + path_start,
10403|    132|                                     path_end - path_start);
10404|    132|    if (path_body.size() >= 2 && path_body[1] == '.') {
  ------------------
  |  Branch (10404:9): [True: 132, False: 0]
  |  Branch (10404:34): [True: 45, False: 87]
  ------------------
10405|     45|      if (path_body.size() == 2 || path_body[2] == '/' ||
  ------------------
  |  Branch (10405:11): [True: 1, False: 44]
  |  Branch (10405:36): [True: 1, False: 43]
  ------------------
10406|     43|          (path_body.size() >= 3 && path_body[2] == '.' &&
  ------------------
  |  Branch (10406:12): [True: 43, False: 0]
  |  Branch (10406:37): [True: 6, False: 37]
  ------------------
10407|      6|           (path_body.size() == 3 || path_body[3] == '/'))) {
  ------------------
  |  Branch (10407:13): [True: 1, False: 5]
  |  Branch (10407:38): [True: 3, False: 2]
  ------------------
10408|      6|        return false;
10409|      6|      }
10410|     45|    }
10411|    126|    static constexpr std::string_view slash_dot{"/.", 2};
10412|    126|    size_t p = 1;
10413|    249|    while ((p = path_body.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (10413:12): [True: 194, False: 55]
  ------------------
10414|    194|      const size_t after = p + 2;
10415|    194|      if (after == path_body.size() || path_body[after] == '/' ||
  ------------------
  |  Branch (10415:11): [True: 1, False: 193]
  |  Branch (10415:40): [True: 36, False: 157]
  ------------------
10416|    157|          (after + 1 <= path_body.size() && path_body[after] == '.' &&
  ------------------
  |  Branch (10416:12): [True: 157, False: 0]
  |  Branch (10416:45): [True: 47, False: 110]
  ------------------
10417|     71|           (after + 1 == path_body.size() || path_body[after + 1] == '/'))) {
  ------------------
  |  Branch (10417:13): [True: 3, False: 44]
  |  Branch (10417:46): [True: 31, False: 13]
  ------------------
10418|     71|        return false;
10419|     71|      }
10420|    123|      p = after;
10421|    123|    }
10422|    126|  }
10423|       |
10424|    106|  const bool need_slash = !has_path;
10425|    106|  out.type = scheme_type;
10426|    106|  out.is_valid = true;
10427|    106|  out.has_opaque_path = false;
10428|    106|  out.host_type = DEFAULT;
10429|       |
10430|    106|  if constexpr (is_aggregator) {
10431|    106|    if (!need_slash) {
  ------------------
  |  Branch (10431:9): [True: 58, False: 48]
  ------------------
10432|     58|      out.buffer.resize(len);
10433|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10434|     58|      std::memcpy(out.buffer.data(), input.data(), len);
10435|     58|      if (has_upper) {
  ------------------
  |  Branch (10435:11): [True: 13, False: 45]
  ------------------
10436|     13|        unicode::to_lower_ascii(out.buffer.data() + host_start,
10437|     13|                                host_end - host_start);
10438|     13|      }
10439|     58|      out.components.protocol_end = protocol_end;
10440|     58|      out.components.username_end = protocol_end + 2;
10441|     58|      out.components.host_start = protocol_end + 2;
10442|     58|      out.components.host_end = static_cast<uint32_t>(host_end);
10443|     58|      out.components.port = url_components::omitted;
10444|     58|      out.components.pathname_start = static_cast<uint32_t>(path_start);
10445|     58|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (10445:37): [True: 17, False: 41]
  ------------------
10446|     58|                                        ? static_cast<uint32_t>(query_start)
10447|     58|                                        : url_components::omitted;
10448|     58|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (10448:35): [True: 12, False: 46]
  ------------------
10449|     58|                                      ? static_cast<uint32_t>(hash_start)
10450|     58|                                      : url_components::omitted;
10451|     58|    } else {
10452|     48|      out.buffer.resize(len + 1);
10453|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
10454|     48|      std::memcpy(out.buffer.data(), input.data(), host_end);
10455|     48|      out.buffer[host_end] = '/';
10456|     48|      if (host_end < len) {
  ------------------
  |  Branch (10456:11): [True: 48, False: 0]
  ------------------
10457|     48|        std::memcpy(out.buffer.data() + host_end + 1, input.data() + host_end,
10458|     48|                    len - host_end);
10459|     48|      }
10460|     48|      if (has_upper) {
  ------------------
  |  Branch (10460:11): [True: 11, False: 37]
  ------------------
10461|     11|        unicode::to_lower_ascii(out.buffer.data() + host_start,
10462|     11|                                host_end - host_start);
10463|     11|      }
10464|     48|      out.components.protocol_end = protocol_end;
10465|     48|      out.components.username_end = protocol_end + 2;
10466|     48|      out.components.host_start = protocol_end + 2;
10467|     48|      out.components.host_end = static_cast<uint32_t>(host_end);
10468|     48|      out.components.port = url_components::omitted;
10469|     48|      out.components.pathname_start = static_cast<uint32_t>(host_end);
10470|     48|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (10470:37): [True: 27, False: 21]
  ------------------
10471|     48|                                        ? static_cast<uint32_t>(query_start + 1)
10472|     48|                                        : url_components::omitted;
10473|     48|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (10473:35): [True: 27, False: 21]
  ------------------
10474|     48|                                      ? static_cast<uint32_t>(hash_start + 1)
10475|     48|                                      : url_components::omitted;
10476|     48|    }
10477|       |  } else {
10478|       |    std::string host_str(input.substr(host_start, host_end - host_start));
10479|       |    if (has_upper) {
10480|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
10481|       |    }
10482|       |    out.host = std::move(host_str);
10483|       |    if (need_slash) {
10484|       |      out.path = "/";
10485|       |    } else {
10486|       |      out.path.assign(input.data() + path_start, path_end - path_start);
10487|       |    }
10488|       |    if (query_start != std::string_view::npos) {
10489|       |      const size_t q_end =
10490|       |          (hash_start != std::string_view::npos) ? hash_start : len;
10491|       |      out.query.emplace(input.data() + query_start + 1,
10492|       |                        q_end - query_start - 1);
10493|       |    }
10494|       |    if (hash_start != std::string_view::npos) {
10495|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
10496|       |    }
10497|       |  }
10498|    106|  return true;
10499|    183|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11593|  6.30k|    const std::string_view input_with_colon) {
11594|  6.30k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
11595|  6.30k|  ADA_ASSERT_TRUE(validate());
11596|  6.30k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
11597|  6.30k|  std::string_view input{input_with_colon};
11598|  6.30k|  input.remove_suffix(1);
11599|  6.30k|  auto parsed_type = ada::scheme::get_scheme_type(input);
11600|  6.30k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
11601|       |  /**
11602|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
11603|       |   *http, https), in which case, we can go really fast.
11604|       |   **/
11605|  6.30k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (11605:7): [True: 6.30k, False: 0]
  ------------------
11606|       |    if constexpr (has_state_override) {
11607|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
11608|       |      // then return.
11609|       |      if (is_special() != is_input_special) {
11610|       |        return false;
11611|       |      }
11612|       |
11613|       |      // If url includes credentials or has a non-null port, and buffer is
11614|       |      // "file", then return.
11615|       |      if ((has_credentials() || components.port != url_components::omitted) &&
11616|       |          parsed_type == ada::scheme::type::FILE) {
11617|       |        return false;
11618|       |      }
11619|       |
11620|       |      // If url's scheme is "file" and its host is an empty host, then return.
11621|       |      // An empty host is the empty string.
11622|       |      if (type == ada::scheme::type::FILE &&
11623|       |          components.host_start == components.host_end) {
11624|       |        return false;
11625|       |      }
11626|       |    }
11627|       |
11628|  6.30k|    type = parsed_type;
11629|  6.30k|    set_scheme_from_view_with_colon(input_with_colon);
11630|       |
11631|       |    if constexpr (has_state_override) {
11632|       |      // This is uncommon.
11633|       |      uint16_t urls_scheme_port = get_special_port();
11634|       |
11635|       |      if (urls_scheme_port) {
11636|       |        // If url's port is url's scheme's default port, then set url's port to
11637|       |        // null.
11638|       |        if (components.port == urls_scheme_port) {
11639|       |          clear_port();
11640|       |        }
11641|       |      }
11642|       |    }
11643|  6.30k|  } else {  // slow path
11644|      0|    std::string _buffer(input);
11645|       |    // Next function is only valid if the input is ASCII and returns false
11646|       |    // otherwise, but it seems that we always have ascii content so we do not
11647|       |    // need to check the return value.
11648|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
11649|       |
11650|       |    if constexpr (has_state_override) {
11651|       |      // The state-override validation errors below ("return" in the WHATWG URL
11652|       |      // parser) leave the URL unchanged. The setter contract is
11653|       |      // "true on success, false if the scheme is invalid" -- the fast path
11654|       |      // above already returns false here, so the slow path must agree.
11655|       |
11656|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
11657|       |      // then return. If url's scheme is not a special scheme and buffer is a
11658|       |      // special scheme, then return.
11659|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
11660|       |        return false;
11661|       |      }
11662|       |
11663|       |      // If url includes credentials or has a non-null port, and buffer is
11664|       |      // "file", then return.
11665|       |      if ((has_credentials() || components.port != url_components::omitted) &&
11666|       |          _buffer == "file") {
11667|       |        return false;
11668|       |      }
11669|       |
11670|       |      // If url's scheme is "file" and its host is an empty host, then return.
11671|       |      // An empty host is the empty string.
11672|       |      if (type == ada::scheme::type::FILE &&
11673|       |          components.host_start == components.host_end) {
11674|       |        return false;
11675|       |      }
11676|       |    }
11677|       |
11678|      0|    set_scheme(_buffer);
11679|       |
11680|       |    if constexpr (has_state_override) {
11681|       |      // This is uncommon.
11682|       |      uint16_t urls_scheme_port = get_special_port();
11683|       |
11684|       |      if (urls_scheme_port) {
11685|       |        // If url's port is url's scheme's default port, then set url's port to
11686|       |        // null.
11687|       |        if (components.port == urls_scheme_port) {
11688|       |          clear_port();
11689|       |        }
11690|       |      }
11691|       |    }
11692|      0|  }
11693|  6.30k|  ADA_ASSERT_TRUE(validate());
11694|  6.30k|  return true;
11695|  6.30k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
11719|  6.30k|    std::string_view new_scheme_with_colon) {
11720|  6.30k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
11721|  6.30k|          new_scheme_with_colon);
11722|  6.30k|  ADA_ASSERT_TRUE(validate());
11723|  6.30k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
11724|  6.30k|                  new_scheme_with_colon.back() == ':');
11725|       |  // next line could overflow but unsigned arithmetic has well-defined
11726|       |  // overflows.
11727|  6.30k|  uint32_t new_difference =
11728|  6.30k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
11729|       |
11730|  6.30k|  if (buffer.empty()) {
  ------------------
  |  Branch (11730:7): [True: 6.30k, False: 0]
  ------------------
11731|  6.30k|    buffer.append(new_scheme_with_colon);
11732|  6.30k|  } else {
11733|      0|    buffer.erase(0, components.protocol_end);
11734|      0|    buffer.insert(0, new_scheme_with_colon);
11735|      0|  }
11736|  6.30k|  components.protocol_end += new_difference;
11737|       |
11738|  6.30k|  apply_shifted_non_scheme_offsets(components, new_difference);
11739|  6.30k|  ADA_ASSERT_TRUE(validate());
11740|  6.30k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5632|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1074|   422k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1075|   422k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1076|   422k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2087|  10.4k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2101|  5.22k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 1591|  7.61k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3573|  5.22k|      : impl_base(unexpect, std::move(e.value())),
 3574|  5.22k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2559|  5.22k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3177|  6.41k|  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_:
 3659|  1.19k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3532|  1.19k|      : impl_base(in_place, std::forward<Args>(args)...),
 3533|  1.19k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2547|  1.19k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7645|  1.19k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7648|  7.61k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6663|  6.30k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6664|  6.30k|  if (scheme.empty()) {
  ------------------
  |  Branch (6664:7): [True: 0, False: 6.30k]
  ------------------
 6665|      0|    return ada::scheme::NOT_SPECIAL;
 6666|      0|  }
 6667|  6.30k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6668|  6.30k|  const std::string_view target = details::is_special_list[hash_value];
 6669|  6.30k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6669:7): [True: 6.30k, False: 0]
  ------------------
 6670|  6.30k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6670:7): [True: 6.30k, False: 0]
  ------------------
 6671|  6.30k|          details::scheme_keys[hash_value]) {
 6672|  6.30k|    return ada::scheme::type(hash_value);
 6673|  6.30k|  } else {
 6674|      0|    return ada::scheme::NOT_SPECIAL;
 6675|      0|  }
 6676|  6.30k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6604|  6.30k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6605|  6.30k|  uint64_t input = (uint8_t)p[0];
 6606|  6.30k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6607|  6.30k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6608|  6.30k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6609|  6.30k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6610|  6.30k|  return input;
 6611|  6.30k|}
_ZN3ada14url_aggregatorC2Ev:
 7643|  6.41k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4837|  6.41k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1344|  7.22k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1345|  7.22k|  const size_t len = input.size();
 1346|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1347|  7.22k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1347:7): [True: 4.09k, False: 3.12k]
  |  Branch (1347:18): [True: 1.60k, False: 1.52k]
  ------------------
 1348|  5.70k|    return ipv4_fast_fail;
 1349|  5.70k|  }
 1350|  1.52k|  const char* data = input.data();
 1351|       |
 1352|       |#if defined(ADA_AVX512)
 1353|       |  return detail::try_parse_ipv4_avx512(data, len);
 1354|       |#else
 1355|  1.52k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1356|  7.22k|#endif
 1357|  7.22k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1244|  1.52k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1245|  1.52k|  uint32_t ipv4 = 0;
 1246|  2.95k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1246:19): [True: 2.62k, False: 324]
  ------------------
 1247|  2.62k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1247:9): [True: 3, False: 2.62k]
  ------------------
 1248|      3|      return ipv4_fast_fail;
 1249|      3|    }
 1250|  2.62k|    uint32_t val;
 1251|  2.62k|    char c = *p;
 1252|  2.62k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1252:9): [True: 2.10k, False: 521]
  |  Branch (1252:21): [True: 1.88k, False: 218]
  ------------------
 1253|  1.88k|      val = static_cast<uint32_t>(c - '0');
 1254|  1.88k|      ++p;
 1255|  1.88k|    } else {
 1256|    739|      return ipv4_fast_fail;
 1257|    739|    }
 1258|  1.88k|    if (p < pend) {
  ------------------
  |  Branch (1258:9): [True: 1.75k, False: 128]
  ------------------
 1259|  1.75k|      c = *p;
 1260|  1.75k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1260:11): [True: 1.12k, False: 635]
  |  Branch (1260:23): [True: 995, False: 128]
  ------------------
 1261|    995|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1261:13): [True: 56, False: 939]
  ------------------
 1262|     56|          return ipv4_fast_fail;
 1263|     56|        }
 1264|    939|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1265|    939|        ++p;
 1266|    939|        if (p < pend) {
  ------------------
  |  Branch (1266:13): [True: 863, False: 76]
  ------------------
 1267|    863|          c = *p;
 1268|    863|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1268:15): [True: 601, False: 262]
  |  Branch (1268:27): [True: 589, False: 12]
  ------------------
 1269|    589|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1270|    589|            ++p;
 1271|    589|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1271:17): [True: 122, False: 467]
  ------------------
 1272|    122|              return ipv4_fast_fail;
 1273|    122|            }
 1274|    589|          }
 1275|    863|        }
 1276|    939|      }
 1277|  1.75k|    }
 1278|  1.70k|    ipv4 = (ipv4 << 8) | val;
 1279|  1.70k|    if (i < 3) {
  ------------------
  |  Branch (1279:9): [True: 1.38k, False: 324]
  ------------------
 1280|  1.38k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1280:11): [True: 25, False: 1.35k]
  |  Branch (1280:24): [True: 253, False: 1.10k]
  ------------------
 1281|    278|        return ipv4_fast_fail;
 1282|    278|      }
 1283|  1.10k|      ++p;
 1284|  1.10k|    }
 1285|  1.70k|  }
 1286|    324|  if (p != pend) {
  ------------------
  |  Branch (1286:7): [True: 35, False: 289]
  ------------------
 1287|     35|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1287:9): [True: 14, False: 21]
  |  Branch (1287:26): [True: 6, False: 8]
  ------------------
 1288|      6|      return ipv4;
 1289|      6|    }
 1290|     29|    return ipv4_fast_fail;
 1291|     35|  }
 1292|    289|  return ipv4;
 1293|    324|}
_ZNK3ada8url_base10is_specialEv:
 7146|  24.8k|    const noexcept {
 7147|  24.8k|  return type != ada::scheme::NOT_SPECIAL;
 7148|  24.8k|}
_ZN3ada8checkers8is_alphaEc:
 1224|  9.20k|constexpr bool is_alpha(char x) noexcept {
 1225|  9.20k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1225:10): [True: 7.35k, False: 1.85k]
  |  Branch (1225:34): [True: 7.22k, False: 124]
  ------------------
 1226|  9.20k|}
_ZN3ada8checkers8to_lowerEc:
 1222|  16.5k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZNK3ada8url_base19scheme_default_portEv:
 7155|     79|url_base::scheme_default_port() const noexcept {
 7156|     79|  return scheme::get_special_port(type);
 7157|     79|}
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6660|     79|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6661|     79|  return details::special_ports[int(type)];
 6662|     79|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1228|  3.54k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1229|  3.54k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1229:10): [True: 2.83k, False: 713]
  ------------------
 1230|  2.83k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1230:11): [True: 900, False: 1.93k]
  |  Branch (1230:34): [True: 25, False: 875]
  |  Branch (1230:55): [True: 3, False: 872]
  ------------------
 1231|     28|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1231:11): [True: 3, False: 25]
  |  Branch (1231:35): [True: 7, False: 18]
  |  Branch (1231:54): [True: 1, False: 17]
  ------------------
 1232|     17|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1232:35): [True: 3, False: 14]
  |  Branch (1232:54): [True: 1, False: 13]
  ------------------
 1233|  3.54k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1236|  3.54k|    std::string_view input) noexcept {
 1237|  3.54k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1237:10): [True: 62, False: 3.48k]
  |  Branch (1237:32): [True: 17, False: 45]
  |  Branch (1237:54): [True: 2, False: 15]
  ------------------
 1238|  3.54k|}
_ZN3ada7helpers14leading_zeroesEj:
 1876|  6.36k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1877|       |#if ADA_REGULAR_VISUAL_STUDIO
 1878|       |  unsigned long leading_zero(0);
 1879|       |  unsigned long in(input_num);
 1880|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1881|       |#else
 1882|  6.36k|  return __builtin_clz(input_num);
 1883|  6.36k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1884|  6.36k|}
_ZN3ada14url_aggregator7reserveEj:
 8866|  6.30k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 8867|  6.30k|  buffer.reserve(capacity);
 8868|  6.30k|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8356|    574|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8357|    574|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8358|    574|          " bytes] \n", to_diagram());
 8359|    574|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8360|    574|  ADA_ASSERT_TRUE(validate());
 8361|       |
 8362|    574|  const bool begins_with_dashdash = input.starts_with("//");
 8363|    574|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8363:7): [True: 459, False: 115]
  |  Branch (8363:32): [True: 0, False: 459]
  ------------------
 8364|       |    // We must delete the ./
 8365|      0|    delete_dash_dot();
 8366|      0|  }
 8367|       |
 8368|    574|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8368:7): [True: 115, False: 459]
  |  Branch (8368:31): [True: 115, False: 0]
  |  Branch (8368:51): [True: 0, False: 115]
  ------------------
 8369|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (8369:7): [True: 0, False: 0]
  ------------------
 8370|       |    // If url's host is null, url does not have an opaque path, url's path's
 8371|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8372|       |    // output.
 8373|      0|    buffer.insert(components.pathname_start, "/.");
 8374|      0|    components.pathname_start += 2;
 8375|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8375:9): [True: 0, False: 0]
  ------------------
 8376|      0|      components.search_start += 2;
 8377|      0|    }
 8378|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8378:9): [True: 0, False: 0]
  ------------------
 8379|      0|      components.hash_start += 2;
 8380|      0|    }
 8381|      0|  }
 8382|       |
 8383|    574|  uint32_t difference = replace_and_resize(
 8384|    574|      components.pathname_start,
 8385|    574|      components.pathname_start + get_pathname_length(), input);
 8386|    574|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8386:7): [True: 0, False: 574]
  ------------------
 8387|      0|    components.search_start += difference;
 8388|      0|  }
 8389|    574|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8389:7): [True: 0, False: 574]
  ------------------
 8390|      0|    components.hash_start += difference;
 8391|      0|  }
 8392|    574|  ADA_ASSERT_TRUE(validate());
 8393|    574|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8199|  2.50k|    uint32_t start, uint32_t end, std::string_view input) {
 8200|  2.50k|  uint32_t current_length = end - start;
 8201|  2.50k|  uint32_t input_size = uint32_t(input.size());
 8202|  2.50k|  uint32_t new_difference = input_size - current_length;
 8203|       |
 8204|  2.50k|  if (current_length == 0) {
  ------------------
  |  Branch (8204:7): [True: 1.94k, False: 559]
  ------------------
 8205|  1.94k|    buffer.insert(start, input);
 8206|  1.94k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8206:14): [True: 15, False: 544]
  ------------------
 8207|     15|    buffer.replace(start, input_size, input);
 8208|    544|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8208:14): [True: 22, False: 522]
  ------------------
 8209|     22|    buffer.erase(start, current_length - input_size);
 8210|     22|    buffer.replace(start, input_size, input);
 8211|    522|  } else {
 8212|    522|    buffer.replace(start, current_length, input.substr(0, current_length));
 8213|    522|    buffer.insert(start + current_length, input.substr(current_length));
 8214|    522|  }
 8215|       |
 8216|  2.50k|  return new_difference;
 8217|  2.50k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8248|    574|url_aggregator::get_pathname_length() const noexcept {
 8249|    574|  ada_log("url_aggregator::get_pathname_length");
 8250|    574|  uint32_t ending_index = uint32_t(buffer.size());
 8251|    574|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8251:7): [True: 0, False: 574]
  ------------------
 8252|      0|    ending_index = components.search_start;
 8253|    574|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8253:14): [True: 0, False: 574]
  ------------------
 8254|      0|    ending_index = components.hash_start;
 8255|      0|  }
 8256|    574|  return ending_index - components.pathname_start;
 8257|    574|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9193|    528|    ada_lifetime_bound {
 9194|    528|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9195|    528|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9196|    528|          " components.search_start = ", components.search_start,
 9197|    528|          " components.hash_start = ", components.hash_start);
 9198|    528|  auto ending_index = uint32_t(buffer.size());
 9199|    528|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9199:7): [True: 0, False: 528]
  ------------------
 9200|      0|    ending_index = components.search_start;
 9201|    528|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9201:14): [True: 0, False: 528]
  ------------------
 9202|      0|    ending_index = components.hash_start;
 9203|      0|  }
 9204|    528|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9205|    528|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8175|     84|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8176|     84|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8177|     84|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8178|     84|          " bytes] components.hash_start = ", components.hash_start);
 8179|     84|  ADA_ASSERT_TRUE(validate());
 8180|     84|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8181|     84|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8181:7): [True: 0, False: 84]
  ------------------
 8182|      0|    buffer.resize(components.hash_start);
 8183|      0|  }
 8184|     84|  components.hash_start = uint32_t(buffer.size());
 8185|     84|  buffer += "#";
 8186|     84|  bool encoding_required = unicode::percent_encode<true>(
 8187|     84|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8188|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8189|       |  // encoding was not deemed required.
 8190|     84|  if (!encoding_required) {
  ------------------
  |  Branch (8190:7): [True: 62, False: 22]
  ------------------
 8191|     62|    buffer.append(input);
 8192|     62|  }
 8193|     84|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8194|     84|          buffer, "' [", buffer.size(), " bytes]");
 8195|     84|  ADA_ASSERT_TRUE(validate());
 8196|     84|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8584|  1.45k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8585|  1.45k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8586|  1.45k|          "\n", to_diagram());
 8587|  1.45k|  ADA_ASSERT_TRUE(validate());
 8588|  1.45k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8589|       |#if ADA_DEVELOPMENT_CHECKS
 8590|       |  // computing the expected password.
 8591|       |  std::string password_expected = std::string(get_password());
 8592|       |  password_expected.append(input);
 8593|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8594|  1.45k|  add_authority_slashes_if_needed();
 8595|       |
 8596|       |  // If input is empty, do nothing.
 8597|  1.45k|  if (input.empty()) {
  ------------------
  |  Branch (8597:7): [True: 566, False: 890]
  ------------------
 8598|    566|    return;
 8599|    566|  }
 8600|       |
 8601|    890|  uint32_t difference = uint32_t(input.size());
 8602|    890|  if (has_password()) {
  ------------------
  |  Branch (8602:7): [True: 791, False: 99]
  ------------------
 8603|    791|    buffer.insert(components.host_start, input);
 8604|    791|  } else {
 8605|     99|    difference++;  // Increment for ":"
 8606|     99|    buffer.insert(components.username_end, ":");
 8607|     99|    buffer.insert(components.username_end + 1, input);
 8608|     99|  }
 8609|    890|  components.host_start += difference;
 8610|       |
 8611|       |  // The following line is required to add "@" to hostname. When updating
 8612|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8613|       |  // responsibility to set it.
 8614|    890|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8614:7): [True: 32, False: 858]
  ------------------
 8615|     32|    buffer.insert(components.host_start, "@");
 8616|     32|    difference++;
 8617|     32|  }
 8618|       |
 8619|    890|  components.host_end += difference;
 8620|    890|  components.pathname_start += difference;
 8621|    890|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8621:7): [True: 0, False: 890]
  ------------------
 8622|      0|    components.search_start += difference;
 8623|      0|  }
 8624|    890|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8624:7): [True: 0, False: 890]
  ------------------
 8625|      0|    components.hash_start += difference;
 8626|      0|  }
 8627|       |#if ADA_DEVELOPMENT_CHECKS
 8628|       |  std::string password_after(get_password());
 8629|       |  ADA_ASSERT_EQUAL(
 8630|       |      password_expected, password_after,
 8631|       |      "append_base_password problem after inserting " + std::string(input));
 8632|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8633|    890|  ADA_ASSERT_TRUE(validate());
 8634|    890|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 8840|  4.60k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 8841|  4.60k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 8842|  4.60k|  ADA_ASSERT_TRUE(validate());
 8843|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 8844|       |  // to insert
 8845|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 8846|  4.60k|  if (has_authority()) {
  ------------------
  |  Branch (8846:7): [True: 3.02k, False: 1.58k]
  ------------------
 8847|  3.02k|    return;
 8848|  3.02k|  }
 8849|       |  // Performance: the common case is components.protocol_end == buffer.size()
 8850|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 8851|       |  // the insert could be fused with another insert.
 8852|  1.58k|  buffer.insert(components.protocol_end, "//");
 8853|  1.58k|  components.username_end += 2;
 8854|  1.58k|  components.host_start += 2;
 8855|  1.58k|  components.host_end += 2;
 8856|  1.58k|  components.pathname_start += 2;
 8857|  1.58k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8857:7): [True: 0, False: 1.58k]
  ------------------
 8858|      0|    components.search_start += 2;
 8859|      0|  }
 8860|  1.58k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8860:7): [True: 0, False: 1.58k]
  ------------------
 8861|      0|    components.hash_start += 2;
 8862|      0|  }
 8863|  1.58k|  ADA_ASSERT_TRUE(validate());
 8864|  1.58k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8466|  1.22k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8467|  1.22k|  ada_log("url_aggregator::append_base_username ", input);
 8468|  1.22k|  ADA_ASSERT_TRUE(validate());
 8469|  1.22k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8470|       |#if ADA_DEVELOPMENT_CHECKS
 8471|       |  // computing the expected password.
 8472|       |  std::string username_expected(get_username());
 8473|       |  username_expected.append(input);
 8474|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8475|  1.22k|  add_authority_slashes_if_needed();
 8476|       |
 8477|       |  // If input is empty, do nothing.
 8478|  1.22k|  if (input.empty()) {
  ------------------
  |  Branch (8478:7): [True: 496, False: 726]
  ------------------
 8479|    496|    return;
 8480|    496|  }
 8481|       |
 8482|    726|  uint32_t difference = uint32_t(input.size());
 8483|    726|  buffer.insert(components.username_end, input);
 8484|    726|  components.username_end += difference;
 8485|    726|  components.host_start += difference;
 8486|       |
 8487|    726|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8487:7): [True: 175, False: 551]
  ------------------
 8488|    175|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8488:7): [True: 175, False: 0]
  ------------------
 8489|    175|    buffer.insert(components.host_start, "@");
 8490|    175|    difference++;
 8491|    175|  }
 8492|       |
 8493|    726|  components.host_end += difference;
 8494|    726|  components.pathname_start += difference;
 8495|    726|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8495:7): [True: 0, False: 726]
  ------------------
 8496|      0|    components.search_start += difference;
 8497|      0|  }
 8498|    726|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8498:7): [True: 0, False: 726]
  ------------------
 8499|      0|    components.hash_start += difference;
 8500|      0|  }
 8501|       |#if ADA_DEVELOPMENT_CHECKS
 8502|       |  std::string username_after(get_username());
 8503|       |  ADA_ASSERT_EQUAL(
 8504|       |      username_expected, username_after,
 8505|       |      "append_base_username problem after inserting " + std::string(input));
 8506|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8507|    726|  ADA_ASSERT_TRUE(validate());
 8508|    726|}
_ZN3ada14url_aggregator16update_base_portEj:
 8636|     52|inline void url_aggregator::update_base_port(uint32_t input) {
 8637|     52|  ada_log("url_aggregator::update_base_port");
 8638|     52|  ADA_ASSERT_TRUE(validate());
 8639|     52|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8639:7): [True: 0, False: 52]
  ------------------
 8640|      0|    clear_port();
 8641|      0|    return;
 8642|      0|  }
 8643|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8644|       |  // value is probably already available as a string.
 8645|     52|  std::string value = helpers::concat(":", std::to_string(input));
 8646|     52|  uint32_t difference = uint32_t(value.size());
 8647|       |
 8648|     52|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8648:7): [True: 0, False: 52]
  ------------------
 8649|      0|    difference -= components.pathname_start - components.host_end;
 8650|      0|    buffer.erase(components.host_end,
 8651|      0|                 components.pathname_start - components.host_end);
 8652|      0|  }
 8653|       |
 8654|     52|  buffer.insert(components.host_end, value);
 8655|     52|  components.pathname_start += difference;
 8656|     52|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8656:7): [True: 0, False: 52]
  ------------------
 8657|      0|    components.search_start += difference;
 8658|      0|  }
 8659|     52|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8659:7): [True: 0, False: 52]
  ------------------
 8660|      0|    components.hash_start += difference;
 8661|      0|  }
 8662|     52|  components.port = input;
 8663|     52|  ADA_ASSERT_TRUE(validate());
 8664|     52|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1866|     52|std::string concat(Args... args) {
 1867|     52|  std::string answer;
 1868|     52|  inner_concat(answer, args...);
 1869|     52|  return answer;
 1870|     52|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1855|     52|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1856|     52|  buffer.append(t);
 1857|     52|  return inner_concat(buffer, args...);
 1858|     52|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1847|     52|inline void inner_concat(std::string& buffer, T t) {
 1848|     52|  buffer.append(t);
 1849|     52|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8304|    338|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8305|    338|  ada_log("url_aggregator::update_base_search ", input,
 8306|    338|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8307|    338|  ADA_ASSERT_TRUE(validate());
 8308|    338|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8309|       |
 8310|    338|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8310:7): [True: 338, False: 0]
  ------------------
 8311|    338|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8311:9): [True: 338, False: 0]
  ------------------
 8312|    338|      components.search_start = uint32_t(buffer.size());
 8313|    338|      buffer += "?";
 8314|    338|    } else {
 8315|      0|      buffer.resize(components.search_start + 1);
 8316|      0|    }
 8317|       |
 8318|    338|    bool encoding_required =
 8319|    338|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8320|       |    // When encoding_required is false, then buffer is left unchanged, and
 8321|       |    // percent encoding was not deemed required.
 8322|    338|    if (!encoding_required) {
  ------------------
  |  Branch (8322:9): [True: 285, False: 53]
  ------------------
 8323|    285|      buffer.append(input);
 8324|    285|    }
 8325|    338|  } else {
 8326|      0|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8326:9): [True: 0, False: 0]
  ------------------
 8327|      0|      components.search_start = components.hash_start;
 8328|      0|    } else {
 8329|      0|      buffer.erase(components.search_start,
 8330|      0|                   components.hash_start - components.search_start);
 8331|      0|      components.hash_start = components.search_start;
 8332|      0|    }
 8333|       |
 8334|      0|    buffer.insert(components.search_start, "?");
 8335|      0|    size_t idx =
 8336|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8337|      0|    if (idx == input.size()) {
  ------------------
  |  Branch (8337:9): [True: 0, False: 0]
  ------------------
 8338|      0|      buffer.insert(components.search_start + 1, input);
 8339|      0|      components.hash_start += uint32_t(input.size() + 1);  // Do not forget `?`
 8340|      0|    } else {
 8341|      0|      buffer.insert(components.search_start + 1, input, 0, idx);
 8342|      0|      input.remove_prefix(idx);
 8343|       |      // We only create a temporary string if we need percent encoding and
 8344|       |      // we attempt to create as small a temporary string as we can.
 8345|      0|      std::string encoded =
 8346|      0|          ada::unicode::percent_encode(input, query_percent_encode_set);
 8347|      0|      buffer.insert(components.search_start + idx + 1, encoded);
 8348|      0|      components.hash_start +=
 8349|      0|          uint32_t(encoded.size() + idx + 1);  // Do not forget `?`
 8350|      0|    }
 8351|      0|  }
 8352|       |
 8353|    338|  ADA_ASSERT_TRUE(validate());
 8354|    338|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8219|  1.92k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8220|  1.92k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8221|  1.92k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8222|  1.92k|  ADA_ASSERT_TRUE(validate());
 8223|  1.92k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8224|       |
 8225|       |  // This next line is required for when parsing a URL like `foo://`
 8226|  1.92k|  add_authority_slashes_if_needed();
 8227|       |
 8228|  1.92k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8229|  1.92k|  uint32_t new_difference =
 8230|  1.92k|      replace_and_resize(components.host_start, components.host_end, input);
 8231|       |
 8232|  1.92k|  if (has_credentials) {
  ------------------
  |  Branch (8232:7): [True: 206, False: 1.72k]
  ------------------
 8233|    206|    buffer.insert(components.host_start, "@");
 8234|    206|    new_difference++;
 8235|    206|  }
 8236|  1.92k|  components.host_end += new_difference;
 8237|  1.92k|  components.pathname_start += new_difference;
 8238|  1.92k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8238:7): [True: 0, False: 1.92k]
  ------------------
 8239|      0|    components.search_start += new_difference;
 8240|      0|  }
 8241|  1.92k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8241:7): [True: 0, False: 1.92k]
  ------------------
 8242|      0|    components.hash_start += new_difference;
 8243|      0|  }
 8244|  1.92k|  ADA_ASSERT_TRUE(validate());
 8245|  1.92k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 8954|    269|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 8955|    269|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 8956|    269|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (8956:7): [True: 268, False: 1]
  |  Branch (8956:24): [True: 3, False: 265]
  ------------------
 8957|      3|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 8958|      3|    is_valid = false;
 8959|      3|    return 0;
 8960|      3|  }
 8961|    266|  uint16_t parsed_port{};
 8962|    266|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 8963|    266|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (8963:7): [True: 18, False: 248]
  ------------------
 8964|     18|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 8965|     18|    is_valid = false;
 8966|     18|    return 0;
 8967|     18|  }
 8968|    248|  ada_log("parse_port: ", parsed_port);
 8969|    248|  const size_t consumed = size_t(r.ptr - view.data());
 8970|    248|  ada_log("parse_port: consumed ", consumed);
 8971|    248|  if (check_trailing_content) {
  ------------------
  |  Branch (8971:7): [True: 248, False: 0]
  ------------------
 8972|    248|    is_valid &=
 8973|    248|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (8973:10): [True: 23, False: 225]
  |  Branch (8973:37): [True: 45, False: 180]
  ------------------
 8974|    180|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (8974:10): [True: 8, False: 172]
  |  Branch (8974:36): [True: 172, False: 0]
  |  Branch (8974:52): [True: 3, False: 169]
  ------------------
 8975|    248|  }
 8976|    248|  ada_log("parse_port: is_valid = ", is_valid);
 8977|    248|  if (is_valid) {
  ------------------
  |  Branch (8977:7): [True: 79, False: 169]
  ------------------
 8978|     79|    ada_log("parse_port", r.ec == std::errc());
 8979|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 8980|     79|    auto default_port = scheme_default_port();
 8981|     79|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (8981:27): [True: 0, False: 79]
  |  Branch (8981:48): [True: 0, False: 0]
  ------------------
 8982|     79|                         (default_port != parsed_port);
  ------------------
  |  Branch (8982:26): [True: 77, False: 2]
  ------------------
 8983|     79|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (8983:9): [True: 54, False: 25]
  |  Branch (8983:32): [True: 52, False: 2]
  ------------------
 8984|     52|      update_base_port(parsed_port);
 8985|     52|    } else {
 8986|     27|      clear_port();
 8987|     27|    }
 8988|     79|  }
 8989|    248|  return consumed;
 8990|    266|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8077|  3.54k|                                              const uint8_t character_set[]) {
 8078|  3.54k|  const char* data = input.data();
 8079|  3.54k|  const size_t size = input.size();
 8080|       |
 8081|       |  // Process 8 bytes at a time using unrolled loop
 8082|  3.54k|  size_t i = 0;
 8083|  3.97k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8083:10): [True: 732, False: 3.23k]
  ------------------
 8084|    732|    unsigned char chunk[8];
 8085|    732|    std::memcpy(&chunk, data + i,
 8086|    732|                8);  // entices compiler to unconditionally process 8 characters
 8087|       |
 8088|       |    // Check 8 characters at once
 8089|  4.67k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8089:24): [True: 4.25k, False: 428]
  ------------------
 8090|  4.25k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8090:11): [True: 304, False: 3.94k]
  ------------------
 8091|    304|        return i + j;
 8092|    304|      }
 8093|  4.25k|    }
 8094|    732|  }
 8095|       |
 8096|       |  // Handle remaining bytes
 8097|  5.85k|  for (; i < size; i++) {
  ------------------
  |  Branch (8097:10): [True: 3.19k, False: 2.66k]
  ------------------
 8098|  3.19k|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8098:9): [True: 577, False: 2.61k]
  ------------------
 8099|    577|      return i;
 8100|    577|    }
 8101|  3.19k|  }
 8102|       |
 8103|  2.66k|  return size;
 8104|  3.23k|}
_ZN3ada14url_aggregator10clear_portEv:
 8666|     27|inline void url_aggregator::clear_port() {
 8667|     27|  ada_log("url_aggregator::clear_port");
 8668|     27|  ADA_ASSERT_TRUE(validate());
 8669|     27|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8669:7): [True: 27, False: 0]
  ------------------
 8670|     27|    return;
 8671|     27|  }
 8672|      0|  uint32_t length = components.pathname_start - components.host_end;
 8673|      0|  buffer.erase(components.host_end, length);
 8674|      0|  components.pathname_start -= length;
 8675|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8675:7): [True: 0, False: 0]
  ------------------
 8676|      0|    components.search_start -= length;
 8677|      0|  }
 8678|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8678:7): [True: 0, False: 0]
  ------------------
 8679|      0|    components.hash_start -= length;
 8680|      0|  }
 8681|      0|  components.port = url_components::omitted;
 8682|      0|  ADA_ASSERT_TRUE(validate());
 8683|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 8831|  4.72k|    const noexcept {
 8832|  4.72k|  ada_log("url_aggregator::has_authority");
 8833|       |  // Performance: instead of doing this potentially expensive check, we could
 8834|       |  // have a boolean in the struct.
 8835|  4.72k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (8835:10): [True: 3.13k, False: 1.58k]
  ------------------
 8836|  3.13k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (8836:10): [True: 3.13k, False: 0]
  ------------------
 8837|  3.13k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (8837:10): [True: 3.13k, False: 0]
  ------------------
 8838|  4.72k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 8911|    459|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 8912|       |  // If url's host is null, url does not have an opaque path, url's path's size
 8913|       |  // is greater than 1, and url's path[0] is the empty string, then append
 8914|       |  // U+002F (/) followed by U+002E (.) to output.
 8915|    459|  ada_log("url_aggregator::has_dash_dot");
 8916|       |#if ADA_DEVELOPMENT_CHECKS
 8917|       |  // If pathname_start and host_end are exactly two characters apart, then we
 8918|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 8919|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 8920|       |  if (components.pathname_start == components.host_end + 2) {
 8921|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 8922|       |                     buffer[components.host_end + 1] == '.') ||
 8923|       |                    (buffer[components.host_end] == ':' &&
 8924|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 8925|       |  }
 8926|       |  if (components.pathname_start == components.host_end + 2 &&
 8927|       |      buffer[components.host_end] == '/' &&
 8928|       |      buffer[components.host_end + 1] == '.') {
 8929|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 8930|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 8931|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 8932|       |  }
 8933|       |#endif
 8934|       |  // Performance: it should be uncommon for components.pathname_start ==
 8935|       |  // components.host_end + 2 to be true. So we put this check first in the
 8936|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 8937|       |  // more expensive, but should be uncommon.
 8938|    459|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (8938:10): [True: 9, False: 450]
  ------------------
 8939|      9|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (8939:10): [True: 9, False: 0]
  |  Branch (8939:30): [True: 0, False: 9]
  ------------------
 8940|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (8940:10): [True: 0, False: 0]
  ------------------
 8941|    459|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 3972|  6.41k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 3941|  1.38k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 3942|  1.38k|    TL_ASSERT(has_value());
  ------------------
  |  | 1994|  1.38k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (3942:5): [True: 1.38k, False: 0]
  ------------------
 3943|  1.38k|    return valptr();
 3944|  1.38k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3237|  1.38k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 3971|  1.38k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2569|  6.41k|  ~expected_storage_base() {
 2570|  6.41k|    if (m_has_val) {
  ------------------
  |  Branch (2570:9): [True: 1.19k, False: 5.22k]
  ------------------
 2571|  1.19k|      m_val.~T();
 2572|  1.19k|    }
 2573|  6.41k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1788|  3.84k|                                                       size_t pos2) {
 1789|       |#if ADA_DEVELOPMENT_CHECKS
 1790|       |  if (pos2 < pos1) {
 1791|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1792|       |              << std::endl;
 1793|       |    abort();
 1794|       |  }
 1795|       |#endif
 1796|  3.84k|  return input.substr(pos1, pos2 - pos1);
 1797|  3.84k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8260|    515|    const noexcept {
 8261|    515|  return buffer.size() == components.pathname_start;
 8262|    515|}
_ZN3ada8checkers8is_digitEc:
 1220|  13.8k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZNK3ada14url_aggregator12has_passwordEv:
 8880|    890|constexpr bool url_aggregator::has_password() const noexcept {
 8881|    890|  ada_log("url_aggregator::has_password");
 8882|       |  // This function does not care about the length of the password
 8883|    890|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (8883:10): [True: 791, False: 99]
  ------------------
 8884|    791|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (8884:10): [True: 791, False: 0]
  ------------------
 8885|    890|}
_ZNK3ada14url_aggregator8validateEv:
 9022|  1.19k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9023|  1.19k|  if (!is_valid) {
  ------------------
  |  Branch (9023:7): [True: 0, False: 1.19k]
  ------------------
 9024|      0|    return true;
 9025|      0|  }
 9026|  1.19k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9026:7): [True: 0, False: 1.19k]
  ------------------
 9027|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9028|      0|            to_diagram());
 9029|      0|    return false;
 9030|      0|  }
 9031|       |  // We have a credible components struct, but let us investivate more
 9032|       |  // carefully:
 9033|       |  /**
 9034|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9035|       |   *       |     |    |          | ^^^^|       |   |
 9036|       |   *       |     |    |          | |   |       |   `----- hash_start
 9037|       |   *       |     |    |          | |   |       `--------- search_start
 9038|       |   *       |     |    |          | |   `----------------- pathname_start
 9039|       |   *       |     |    |          | `--------------------- port
 9040|       |   *       |     |    |          `----------------------- host_end
 9041|       |   *       |     |    `---------------------------------- host_start
 9042|       |   *       |     `--------------------------------------- username_end
 9043|       |   *       `--------------------------------------------- protocol_end
 9044|       |   */
 9045|  1.19k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9045:7): [True: 0, False: 1.19k]
  ------------------
 9046|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9047|      0|    return false;
 9048|      0|  }
 9049|  1.19k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9049:7): [True: 0, False: 1.19k]
  ------------------
 9050|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9051|      0|    return false;
 9052|      0|  }
 9053|  1.19k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9053:7): [True: 0, False: 1.19k]
  ------------------
 9054|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9055|      0|    return false;
 9056|      0|  }
 9057|  1.19k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9057:7): [True: 0, False: 1.19k]
  ------------------
 9058|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9059|      0|    return false;
 9060|      0|  }
 9061|  1.19k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9061:7): [True: 0, False: 1.19k]
  ------------------
 9062|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9063|      0|    return false;
 9064|      0|  }
 9065|       |
 9066|  1.19k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9066:7): [True: 0, False: 1.19k]
  ------------------
 9067|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9068|      0|    return false;
 9069|      0|  }
 9070|  1.19k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9070:7): [True: 0, False: 1.19k]
  ------------------
 9071|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9072|      0|    return false;
 9073|      0|  }
 9074|  1.19k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9074:7): [True: 0, False: 1.19k]
  ------------------
 9075|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9076|      0|    return false;
 9077|      0|  }
 9078|  1.19k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9078:7): [True: 0, False: 1.19k]
  ------------------
 9079|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9080|      0|    return false;
 9081|      0|  }
 9082|  1.19k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9082:7): [True: 0, False: 1.19k]
  ------------------
 9083|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9084|      0|            to_diagram());
 9085|      0|    return false;
 9086|      0|  }
 9087|       |
 9088|  1.19k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9088:7): [True: 1.19k, False: 0]
  ------------------
 9089|  1.19k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9089:9): [True: 0, False: 1.19k]
  ------------------
 9090|      0|      ada_log(
 9091|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9092|      0|          to_diagram());
 9093|      0|      return false;
 9094|      0|    }
 9095|  1.19k|  }
 9096|       |
 9097|  1.19k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9097:7): [True: 1.19k, False: 0]
  ------------------
 9098|  1.19k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9098:7): [True: 61, False: 1.13k]
  ------------------
 9099|     61|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9099:9): [True: 42, False: 19]
  ------------------
 9100|     42|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9100:9): [True: 0, False: 42]
  ------------------
 9101|      0|      ada_log(
 9102|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9103|      0|          "\n",
 9104|      0|          to_diagram());
 9105|      0|      return false;
 9106|      0|    }
 9107|     61|  }
 9108|       |
 9109|  1.19k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9109:7): [True: 1.19k, False: 0]
  ------------------
 9110|  1.19k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9110:9): [True: 40, False: 1.15k]
  ------------------
 9111|     40|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9111:11): [True: 0, False: 40]
  ------------------
 9112|      0|        ada_log(
 9113|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9114|      0|            to_diagram());
 9115|      0|        return false;
 9116|      0|      }
 9117|  1.15k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9117:16): [True: 1.15k, False: 0]
  ------------------
 9118|  1.15k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9118:16): [True: 1.15k, False: 0]
  ------------------
 9119|  1.15k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9119:11): [True: 1.11k, False: 42]
  ------------------
 9120|  1.11k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9120:13): [True: 0, False: 1.11k]
  ------------------
 9121|  1.11k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9121:13): [True: 0, False: 1.11k]
  ------------------
 9122|      0|          ada_log(
 9123|      0|              "url_aggregator::validate missing // between protocol and host "
 9124|      0|              "\n",
 9125|      0|              to_diagram());
 9126|      0|          return false;
 9127|      0|        }
 9128|  1.11k|      } else {
 9129|     42|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9129:13): [True: 42, False: 0]
  ------------------
 9130|     42|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9130:13): [True: 0, False: 42]
  ------------------
 9131|      0|          ada_log(
 9132|      0|              "url_aggregator::validate missing @ at the end of the username "
 9133|      0|              "\n",
 9134|      0|              to_diagram());
 9135|      0|          return false;
 9136|      0|        }
 9137|     42|      }
 9138|  1.15k|    } else {
 9139|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9139:11): [True: 0, False: 0]
  ------------------
 9140|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9141|      0|                to_diagram());
 9142|      0|        return false;
 9143|      0|      }
 9144|      0|    }
 9145|  1.19k|  }
 9146|  1.19k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9146:7): [True: 1.19k, False: 0]
  ------------------
 9147|  1.19k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9147:7): [True: 52, False: 1.14k]
  ------------------
 9148|     52|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9148:9): [True: 13, False: 39]
  ------------------
 9149|     13|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9149:9): [True: 0, False: 13]
  ------------------
 9150|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9150:9): [True: 0, False: 0]
  ------------------
 9151|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9151:11): [True: 0, False: 0]
  ------------------
 9152|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9152:11): [True: 0, False: 0]
  ------------------
 9153|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9153:11): [True: 0, False: 0]
  ------------------
 9154|      0|        ada_log(
 9155|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9156|      0|            to_diagram());
 9157|      0|        return false;
 9158|      0|      }
 9159|     52|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9159:16): [True: 0, False: 52]
  ------------------
 9160|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9161|      0|              to_diagram());
 9162|      0|      return false;
 9163|      0|    }
 9164|     52|  }
 9165|  1.19k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9165:7): [True: 1.19k, False: 0]
  ------------------
 9166|  1.19k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9166:7): [True: 1.19k, False: 0]
  ------------------
 9167|  1.19k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9167:7): [True: 1.19k, False: 0]
  |  Branch (9167:60): [True: 1.19k, False: 0]
  ------------------
 9168|  1.19k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9168:9): [True: 0, False: 1.19k]
  ------------------
 9169|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9170|      0|              to_diagram());
 9171|      0|      return false;
 9172|      0|    }
 9173|  1.19k|  }
 9174|  1.19k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9174:7): [True: 382, False: 813]
  ------------------
 9175|    382|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9175:9): [True: 0, False: 382]
  ------------------
 9176|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9177|      0|              to_diagram());
 9178|      0|      return false;
 9179|      0|    }
 9180|    382|  }
 9181|  1.19k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9181:7): [True: 123, False: 1.07k]
  ------------------
 9182|    123|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9182:9): [True: 0, False: 123]
  ------------------
 9183|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9184|      0|              to_diagram());
 9185|      0|      return false;
 9186|      0|    }
 9187|    123|  }
 9188|       |
 9189|  1.19k|  return true;
 9190|  1.19k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7526|  1.19k|    const noexcept {
 7527|       |  /**
 7528|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7529|       |   *       |     |    |          | ^^^^|       |   |
 7530|       |   *       |     |    |          | |   |       |   `----- hash_start
 7531|       |   *       |     |    |          | |   |       `--------- search_start
 7532|       |   *       |     |    |          | |   `----------------- pathname_start
 7533|       |   *       |     |    |          | `--------------------- port
 7534|       |   *       |     |    |          `----------------------- host_end
 7535|       |   *       |     |    `---------------------------------- host_start
 7536|       |   *       |     `--------------------------------------- username_end
 7537|       |   *       `--------------------------------------------- protocol_end
 7538|       |   */
 7539|       |  // These conditions can be made more strict.
 7540|  1.19k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7540:7): [True: 0, False: 1.19k]
  ------------------
 7541|      0|    return false;
 7542|      0|  }
 7543|  1.19k|  uint32_t index = protocol_end;
 7544|       |
 7545|  1.19k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7545:7): [True: 0, False: 1.19k]
  ------------------
 7546|      0|    return false;
 7547|      0|  }
 7548|  1.19k|  if (username_end < index) {
  ------------------
  |  Branch (7548:7): [True: 0, False: 1.19k]
  ------------------
 7549|      0|    return false;
 7550|      0|  }
 7551|  1.19k|  index = username_end;
 7552|       |
 7553|  1.19k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7553:7): [True: 0, False: 1.19k]
  ------------------
 7554|      0|    return false;
 7555|      0|  }
 7556|  1.19k|  if (host_start < index) {
  ------------------
  |  Branch (7556:7): [True: 0, False: 1.19k]
  ------------------
 7557|      0|    return false;
 7558|      0|  }
 7559|  1.19k|  index = host_start;
 7560|       |
 7561|  1.19k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7561:7): [True: 52, False: 1.14k]
  ------------------
 7562|     52|    if (port > 0xffff) {
  ------------------
  |  Branch (7562:9): [True: 0, False: 52]
  ------------------
 7563|      0|      return false;
 7564|      0|    }
 7565|     52|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7566|     52|    if (index + port_length < index) {
  ------------------
  |  Branch (7566:9): [True: 0, False: 52]
  ------------------
 7567|      0|      return false;
 7568|      0|    }
 7569|     52|    index += port_length;
 7570|     52|  }
 7571|       |
 7572|  1.19k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7572:7): [True: 0, False: 1.19k]
  ------------------
 7573|      0|    return false;
 7574|      0|  }
 7575|  1.19k|  if (pathname_start < index) {
  ------------------
  |  Branch (7575:7): [True: 0, False: 1.19k]
  ------------------
 7576|      0|    return false;
 7577|      0|  }
 7578|  1.19k|  index = pathname_start;
 7579|       |
 7580|  1.19k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7580:7): [True: 382, False: 813]
  ------------------
 7581|    382|    if (search_start < index) {
  ------------------
  |  Branch (7581:9): [True: 0, False: 382]
  ------------------
 7582|      0|      return false;
 7583|      0|    }
 7584|    382|    index = search_start;
 7585|    382|  }
 7586|       |
 7587|  1.19k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7587:7): [True: 123, False: 1.07k]
  ------------------
 7588|    123|    if (hash_start < index) {
  ------------------
  |  Branch (7588:9): [True: 0, False: 123]
  ------------------
 7589|      0|      return false;
 7590|      0|    }
 7591|    123|  }
 7592|       |
 7593|  1.19k|  return true;
 7594|  1.19k|}
_ZN3ada7helpers16fast_digit_countEj:
 1892|     52|inline int fast_digit_count(uint32_t x) noexcept {
 1893|     52|  auto int_log2 = [](uint32_t z) -> int {
 1894|     52|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1895|     52|  };
 1896|       |  // Compiles to very few instructions. Note that the
 1897|       |  // table is static and thus effectively a constant.
 1898|       |  // We leave it inside the function because it is meaningless
 1899|       |  // outside of it (this comes at no performance cost).
 1900|     52|  const static uint64_t table[] = {
 1901|     52|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 1902|     52|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 1903|     52|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 1904|     52|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 1905|     52|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 1906|     52|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 1907|     52|      42949672960, 42949672960};
 1908|     52|  return int((x + table[int_log2(x)]) >> 32);
 1909|     52|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 1893|     52|  auto int_log2 = [](uint32_t z) -> int {
 1894|     52|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1895|     52|  };

LLVMFuzzerTestOneInput:
   21|  3.54k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   22|  3.54k|  FuzzedDataProvider fdp(data, size);
   23|       |
   24|       |  // ===== IPv4 Serialization =====
   25|       |  // ipv4() takes a uint64_t (valid addresses are 0..0xFFFFFFFF, but the
   26|       |  // function accepts any value – out-of-range inputs should still be safe).
   27|  3.54k|  uint64_t ipv4_addr = fdp.ConsumeIntegral<uint64_t>();
   28|  3.54k|  std::string ipv4_str = ada::serializers::ipv4(ipv4_addr);
   29|  3.54k|  volatile size_t ipv4_len = ipv4_str.size();
   30|  3.54k|  (void)ipv4_len;
   31|       |
   32|       |  // ===== IPv6 Serialization =====
   33|  3.54k|  std::array<uint16_t, 8> ipv6_addr{};
   34|  28.3k|  for (auto& piece : ipv6_addr) {
  ------------------
  |  Branch (34:20): [True: 28.3k, False: 3.54k]
  ------------------
   35|  28.3k|    piece = fdp.ConsumeIntegral<uint16_t>();
   36|  28.3k|  }
   37|       |
   38|       |  // find_longest_sequence_of_ipv6_pieces: basic invariants must hold.
   39|  3.54k|  size_t compress = 0, compress_length = 0;
   40|  3.54k|  ada::serializers::find_longest_sequence_of_ipv6_pieces(ipv6_addr, compress,
   41|  3.54k|                                                         compress_length);
   42|       |  // The longest run cannot exceed 8 pieces.
   43|  3.54k|  assert(compress_length <= 8);
  ------------------
  |  Branch (43:3): [True: 3.54k, False: 0]
  ------------------
   44|       |  // If a run was found (length > 0) its start index must be in-bounds.
   45|  3.54k|  if (compress_length > 0) {
  ------------------
  |  Branch (45:7): [True: 590, False: 2.95k]
  ------------------
   46|    590|    assert(compress < 8);
  ------------------
  |  Branch (46:5): [True: 590, False: 0]
  ------------------
   47|    590|    assert(compress + compress_length <= 8);
  ------------------
  |  Branch (47:5): [True: 590, False: 0]
  ------------------
   48|    590|  }
   49|       |
   50|  3.54k|  std::string ipv6_str = ada::serializers::ipv6(ipv6_addr);
   51|  3.54k|  volatile size_t ipv6_len = ipv6_str.size();
   52|  3.54k|  (void)ipv6_len;
   53|       |
   54|       |  // Serialized IPv6 must always be a non-empty string.
   55|  3.54k|  assert(!ipv6_str.empty());
  ------------------
  |  Branch (55:3): [True: 3.54k, False: 0]
  ------------------
   56|       |
   57|       |  // ===== Fast IPv4 Parser =====
   58|       |  // try_parse_ipv4_fast() should agree with the full parsing pipeline on its
   59|       |  // output: if it succeeds (result <= 0xFFFFFFFF), re-serializing with
   60|       |  // ipv4() and parsing again must yield the same address value.
   61|  3.54k|  {
   62|  3.54k|    std::string ip_candidate = fdp.ConsumeRandomLengthString(32);
   63|  3.54k|    uint64_t fast_result = ada::checkers::try_parse_ipv4_fast(ip_candidate);
   64|  3.54k|    if (fast_result <= 0xFFFFFFFF) {
  ------------------
  |  Branch (64:9): [True: 49, False: 3.49k]
  ------------------
   65|       |      // Serialize the parsed address and re-parse.
   66|     49|      std::string canonical = ada::serializers::ipv4(fast_result);
   67|     49|      uint64_t recheck = ada::checkers::try_parse_ipv4_fast(canonical);
   68|     49|      if (recheck != fast_result) {
  ------------------
  |  Branch (68:11): [True: 0, False: 49]
  ------------------
   69|      0|        printf(
   70|      0|            "try_parse_ipv4_fast round-trip failure:\n"
   71|      0|            "  input='%s' result=%llu canonical='%s' recheck=%llu\n",
   72|      0|            ip_candidate.c_str(), (unsigned long long)fast_result,
   73|      0|            canonical.c_str(), (unsigned long long)recheck);
   74|      0|        abort();
   75|      0|      }
   76|     49|    }
   77|  3.54k|  }
   78|       |
   79|       |  // ===== Percent Encode / Decode =====
   80|  3.54k|  {
   81|  3.54k|    std::string source = fdp.ConsumeRandomLengthString(128);
   82|       |
   83|       |    // Exercise all six standard character sets used by the URL parser.
   84|  3.54k|    const uint8_t* sets[] = {
   85|  3.54k|        ada::character_sets::C0_CONTROL_PERCENT_ENCODE,
   86|  3.54k|        ada::character_sets::PATH_PERCENT_ENCODE,
   87|  3.54k|        ada::character_sets::QUERY_PERCENT_ENCODE,
   88|  3.54k|        ada::character_sets::FRAGMENT_PERCENT_ENCODE,
   89|  3.54k|        ada::character_sets::USERINFO_PERCENT_ENCODE,
   90|  3.54k|        ada::character_sets::SPECIAL_QUERY_PERCENT_ENCODE,
   91|  3.54k|    };
   92|       |
   93|  21.2k|    for (const uint8_t* charset : sets) {
  ------------------
  |  Branch (93:33): [True: 21.2k, False: 3.54k]
  ------------------
   94|       |      // Two-argument percent_encode: returns the encoded string.
   95|  21.2k|      std::string encoded = ada::unicode::percent_encode(source, charset);
   96|  21.2k|      volatile size_t enc_len = encoded.size();
   97|  21.2k|      (void)enc_len;
   98|       |
   99|       |      // Encoded output must be at least as long as the input (each byte
  100|       |      // either stays the same or expands to %XX – three bytes).
  101|  21.2k|      assert(encoded.size() >= source.size());
  ------------------
  |  Branch (101:7): [True: 21.2k, False: 0]
  ------------------
  102|       |
  103|       |      // Three-argument percent_encode: starts encoding from a given index.
  104|  21.2k|      size_t start_idx = fdp.ConsumeIntegralInRange<size_t>(0, source.size());
  105|  21.2k|      std::string encoded_from =
  106|  21.2k|          ada::unicode::percent_encode(source, charset, start_idx);
  107|  21.2k|      volatile size_t enf_len = encoded_from.size();
  108|  21.2k|      (void)enf_len;
  109|       |
  110|       |      // Template form: percent_encode<false> (replace).
  111|  21.2k|      {
  112|  21.2k|        std::string out;
  113|  21.2k|        bool changed =
  114|  21.2k|            ada::unicode::percent_encode<false>(source, charset, out);
  115|  21.2k|        volatile bool c = changed;
  116|  21.2k|        (void)c;
  117|       |        // When encoding was needed 'out' holds the encoded string; when not,
  118|       |        // 'out' is unchanged (empty). If changed, 'out' must not be shorter.
  119|  21.2k|        if (changed) {
  ------------------
  |  Branch (119:13): [True: 5.42k, False: 15.8k]
  ------------------
  120|  5.42k|          assert(out.size() >= source.size());
  ------------------
  |  Branch (120:11): [True: 5.42k, False: 0]
  ------------------
  121|  5.42k|        }
  122|  21.2k|      }
  123|       |
  124|       |      // Template form: percent_encode<true> (append).
  125|  21.2k|      {
  126|  21.2k|        std::string out = "prefix_";
  127|  21.2k|        size_t prefix_len = out.size();
  128|  21.2k|        ada::unicode::percent_encode<true>(source, charset, out);
  129|       |        // Append mode: 'out' must grow by at least source.size() bytes if
  130|       |        // encoding was needed, or stay unchanged if it wasn't.
  131|  21.2k|        assert(out.size() >= prefix_len);
  ------------------
  |  Branch (131:9): [True: 21.2k, False: 0]
  ------------------
  132|  21.2k|      }
  133|  21.2k|    }
  134|       |
  135|       |    // Percent decode: feed raw fuzz input (may contain invalid sequences).
  136|  3.54k|    {
  137|  3.54k|      size_t pct_pos = source.find('%');
  138|  3.54k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (138:11): [True: 125, False: 3.41k]
  ------------------
  139|    125|        std::string decoded = ada::unicode::percent_decode(source, pct_pos);
  140|       |        // Decoded output can't be longer than the input.
  141|    125|        assert(decoded.size() <= source.size());
  ------------------
  |  Branch (141:9): [True: 125, False: 0]
  ------------------
  142|    125|        volatile size_t dec_len = decoded.size();
  143|    125|        (void)dec_len;
  144|    125|      }
  145|  3.54k|    }
  146|       |
  147|       |    // Round-trip: encode with PATH set, then decode the result; the decoded
  148|       |    // form must equal the original (encoding then decoding is an identity).
  149|  3.54k|    {
  150|  3.54k|      std::string encoded = ada::unicode::percent_encode(
  151|  3.54k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  152|  3.54k|      size_t pct_pos = encoded.find('%');
  153|  3.54k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (153:11): [True: 916, False: 2.62k]
  ------------------
  154|    916|        std::string decoded = ada::unicode::percent_decode(encoded, pct_pos);
  155|    916|        if (decoded != source) {
  ------------------
  |  Branch (155:13): [True: 0, False: 916]
  ------------------
  156|      0|          printf(
  157|      0|              "percent_encode/decode round-trip failure!\n"
  158|      0|              "  source='%s'\n  encoded='%s'\n  decoded='%s'\n",
  159|      0|              source.c_str(), encoded.c_str(), decoded.c_str());
  160|      0|          abort();
  161|      0|        }
  162|  2.62k|      } else {
  163|       |        // No encoding was needed; the output should equal the input.
  164|  2.62k|        assert(encoded == source);
  ------------------
  |  Branch (164:9): [True: 2.62k, False: 0]
  ------------------
  165|  2.62k|      }
  166|  3.54k|    }
  167|       |
  168|       |    // percent_encode_index: the returned index must be within [0, size].
  169|  3.54k|    {
  170|  3.54k|      size_t idx = ada::unicode::percent_encode_index(
  171|  3.54k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  172|  3.54k|      assert(idx <= source.size());
  ------------------
  |  Branch (172:7): [True: 3.54k, False: 0]
  ------------------
  173|  3.54k|    }
  174|  3.54k|  }
  175|       |
  176|       |  // ===== Checker and Unicode Utility Functions =====
  177|       |  // These are internal helpers used throughout the parser. Fuzzing them
  178|       |  // directly (rather than only through the URL parsing pipeline) ensures
  179|       |  // every edge case is reachable without a valid URL structure.
  180|  3.54k|  {
  181|  3.54k|    std::string util_input = fdp.ConsumeRandomLengthString(128);
  182|       |
  183|       |    // has_tabs_or_newline: any string is valid input.
  184|  3.54k|    volatile bool has_tn = ada::unicode::has_tabs_or_newline(util_input);
  185|  3.54k|    (void)has_tn;
  186|       |
  187|       |    // is_ipv4 assumes a non-empty, lower-cased input, so honor that
  188|       |    // precondition here. Cross-check against URL parsing: if is_ipv4 reports
  189|       |    // true, embedding the string as a hostname in an http:// URL must succeed
  190|       |    // (it must be a parseable IPv4 address).
  191|  3.54k|    if (!util_input.empty()) {
  ------------------
  |  Branch (191:9): [True: 2.87k, False: 673]
  ------------------
  192|  2.87k|      volatile bool is_v4 = ada::checkers::is_ipv4(util_input);
  193|  2.87k|      (void)is_v4;
  194|  2.87k|      if (is_v4) {
  ------------------
  |  Branch (194:11): [True: 2.68k, False: 184]
  ------------------
  195|  2.68k|        std::string ipv4_url = "http://" + util_input + "/";
  196|  2.68k|        auto parsed = ada::parse<ada::url_aggregator>(ipv4_url);
  197|       |        // is_ipv4 reports true only for strings that look like IPv4 addresses;
  198|       |        // the full parser may still reject them (e.g. out-of-range octets), but
  199|       |        // if it accepts them the host type must be IPv4.
  200|  2.68k|        if (parsed) {
  ------------------
  |  Branch (200:13): [True: 1.00k, False: 1.67k]
  ------------------
  201|  1.00k|          volatile bool v = parsed->validate();
  202|  1.00k|          (void)v;
  203|  1.00k|        }
  204|  2.68k|      }
  205|  2.87k|    }
  206|       |
  207|       |    // path_signature: returns a bitmask; must not crash.
  208|  3.54k|    volatile uint8_t sig = ada::checkers::path_signature(util_input);
  209|  3.54k|    (void)sig;
  210|       |
  211|       |    // is_windows_drive_letter: must not crash on short or long inputs.
  212|  3.54k|    volatile bool is_wdl = ada::checkers::is_windows_drive_letter(util_input);
  213|  3.54k|    (void)is_wdl;
  214|       |
  215|       |    // is_normalized_windows_drive_letter
  216|  3.54k|    volatile bool is_nwdl =
  217|  3.54k|        ada::checkers::is_normalized_windows_drive_letter(util_input);
  218|  3.54k|    (void)is_nwdl;
  219|       |
  220|       |    // Consistency: a normalised Windows drive letter is a subset of
  221|       |    // Windows drive letters.
  222|  3.54k|    if (is_nwdl && !is_wdl) {
  ------------------
  |  Branch (222:9): [True: 2, False: 3.54k]
  |  Branch (222:20): [True: 0, False: 2]
  ------------------
  223|      0|      printf(
  224|      0|          "is_normalized_windows_drive_letter implies is_windows_drive_letter"
  225|      0|          " but got inconsistent results for '%s'\n",
  226|      0|          util_input.c_str());
  227|      0|      abort();
  228|      0|    }
  229|       |
  230|       |    // to_lower_ascii: works in-place; must not crash.
  231|  3.54k|    {
  232|  3.54k|      std::string lower_copy = util_input;
  233|  3.54k|      volatile bool all_ascii =
  234|  3.54k|          ada::unicode::to_lower_ascii(lower_copy.data(), lower_copy.size());
  235|  3.54k|      (void)all_ascii;
  236|       |      // The result should be at most as long as the input.
  237|  3.54k|      assert(lower_copy.size() == util_input.size());
  ------------------
  |  Branch (237:7): [True: 3.54k, False: 0]
  ------------------
  238|  3.54k|    }
  239|       |
  240|       |    // contains_forbidden_domain_code_point: must not crash.
  241|  3.54k|    volatile bool has_forbidden =
  242|  3.54k|        ada::unicode::contains_forbidden_domain_code_point(util_input.data(),
  243|  3.54k|                                                           util_input.size());
  244|  3.54k|    (void)has_forbidden;
  245|       |
  246|       |    // contains_forbidden_domain_code_point_or_upper: must not crash.
  247|  3.54k|    volatile uint8_t forbidden_or_upper =
  248|  3.54k|        ada::unicode::contains_forbidden_domain_code_point_or_upper(
  249|  3.54k|            util_input.data(), util_input.size());
  250|  3.54k|    (void)forbidden_or_upper;
  251|       |
  252|       |    // verify_dns_length: must not crash; also check consistency with
  253|       |    // to_ascii output.
  254|  3.54k|    volatile bool dns_ok = ada::checkers::verify_dns_length(util_input);
  255|  3.54k|    (void)dns_ok;
  256|  3.54k|  }
  257|       |
  258|       |  // ===== Integration: embed serialized addresses into real URLs =====
  259|       |  // This exercises the full parsing pipeline with our synthetic addresses
  260|       |  // and verifies that serialization output is always round-trip safe.
  261|      0|  {
  262|       |    // Only valid IPv4 address range (0..0xFFFFFFFF) should embed cleanly.
  263|  3.54k|    if (ipv4_addr <= 0xFFFFFFFF) {
  ------------------
  |  Branch (263:9): [True: 186, False: 3.35k]
  ------------------
  264|    186|      std::string url_str = "http://" + ipv4_str + "/path?q=1";
  265|    186|      auto parsed = ada::parse<ada::url_aggregator>(url_str);
  266|    186|      if (parsed) {
  ------------------
  |  Branch (266:11): [True: 186, False: 0]
  ------------------
  267|    186|        volatile bool v = parsed->validate();
  268|    186|        (void)v;
  269|       |        // The URL's hostname must be the canonical dotted-decimal address.
  270|    186|        std::string host = std::string(parsed->get_hostname());
  271|       |        // host == ipv4_str  (not asserted here because the URL parser may
  272|       |        // normalise the address differently for non-standard values, but it
  273|       |        // must always successfully parse our serialized form).
  274|    186|        (void)host;
  275|    186|      }
  276|    186|    }
  277|       |
  278|       |    // IPv6: wrap in brackets.
  279|  3.54k|    std::string ipv6_url_str = "http://[" + ipv6_str + "]/path";
  280|  3.54k|    auto parsed_ipv6 = ada::parse<ada::url_aggregator>(ipv6_url_str);
  281|  3.54k|    if (parsed_ipv6) {
  ------------------
  |  Branch (281:9): [True: 0, False: 3.54k]
  ------------------
  282|      0|      volatile bool v = parsed_ipv6->validate();
  283|      0|      (void)v;
  284|       |      // Re-parse the href – must be idempotent.
  285|      0|      std::string href = std::string(parsed_ipv6->get_href());
  286|      0|      auto reparsed = ada::parse<ada::url_aggregator>(href);
  287|      0|      if (!reparsed) {
  ------------------
  |  Branch (287:11): [True: 0, False: 0]
  ------------------
  288|      0|        printf("IPv6 URL re-parse failure: '%s'\n", href.c_str());
  289|      0|        abort();
  290|      0|      }
  291|      0|      if (std::string(reparsed->get_href()) != href) {
  ------------------
  |  Branch (291:11): [True: 0, False: 0]
  ------------------
  292|      0|        printf("IPv6 URL re-parse href mismatch: '%s' vs '%s'\n", href.c_str(),
  293|      0|               std::string(reparsed->get_href()).c_str());
  294|      0|        abort();
  295|      0|      }
  296|      0|    }
  297|  3.54k|  }
  298|       |
  299|  3.54k|  return 0;
  300|  3.54k|}

