_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  160|  2.61k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  161|  2.61k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  162|  2.61k|  size_t pos = 0;
  163|  2.61k|  const char32_t* start{utf32_output};
  164|  28.9k|  while (pos < len) {
  ------------------
  |  Branch (164:10): [True: 26.5k, False: 2.45k]
  ------------------
  165|       |    // try to convert the next block of 16 ASCII bytes
  166|  26.5k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (166:9): [True: 10.2k, False: 16.2k]
  ------------------
  167|       |                            // bytes, check that they are ascii
  168|  10.2k|      uint64_t v1;
  169|  10.2k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  170|  10.2k|      uint64_t v2;
  171|  10.2k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  172|  10.2k|      uint64_t v{v1 | v2};
  173|  10.2k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (173:11): [True: 813, False: 9.42k]
  ------------------
  174|    813|        size_t final_pos = pos + 16;
  175|  13.8k|        while (pos < final_pos) {
  ------------------
  |  Branch (175:16): [True: 13.0k, False: 813]
  ------------------
  176|  13.0k|          *utf32_output++ = char32_t(buf[pos]);
  177|  13.0k|          pos++;
  178|  13.0k|        }
  179|    813|        continue;
  180|    813|      }
  181|  10.2k|    }
  182|  25.7k|    uint8_t leading_byte = data[pos];  // leading byte
  183|  25.7k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (183:9): [True: 16.1k, False: 9.53k]
  ------------------
  184|       |      // converting one ASCII byte !!!
  185|  16.1k|      *utf32_output++ = char32_t(leading_byte);
  186|  16.1k|      pos++;
  187|  16.1k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (187:16): [True: 2.75k, False: 6.77k]
  ------------------
  188|       |      // We have a two-byte UTF-8
  189|  2.75k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (189:11): [True: 3, False: 2.75k]
  ------------------
  190|      3|        return 0;
  191|      3|      }  // minimal bound checking
  192|  2.75k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (192:11): [True: 36, False: 2.71k]
  ------------------
  193|     36|        return 0;
  194|     36|      }
  195|       |      // range check
  196|  2.71k|      uint32_t code_point =
  197|  2.71k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  198|  2.71k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (198:11): [True: 3, False: 2.71k]
  |  Branch (198:32): [True: 0, False: 2.71k]
  ------------------
  199|      3|        return 0;
  200|      3|      }
  201|  2.71k|      *utf32_output++ = char32_t(code_point);
  202|  2.71k|      pos += 2;
  203|  6.77k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (203:16): [True: 6.28k, False: 487]
  ------------------
  204|       |      // We have a three-byte UTF-8
  205|  6.28k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (205:11): [True: 2, False: 6.28k]
  ------------------
  206|      2|        return 0;
  207|      2|      }  // minimal bound checking
  208|       |
  209|  6.28k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (209:11): [True: 16, False: 6.27k]
  ------------------
  210|     16|        return 0;
  211|     16|      }
  212|  6.27k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (212:11): [True: 5, False: 6.26k]
  ------------------
  213|      5|        return 0;
  214|      5|      }
  215|       |      // range check
  216|  6.26k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  217|  6.26k|                            (data[pos + 1] & 0b00111111) << 6 |
  218|  6.26k|                            (data[pos + 2] & 0b00111111);
  219|  6.26k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (219:11): [True: 1, False: 6.26k]
  |  Branch (219:33): [True: 0, False: 6.26k]
  ------------------
  220|  6.26k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (220:12): [True: 1.62k, False: 4.64k]
  |  Branch (220:35): [True: 1, False: 1.62k]
  ------------------
  221|      2|        return 0;
  222|      2|      }
  223|  6.26k|      *utf32_output++ = char32_t(code_point);
  224|  6.26k|      pos += 3;
  225|  6.26k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (225:16): [True: 423, False: 64]
  ------------------
  226|       |      // we have a 4-byte UTF-8 word.
  227|    423|      if (pos + 3 >= len) {
  ------------------
  |  Branch (227:11): [True: 9, False: 414]
  ------------------
  228|      9|        return 0;
  229|      9|      }  // minimal bound checking
  230|    414|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (230:11): [True: 8, False: 406]
  ------------------
  231|      8|        return 0;
  232|      8|      }
  233|    406|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (233:11): [True: 3, False: 403]
  ------------------
  234|      3|        return 0;
  235|      3|      }
  236|    403|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (236:11): [True: 5, False: 398]
  ------------------
  237|      5|        return 0;
  238|      5|      }
  239|       |
  240|       |      // range check
  241|    398|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  242|    398|                            (data[pos + 1] & 0b00111111) << 12 |
  243|    398|                            (data[pos + 2] & 0b00111111) << 6 |
  244|    398|                            (data[pos + 3] & 0b00111111);
  245|    398|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (245:11): [True: 5, False: 393]
  |  Branch (245:35): [True: 2, False: 391]
  ------------------
  246|      7|        return 0;
  247|      7|      }
  248|    391|      *utf32_output++ = char32_t(code_point);
  249|    391|      pos += 4;
  250|    391|    } else {
  251|     64|      return 0;
  252|     64|    }
  253|  25.7k|  }
  254|  2.45k|  return utf32_output - start;
  255|  2.61k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  270|  2.61k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  271|  2.61k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  272|  2.61k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  273|       |    // -65 is 0b10111111, anything larger in two-complement's
  274|       |    // should start a new code point.
  275|  2.61k|    return c > -65;
  276|  2.61k|  });
  277|  2.61k|}
_ZN3ada4idna7deflate9BitReader3getEi:
  405|   457k|  uint32_t get(int n) {
  406|   457k|    if (!ensure(n)) return UINT32_MAX;
  ------------------
  |  Branch (406:9): [True: 0, False: 457k]
  ------------------
  407|   457k|    uint32_t v = acc & ((1u << n) - 1);
  408|   457k|    acc >>= n;
  409|   457k|    bits -= n;
  410|   457k|    return v;
  411|   457k|  }
_ZN3ada4idna9ascii_mapEPcm:
 5126|    149|void ascii_map(char* input, size_t length) {
 5127|    149|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    149|    return 0x101010101010101ull * v;
 5129|    149|  };
 5130|    149|  uint64_t broadcast_80 = broadcast(0x80);
 5131|    149|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5132|    149|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5133|    149|  size_t i = 0;
 5134|       |
 5135|    465|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5135:10): [True: 316, False: 149]
  ------------------
 5136|    316|    uint64_t word{};
 5137|    316|    std::memcpy(&word, input + i, sizeof(word));
 5138|    316|    word ^=
 5139|    316|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5140|    316|    std::memcpy(input + i, &word, sizeof(word));
 5141|    316|  }
 5142|    149|  if (i < length) {
  ------------------
  |  Branch (5142:7): [True: 120, False: 29]
  ------------------
 5143|    120|    uint64_t word{};
 5144|    120|    std::memcpy(&word, input + i, length - i);
 5145|    120|    word ^=
 5146|    120|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|    120|    std::memcpy(input + i, &word, length - i);
 5148|    120|  }
 5149|    149|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5153|  3.51k|bool map(std::u32string_view input, std::u32string& out) {
 5154|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5155|  3.51k|  out.clear();
 5156|  3.51k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5156:7): [True: 0, False: 3.51k]
  ------------------
 5157|      0|    return false;
 5158|      0|  }
 5159|       |
 5160|       |  // Pass 1: validate and compute exact output length.
 5161|  3.51k|  size_t out_size = 0;
 5162|  45.7k|  for (char32_t x : input) {
  ------------------
  |  Branch (5162:19): [True: 45.7k, False: 3.32k]
  ------------------
 5163|  45.7k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5164|  45.7k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5164:9): [True: 194, False: 45.5k]
  ------------------
 5165|    194|      return false;
 5166|    194|    }
 5167|  45.5k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5167:9): [True: 35.5k, False: 10.0k]
  ------------------
 5168|  35.5k|      ++out_size;
 5169|  35.5k|      continue;
 5170|  35.5k|    }
 5171|  10.0k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5171:9): [True: 0, False: 10.0k]
  ------------------
 5172|      0|      return false;
 5173|      0|    }
 5174|  10.0k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5175|  10.0k|  }
 5176|       |
 5177|       |  // Pass 2: write into a single allocation.
 5178|  3.32k|  out.resize(out_size);
 5179|  3.32k|  size_t w = 0;
 5180|  45.3k|  for (char32_t x : input) {
  ------------------
  |  Branch (5180:19): [True: 45.3k, False: 3.32k]
  ------------------
 5181|  45.3k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5182|  45.3k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5182:9): [True: 35.3k, False: 9.99k]
  ------------------
 5183|  35.3k|      out[w++] = x;
 5184|  35.3k|      continue;
 5185|  35.3k|    }
 5186|       |    // IGNORED or mapped (status already validated in pass 1).
 5187|  9.99k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5188|  62.8k|    while (*ptr != 0) {
  ------------------
  |  Branch (5188:12): [True: 52.8k, False: 9.99k]
  ------------------
 5189|  52.8k|      out[w++] = utf8_next(ptr);
 5190|  52.8k|    }
 5191|  9.99k|  }
 5192|  3.32k|  return true;
 5193|  3.51k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5286|    922|    const std::u32string_view input) noexcept {
 5287|    922|  bool decomposition_needed{false};
 5288|    922|  size_t additional_elements{0};
 5289|  16.2k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5289:35): [True: 16.2k, False: 922]
  ------------------
 5290|  16.2k|    size_t decomposition_length{0};
 5291|       |
 5292|  16.2k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5292:9): [True: 1.72k, False: 14.4k]
  ------------------
 5293|  1.72k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5293:9): [True: 897, False: 830]
  ------------------
 5294|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5295|    897|      decomposition_length = 2;
 5296|    897|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5296:11): [True: 651, False: 246]
  ------------------
 5297|    651|        decomposition_length = 3;
 5298|    651|      }
 5299|  15.3k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5299:16): [True: 15.3k, False: 0]
  ------------------
 5300|  15.3k|      const uint8_t di = decomposition_index[current_character >> 8];
 5301|  15.3k|      const uint16_t* const decomposition =
 5302|  15.3k|          decomposition_block_row(di) + (current_character % 256);
 5303|  15.3k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5304|  15.3k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5304:11): [True: 1.16k, False: 14.1k]
  |  Branch (5304:41): [True: 0, False: 1.16k]
  ------------------
 5305|      0|        decomposition_length = 0;
 5306|      0|      }
 5307|  15.3k|    }
 5308|  16.2k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5308:9): [True: 2.06k, False: 14.1k]
  ------------------
 5309|  2.06k|      decomposition_needed = true;
 5310|  2.06k|      additional_elements += decomposition_length - 1;
 5311|  2.06k|    }
 5312|  16.2k|  }
 5313|    922|  return {decomposition_needed, additional_elements};
 5314|    922|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5316|    612|void decompose(std::u32string& input, size_t additional_elements) {
 5317|    612|  input.resize(input.size() + additional_elements);
 5318|    612|  for (size_t descending_idx = input.size(),
 5319|    612|              input_count = descending_idx - additional_elements;
 5320|  10.6k|       input_count--;) {
  ------------------
  |  Branch (5320:8): [True: 10.0k, False: 612]
  ------------------
 5321|  10.0k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5321:9): [True: 1.21k, False: 8.85k]
  ------------------
 5322|  1.21k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5322:9): [True: 897, False: 313]
  ------------------
 5323|       |      // Hangul decomposition.
 5324|    897|      char32_t s_index = input[input_count] - hangul_sbase;
 5325|    897|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5325:11): [True: 651, False: 246]
  ------------------
 5326|    651|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5327|    651|      }
 5328|    897|      input[--descending_idx] =
 5329|    897|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5330|    897|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5331|  9.16k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5331:16): [True: 9.16k, False: 0]
  ------------------
 5332|  9.16k|      const uint16_t* decomposition =
 5333|  9.16k|          decomposition_block_row(
 5334|  9.16k|              decomposition_index[input[input_count] >> 8]) +
 5335|  9.16k|          (input[input_count] % 256);
 5336|  9.16k|      uint16_t decomposition_length =
 5337|  9.16k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5338|  9.16k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5338:11): [True: 1.16k, False: 7.99k]
  |  Branch (5338:39): [True: 0, False: 1.16k]
  ------------------
 5339|      0|        decomposition_length = 0;
 5340|      0|      }
 5341|  9.16k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5341:11): [True: 1.16k, False: 7.99k]
  ------------------
 5342|  1.16k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5343|  1.16k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5343:13): [True: 0, False: 1.16k]
  ------------------
 5344|      0|          input[--descending_idx] = input[input_count];
 5345|  1.16k|        } else {
 5346|  3.92k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5346:18): [True: 2.75k, False: 1.16k]
  ------------------
 5347|  2.75k|            input[--descending_idx] =
 5348|  2.75k|                decomposition_data[base + decomposition_length];
 5349|  2.75k|          }
 5350|  1.16k|        }
 5351|  7.99k|      } else {
 5352|  7.99k|        input[--descending_idx] = input[input_count];
 5353|  7.99k|      }
 5354|  9.16k|    } else {
 5355|      0|      input[--descending_idx] = input[input_count];
 5356|      0|    }
 5357|  10.0k|  }
 5358|    612|}
_ZN3ada4idna7get_cccEDi:
 5360|   278k|uint8_t get_ccc(char32_t c) noexcept {
 5361|   278k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5361:7): [True: 0, False: 278k]
  ------------------
 5362|      0|    return 0;
 5363|      0|  }
 5364|   278k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5365|   278k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5367|    922|void sort_marks(std::u32string& input) {
 5368|  19.3k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5368:24): [True: 18.4k, False: 922]
  ------------------
 5369|  18.4k|    uint8_t ccc = get_ccc(input[idx]);
 5370|  18.4k|    if (ccc == 0) {
  ------------------
  |  Branch (5370:9): [True: 14.6k, False: 3.80k]
  ------------------
 5371|  14.6k|      continue;
 5372|  14.6k|    }
 5373|  3.80k|    auto current_character = input[idx];
 5374|  3.80k|    size_t back_idx = idx;
 5375|  20.5k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5375:12): [True: 20.4k, False: 89]
  |  Branch (5375:29): [True: 16.7k, False: 3.71k]
  ------------------
 5376|  16.7k|      input[back_idx] = input[back_idx - 1];
 5377|  16.7k|      back_idx--;
 5378|  16.7k|    }
 5379|  3.80k|    input[back_idx] = current_character;
 5380|  3.80k|  }
 5381|    922|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5383|    922|void decompose_nfc(std::u32string& input) {
 5384|       |  /**
 5385|       |   * Decompose the domain_name string to Unicode Normalization Form C.
 5386|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepDecompose
 5387|       |   */
 5388|    922|  auto [decomposition_needed, additional_elements] =
 5389|    922|      compute_decomposition_length(input);
 5390|    922|  if (decomposition_needed) {
  ------------------
  |  Branch (5390:7): [True: 612, False: 310]
  ------------------
 5391|    612|    decompose(input, additional_elements);
 5392|    612|  }
 5393|    922|  sort_marks(input);
 5394|    922|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5477|  3.75k|bool is_already_nfc(std::u32string_view input) noexcept {
 5478|  3.75k|  if (input.empty()) {
  ------------------
  |  Branch (5478:7): [True: 0, False: 3.75k]
  ------------------
 5479|      0|    return true;
 5480|      0|  }
 5481|  3.75k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5481:7): [True: 0, False: 3.75k]
  |  Branch (5481:30): [True: 0, False: 0]
  ------------------
 5482|      0|    return false;
 5483|      0|  }
 5484|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5485|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5486|  85.3k|  for (char32_t c : input) {
  ------------------
  |  Branch (5486:19): [True: 85.3k, False: 3.75k]
  ------------------
 5487|  85.3k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5487:9): [True: 0, False: 85.3k]
  ------------------
 5488|      0|      return false;
 5489|      0|    }
 5490|  85.3k|  }
 5491|       |  // 2) Combining marks already in canonical order. prev_ccc carries the
 5492|       |  //    trailing class of the previous character's canonical decomposition so a
 5493|       |  //    composite starter followed by a lower-class mark is caught.
 5494|  3.75k|  uint8_t prev_ccc = 0;
 5495|  79.7k|  for (char32_t c : input) {
  ------------------
  |  Branch (5495:19): [True: 79.7k, False: 2.65k]
  ------------------
 5496|  79.7k|    uint8_t ccc = get_ccc(c);
 5497|  79.7k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5497:9): [True: 3.45k, False: 76.2k]
  |  Branch (5497:21): [True: 1.10k, False: 2.35k]
  ------------------
 5498|  1.10k|      return false;
 5499|  1.10k|    }
 5500|  78.6k|    prev_ccc = trailing_ccc(c);
 5501|  78.6k|  }
 5502|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5503|  2.65k|  return !would_compose(input);
 5504|  3.75k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5506|    922|void compose(std::u32string& input) {
 5507|       |  /**
 5508|       |   * Compose the domain_name string to Unicode Normalization Form C.
 5509|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepCompose
 5510|       |   */
 5511|    922|  size_t input_count{0};
 5512|    922|  size_t composition_count{0};
 5513|  14.8k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5513:10): [True: 13.9k, False: 922]
  ------------------
 5514|  13.9k|    input[composition_count] = input[input_count];
 5515|  13.9k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5515:9): [True: 2.70k, False: 11.2k]
  ------------------
 5516|  2.70k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5516:9): [True: 1.21k, False: 1.49k]
  ------------------
 5517|  1.21k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5517:11): [True: 1.19k, False: 19]
  ------------------
 5518|  1.19k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5518:11): [True: 1.00k, False: 182]
  ------------------
 5519|  1.00k|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5519:11): [True: 930, False: 79]
  ------------------
 5520|    930|        input[composition_count] =
 5521|    930|            hangul_sbase +
 5522|    930|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5523|    930|             input[input_count + 1] - hangul_vbase) *
 5524|    930|                hangul_tcount;
 5525|    930|        input_count++;
 5526|    930|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5526:13): [True: 904, False: 26]
  ------------------
 5527|    904|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5527:13): [True: 732, False: 172]
  ------------------
 5528|    732|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5528:13): [True: 651, False: 81]
  ------------------
 5529|    651|          input[composition_count] += input[++input_count] - hangul_tbase;
 5530|    651|        }
 5531|    930|      }
 5532|  12.7k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5532:16): [True: 759, False: 11.9k]
  ------------------
 5533|    759|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5533:16): [True: 0, False: 759]
  ------------------
 5534|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5534:11): [True: 0, False: 0]
  ------------------
 5535|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5535:11): [True: 0, False: 0]
  ------------------
 5536|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5536:11): [True: 0, False: 0]
  ------------------
 5537|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5537:11): [True: 0, False: 0]
  ------------------
 5538|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5539|      0|      }
 5540|  12.7k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5540:16): [True: 12.7k, False: 0]
  ------------------
 5541|  12.7k|      const uint16_t* composition =
 5542|  12.7k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5543|  12.7k|          (input[input_count] % 256);
 5544|  12.7k|      size_t initial_composition_count = composition_count;
 5545|  16.5k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5545:39): [True: 15.6k, False: 865]
  ------------------
 5546|  15.6k|           input_count++) {
 5547|  15.6k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5548|       |
 5549|  15.6k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5549:13): [True: 6.02k, False: 9.66k]
  |  Branch (5549:49): [True: 5.61k, False: 411]
  ------------------
 5550|  5.61k|          int left = composition[0];
 5551|  5.61k|          int right = composition[1];
 5552|  5.61k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5552:15): [True: 0, False: 5.61k]
  |  Branch (5552:27): [True: 0, False: 5.61k]
  ------------------
 5553|  5.61k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5553:15): [True: 0, False: 5.61k]
  ------------------
 5554|      0|            break;
 5555|      0|          }
 5556|  13.5k|          while (left + 2 < right) {
  ------------------
  |  Branch (5556:18): [True: 7.97k, False: 5.61k]
  ------------------
 5557|  7.97k|            int middle = left + (((right - left) >> 1) & ~1);
 5558|  7.97k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5558:17): [True: 2.75k, False: 5.22k]
  ------------------
 5559|  7.97k|                input[input_count + 1]) {
 5560|  2.75k|              left = middle;
 5561|  2.75k|            }
 5562|  7.97k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5562:17): [True: 6.71k, False: 1.25k]
  ------------------
 5563|  7.97k|                input[input_count + 1]) {
 5564|  6.71k|              right = middle;
 5565|  6.71k|            }
 5566|  7.97k|          }
 5567|  5.61k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5567:15): [True: 5.61k, False: 0]
  ------------------
 5568|  5.61k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5568:15): [True: 1.87k, False: 3.74k]
  ------------------
 5569|  5.61k|                  input[input_count + 1]) {
 5570|  1.87k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5571|  1.87k|            input[initial_composition_count] = composed;
 5572|  1.87k|            composition =
 5573|  1.87k|                composition_block_row(composition_index[composed >> 8]) +
 5574|  1.87k|                (composed % 256);
 5575|  1.87k|            continue;
 5576|  1.87k|          }
 5577|  5.61k|        }
 5578|       |
 5579|  13.8k|        if (ccc == 0) {
  ------------------
  |  Branch (5579:13): [True: 11.8k, False: 1.92k]
  ------------------
 5580|  11.8k|          break;
 5581|  11.8k|        }
 5582|  1.92k|        previous_ccc = ccc;
 5583|  1.92k|        input[++composition_count] = input[input_count + 1];
 5584|  1.92k|      }
 5585|  12.7k|    }
 5586|  13.9k|  }
 5587|       |
 5588|    922|  if (composition_count < input_count) {
  ------------------
  |  Branch (5588:7): [True: 841, False: 81]
  ------------------
 5589|    841|    input.resize(composition_count);
 5590|    841|  }
 5591|    922|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5593|    922|bool normalize(std::u32string& input) {
 5594|       |  /**
 5595|       |   * Normalize the characters according to IDNA (Unicode Normalization Form C).
 5596|       |   * @see https://www.unicode.org/reports/tr46/#ProcessingStepNormalize
 5597|       |   */
 5598|    922|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5598:7): [True: 0, False: 922]
  |  Branch (5598:27): [True: 0, False: 922]
  ------------------
 5599|    922|      composition_index == nullptr) {
  ------------------
  |  Branch (5599:7): [True: 0, False: 922]
  ------------------
 5600|      0|    return false;
 5601|      0|  }
 5602|    922|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5602:7): [True: 0, False: 922]
  ------------------
 5603|      0|    return true;
 5604|      0|  }
 5605|    922|  decompose_nfc(input);
 5606|    922|  compose(input);
 5607|    922|  return true;
 5608|    922|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5668|  1.20k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5669|  1.20k|  int32_t written_out{0};
 5670|  1.20k|  out.reserve(out.size() + input.size());
 5671|  1.20k|  uint32_t n = initial_n;
 5672|  1.20k|  int32_t i = 0;
 5673|  1.20k|  int32_t bias = initial_bias;
 5674|       |  // grab ascii content
 5675|  1.20k|  size_t end_of_ascii = input.find_last_of('-');
 5676|  1.20k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5676:7): [True: 209, False: 992]
  ------------------
 5677|  1.30k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5677:20): [True: 1.30k, False: 209]
  ------------------
 5678|  1.30k|      if (c >= 0x80) {
  ------------------
  |  Branch (5678:11): [True: 0, False: 1.30k]
  ------------------
 5679|      0|        return false;
 5680|      0|      }
 5681|  1.30k|      out.push_back(c);
 5682|  1.30k|      written_out++;
 5683|  1.30k|    }
 5684|    209|    input.remove_prefix(end_of_ascii + 1);
 5685|    209|  }
 5686|  9.60k|  while (!input.empty()) {
  ------------------
  |  Branch (5686:10): [True: 8.48k, False: 1.11k]
  ------------------
 5687|  8.48k|    int32_t oldi = i;
 5688|  8.48k|    int32_t w = 1;
 5689|  12.8k|    for (int32_t k = base;; k += base) {
 5690|  12.8k|      if (input.empty()) {
  ------------------
  |  Branch (5690:11): [True: 40, False: 12.8k]
  ------------------
 5691|     40|        return false;
 5692|     40|      }
 5693|  12.8k|      uint8_t code_point = input.front();
 5694|  12.8k|      input.remove_prefix(1);
 5695|  12.8k|      int32_t digit = char_to_digit_value(code_point);
 5696|  12.8k|      if (digit < 0) {
  ------------------
  |  Branch (5696:11): [True: 9, False: 12.8k]
  ------------------
 5697|      9|        return false;
 5698|      9|      }
 5699|  12.8k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5699:11): [True: 7, False: 12.8k]
  ------------------
 5700|      7|        return false;
 5701|      7|      }
 5702|  12.8k|      i = i + digit * w;
 5703|  12.8k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5703:19): [True: 2.89k, False: 9.92k]
  |  Branch (5703:38): [True: 9.42k, False: 499]
  ------------------
 5704|  12.8k|      if (digit < t) {
  ------------------
  |  Branch (5704:11): [True: 8.43k, False: 4.38k]
  ------------------
 5705|  8.43k|        break;
 5706|  8.43k|      }
 5707|  4.38k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5707:11): [True: 0, False: 4.38k]
  ------------------
 5708|      0|        return false;
 5709|      0|      }
 5710|  4.38k|      w = w * (base - t);
 5711|  4.38k|    }
 5712|  8.43k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5713|  8.43k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5713:9): [True: 28, False: 8.40k]
  ------------------
 5714|     28|      return false;
 5715|     28|    }
 5716|  8.40k|    n = n + i / (written_out + 1);
 5717|  8.40k|    i = i % (written_out + 1);
 5718|  8.40k|    if (n < 0x80) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 8.40k]
  ------------------
 5719|      0|      return false;
 5720|      0|    }
 5721|  8.40k|    out.insert(out.begin() + i, n);
 5722|  8.40k|    written_out++;
 5723|  8.40k|    ++i;
 5724|  8.40k|  }
 5725|       |  // See https://github.com/whatwg/url/issues/803
 5726|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5727|  1.11k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5727:7): [True: 423, False: 694]
  |  Branch (5727:26): [True: 129, False: 294]
  |  Branch (5727:44): [True: 84, False: 45]
  |  Branch (5727:62): [True: 45, False: 39]
  ------------------
 5728|     45|      out[3] == U'-') {
  ------------------
  |  Branch (5728:7): [True: 1, False: 44]
  ------------------
 5729|      1|    return false;
 5730|      1|  }
 5731|  1.11k|  return true;
 5732|  1.11k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5812|  3.23k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5813|  3.23k|  out.reserve(input.size() + out.size());
 5814|  3.23k|  uint32_t n = initial_n;
 5815|  3.23k|  int32_t d = 0;
 5816|  3.23k|  int32_t bias = initial_bias;
 5817|  3.23k|  size_t h = 0;
 5818|       |  // first push the ascii content
 5819|  24.6k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5819:19): [True: 24.6k, False: 3.23k]
  ------------------
 5820|  24.6k|    if (c < 0x80) {
  ------------------
  |  Branch (5820:9): [True: 3.20k, False: 21.4k]
  ------------------
 5821|  3.20k|      ++h;
 5822|  3.20k|      out.push_back(char(c));
 5823|  3.20k|    }
 5824|  24.6k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5824:9): [True: 0, False: 24.6k]
  |  Branch (5824:26): [True: 357, False: 24.3k]
  |  Branch (5824:41): [True: 0, False: 357]
  ------------------
 5825|      0|      return false;
 5826|      0|    }
 5827|  24.6k|  }
 5828|  3.23k|  size_t b = h;
 5829|  3.23k|  if (b > 0) {
  ------------------
  |  Branch (5829:7): [True: 573, False: 2.66k]
  ------------------
 5830|    573|    out.push_back('-');
 5831|    573|  }
 5832|  15.8k|  while (h < input.size()) {
  ------------------
  |  Branch (5832:10): [True: 12.5k, False: 3.23k]
  ------------------
 5833|  12.5k|    uint32_t m = 0x10FFFF;
 5834|   194k|    for (auto code_point : input) {
  ------------------
  |  Branch (5834:26): [True: 194k, False: 12.5k]
  ------------------
 5835|   194k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5835:11): [True: 88.8k, False: 105k]
  |  Branch (5835:30): [True: 20.3k, False: 68.4k]
  ------------------
 5836|   194k|    }
 5837|       |
 5838|  12.5k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5838:9): [True: 0, False: 12.5k]
  ------------------
 5839|      0|      return false;
 5840|      0|    }
 5841|  12.5k|    d = d + int32_t((m - n) * (h + 1));
 5842|  12.5k|    n = m;
 5843|   194k|    for (auto c : input) {
  ------------------
  |  Branch (5843:17): [True: 194k, False: 12.5k]
  ------------------
 5844|   194k|      if (c < n) {
  ------------------
  |  Branch (5844:11): [True: 105k, False: 88.8k]
  ------------------
 5845|   105k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5845:13): [True: 0, False: 105k]
  ------------------
 5846|      0|          return false;
 5847|      0|        }
 5848|   105k|        ++d;
 5849|   105k|      }
 5850|   194k|      if (c == n) {
  ------------------
  |  Branch (5850:11): [True: 21.4k, False: 172k]
  ------------------
 5851|  21.4k|        int32_t q = d;
 5852|  38.7k|        for (int32_t k = base;; k += base) {
 5853|  38.7k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5853:23): [True: 7.34k, False: 31.4k]
  |  Branch (5853:42): [True: 24.6k, False: 6.81k]
  ------------------
 5854|       |
 5855|  38.7k|          if (q < t) {
  ------------------
  |  Branch (5855:15): [True: 21.4k, False: 17.3k]
  ------------------
 5856|  21.4k|            break;
 5857|  21.4k|          }
 5858|  17.3k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5859|  17.3k|          q = (q - t) / (base - t);
 5860|  17.3k|        }
 5861|  21.4k|        out.push_back(digit_to_char(q));
 5862|  21.4k|        bias = adapt(d, int32_t(h + 1), h == b);
 5863|  21.4k|        d = 0;
 5864|  21.4k|        ++h;
 5865|  21.4k|      }
 5866|   194k|    }
 5867|  12.5k|    ++d;
 5868|  12.5k|    ++n;
 5869|  12.5k|  }
 5870|  3.23k|  return true;
 5871|  3.23k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5955|  4.60k|bool is_label_valid(const std::u32string_view label) {
 5956|  4.60k|  if (label.empty()) {
  ------------------
  |  Branch (5956:7): [True: 0, False: 4.60k]
  ------------------
 5957|      0|    return true;
 5958|      0|  }
 5959|  4.60k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5959:7): [True: 0, False: 4.60k]
  |  Branch (5959:27): [True: 0, False: 4.60k]
  |  Branch (5959:58): [True: 0, False: 4.60k]
  ------------------
 5960|  4.60k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5960:7): [True: 0, False: 4.60k]
  |  Branch (5960:31): [True: 0, False: 4.60k]
  ------------------
 5961|      0|    return false;
 5962|      0|  }
 5963|       |
 5964|       |  ///////////////
 5965|       |  // We have a normalization step which ensures that we are in NFC.
 5966|       |  // If we receive punycode, we normalize and check that the normalized
 5967|       |  // version matches the original.
 5968|       |  // --------------------------------------
 5969|       |  // The label must be in Unicode Normalization Form NFC.
 5970|       |
 5971|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5972|       |  // ---------------------------------------
 5973|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5974|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5975|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5976|       |
 5977|       |  // This is not necessary because we segment the
 5978|       |  // labels by '.'.
 5979|       |  // ---------------------------------------
 5980|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5981|       |  // if (label.find('.') != std::string_view::npos) return false;
 5982|       |
 5983|       |  // The label must not begin with a combining mark.
 5984|       |  // Range membership via lower_bound on range end.
 5985|  4.60k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5986|  4.60k|                                               combining_range_count};
 5987|  4.60k|  const auto comb_it = std::ranges::lower_bound(
 5988|  4.60k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5989|  4.60k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5989:7): [True: 4.60k, False: 0]
  |  Branch (5989:7): [True: 82, False: 4.52k]
  |  Branch (5989:37): [True: 82, False: 4.52k]
  ------------------
 5990|     82|    return false;
 5991|     82|  }
 5992|       |  // We verify this next step as part of the mapping:
 5993|       |  // ---------------------------------------------
 5994|       |  // Each code point in the label must only have certain status values
 5995|       |  // according to Section 5, IDNA Mapping Table:
 5996|       |  // - For Transitional Processing, each value must be valid.
 5997|       |  // - For Nontransitional Processing, each value must be either valid or
 5998|       |  // deviation.
 5999|       |
 6000|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6001|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6002|       |  // Applications (IDNA) [IDNA2008].
 6003|  4.52k|  constexpr static uint32_t virama[] = {
 6004|  4.52k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 6005|  4.52k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 6006|  4.52k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 6007|  4.52k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 6008|  4.52k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 6009|  4.52k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 6010|  4.52k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6011|  4.52k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6012|  4.52k|  constexpr static uint32_t R[] = {
 6013|  4.52k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6014|  4.52k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6015|  4.52k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6016|  4.52k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6017|  4.52k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6018|  4.52k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6019|  4.52k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6020|  4.52k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6021|  4.52k|  constexpr static uint32_t L[] = {0xa872};
 6022|  4.52k|  constexpr static uint32_t D[] = {
 6023|  4.52k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6024|  4.52k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6025|  4.52k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6026|  4.52k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6027|  4.52k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6028|  4.52k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6029|  4.52k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6030|  4.52k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6031|  4.52k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6032|  4.52k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6033|  4.52k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6034|  4.52k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6035|  4.52k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6036|  4.52k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6037|  4.52k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6038|  4.52k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6039|  4.52k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6040|  4.52k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6041|  4.52k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6042|  4.52k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6043|  4.52k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6044|  4.52k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6045|  4.52k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6046|  4.52k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6047|  4.52k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6048|  4.52k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6049|  4.52k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6050|  4.52k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6051|  4.52k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6052|  4.52k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6053|  4.52k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6054|  4.52k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6055|  4.52k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6056|  4.52k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6057|  4.52k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6058|  4.52k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6059|  4.52k|      0xa870, 0xa871};
 6060|       |
 6061|  47.6k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6061:22): [True: 43.5k, False: 4.04k]
  ------------------
 6062|  43.5k|    uint32_t c = label[i];
 6063|  43.5k|    if (c == 0x200c) {
  ------------------
  |  Branch (6063:9): [True: 369, False: 43.2k]
  ------------------
 6064|    369|      if (i > 0) {
  ------------------
  |  Branch (6064:11): [True: 367, False: 2]
  ------------------
 6065|    367|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6065:13): [True: 19, False: 348]
  ------------------
 6066|     19|          return true;
 6067|     19|        }
 6068|    367|      }
 6069|    350|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6069:11): [True: 2, False: 348]
  |  Branch (6069:23): [True: 36, False: 312]
  ------------------
 6070|     38|        return false;
 6071|     38|      }
 6072|       |      // we go backward looking for L or D
 6073|    312|      auto is_l_or_d = [](uint32_t code) {
 6074|    312|        return std::ranges::binary_search(L, code) ||
 6075|    312|               std::ranges::binary_search(D, code);
 6076|    312|      };
 6077|    312|      auto is_r_or_d = [](uint32_t code) {
 6078|    312|        return std::ranges::binary_search(R, code) ||
 6079|    312|               std::ranges::binary_search(D, code);
 6080|    312|      };
 6081|    312|      std::u32string_view before = label.substr(0, i);
 6082|    312|      std::u32string_view after = label.substr(i + 1);
 6083|    312|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6083:14): [True: 264, False: 48]
  ------------------
 6084|    312|              before.end()) &&
 6085|    264|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6085:14): [True: 181, False: 83]
  ------------------
 6086|    264|              after.end());
 6087|  43.2k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6087:16): [True: 116, False: 43.0k]
  ------------------
 6088|    116|      if (i > 0) {
  ------------------
  |  Branch (6088:11): [True: 112, False: 4]
  ------------------
 6089|    112|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6089:13): [True: 80, False: 32]
  ------------------
 6090|     80|          return true;
 6091|     80|        }
 6092|    112|      }
 6093|     36|      return false;
 6094|    116|    }
 6095|  43.5k|  }
 6096|       |
 6097|       |  // If CheckBidi, and if the domain name is a  Bidi domain name, then the label
 6098|       |  // must satisfy all six of the numbered conditions in [IDNA2008] RFC 5893,
 6099|       |  // Section 2.
 6100|       |
 6101|       |  // The following rule, consisting of six conditions, applies to labels
 6102|       |  // in Bidi domain names.  The requirements that this rule satisfies are
 6103|       |  // described in Section 3.  All of the conditions must be satisfied for
 6104|       |  // the rule to be satisfied.
 6105|       |  //
 6106|       |  //  1.  The first character must be a character with Bidi property L, R,
 6107|       |  //     or AL.  If it has the R or AL property, it is an RTL label; if it
 6108|       |  //     has the L property, it is an LTR label.
 6109|       |  //
 6110|       |  //  2.  In an RTL label, only characters with the Bidi properties R, AL,
 6111|       |  //      AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
 6112|       |  //
 6113|       |  //   3.  In an RTL label, the end of the label must be a character with
 6114|       |  //       Bidi property R, AL, EN, or AN, followed by zero or more
 6115|       |  //       characters with Bidi property NSM.
 6116|       |  //
 6117|       |  //   4.  In an RTL label, if an EN is present, no AN may be present, and
 6118|       |  //       vice versa.
 6119|       |  //
 6120|       |  //  5.  In an LTR label, only characters with the Bidi properties L, EN,
 6121|       |  //       ES, CS, ET, ON, BN, or NSM are allowed.
 6122|       |  //
 6123|       |  //   6.  In an LTR label, the end of the label must be a character with
 6124|       |  //       Bidi property L or EN, followed by zero or more characters with
 6125|       |  //       Bidi property NSM.
 6126|       |
 6127|  4.04k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6128|  4.04k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6128:7): [True: 0, False: 4.04k]
  ------------------
 6129|      0|    return false;
 6130|      0|  }
 6131|       |
 6132|       |  // A "Bidi domain name" is a domain name that contains at least one RTL label.
 6133|       |  // The following rule, consisting of six conditions, applies to labels in Bidi
 6134|       |  // domain names.
 6135|  4.04k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6135:7): [True: 1.01k, False: 3.02k]
  ------------------
 6136|       |    // The first character must be a character with Bidi property L, R,
 6137|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6138|       |    // has the L property, it is an LTR label.
 6139|       |
 6140|  1.01k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6140:9): [True: 135, False: 884]
  ------------------
 6141|       |      // Eval as LTR
 6142|       |
 6143|       |      // In an LTR label, only characters with the Bidi properties L, EN,
 6144|       |      // ES, CS, ET, ON, BN, or NSM are allowed.
 6145|  1.54k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6145:26): [True: 1.54k, False: 0]
  ------------------
 6146|  1.54k|        const direction d = find_direction(label[i]);
 6147|  1.54k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6147:15): [True: 627, False: 920]
  |  Branch (6147:36): [True: 167, False: 753]
  |  Branch (6147:58): [True: 80, False: 673]
  ------------------
 6148|    673|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6148:15): [True: 113, False: 560]
  |  Branch (6148:37): [True: 74, False: 486]
  |  Branch (6148:59): [True: 103, False: 383]
  ------------------
 6149|    383|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6149:15): [True: 180, False: 203]
  |  Branch (6149:37): [True: 68, False: 135]
  ------------------
 6150|    135|          return false;
 6151|    135|        }
 6152|  1.54k|      }
 6153|       |
 6154|      0|      const direction last_dir = find_direction(label[last_non_nsm_char]);
 6155|      0|      if (!(last_dir == direction::L || last_dir == direction::EN)) {
  ------------------
  |  Branch (6155:13): [True: 0, False: 0]
  |  Branch (6155:41): [True: 0, False: 0]
  ------------------
 6156|      0|        return false;
 6157|      0|      }
 6158|       |
 6159|      0|      return true;
 6160|       |
 6161|    884|    } else {
 6162|       |      // Eval as RTL
 6163|       |
 6164|       |      // The first character must be R or AL; a leading AN (or any other
 6165|       |      // direction) does not start a valid RTL label.
 6166|    884|      const direction first_dir = find_direction(label[0]);
 6167|    884|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6167:11): [True: 589, False: 295]
  |  Branch (6167:40): [True: 43, False: 546]
  ------------------
 6168|     43|        return false;
 6169|     43|      }
 6170|       |
 6171|    841|      bool has_an = false;
 6172|    841|      bool has_en = false;
 6173|  3.97k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6173:26): [True: 3.25k, False: 723]
  ------------------
 6174|  3.25k|        const direction d = find_direction(label[i]);
 6175|       |
 6176|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6177|       |        // versa.
 6178|  3.25k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6178:14): [True: 176, False: 3.07k]
  |  Branch (6178:37): [True: 176, False: 0]
  |  Branch (6178:56): [True: 1, False: 175]
  ------------------
 6179|  3.25k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6179:14): [True: 116, False: 3.13k]
  |  Branch (6179:37): [True: 116, False: 0]
  |  Branch (6179:56): [True: 1, False: 115]
  ------------------
 6180|      2|          return false;
 6181|      2|        }
 6182|       |
 6183|  3.25k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6183:15): [True: 487, False: 2.76k]
  |  Branch (6183:36): [True: 1.70k, False: 1.06k]
  |  Branch (6183:58): [True: 115, False: 950]
  ------------------
 6184|    950|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6184:15): [True: 175, False: 775]
  |  Branch (6184:37): [True: 75, False: 700]
  |  Branch (6184:59): [True: 84, False: 616]
  ------------------
 6185|    616|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6185:15): [True: 81, False: 535]
  |  Branch (6185:37): [True: 169, False: 366]
  |  Branch (6185:59): [True: 165, False: 201]
  ------------------
 6186|    201|              d == direction::NSM)) {
  ------------------
  |  Branch (6186:15): [True: 136, False: 65]
  ------------------
 6187|     65|          return false;
 6188|     65|        }
 6189|       |
 6190|  3.18k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6190:13): [True: 774, False: 2.41k]
  ------------------
 6191|    774|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6191:15): [True: 230, False: 544]
  |  Branch (6191:36): [True: 393, False: 151]
  |  Branch (6191:58): [True: 42, False: 109]
  ------------------
 6192|    109|              d == direction::EN)) {
  ------------------
  |  Branch (6192:15): [True: 58, False: 51]
  ------------------
 6193|     51|          return false;
 6194|     51|        }
 6195|  3.18k|      }
 6196|       |
 6197|    723|      return true;
 6198|    841|    }
 6199|  1.01k|  }
 6200|       |
 6201|  3.02k|  return true;
 6202|  4.04k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6359|  2.76k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6360|  2.76k|  out.clear();
 6361|  2.76k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6361:7): [True: 0, False: 2.76k]
  ------------------
 6362|      0|    return false;
 6363|      0|  }
 6364|  2.76k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6364:7): [True: 149, False: 2.61k]
  ------------------
 6365|    149|    from_ascii_to_ascii(ut8_string, out);
 6366|    149|    return true;
 6367|    149|  }
 6368|       |
 6369|       |#ifdef ADA_USE_SIMDUTF
 6370|       |  size_t utf32_length =
 6371|       |      simdutf::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6372|       |  if (utf32_length == 0 && !ut8_string.empty()) {
 6373|       |    return false;
 6374|       |  }
 6375|       |  std::u32string working(utf32_length, U'\0');
 6376|       |  size_t actual_utf32_length = simdutf::convert_utf8_to_utf32(
 6377|       |      ut8_string.data(), ut8_string.size(), working.data());
 6378|       |#else
 6379|  2.61k|  size_t utf32_length =
 6380|  2.61k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6381|  2.61k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6381:7): [True: 5, False: 2.61k]
  |  Branch (6381:28): [True: 5, False: 0]
  ------------------
 6382|      5|    return false;
 6383|      5|  }
 6384|  2.61k|  std::u32string working(utf32_length, U'\0');
 6385|  2.61k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6386|  2.61k|      ut8_string.data(), ut8_string.size(), working.data());
 6387|  2.61k|#endif
 6388|  2.61k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6388:7): [True: 163, False: 2.45k]
  |  Branch (6388:35): [True: 0, False: 2.45k]
  ------------------
 6389|    163|    return false;
 6390|    163|  }
 6391|  2.45k|  working.resize(actual_utf32_length);
 6392|       |
 6393|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6394|  2.45k|  std::u32string mapped;
 6395|  2.45k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6395:7): [True: 36, False: 2.41k]
  ------------------
 6396|     36|    return false;
 6397|     36|  }
 6398|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6399|  2.41k|  working.clear();
 6400|       |
 6401|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6402|  2.41k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6402:7): [True: 1.95k, False: 456]
  |  Branch (6402:28): [True: 437, False: 1.52k]
  ------------------
 6403|    437|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6403:9): [True: 0, False: 437]
  ------------------
 6404|      0|      return false;
 6405|      0|    }
 6406|    437|  }
 6407|       |
 6408|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6409|  2.41k|  out.reserve(mapped.size() + 8);
 6410|       |
 6411|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6412|  2.41k|  const char32_t* p = mapped.data();
 6413|  2.41k|  const char32_t* const end = p + mapped.size();
 6414|  2.41k|  std::u32string post_map;
 6415|       |
 6416|  8.12k|  while (p < end) {
  ------------------
  |  Branch (6416:10): [True: 6.69k, False: 1.42k]
  ------------------
 6417|  6.69k|    const char32_t* label_begin = p;
 6418|  73.3k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6418:12): [True: 71.9k, False: 1.40k]
  |  Branch (6418:23): [True: 66.6k, False: 5.28k]
  ------------------
 6419|  66.6k|      ++p;
 6420|  66.6k|    }
 6421|  6.69k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6422|  6.69k|    std::u32string_view label_view(label_begin, label_size);
 6423|  6.69k|    const bool is_last_label = (p == end);
 6424|  6.69k|    if (p < end) {
  ------------------
  |  Branch (6424:9): [True: 5.28k, False: 1.40k]
  ------------------
 6425|  5.28k|      ++p;  // skip dot
 6426|  5.28k|    }
 6427|       |
 6428|  6.69k|    if (label_size == 0) {
  ------------------
  |  Branch (6428:9): [True: 187, False: 6.50k]
  ------------------
 6429|       |      // empty label
 6430|  6.50k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6430:16): [True: 1.21k, False: 5.29k]
  ------------------
 6431|  19.3k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6431:23): [True: 19.3k, False: 1.20k]
  ------------------
 6432|  19.3k|        if (c >= 0x80) {
  ------------------
  |  Branch (6432:13): [True: 13, False: 19.3k]
  ------------------
 6433|     13|          out.clear();
 6434|     13|          return false;
 6435|     13|        }
 6436|  19.3k|      }
 6437|  1.20k|      append_ascii_label(out, label_view);
 6438|  1.20k|      std::string_view puny_segment_ascii(
 6439|  1.20k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6440|  1.20k|      working.clear();
 6441|  1.20k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6441:11): [True: 85, False: 1.11k]
  ------------------
 6442|     85|        out.clear();
 6443|     85|        return false;
 6444|     85|      }
 6445|  1.11k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6445:11): [True: 47, False: 1.06k]
  ------------------
 6446|     47|        out.clear();
 6447|     47|        return false;
 6448|     47|      }
 6449|  1.06k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6449:11): [True: 158, False: 911]
  |  Branch (6449:49): [True: 35, False: 876]
  ------------------
 6450|    193|        out.clear();
 6451|    193|        return false;
 6452|    193|      }
 6453|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6454|    876|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6454:11): [True: 876, False: 0]
  |  Branch (6454:34): [True: 485, False: 391]
  ------------------
 6455|    485|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6455:13): [True: 0, False: 485]
  |  Branch (6455:37): [True: 65, False: 420]
  ------------------
 6456|     65|          out.clear();
 6457|     65|          return false;
 6458|     65|        }
 6459|    485|      }
 6460|    811|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6460:11): [True: 0, False: 811]
  |  Branch (6460:31): [True: 18, False: 793]
  ------------------
 6461|     18|        out.clear();
 6462|     18|        return false;
 6463|     18|      }
 6464|  5.29k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6464:16): [True: 1.49k, False: 3.79k]
  ------------------
 6465|  1.49k|      append_ascii_label(out, label_view);
 6466|  3.79k|    } else {
 6467|  3.79k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6467:11): [True: 565, False: 3.23k]
  ------------------
 6468|    565|        out.clear();
 6469|    565|        return false;
 6470|    565|      }
 6471|  3.23k|      out.append("xn--");
 6472|  3.23k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6472:11): [True: 0, False: 3.23k]
  ------------------
 6473|      0|        out.clear();
 6474|      0|        return false;
 6475|      0|      }
 6476|  3.23k|    }
 6477|  5.70k|    if (!is_last_label) {
  ------------------
  |  Branch (6477:9): [True: 4.31k, False: 1.39k]
  ------------------
 6478|  4.31k|      out.push_back('.');
 6479|  4.31k|    }
 6480|  5.70k|  }
 6481|  1.42k|  return true;
 6482|  2.41k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6484|  2.76k|std::string to_ascii(std::string_view ut8_string) {
 6485|  2.76k|  std::string out;
 6486|  2.76k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6486:7): [True: 1.19k, False: 1.57k]
  ------------------
 6487|  1.19k|    return {};
 6488|  1.19k|  }
 6489|  1.57k|  return out;
 6490|  2.76k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  42.6k|                    std::string& out) {
 7356|  42.6k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  42.6k|          append ? "appending" : "overwriting");
 7358|  42.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  42.6k|    return character_sets::bit_at(character_set, c);
 7360|  42.6k|  });
 7361|  42.6k|  ada_log("percent_encode done checking, moved to ",
 7362|  42.6k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  42.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 40.3k, False: 2.26k]
  ------------------
 7366|  40.3k|    ada_log("percent_encode encoding not needed.");
 7367|  40.3k|    return false;
 7368|  40.3k|  }
 7369|       |  if constexpr (!append) {
 7370|       |    out.clear();
 7371|       |  }
 7372|  2.26k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|  2.26k|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|  2.26k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|  2.26k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|  2.26k|          " bytes");
 7378|  57.6k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 55.3k, False: 2.26k]
  ------------------
 7379|  55.3k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 27.2k, False: 28.1k]
  ------------------
 7380|  27.2k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  28.1k|    } else {
 7382|  28.1k|      out += *pointer;
 7383|  28.1k|    }
 7384|  55.3k|  }
 7385|  2.26k|  return true;
 7386|  42.6k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  45.5k|                    std::string& out) {
 7356|  45.5k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  45.5k|          append ? "appending" : "overwriting");
 7358|  45.5k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  45.5k|    return character_sets::bit_at(character_set, c);
 7360|  45.5k|  });
 7361|  45.5k|  ada_log("percent_encode done checking, moved to ",
 7362|  45.5k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  45.5k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 42.2k, False: 3.26k]
  ------------------
 7366|  42.2k|    ada_log("percent_encode encoding not needed.");
 7367|  42.2k|    return false;
 7368|  42.2k|  }
 7369|  3.26k|  if constexpr (!append) {
 7370|  3.26k|    out.clear();
 7371|  3.26k|  }
 7372|  3.26k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|  3.26k|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|  3.26k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|  3.26k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|  3.26k|          " bytes");
 7378|  63.9k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 60.7k, False: 3.26k]
  ------------------
 7379|  60.7k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 32.7k, False: 27.9k]
  ------------------
 7380|  32.7k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  32.7k|    } else {
 7382|  27.9k|      out += *pointer;
 7383|  27.9k|    }
 7384|  60.7k|  }
 7385|  3.26k|  return true;
 7386|  45.5k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7186|  1.05k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7187|       |  // next line is for safety only, we expect users to avoid calling
 7188|       |  // percent_decode when first_percent is outside the range.
 7189|  1.05k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7189:7): [True: 0, False: 1.05k]
  ------------------
 7190|      0|    return std::string(input);
 7191|      0|  }
 7192|       |
 7193|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7194|  1.05k|  const char* const src = input.data();
 7195|  1.05k|  const char* const end = src + input.size();
 7196|       |
 7197|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7198|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7199|       |  // byte-at-a-time appends of the naive version.
 7200|  1.05k|  std::string out(input.size(), '\0');
 7201|  1.05k|  char* d = out.data();
 7202|  1.05k|  char* const d0 = d;
 7203|       |
 7204|  1.05k|  std::memcpy(d, src, first_percent);
 7205|  1.05k|  d += first_percent;
 7206|       |
 7207|  1.05k|  const char* p = src + first_percent;
 7208|  6.54k|  while (p < end) {
  ------------------
  |  Branch (7208:10): [True: 5.49k, False: 1.05k]
  ------------------
 7209|  5.49k|    if (*p == '%') {
  ------------------
  |  Branch (7209:9): [True: 3.39k, False: 2.09k]
  ------------------
 7210|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7211|  8.40k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7211:14): [True: 7.84k, False: 558]
  |  Branch (7211:29): [True: 7.00k, False: 840]
  ------------------
 7212|  7.00k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7212:13): [True: 1.16k, False: 5.84k]
  |  Branch (7212:42): [True: 834, False: 5.00k]
  ------------------
 7213|  2.00k|          break;
 7214|  2.00k|        }
 7215|  5.00k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7216|  5.00k|                                 convert_hex_to_binary(p[2]));
 7217|  5.00k|        p += 3;
 7218|  5.00k|      }
 7219|  3.39k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7219:11): [True: 3.12k, False: 274]
  |  Branch (7219:22): [True: 2.16k, False: 962]
  ------------------
 7220|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7221|       |        // literally and keep scanning after it.
 7222|  2.16k|        *d++ = *p++;
 7223|  2.16k|      }
 7224|  3.39k|    } else {
 7225|  2.09k|      const char* q = static_cast<const char*>(
 7226|  2.09k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7227|  2.09k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7227:29): [True: 1.41k, False: 679]
  ------------------
 7228|  2.09k|      const size_t n = static_cast<size_t>(run_end - p);
 7229|  2.09k|      std::memcpy(d, p, n);
 7230|  2.09k|      d += n;
 7231|  2.09k|      p = run_end;
 7232|  2.09k|    }
 7233|  5.49k|  }
 7234|       |
 7235|  1.05k|  out.resize(static_cast<size_t>(d - d0));
 7236|  1.05k|  return out;
 7237|  1.05k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7325|  50.4k|                           const uint8_t character_set[]) {
 7326|  50.4k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|  50.4k|    return character_sets::bit_at(character_set, c);
 7328|  50.4k|  });
 7329|       |  // Optimization: Don't iterate if percent encode is not required
 7330|  50.4k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7330:7): [True: 47.7k, False: 2.72k]
  ------------------
 7331|  47.7k|    return std::string(input);
 7332|  47.7k|  }
 7333|       |
 7334|  2.72k|  std::string result;
 7335|  2.72k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7336|       |                                   // produce 3 characters.
 7337|  2.72k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7338|  2.72k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7338:7): [True: 564, False: 2.16k]
  ------------------
 7339|    564|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7340|    564|                          result);
 7341|  2.16k|  } else {
 7342|  27.4k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7342:12): [True: 25.3k, False: 2.16k]
  ------------------
 7343|  25.3k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7343:11): [True: 12.8k, False: 12.5k]
  ------------------
 7344|  12.8k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7345|  12.8k|      } else {
 7346|  12.5k|        result += *pointer;
 7347|  12.5k|      }
 7348|  25.3k|    }
 7349|  2.16k|  }
 7350|  2.72k|  return result;
 7351|  50.4k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7396|  2.76k|              size_t first_percent) {
 7397|  2.76k|  std::string percent_decoded_buffer;
 7398|  2.76k|  std::string_view input = plain;
 7399|  2.76k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7399:7): [True: 119, False: 2.64k]
  ------------------
 7400|    119|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7401|    119|    input = percent_decoded_buffer;
 7402|    119|  }
 7403|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7404|  2.76k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7405|  2.76k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7405:7): [True: 1.19k, False: 1.57k]
  |  Branch (7405:29): [True: 232, False: 1.34k]
  ------------------
 7406|  1.57k|                                idna_ascii.data(), idna_ascii.size())) {
 7407|  1.42k|    return false;
 7408|  1.42k|  }
 7409|  1.34k|  out = std::move(idna_ascii);
 7410|  1.34k|  return true;
 7411|  2.76k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7414|  41.7k|                           const uint8_t character_set[], size_t index) {
 7415|  41.7k|  std::string out;
 7416|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7417|  41.7k|  out.append(input.data(), index);
 7418|  41.7k|  auto pointer = input.begin() + index;
 7419|  41.7k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7419:7): [True: 836, False: 40.9k]
  ------------------
 7420|    836|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7421|    836|                          out);
 7422|  40.9k|  } else {
 7423|  58.1k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7423:12): [True: 17.2k, False: 40.9k]
  ------------------
 7424|  17.2k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7424:11): [True: 6.34k, False: 10.8k]
  ------------------
 7425|  6.34k|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7426|  10.8k|      } else {
 7427|  10.8k|        out += *pointer;
 7428|  10.8k|      }
 7429|  17.2k|    }
 7430|  40.9k|  }
 7431|  41.7k|  return out;
 7432|  41.7k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7726|  1.40k|                           const uint8_t character_set[], std::string& out) {
 7727|  1.40k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7728|  1.40k|  if (static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (7728:7): [True: 1.40k, False: 0]
  ------------------
 7729|  1.40k|    percent_encode_to_wide(p, end, character_set, out);
 7730|  1.40k|    return;
 7731|  1.40k|  }
 7732|      0|#endif
 7733|      0|  percent_encode_to_scalar(p, end, character_set, out);
 7734|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7799|  13.9k|    size_t& compress_length) noexcept {
 7800|  13.9k|  compress = 0;
 7801|  13.9k|  compress_length = 0;
 7802|  13.9k|  size_t i = 0;
 7803|   119k|  while (i < 8) {
  ------------------
  |  Branch (7803:10): [True: 105k, False: 13.9k]
  ------------------
 7804|   105k|    if (address[i] != 0) {
  ------------------
  |  Branch (7804:9): [True: 100k, False: 4.64k]
  ------------------
 7805|   100k|      ++i;
 7806|   100k|      continue;
 7807|   100k|    }
 7808|  4.64k|    size_t next = i + 1;
 7809|  10.8k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7809:12): [True: 10.0k, False: 786]
  |  Branch (7809:24): [True: 6.16k, False: 3.86k]
  ------------------
 7810|  6.16k|      ++next;
 7811|  6.16k|    }
 7812|  4.64k|    const size_t count = next - i;
 7813|  4.64k|    if (count > compress_length) {
  ------------------
  |  Branch (7813:9): [True: 4.15k, False: 489]
  ------------------
 7814|  4.15k|      compress_length = count;
 7815|  4.15k|      compress = i;
 7816|  4.15k|    }
 7817|  4.64k|    i = next;
 7818|  4.64k|  }
 7819|  13.9k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7821|  6.98k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7822|  6.98k|  size_t compress = 0;
 7823|  6.98k|  size_t compress_length = 0;
 7824|  6.98k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7825|       |
 7826|       |  // Skip compression when the longest zero run is a single piece.
 7827|  6.98k|  if (compress_length <= 1) {
  ------------------
  |  Branch (7827:7): [True: 5.94k, False: 1.04k]
  ------------------
 7828|  5.94k|    compress = compress_length = 8;
 7829|  5.94k|  }
 7830|       |
 7831|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7832|  6.98k|  std::string output(4 * 8 + 7 + 2, '\0');
 7833|  6.98k|  char* point = output.data();
 7834|  6.98k|  *point++ = '[';
 7835|  6.98k|  size_t piece_index = 0;
 7836|  52.1k|  while (true) {
  ------------------
  |  Branch (7836:10): [True: 52.1k, Folded]
  ------------------
 7837|  52.1k|    if (piece_index == compress) {
  ------------------
  |  Branch (7837:9): [True: 1.04k, False: 51.0k]
  ------------------
 7838|  1.04k|      *point++ = ':';
 7839|       |      // If we skip a value initially, we need to write '::'.
 7840|  1.04k|      if (piece_index == 0) {
  ------------------
  |  Branch (7840:11): [True: 405, False: 635]
  ------------------
 7841|    405|        *point++ = ':';
 7842|    405|      }
 7843|  1.04k|      piece_index += compress_length;
 7844|  1.04k|      if (piece_index == 8) {
  ------------------
  |  Branch (7844:11): [True: 334, False: 706]
  ------------------
 7845|    334|        break;
 7846|    334|      }
 7847|  1.04k|    }
 7848|  51.7k|    point = write_hex_u16(point, address[piece_index]);
 7849|  51.7k|    ++piece_index;
 7850|  51.7k|    if (piece_index == 8) {
  ------------------
  |  Branch (7850:9): [True: 6.65k, False: 45.1k]
  ------------------
 7851|  6.65k|      break;
 7852|  6.65k|    }
 7853|  45.1k|    *point++ = ':';
 7854|  45.1k|  }
 7855|  6.98k|  *point++ = ']';
 7856|  6.98k|  output.resize(static_cast<size_t>(point - output.data()));
 7857|  6.98k|  return output;
 7858|  6.98k|}
_ZN3ada11serializers4ipv4Em:
 7860|  7.74k|std::string ipv4(const uint64_t address) {
 7861|  7.74k|  std::string output(15, '\0');
 7862|  7.74k|  char* point = output.data();
 7863|  7.74k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7864|  7.74k|  *point++ = '.';
 7865|  7.74k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7866|  7.74k|  *point++ = '.';
 7867|  7.74k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7868|  7.74k|  *point++ = '.';
 7869|  7.74k|  point = write_u8(point, static_cast<uint8_t>(address));
 7870|  7.74k|  output.resize(static_cast<size_t>(point - output.data()));
 7871|  7.74k|  return output;
 7872|  7.74k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8274|  13.1k|    std::string_view input, const result_type* base_url) {
 8275|  13.1k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8276|  13.1k|  if (!u.is_valid) {
  ------------------
  |  Branch (8276:7): [True: 10.7k, False: 2.37k]
  ------------------
 8277|  10.7k|    return tl::unexpected(errors::type_error);
 8278|  10.7k|  }
 8279|  2.37k|  return u;
 8280|  13.1k|}
_ZN3ada20get_max_input_lengthEv:
 7895|  13.1k|uint32_t get_max_input_length() {
 7896|  13.1k|  return max_input_length_.load(std::memory_order_relaxed);
 7897|  13.1k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9254|  11.9k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9255|  11.9k|  while (!input.empty() &&
  ------------------
  |  Branch (9255:10): [True: 11.9k, False: 0]
  ------------------
 9256|  11.9k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9256:10): [True: 0, False: 11.9k]
  ------------------
 9257|      0|    input.remove_prefix(1);
 9258|      0|  }
 9259|  11.9k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9259:10): [True: 11.9k, False: 0]
  |  Branch (9259:28): [True: 0, False: 11.9k]
  ------------------
 9260|      0|    input.remove_suffix(1);
 9261|      0|  }
 9262|  11.9k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9429|      6|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9430|      6|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9431|      6|          input1.size(), " bytes] is part of string '", input2, "' [",
 9432|      6|          input2.size(), " bytes]");
 9433|      6|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9433:10): [True: 6, False: 0]
  |  Branch (9433:29): [True: 6, False: 0]
  |  Branch (9433:48): [True: 6, False: 0]
  ------------------
 9434|      6|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9434:10): [True: 0, False: 6]
  ------------------
 9435|      6|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11957|  4.56k|                                                result_type& out) {
11958|  4.56k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11959|  4.56k|  constexpr bool is_aggregator =
11960|  4.56k|      std::is_same_v<result_type, ada::url_aggregator>;
11961|  4.56k|  static_assert(is_ada_url || is_aggregator);
11962|       |
11963|  4.56k|  const size_t len = input.size();
11964|       |  // Shortest accepted form is "ws://x" (6).
11965|  4.56k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11965:7): [True: 0, False: 4.56k]
  ------------------
11966|      0|    return false;
11967|      0|  }
11968|  4.56k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11969|       |
11970|  4.56k|  size_t pos = 0;
11971|  4.56k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11972|  4.56k|  uint32_t protocol_end = 0;
11973|  4.56k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11974|  4.56k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11975|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11976|       |  // Masked compares cover the shorter special schemes without extra loads.
11977|  4.56k|  if (len >= 8) {
  ------------------
  |  Branch (11977:7): [True: 4.56k, False: 0]
  ------------------
11978|  4.56k|    uint64_t first8 = 0;
11979|  4.56k|    std::memcpy(&first8, b, 8);
11980|  4.56k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11980:9): [True: 0, False: 4.56k]
  ------------------
11981|      0|      pos = 8;
11982|      0|      scheme_type = ada::scheme::type::HTTPS;
11983|      0|      protocol_end = 6;
11984|  4.56k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11984:16): [True: 4.56k, False: 0]
  ------------------
11985|  4.56k|               0x002f2f3a70747468ull) {  // "http://"
11986|  4.56k|      pos = 7;
11987|  4.56k|      scheme_type = ada::scheme::type::HTTP;
11988|  4.56k|      protocol_end = 5;
11989|  4.56k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11989:16): [True: 0, False: 0]
  ------------------
11990|      0|               0x00002f2f3a737377ull) {  // "wss://"
11991|      0|      pos = 6;
11992|      0|      scheme_type = ada::scheme::type::WSS;
11993|      0|      protocol_end = 4;
11994|      0|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11994:16): [True: 0, False: 0]
  ------------------
11995|      0|               0x00002f2f3a707466ull) {  // "ftp://"
11996|      0|      pos = 6;
11997|      0|      scheme_type = ada::scheme::type::FTP;
11998|      0|      protocol_end = 4;
11999|      0|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11999:16): [True: 0, False: 0]
  ------------------
12000|      0|               0x0000002f2f3a7377ull) {  // "ws://"
12001|      0|      pos = 5;
12002|      0|      scheme_type = ada::scheme::type::WS;
12003|      0|      protocol_end = 3;
12004|      0|    } else {
12005|      0|      return false;
12006|      0|    }
12007|  4.56k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12007:14): [True: 0, False: 0]
  |  Branch (12007:29): [True: 0, False: 0]
  ------------------
12008|      0|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12008:9): [True: 0, False: 0]
  |  Branch (12008:24): [True: 0, False: 0]
  |  Branch (12008:39): [True: 0, False: 0]
  ------------------
12009|      0|      pos = 5;
12010|      0|      scheme_type = ada::scheme::type::WS;
12011|      0|      protocol_end = 3;
12012|      0|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12012:16): [True: 0, False: 0]
  |  Branch (12012:31): [True: 0, False: 0]
  |  Branch (12012:46): [True: 0, False: 0]
  |  Branch (12012:61): [True: 0, False: 0]
  ------------------
12013|      0|      pos = 6;
12014|      0|      scheme_type = ada::scheme::type::WSS;
12015|      0|      protocol_end = 4;
12016|      0|    } else {
12017|      0|      return false;
12018|      0|    }
12019|      0|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12019:14): [True: 0, False: 0]
  |  Branch (12019:29): [True: 0, False: 0]
  |  Branch (12019:44): [True: 0, False: 0]
  |  Branch (12019:59): [True: 0, False: 0]
  ------------------
12020|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12020:14): [True: 0, False: 0]
  |  Branch (12020:29): [True: 0, False: 0]
  ------------------
12021|      0|    pos = 6;
12022|      0|    scheme_type = ada::scheme::type::FTP;
12023|      0|    protocol_end = 4;
12024|      0|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12024:14): [True: 0, False: 0]
  |  Branch (12024:26): [True: 0, False: 0]
  |  Branch (12024:41): [True: 0, False: 0]
  |  Branch (12024:56): [True: 0, False: 0]
  ------------------
12025|      0|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12025:14): [True: 0, False: 0]
  |  Branch (12025:29): [True: 0, False: 0]
  |  Branch (12025:44): [True: 0, False: 0]
  |  Branch (12025:59): [True: 0, False: 0]
  ------------------
12026|      0|    pos = 7;
12027|      0|    scheme_type = ada::scheme::type::HTTP;
12028|      0|    protocol_end = 5;
12029|      0|  } else {
12030|      0|    return false;
12031|      0|  }
12032|       |#else
12033|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12034|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12035|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12036|       |    pos = 8;
12037|       |    scheme_type = ada::scheme::type::HTTPS;
12038|       |    protocol_end = 6;
12039|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12040|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12041|       |    pos = 7;
12042|       |    scheme_type = ada::scheme::type::HTTP;
12043|       |    protocol_end = 5;
12044|       |  } else if (b[0] == 'w' && b[1] == 's') {
12045|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12046|       |      pos = 5;
12047|       |      scheme_type = ada::scheme::type::WS;
12048|       |      protocol_end = 3;
12049|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12050|       |               b[5] == '/') {
12051|       |      pos = 6;
12052|       |      scheme_type = ada::scheme::type::WSS;
12053|       |      protocol_end = 4;
12054|       |    } else {
12055|       |      return false;
12056|       |    }
12057|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12058|       |             b[4] == '/' && b[5] == '/') {
12059|       |    pos = 6;
12060|       |    scheme_type = ada::scheme::type::FTP;
12061|       |    protocol_end = 4;
12062|       |  } else {
12063|       |    return false;
12064|       |  }
12065|       |#endif
12066|  4.56k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12066:7): [True: 4.56k, False: 0]
  |  Branch (12066:21): [True: 20, False: 4.54k]
  |  Branch (12066:38): [True: 5, False: 4.53k]
  ------------------
12067|     25|    return false;
12068|     25|  }
12069|       |
12070|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12071|  4.53k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12071:7): [True: 4.53k, False: 0]
  |  Branch (12071:22): [True: 3.66k, False: 873]
  |  Branch (12071:39): [True: 0, False: 3.66k]
  |  Branch (12071:57): [True: 0, False: 4.53k]
  ------------------
12072|      0|    return false;
12073|      0|  }
12074|       |
12075|  4.53k|  const size_t host_start = pos;
12076|  4.53k|  bool has_upper = false;
12077|  4.53k|  bool has_x = false;
12078|  4.53k|  size_t host_end = pos;
12079|  4.53k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12079:7): [True: 2.83k, False: 1.70k]
  ------------------
12080|  2.83k|    return false;
12081|  2.83k|  }
12082|  1.70k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12082:7): [True: 7, False: 1.69k]
  ------------------
12083|      7|    return false;
12084|      7|  }
12085|  1.69k|  const size_t host_len = host_end - host_start;
12086|  1.69k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12086:7): [True: 0, False: 1.69k]
  ------------------
12087|      0|    return false;
12088|      0|  }
12089|  1.69k|  {
12090|  1.69k|    std::string_view hv(input.data() + host_start, host_len);
12091|  1.69k|    char host_buf[256];
12092|  1.69k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12092:9): [True: 430, False: 1.26k]
  ------------------
12093|    430|      std::memcpy(host_buf, input.data() + host_start, host_len);
12094|    430|      unicode::to_lower_ascii(host_buf, host_len);
12095|    430|      hv = std::string_view(host_buf, host_len);
12096|    430|    }
12097|  1.69k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12097:9): [True: 263, False: 1.43k]
  ------------------
12098|    263|      return false;
12099|    263|    }
12100|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12101|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12102|  1.43k|    static constexpr std::string_view xn{"xn-", 3};
12103|  1.43k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12103:10): [True: 198, False: 1.23k]
  |  Branch (12103:19): [True: 230, False: 1.00k]
  |  Branch (12103:33): [True: 22, False: 406]
  ------------------
12104|     22|        [[unlikely]] {
12105|     22|      return false;
12106|     22|    }
12107|  1.43k|  }
12108|       |
12109|  1.41k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12109:7): [True: 1.41k, False: 0]
  |  Branch (12109:25): [True: 403, False: 1.01k]
  ------------------
12110|    403|    return finish_simple_absolute_with_port(input, out, scheme_type,
12111|    403|                                            protocol_end, host_start, host_end,
12112|    403|                                            host_len, has_upper);
12113|    403|  }
12114|       |
12115|  1.01k|  size_t i = host_end;
12116|  1.01k|  size_t path_start = host_end;
12117|  1.01k|  size_t path_end = host_end;
12118|  1.01k|  size_t query_start = std::string_view::npos;
12119|  1.01k|  size_t hash_start = std::string_view::npos;
12120|  1.01k|  bool has_path = false;
12121|  1.01k|  bool maybe_dot_segment = false;
12122|  1.01k|  bool rest_simple = true;
12123|       |
12124|  1.01k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12124:7): [True: 1.01k, False: 0]
  |  Branch (12124:18): [True: 811, False: 199]
  ------------------
12125|    811|    has_path = true;
12126|    811|    path_start = i;
12127|    811|    ++i;
12128|    811|    scan_path_run(b, i, len, maybe_dot_segment);
12129|    811|    if (i < len) {
  ------------------
  |  Branch (12129:9): [True: 595, False: 216]
  ------------------
12130|    595|      const uint8_t cls = k_path[b[i]];
12131|    595|      if (cls == 1) {
  ------------------
  |  Branch (12131:11): [True: 81, False: 514]
  ------------------
12132|     81|        path_end = i;
12133|     81|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 45, False: 36]
  ------------------
12134|     45|          query_start = i;
12135|     45|          ++i;
12136|     45|          goto scan_query;
12137|     45|        }
12138|     36|        hash_start = i;
12139|     36|        ++i;
12140|     36|        goto scan_hash;
12141|     81|      }
12142|    514|      rest_simple = false;
12143|  11.7k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12143:14): [True: 11.2k, False: 444]
  ------------------
12144|  11.2k|        if (b[i] == '?') {
  ------------------
  |  Branch (12144:13): [True: 50, False: 11.2k]
  ------------------
12145|     50|          path_end = i;
12146|     50|          query_start = i;
12147|     50|          ++i;
12148|     50|          goto scan_query_boundary;
12149|     50|        }
12150|  11.2k|        if (b[i] == '#') {
  ------------------
  |  Branch (12150:13): [True: 20, False: 11.2k]
  ------------------
12151|     20|          path_end = i;
12152|     20|          hash_start = i;
12153|     20|          ++i;
12154|     20|          goto after_rest;
12155|     20|        }
12156|  11.2k|      }
12157|    444|      path_end = i;
12158|    444|      goto after_rest;
12159|    514|    }
12160|    216|    path_end = i;
12161|    216|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12161:14): [True: 199, False: 0]
  |  Branch (12161:25): [True: 104, False: 95]
  ------------------
12162|    104|    query_start = i;
12163|    104|    ++i;
12164|    104|    goto scan_query;
12165|    104|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12165:14): [True: 95, False: 0]
  |  Branch (12165:25): [True: 95, False: 0]
  ------------------
12166|     95|    hash_start = i;
12167|     95|    ++i;
12168|     95|    goto scan_hash;
12169|     95|  }
12170|    216|  goto after_rest;
12171|       |
12172|    216|scan_query:
12173|    149|  scan_query_run(b, i, len);
12174|    149|  if (i < len) {
  ------------------
  |  Branch (12174:7): [True: 92, False: 57]
  ------------------
12175|     92|    if (b[i] == '#') {
  ------------------
  |  Branch (12175:9): [True: 17, False: 75]
  ------------------
12176|     17|      hash_start = i;
12177|     17|      ++i;
12178|     17|      goto scan_hash;
12179|     17|    }
12180|     75|    rest_simple = false;
12181|     75|    goto scan_query_boundary;
12182|     92|  }
12183|     57|  goto after_rest;
12184|       |
12185|    125|scan_query_boundary:
12186|  1.47k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12186:10): [True: 1.37k, False: 109]
  ------------------
12187|  1.37k|    if (b[i] == '#') {
  ------------------
  |  Branch (12187:9): [True: 16, False: 1.35k]
  ------------------
12188|     16|      hash_start = i;
12189|     16|      ++i;
12190|     16|      goto after_rest;
12191|     16|    }
12192|  1.37k|  }
12193|    109|  goto after_rest;
12194|       |
12195|    148|scan_hash:
12196|    148|  scan_hash_run(b, i, len);
12197|    148|  if (i < len) {
  ------------------
  |  Branch (12197:7): [True: 78, False: 70]
  ------------------
12198|     78|    rest_simple = false;
12199|     78|  }
12200|       |
12201|  1.01k|after_rest:
12202|  1.01k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12202:7): [True: 343, False: 667]
  |  Branch (12202:22): [True: 237, False: 106]
  ------------------
12203|    237|    const std::string_view path_body(input.data() + path_start,
12204|    237|                                     path_end - path_start);
12205|    237|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12205:9): [True: 144, False: 93]
  ------------------
12206|    144|      rest_simple = false;
12207|    144|    }
12208|    237|  }
12209|       |
12210|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12211|       |  // trailing C0 control or space; this fast path does neither. A query or
12212|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12213|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12214|       |  // inputs back to the slow path.
12215|  1.01k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12215:7): [True: 811, False: 199]
  |  Branch (12215:24): [True: 0, False: 811]
  ------------------
12216|    811|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12216:24): [True: 51, False: 760]
  ------------------
12217|     51|    return false;
12218|     51|  }
12219|       |
12220|    959|  out.type = scheme_type;
12221|    959|  out.is_valid = true;
12222|    959|  out.has_opaque_path = false;
12223|    959|  out.host_type = DEFAULT;
12224|       |
12225|    959|  if (!rest_simple) {
  ------------------
  |  Branch (12225:7): [True: 760, False: 199]
  ------------------
12226|       |    // Host is a plain domain. Finish path/query/hash with
12227|       |    // the regular helpers
12228|       |    // so percent-encoding and dot segments do not re-parse the authority.
12229|    760|    const std::string_view path_view =
12230|    760|        has_path
  ------------------
  |  Branch (12230:9): [True: 652, False: 108]
  ------------------
12231|    760|            ? std::string_view(input.data() + path_start, path_end - path_start)
12232|    760|            : std::string_view{};
12233|    760|    auto apply_query_and_hash = [&]() {
12234|    760|      if (query_start != std::string_view::npos) {
12235|    760|        const size_t q_end =
12236|    760|            (hash_start != std::string_view::npos) ? hash_start : len;
12237|    760|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|    760|                                                q_end - query_start - 1),
12239|    760|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|    760|      }
12241|    760|      if (hash_start != std::string_view::npos) {
12242|    760|        out.update_unencoded_base_hash(std::string_view(
12243|    760|            input.data() + hash_start + 1, len - hash_start - 1));
12244|    760|      }
12245|    760|    };
12246|    760|    if constexpr (is_aggregator) {
12247|    760|      out.buffer.assign(input.substr(0, host_end));
12248|    760|      if (has_upper) {
  ------------------
  |  Branch (12248:11): [True: 90, False: 670]
  ------------------
12249|     90|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12250|     90|      }
12251|    760|      out.components.protocol_end = protocol_end;
12252|    760|      out.components.username_end = protocol_end + 2;
12253|    760|      out.components.host_start = protocol_end + 2;
12254|    760|      out.components.host_end = static_cast<uint32_t>(host_end);
12255|    760|      out.components.port = url_components::omitted;
12256|    760|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12257|    760|      out.components.search_start = url_components::omitted;
12258|    760|      out.components.hash_start = url_components::omitted;
12259|    760|      out.parse_path(path_view);
12260|    760|      apply_query_and_hash();
12261|       |    } else {
12262|       |      std::string host_str(input.substr(host_start, host_len));
12263|       |      if (has_upper) {
12264|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12265|       |      }
12266|       |      out.host = std::move(host_str);
12267|       |      out.parse_path(path_view);
12268|       |      apply_query_and_hash();
12269|       |    }
12270|    760|    return true;
12271|    760|  }
12272|       |
12273|    199|  const bool need_slash = !has_path;
12274|    199|  if constexpr (is_aggregator) {
12275|    199|    if (!need_slash) {
  ------------------
  |  Branch (12275:9): [True: 137, False: 62]
  ------------------
12276|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12277|    137|      out.buffer.assign(input);
12278|    137|      if (has_upper) {
  ------------------
  |  Branch (12278:11): [True: 21, False: 116]
  ------------------
12279|     21|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12280|     21|      }
12281|    137|      out.components.protocol_end = protocol_end;
12282|    137|      out.components.username_end = protocol_end + 2;
12283|    137|      out.components.host_start = protocol_end + 2;
12284|    137|      out.components.host_end = static_cast<uint32_t>(host_end);
12285|    137|      out.components.port = url_components::omitted;
12286|    137|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12287|    137|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12287:37): [True: 10, False: 127]
  ------------------
12288|    137|                                        ? static_cast<uint32_t>(query_start)
12289|    137|                                        : url_components::omitted;
12290|    137|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12290:35): [True: 11, False: 126]
  ------------------
12291|    137|                                      ? static_cast<uint32_t>(hash_start)
12292|    137|                                      : url_components::omitted;
12293|    137|    } else {
12294|     62|      out.buffer.clear();
12295|     62|      out.buffer.reserve(len + 1);
12296|     62|      out.buffer.append(input.substr(0, host_end));
12297|     62|      out.buffer.push_back('/');
12298|     62|      if (host_end < len) {
  ------------------
  |  Branch (12298:11): [True: 62, False: 0]
  ------------------
12299|     62|        out.buffer.append(input.substr(host_end));
12300|     62|      }
12301|     62|      if (has_upper) {
  ------------------
  |  Branch (12301:11): [True: 18, False: 44]
  ------------------
12302|     18|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12303|     18|      }
12304|     62|      out.components.protocol_end = protocol_end;
12305|     62|      out.components.username_end = protocol_end + 2;
12306|     62|      out.components.host_start = protocol_end + 2;
12307|     62|      out.components.host_end = static_cast<uint32_t>(host_end);
12308|     62|      out.components.port = url_components::omitted;
12309|     62|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12310|     62|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12310:37): [True: 34, False: 28]
  ------------------
12311|     62|                                        ? static_cast<uint32_t>(query_start + 1)
12312|     62|                                        : url_components::omitted;
12313|     62|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12313:35): [True: 40, False: 22]
  ------------------
12314|     62|                                      ? static_cast<uint32_t>(hash_start + 1)
12315|     62|                                      : url_components::omitted;
12316|     62|    }
12317|       |  } else {
12318|       |    std::string host_str(input.substr(host_start, host_len));
12319|       |    if (has_upper) {
12320|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12321|       |    }
12322|       |    out.host = std::move(host_str);
12323|       |    if (need_slash) {
12324|       |      out.path = "/";
12325|       |    } else {
12326|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12327|       |    }
12328|       |    if (query_start != std::string_view::npos) {
12329|       |      const size_t q_end =
12330|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12331|       |      out.query.emplace(input.data() + query_start + 1,
12332|       |                        q_end - query_start - 1);
12333|       |    }
12334|       |    if (hash_start != std::string_view::npos) {
12335|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12336|       |    }
12337|       |  }
12338|    199|  return true;
12339|    959|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11685|    403|    bool has_upper) {
11686|    403|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11687|    403|  constexpr bool is_aggregator =
11688|    403|      std::is_same_v<result_type, ada::url_aggregator>;
11689|    403|  static_assert(is_ada_url || is_aggregator);
11690|       |
11691|    403|  const size_t len = input.size();
11692|    403|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11693|    403|  size_t p = host_end + 1;
11694|    403|  uint32_t port_value = 0;
11695|    403|  bool any_digit = false;
11696|    915|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11696:10): [True: 915, False: 0]
  |  Branch (11696:21): [True: 586, False: 329]
  |  Branch (11696:36): [True: 526, False: 60]
  ------------------
11697|    526|    any_digit = true;
11698|    526|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11699|    526|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11699:9): [True: 14, False: 512]
  ------------------
11700|     14|      return false;
11701|     14|    }
11702|    512|    ++p;
11703|    512|  }
11704|    389|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11704:7): [True: 389, False: 0]
  |  Branch (11704:18): [True: 264, False: 125]
  |  Branch (11704:33): [True: 225, False: 39]
  |  Branch (11704:48): [True: 182, False: 43]
  ------------------
11705|    182|    return false;
11706|    182|  }
11707|    207|  uint32_t parsed_port = url_components::omitted;
11708|    207|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11709|    207|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11709:7): [True: 90, False: 117]
  |  Branch (11709:20): [True: 89, False: 1]
  ------------------
11710|     89|    parsed_port = port_value;
11711|     89|  }
11712|    207|  const size_t authority_end = p;
11713|       |
11714|    207|  size_t i = authority_end;
11715|    207|  size_t path_start = host_end;
11716|    207|  size_t path_end = host_end;
11717|    207|  size_t query_start = std::string_view::npos;
11718|    207|  size_t hash_start = std::string_view::npos;
11719|    207|  bool has_path = false;
11720|    207|  bool maybe_dot_segment = false;
11721|    207|  bool rest_simple = true;
11722|       |
11723|    207|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11723:7): [True: 207, False: 0]
  |  Branch (11723:18): [True: 125, False: 82]
  ------------------
11724|    125|    has_path = true;
11725|    125|    path_start = i;
11726|    125|    ++i;
11727|    125|    scan_path_run(b, i, len, maybe_dot_segment);
11728|    125|    if (i < len) {
  ------------------
  |  Branch (11728:9): [True: 96, False: 29]
  ------------------
11729|     96|      const uint8_t cls = k_path[b[i]];
11730|     96|      if (cls == 1) {
  ------------------
  |  Branch (11730:11): [True: 16, False: 80]
  ------------------
11731|     16|        path_end = i;
11732|     16|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 10, False: 6]
  ------------------
11733|     10|          query_start = i;
11734|     10|          ++i;
11735|     10|          goto scan_query;
11736|     10|        }
11737|      6|        hash_start = i;
11738|      6|        ++i;
11739|      6|        goto scan_hash;
11740|     16|      }
11741|     80|      rest_simple = false;
11742|  1.16k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11742:14): [True: 1.09k, False: 67]
  ------------------
11743|  1.09k|        if (b[i] == '?') {
  ------------------
  |  Branch (11743:13): [True: 9, False: 1.08k]
  ------------------
11744|      9|          path_end = i;
11745|      9|          query_start = i;
11746|      9|          ++i;
11747|      9|          goto scan_query_boundary;
11748|      9|        }
11749|  1.08k|        if (b[i] == '#') {
  ------------------
  |  Branch (11749:13): [True: 4, False: 1.08k]
  ------------------
11750|      4|          path_end = i;
11751|      4|          hash_start = i;
11752|      4|          ++i;
11753|      4|          goto after_rest;
11754|      4|        }
11755|  1.08k|      }
11756|     67|      path_end = i;
11757|     67|      goto after_rest;
11758|     80|    }
11759|     29|    path_end = i;
11760|     82|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11760:14): [True: 82, False: 0]
  |  Branch (11760:25): [True: 39, False: 43]
  ------------------
11761|     39|    query_start = i;
11762|     39|    ++i;
11763|     39|    goto scan_query;
11764|     43|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11764:14): [True: 43, False: 0]
  |  Branch (11764:25): [True: 43, False: 0]
  ------------------
11765|     43|    hash_start = i;
11766|     43|    ++i;
11767|     43|    goto scan_hash;
11768|     43|  }
11769|     29|  goto after_rest;
11770|       |
11771|     49|scan_query:
11772|     49|  scan_query_run(b, i, len);
11773|     49|  if (i < len) {
  ------------------
  |  Branch (11773:7): [True: 20, False: 29]
  ------------------
11774|     20|    if (b[i] == '#') {
  ------------------
  |  Branch (11774:9): [True: 6, False: 14]
  ------------------
11775|      6|      hash_start = i;
11776|      6|      ++i;
11777|      6|      goto scan_hash;
11778|      6|    }
11779|     14|    rest_simple = false;
11780|     14|    goto scan_query_boundary;
11781|     20|  }
11782|     29|  goto after_rest;
11783|       |
11784|     29|scan_query_boundary:
11785|    237|  for (; i < len; ++i) {
  ------------------
  |  Branch (11785:10): [True: 221, False: 16]
  ------------------
11786|    221|    if (b[i] == '#') {
  ------------------
  |  Branch (11786:9): [True: 7, False: 214]
  ------------------
11787|      7|      hash_start = i;
11788|      7|      ++i;
11789|      7|      goto after_rest;
11790|      7|    }
11791|    221|  }
11792|     16|  goto after_rest;
11793|       |
11794|     55|scan_hash:
11795|     55|  scan_hash_run(b, i, len);
11796|     55|  if (i < len) {
  ------------------
  |  Branch (11796:7): [True: 6, False: 49]
  ------------------
11797|      6|    rest_simple = false;
11798|      6|  }
11799|       |
11800|    207|after_rest:
11801|    207|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11801:7): [True: 107, False: 100]
  |  Branch (11801:22): [True: 27, False: 80]
  ------------------
11802|     27|    const std::string_view path_body(input.data() + path_start,
11803|     27|                                     path_end - path_start);
11804|     27|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11804:9): [True: 5, False: 22]
  ------------------
11805|      5|      rest_simple = false;
11806|      5|    }
11807|     27|  }
11808|       |
11809|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11810|       |  // trailing C0 control or space; this fast path does neither. A query or
11811|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11812|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11813|       |  // inputs back to the slow path.
11814|    207|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11814:7): [True: 105, False: 102]
  |  Branch (11814:24): [True: 0, False: 105]
  ------------------
11815|    105|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11815:24): [True: 19, False: 86]
  ------------------
11816|     19|    return false;
11817|     19|  }
11818|       |
11819|    188|  out.type = scheme_type;
11820|    188|  out.is_valid = true;
11821|    188|  out.has_opaque_path = false;
11822|    188|  out.host_type = DEFAULT;
11823|       |
11824|    188|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11824:31): [True: 87, False: 101]
  ------------------
11825|    188|                                  ? (1 + port_decimal_digit_count(parsed_port))
11826|    188|                                  : 0;
11827|       |
11828|    188|  if (!rest_simple) {
  ------------------
  |  Branch (11828:7): [True: 86, False: 102]
  ------------------
11829|     86|    const std::string_view path_view =
11830|     86|        has_path
  ------------------
  |  Branch (11830:9): [True: 73, False: 13]
  ------------------
11831|     86|            ? std::string_view(input.data() + path_start, path_end - path_start)
11832|     86|            : std::string_view{};
11833|     86|    auto apply_query_and_hash = [&]() {
11834|     86|      if (query_start != std::string_view::npos) {
11835|     86|        const size_t q_end =
11836|     86|            (hash_start != std::string_view::npos) ? hash_start : len;
11837|     86|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|     86|                                                q_end - query_start - 1),
11839|     86|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|     86|      }
11841|     86|      if (hash_start != std::string_view::npos) {
11842|     86|        out.update_unencoded_base_hash(std::string_view(
11843|     86|            input.data() + hash_start + 1, len - hash_start - 1));
11844|     86|      }
11845|     86|    };
11846|     86|    if constexpr (is_aggregator) {
11847|     86|      out.buffer.assign(input.substr(0, host_end));
11848|     86|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11848:11): [True: 18, False: 68]
  ------------------
11849|     18|        append_canonical_port(out.buffer, parsed_port);
11850|     18|      }
11851|     86|      if (has_upper) {
  ------------------
  |  Branch (11851:11): [True: 27, False: 59]
  ------------------
11852|     27|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11853|     27|      }
11854|     86|      out.components.protocol_end = protocol_end;
11855|     86|      out.components.username_end = protocol_end + 2;
11856|     86|      out.components.host_start = protocol_end + 2;
11857|     86|      out.components.host_end = static_cast<uint32_t>(host_end);
11858|     86|      out.components.port = parsed_port;
11859|     86|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11860|     86|      out.components.search_start = url_components::omitted;
11861|     86|      out.components.hash_start = url_components::omitted;
11862|     86|      out.parse_path(path_view);
11863|     86|      apply_query_and_hash();
11864|       |    } else {
11865|       |      std::string host_str(input.substr(host_start, host_len));
11866|       |      if (has_upper) {
11867|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
11868|       |      }
11869|       |      out.host = std::move(host_str);
11870|       |      if (parsed_port != url_components::omitted) {
11871|       |        out.port = static_cast<uint16_t>(parsed_port);
11872|       |      }
11873|       |      out.parse_path(path_view);
11874|       |      apply_query_and_hash();
11875|       |    }
11876|     86|    return true;
11877|     86|  }
11878|       |
11879|    102|  const bool insert_slash = !has_path;
11880|    102|  if constexpr (is_aggregator) {
11881|    102|    const size_t out_len =
11882|    102|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (11882:34): [True: 66, False: 36]
  ------------------
11883|    102|    const bool omit_port_bytes = parsed_port == url_components::omitted;
11884|    102|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (11884:9): [True: 15, False: 87]
  |  Branch (11884:27): [True: 9, False: 6]
  |  Branch (11884:44): [True: 9, False: 0]
  ------------------
11885|      9|      out.buffer.assign(input);
11886|     93|    } else {
11887|     93|      out.buffer.clear();
11888|     93|      out.buffer.reserve(out_len);
11889|     93|      out.buffer.append(input.substr(0, host_end));
11890|     93|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11890:11): [True: 60, False: 33]
  ------------------
11891|     60|        append_canonical_port(out.buffer, parsed_port);
11892|     60|      }
11893|     93|      if (insert_slash) {
  ------------------
  |  Branch (11893:11): [True: 66, False: 27]
  ------------------
11894|     66|        out.buffer.push_back('/');
11895|     66|      }
11896|     93|      if (authority_end < len) {
  ------------------
  |  Branch (11896:11): [True: 93, False: 0]
  ------------------
11897|     93|        out.buffer.append(input.substr(authority_end));
11898|     93|      }
11899|     93|    }
11900|    102|    if (has_upper) {
  ------------------
  |  Branch (11900:9): [True: 28, False: 74]
  ------------------
11901|     28|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11902|     28|    }
11903|    102|    const uint32_t pathname_start =
11904|    102|        static_cast<uint32_t>(host_end) + port_bytes;
11905|    102|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11906|    102|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (11906:33): [True: 66, False: 36]
  ------------------
11907|    102|                               static_cast<int32_t>(authority_end);
11908|    102|    out.components.protocol_end = protocol_end;
11909|    102|    out.components.username_end = protocol_end + 2;
11910|    102|    out.components.host_start = protocol_end + 2;
11911|    102|    out.components.host_end = static_cast<uint32_t>(host_end);
11912|    102|    out.components.port = parsed_port;
11913|    102|    out.components.pathname_start = pathname_start;
11914|    102|    out.components.search_start =
11915|    102|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (11915:9): [True: 32, False: 70]
  ------------------
11916|    102|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11917|     32|                                    tail_delta)
11918|    102|            : url_components::omitted;
11919|    102|    out.components.hash_start =
11920|    102|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (11920:9): [True: 47, False: 55]
  ------------------
11921|    102|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11922|     47|                                    tail_delta)
11923|    102|            : url_components::omitted;
11924|       |  } else {
11925|       |    std::string host_str(input.substr(host_start, host_len));
11926|       |    if (has_upper) {
11927|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
11928|       |    }
11929|       |    out.host = std::move(host_str);
11930|       |    if (parsed_port != url_components::omitted) {
11931|       |      out.port = static_cast<uint16_t>(parsed_port);
11932|       |    }
11933|       |    if (insert_slash) {
11934|       |      out.path = "/";
11935|       |    } else {
11936|       |      out.path.assign(input.data() + path_start, path_end - path_start);
11937|       |    }
11938|       |    if (query_start != std::string_view::npos) {
11939|       |      const size_t q_end =
11940|       |          (hash_start != std::string_view::npos) ? hash_start : len;
11941|       |      out.query.emplace(input.data() + query_start + 1,
11942|       |                        q_end - query_start - 1);
11943|       |    }
11944|       |    if (hash_start != std::string_view::npos) {
11945|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11946|       |    }
11947|       |  }
11948|    102|  return true;
11949|    188|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12528|  13.1k|                           const result_type* base_url) {
12529|       |  // We can specialize the implementation per type.
12530|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12531|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12532|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12533|       |  // and ada::url **do not have to support the exact same API**.
12534|  13.1k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12535|  13.1k|  constexpr bool result_type_is_ada_url_aggregator =
12536|  13.1k|      std::is_same_v<url_aggregator, result_type>;
12537|  13.1k|  static_assert(result_type_is_ada_url ||
12538|  13.1k|                result_type_is_ada_url_aggregator);  // We don't support
12539|       |                                                     // anything else for now.
12540|       |
12541|  13.1k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12542|  13.1k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12543|  13.1k|          ")");
12544|       |
12545|  13.1k|  result_type url{};
12546|       |
12547|  13.1k|  const uint32_t max_input_length = ada::get_max_input_length();
12548|       |
12549|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12550|       |  // max_input_length even when the input fit under it. The check at the end of
12551|       |  // the state machine covers URLs that run to completion, but several states
12552|       |  // return early after appending a query or fragment, so run the same check on
12553|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12554|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12555|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12556|  13.1k|  const auto enforce_max_input_length = [&]() {
12557|  13.1k|    if constexpr (store_values) {
12558|  13.1k|      if (url.is_valid) {
12559|  13.1k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|  13.1k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12561|  13.1k|            url.is_valid = false;
12562|  13.1k|          }
12563|  13.1k|        } else {
12564|  13.1k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|  13.1k|            url.is_valid = false;
12566|  13.1k|          }
12567|  13.1k|        }
12568|  13.1k|      }
12569|  13.1k|    }
12570|  13.1k|  };
12571|       |
12572|       |  // We refuse to parse URL strings that exceed the maximum input length.
12573|       |  // By default, this is 4GB but can be configured via
12574|       |  // ada::set_max_input_length().
12575|  13.1k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12575:7): [True: 0, False: 13.1k]
  ------------------
12576|      0|    url.is_valid = false;
12577|      0|  }
12578|       |  // Going forward, user_input.size() is in [0,
12579|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12580|       |  // base, or the optional_url was invalid, we must return.
12581|  13.1k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12581:7): [True: 0, False: 13.1k]
  ------------------
12582|      0|    url.is_valid &= base_url->is_valid;
12583|      0|  }
12584|  13.1k|  if (!url.is_valid) {
  ------------------
  |  Branch (12584:7): [True: 0, False: 13.1k]
  ------------------
12585|      0|    return url;
12586|      0|  }
12587|       |
12588|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12589|  13.1k|  if constexpr (store_values) {
12590|  13.1k|    bool hit_fast_path = false;
12591|  13.1k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12591:9): [True: 13.1k, False: 0]
  ------------------
12592|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12593|       |      // call so those URLs (including SetHref) do not pay for a miss.
12594|  13.1k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12595|  13.1k|      const size_t n = user_input.size();
12596|  13.1k|      size_t host_start = 0;
12597|  13.1k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12597:11): [True: 13.1k, False: 0]
  |  Branch (12597:21): [True: 13.1k, False: 0]
  |  Branch (12597:36): [True: 13.1k, False: 0]
  |  Branch (12597:51): [True: 13.1k, False: 0]
  ------------------
12598|  13.1k|        host_start = 7;
12599|  13.1k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12599:18): [True: 0, False: 0]
  |  Branch (12599:28): [True: 0, False: 0]
  |  Branch (12599:43): [True: 0, False: 0]
  |  Branch (12599:58): [True: 0, False: 0]
  ------------------
12600|      0|        host_start = 8;
12601|      0|      }
12602|  13.1k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12602:34): [True: 13.1k, False: 0]
  ------------------
12603|  13.1k|      const bool skip_ip =
12604|  13.1k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12604:11): [True: 7.15k, False: 5.95k]
  |  Branch (12604:33): [True: 5.05k, False: 908]
  |  Branch (12604:54): [True: 1.22k, False: 3.82k]
  ------------------
12605|  13.1k|      const bool skip_userinfo =
12606|  13.1k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12606:11): [True: 13.1k, False: 0]
  |  Branch (12606:30): [True: 183, False: 12.9k]
  ------------------
12607|  13.1k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12607:23): [True: 4.72k, False: 8.38k]
  |  Branch (12607:35): [True: 4.56k, False: 169]
  ------------------
12608|  4.56k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12608:23): [True: 1.14k, False: 3.41k]
  ------------------
12609|  13.1k|    } else {
12610|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12611|      0|    }
12612|  13.1k|    if (hit_fast_path) {
  ------------------
  |  Branch (12612:9): [True: 1.14k, False: 11.9k]
  ------------------
12613|  1.14k|      if constexpr (result_type_is_ada_url_aggregator) {
12614|  1.14k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12614:13): [True: 0, False: 1.14k]
  ------------------
12615|      0|          url.is_valid = false;
12616|      0|        }
12617|       |      } else {
12618|       |        // For a small absolute input, even worst-case normalization cannot
12619|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12620|       |        // most 4.5x. Avoid traversing every stored component on the common
12621|       |        // default-limit path.
12622|       |        if ((base_url != nullptr ||
12623|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12624|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12625|       |          url.is_valid = false;
12626|       |        }
12627|       |      }
12628|  1.14k|      return url;
12629|  1.14k|    }
12630|  13.1k|  }
12631|       |
12632|  11.9k|  state state = state::SCHEME_START;
12633|       |
12634|  13.1k|  std::string tmp_buffer;
12635|  13.1k|  std::string_view url_data;
12636|  13.1k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12636:7): [True: 135, False: 12.9k]
  ------------------
12637|    135|    tmp_buffer = user_input;
12638|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12639|       |    // just directly build the string from user_input.
12640|    135|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12641|    135|    url_data = tmp_buffer;
12642|  12.9k|  } else [[likely]] {
12643|  12.9k|    url_data = user_input;
12644|  12.9k|  }
12645|       |
12646|       |  // Leading and trailing control characters are uncommon and easy to deal with
12647|       |  // (no performance concern).
12648|  13.1k|  helpers::trim_c0_whitespace(url_data);
12649|       |
12650|  13.1k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12651|       |    // Most of the time, we just need user_input.size().
12652|       |    // In some instances, we may need a bit more.
12653|       |    ///////////////////////////
12654|       |    // This is *very* important. This line should *not* be removed
12655|       |    // hastily. There are principled reasons why reserve is important
12656|       |    // for performance. If you have a benchmark with small inputs,
12657|       |    // it may not matter, but in other instances, it could.
12658|       |    ////
12659|       |    // This rounds up to the next power of two.
12660|       |    // We know that user_input.size() is in [0,
12661|       |    // std::numeric_limits<uint32_t>::max).
12662|  13.1k|    uint32_t reserve_capacity =
12663|  13.1k|        (0xFFFFFFFF >>
12664|  13.1k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12665|  13.1k|        1;
12666|  13.1k|    url.reserve(reserve_capacity);
12667|  13.1k|  }
12668|       |
12669|       |  // Optimization opportunity. Most websites do not have fragment.
12670|  13.1k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12671|       |  // We add it last so that an implementation like ada::url_aggregator
12672|       |  // can append it last to its internal buffer, thus improving performance.
12673|       |
12674|       |  // Here url_data no longer has its fragment.
12675|       |  // We are going to access the data from url_data (it is immutable).
12676|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12677|       |  // The input_position variable should range from 0 to input_size.
12678|       |  // It is illegal to access url_data at input_size.
12679|  13.1k|  size_t input_position = 0;
12680|  13.1k|  const size_t input_size = url_data.size();
12681|       |  // Keep running the following state machine by switching on state.
12682|       |  // If after a run pointer points to the EOF code point, go to the next step.
12683|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12684|       |  // We never decrement input_position.
12685|  64.9k|  while (input_position <= input_size) {
  ------------------
  |  Branch (12685:10): [True: 63.1k, False: 1.84k]
  ------------------
12686|  63.1k|    ada_log("In parsing at ", input_position, " out of ", input_size,
12687|  63.1k|            " in state ", ada::to_string(state));
12688|  63.1k|    switch (state) {
12689|  11.9k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12689:7): [True: 11.9k, False: 51.1k]
  ------------------
12690|  11.9k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12691|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12692|       |        // state to scheme state.
12693|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12693:13): [True: 11.9k, False: 0]
  ------------------
12694|  11.9k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12694:13): [True: 11.9k, False: 0]
  ------------------
12695|  11.9k|          state = state::SCHEME;
12696|  11.9k|          input_position++;
12697|  11.9k|        } else {
12698|       |          // Otherwise, if state override is not given, set state to no scheme
12699|       |          // state and decrease pointer by 1.
12700|      0|          state = state::NO_SCHEME;
12701|      0|        }
12702|  11.9k|        break;
12703|      0|      }
12704|  11.9k|      case state::SCHEME: {
  ------------------
  |  Branch (12704:7): [True: 11.9k, False: 51.1k]
  ------------------
12705|  11.9k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12706|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12707|       |        // append c, lowercased, to buffer.
12708|  47.8k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12708:16): [True: 47.8k, False: 0]
  ------------------
12709|  47.8k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12709:16): [True: 35.9k, False: 11.9k]
  ------------------
12710|  35.9k|          input_position++;
12711|  35.9k|        }
12712|       |        // Otherwise, if c is U+003A (:), then:
12713|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12713:13): [True: 11.9k, False: 0]
  ------------------
12714|  11.9k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12714:13): [True: 11.9k, False: 0]
  ------------------
12715|  11.9k|          ada_log("SCHEME the scheme should be ",
12716|  11.9k|                  url_data.substr(0, input_position));
12717|       |          if constexpr (result_type_is_ada_url) {
12718|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
12719|       |              return url;
12720|       |            }
12721|  11.9k|          } else {
12722|       |            // we pass the colon along instead of painfully adding it back.
12723|  11.9k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (12723:17): [True: 0, False: 11.9k]
  ------------------
12724|  11.9k|                    url_data.substr(0, input_position + 1))) {
12725|      0|              return url;
12726|      0|            }
12727|  11.9k|          }
12728|  11.9k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12729|       |
12730|       |          // If url's scheme is "file", then:
12731|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12732|  11.9k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12732:15): [True: 0, False: 11.9k]
  ------------------
12733|       |            // Set state to file state.
12734|      0|            state = state::FILE;
12735|      0|          }
12736|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12737|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12738|       |          // != nullptr is false.
12739|  11.9k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12739:20): [True: 11.9k, False: 0]
  |  Branch (12739:40): [True: 0, False: 11.9k]
  ------------------
12740|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12740:20): [True: 0, False: 0]
  ------------------
12741|       |            // Set state to special relative or authority state.
12742|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12743|      0|          }
12744|       |          // Otherwise, if url is special, set state to special authority
12745|       |          // slashes state.
12746|  11.9k|          else if (url.is_special()) {
  ------------------
  |  Branch (12746:20): [True: 11.9k, False: 0]
  ------------------
12747|  11.9k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12748|  11.9k|          }
12749|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12750|       |          // path or authority state and increase pointer by 1.
12751|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12751:20): [True: 0, False: 0]
  ------------------
12752|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12752:20): [True: 0, False: 0]
  ------------------
12753|      0|            state = state::PATH_OR_AUTHORITY;
12754|      0|            input_position++;
12755|      0|          }
12756|       |          // Otherwise, set url's path to the empty string and set state to
12757|       |          // opaque path state.
12758|      0|          else {
12759|      0|            state = state::OPAQUE_PATH;
12760|      0|          }
12761|  11.9k|        }
12762|       |        // Otherwise, if state override is not given, set buffer to the empty
12763|       |        // string, state to no scheme state, and start over (from the first code
12764|       |        // point in input).
12765|      0|        else {
12766|      0|          state = state::NO_SCHEME;
12767|      0|          input_position = 0;
12768|      0|          break;
12769|      0|        }
12770|  11.9k|        input_position++;
12771|  11.9k|        break;
12772|  11.9k|      }
12773|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12773:7): [True: 0, False: 63.1k]
  ------------------
12774|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12775|       |        // The fragment was pruned from url_data before the state machine ran,
12776|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12777|       |        // nothing else remains in front of it.
12778|      0|        const bool c_is_hash =
12779|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12779:13): [True: 0, False: 0]
  |  Branch (12779:37): [True: 0, False: 0]
  ------------------
12780|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12781|       |        // validation error, return failure.
12782|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12782:13): [True: 0, False: 0]
  |  Branch (12782:37): [True: 0, False: 0]
  |  Branch (12782:66): [True: 0, False: 0]
  ------------------
12783|      0|          ada_log("NO_SCHEME validation error");
12784|      0|          url.is_valid = false;
12785|      0|          return url;
12786|      0|        }
12787|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12788|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12789|       |        // query to base's query, and set state to fragment state.
12790|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12790:18): [True: 0, False: 0]
  |  Branch (12790:47): [True: 0, False: 0]
  ------------------
12791|      0|          ada_log("NO_SCHEME opaque base with fragment");
12792|      0|          url.copy_scheme(*base_url);
12793|      0|          url.has_opaque_path = base_url->has_opaque_path;
12794|       |
12795|       |          if constexpr (result_type_is_ada_url) {
12796|       |            url.path = base_url->path;
12797|       |            url.query = base_url->query;
12798|      0|          } else {
12799|      0|            url.update_base_pathname(base_url->get_pathname());
12800|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (12800:17): [True: 0, False: 0]
  ------------------
12801|       |              // get_search() returns "" for an empty query string (URL ends
12802|       |              // with '?'). update_base_search("") would incorrectly clear the
12803|       |              // query, so pass "?" to preserve the empty query distinction.
12804|      0|              auto s = base_url->get_search();
12805|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (12805:38): [True: 0, False: 0]
  ------------------
12806|      0|            }
12807|      0|          }
12808|      0|          url.update_unencoded_base_hash(*fragment);
12809|      0|          enforce_max_input_length();
12810|      0|          return url;
12811|      0|        }
12812|       |        // Otherwise, if base's scheme is not "file", set state to relative
12813|       |        // state and decrease pointer by 1.
12814|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12815|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12815:18): [True: 0, False: 0]
  ------------------
12816|      0|          ada_log("NO_SCHEME non-file relative path");
12817|      0|          state = state::RELATIVE_SCHEME;
12818|      0|        }
12819|       |        // Otherwise, set state to file state and decrease pointer by 1.
12820|      0|        else {
12821|      0|          ada_log("NO_SCHEME file base type");
12822|      0|          state = state::FILE;
12823|      0|        }
12824|      0|        break;
12825|      0|      }
12826|  11.9k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12826:7): [True: 11.9k, False: 51.1k]
  ------------------
12827|  11.9k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12828|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12829|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12830|       |        // worry about AUTHORITY.
12831|       |        // TODO: Instead of just collecting a bool, collect the location of the
12832|       |        // '@' and do something useful with it.
12833|       |        // TODO: We could do various processing early on, using a single pass
12834|       |        // over the string to collect information about it, e.g., telling us
12835|       |        // whether there is a @ and if so, where (or how many).
12836|       |
12837|       |        // Check if url data contains an @.
12838|  11.9k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12838:13): [True: 11.7k, False: 256]
  ------------------
12839|  11.7k|          state = state::HOST;
12840|  11.7k|          break;
12841|  11.7k|        }
12842|    256|        bool at_sign_seen{false};
12843|    256|        bool password_token_seen{false};
12844|       |        /**
12845|       |         * We expect something of the sort...
12846|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12847|       |         * --------^
12848|       |         */
12849|  1.86k|        do {
12850|  1.86k|          std::string_view view = url_data.substr(input_position);
12851|       |          // The delimiters are @, /, ? \\.
12852|  1.86k|          size_t location =
12853|  1.86k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12853:15): [True: 1.86k, False: 0]
  ------------------
12854|  1.86k|                               : helpers::find_authority_delimiter(view);
12855|  1.86k|          std::string_view authority_view = view.substr(0, location);
12856|  1.86k|          size_t end_of_authority = input_position + authority_view.size();
12857|       |          // If c is U+0040 (@), then:
12858|  1.86k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12858:15): [True: 1.84k, False: 24]
  ------------------
12859|  1.84k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12859:15): [True: 1.60k, False: 232]
  ------------------
12860|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12861|  1.60k|            if (at_sign_seen) {
  ------------------
  |  Branch (12861:17): [True: 1.37k, False: 237]
  ------------------
12862|  1.37k|              if (password_token_seen) {
  ------------------
  |  Branch (12862:19): [True: 498, False: 874]
  ------------------
12863|       |                if constexpr (result_type_is_ada_url) {
12864|       |                  url.password += "%40";
12865|    498|                } else {
12866|    498|                  url.append_base_password("%40");
12867|    498|                }
12868|    874|              } else {
12869|       |                if constexpr (result_type_is_ada_url) {
12870|       |                  url.username += "%40";
12871|    874|                } else {
12872|    874|                  url.append_base_username("%40");
12873|    874|                }
12874|    874|              }
12875|  1.37k|            }
12876|       |
12877|  1.60k|            at_sign_seen = true;
12878|       |
12879|  1.60k|            if (!password_token_seen) {
  ------------------
  |  Branch (12879:17): [True: 1.11k, False: 498]
  ------------------
12880|  1.11k|              size_t password_token_location = authority_view.find(':');
12881|  1.11k|              password_token_seen =
12882|  1.11k|                  password_token_location != std::string_view::npos;
12883|       |
12884|  1.11k|              if constexpr (store_values) {
12885|  1.11k|                if (!password_token_seen) {
  ------------------
  |  Branch (12885:21): [True: 1.04k, False: 70]
  ------------------
12886|       |                  if constexpr (result_type_is_ada_url) {
12887|       |                    url.username += unicode::percent_encode(
12888|       |                        authority_view,
12889|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12890|  1.04k|                  } else {
12891|  1.04k|                    url.append_base_username(unicode::percent_encode(
12892|  1.04k|                        authority_view,
12893|  1.04k|                        character_sets::USERINFO_PERCENT_ENCODE));
12894|  1.04k|                  }
12895|  1.04k|                } else {
12896|       |                  if constexpr (result_type_is_ada_url) {
12897|       |                    url.username += unicode::percent_encode(
12898|       |                        authority_view.substr(0, password_token_location),
12899|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12900|       |                    url.password += unicode::percent_encode(
12901|       |                        authority_view.substr(password_token_location + 1),
12902|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12903|     70|                  } else {
12904|     70|                    url.append_base_username(unicode::percent_encode(
12905|     70|                        authority_view.substr(0, password_token_location),
12906|     70|                        character_sets::USERINFO_PERCENT_ENCODE));
12907|     70|                    url.append_base_password(unicode::percent_encode(
12908|     70|                        authority_view.substr(password_token_location + 1),
12909|     70|                        character_sets::USERINFO_PERCENT_ENCODE));
12910|     70|                  }
12911|     70|                }
12912|  1.11k|              }
12913|  1.11k|            } else if constexpr (store_values) {
12914|       |              if constexpr (result_type_is_ada_url) {
12915|       |                url.password += unicode::percent_encode(
12916|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12917|    498|              } else {
12918|    498|                url.append_base_password(unicode::percent_encode(
12919|    498|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12920|    498|              }
12921|    498|            }
12922|  1.60k|          }
12923|       |          // Otherwise, if one of the following is true:
12924|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12925|       |          // - url is special and c is U+005C (\)
12926|    256|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12926:20): [True: 24, False: 232]
  ------------------
12927|    232|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12927:20): [True: 209, False: 23]
  ------------------
12928|     23|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12928:20): [True: 22, False: 1]
  ------------------
12929|    256|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12929:21): [True: 1, False: 0]
  |  Branch (12929:41): [True: 1, False: 0]
  ------------------
12930|       |            // If atSignSeen is true and authority_view is the empty string,
12931|       |            // validation error, return failure.
12932|    256|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12932:17): [True: 237, False: 19]
  |  Branch (12932:33): [True: 2, False: 235]
  ------------------
12933|      2|              url.is_valid = false;
12934|      2|              return url;
12935|      2|            }
12936|    254|            state = state::HOST;
12937|    254|            break;
12938|    256|          }
12939|  1.60k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12939:15): [True: 0, False: 1.60k]
  ------------------
12940|      0|            if constexpr (store_values) {
12941|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12941:19): [True: 0, False: 0]
  ------------------
12942|      0|                url.update_unencoded_base_hash(*fragment);
12943|      0|              }
12944|      0|            }
12945|      0|            enforce_max_input_length();
12946|      0|            return url;
12947|      0|          }
12948|  1.60k|          input_position = end_of_authority + 1;
12949|  1.60k|        } while (true);
  ------------------
  |  Branch (12949:18): [True: 1.60k, Folded]
  ------------------
12950|       |
12951|    254|        break;
12952|    256|      }
12953|    254|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12953:7): [True: 0, False: 63.1k]
  ------------------
12954|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12955|      0|                helpers::substring(url_data, input_position));
12956|       |
12957|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12958|       |        // then set state to special authority ignore slashes state and increase
12959|       |        // pointer by 1.
12960|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12960:13): [True: 0, False: 0]
  ------------------
12961|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12962|      0|          input_position += 2;
12963|      0|        } else {
12964|       |          // Otherwise, validation error, set state to relative state and
12965|       |          // decrease pointer by 1.
12966|      0|          state = state::RELATIVE_SCHEME;
12967|      0|        }
12968|       |
12969|      0|        break;
12970|    256|      }
12971|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12971:7): [True: 0, False: 63.1k]
  ------------------
12972|      0|        ada_log("PATH_OR_AUTHORITY ",
12973|      0|                helpers::substring(url_data, input_position));
12974|       |
12975|       |        // If c is U+002F (/), then set state to authority state.
12976|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12976:13): [True: 0, False: 0]
  ------------------
12977|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12977:13): [True: 0, False: 0]
  ------------------
12978|      0|          state = state::AUTHORITY;
12979|      0|          input_position++;
12980|      0|        } else {
12981|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12982|      0|          state = state::PATH;
12983|      0|        }
12984|       |
12985|      0|        break;
12986|    256|      }
12987|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12987:7): [True: 0, False: 63.1k]
  ------------------
12988|      0|        ada_log("RELATIVE_SCHEME ",
12989|      0|                helpers::substring(url_data, input_position));
12990|       |
12991|       |        // Set url's scheme to base's scheme.
12992|      0|        url.copy_scheme(*base_url);
12993|       |
12994|       |        // If c is U+002F (/), then set state to relative slash state.
12995|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12995:13): [True: 0, False: 0]
  ------------------
12996|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12997|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12997:13): [True: 0, False: 0]
  ------------------
12998|      0|          ada_log(
12999|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13000|      0|              "slash state");
13001|      0|          state = state::RELATIVE_SLASH;
13002|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13002:20): [True: 0, False: 0]
  |  Branch (13002:40): [True: 0, False: 0]
  ------------------
13003|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13003:20): [True: 0, False: 0]
  ------------------
13004|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13005|       |          // set state to relative slash state.
13006|      0|          ada_log(
13007|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13008|      0|              "error, set state to relative slash state");
13009|      0|          state = state::RELATIVE_SLASH;
13010|      0|        } else {
13011|      0|          ada_log("RELATIVE_SCHEME otherwise");
13012|       |          // Set url's username to base's username, url's password to base's
13013|       |          // password, url's host to base's host, url's port to base's port,
13014|       |          // url's path to a clone of base's path, and url's query to base's
13015|       |          // query.
13016|       |          if constexpr (result_type_is_ada_url) {
13017|       |            url.username = base_url->username;
13018|       |            url.password = base_url->password;
13019|       |            url.host = base_url->host;
13020|       |            url.port = base_url->port;
13021|       |            // cloning the base path includes cloning the has_opaque_path flag
13022|       |            url.has_opaque_path = base_url->has_opaque_path;
13023|       |            url.path = base_url->path;
13024|       |            url.query = base_url->query;
13025|      0|          } else {
13026|      0|            url.update_base_authority(base_url->get_href(),
13027|      0|                                      base_url->get_components());
13028|      0|            url.update_host_to_base_host(base_url->get_hostname());
13029|      0|            url.update_base_port(base_url->retrieve_base_port());
13030|       |            // cloning the base path includes cloning the has_opaque_path flag
13031|      0|            url.has_opaque_path = base_url->has_opaque_path;
13032|      0|            url.update_base_pathname(base_url->get_pathname());
13033|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13033:17): [True: 0, False: 0]
  ------------------
13034|       |              // get_search() returns "" for an empty query string (URL ends
13035|       |              // with '?'). update_base_search("") would incorrectly clear the
13036|       |              // query, so pass "?" to preserve the empty query distinction.
13037|      0|              auto s = base_url->get_search();
13038|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13038:38): [True: 0, False: 0]
  ------------------
13039|      0|            }
13040|      0|          }
13041|       |
13042|      0|          url.has_opaque_path = base_url->has_opaque_path;
13043|       |
13044|       |          // If c is U+003F (?), then set url's query to the empty string, and
13045|       |          // state to query state.
13046|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13046:15): [True: 0, False: 0]
  ------------------
13047|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13047:15): [True: 0, False: 0]
  ------------------
13048|      0|            state = state::QUERY;
13049|      0|          }
13050|       |          // Otherwise, if c is not the EOF code point:
13051|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13051:20): [True: 0, False: 0]
  ------------------
13052|       |            // Set url's query to null.
13053|      0|            url.clear_search();
13054|       |            if constexpr (result_type_is_ada_url) {
13055|       |              // Shorten url's path.
13056|       |              helpers::shorten_path(url.path, url.type);
13057|      0|            } else {
13058|      0|              std::string_view path = url.get_pathname();
13059|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13059:19): [True: 0, False: 0]
  ------------------
13060|      0|                url.update_base_pathname(std::move(std::string(path)));
13061|      0|              }
13062|      0|            }
13063|       |            // Set state to path state and decrease pointer by 1.
13064|      0|            state = state::PATH;
13065|      0|            break;
13066|      0|          }
13067|      0|        }
13068|      0|        input_position++;
13069|      0|        break;
13070|      0|      }
13071|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13071:7): [True: 0, False: 63.1k]
  ------------------
13072|      0|        ada_log("RELATIVE_SLASH ",
13073|      0|                helpers::substring(url_data, input_position));
13074|       |
13075|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13076|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13077|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13077:13): [True: 0, False: 0]
  |  Branch (13077:33): [True: 0, False: 0]
  ------------------
13078|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13078:14): [True: 0, False: 0]
  ------------------
13079|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13079:14): [True: 0, False: 0]
  ------------------
13080|       |          // Set state to special authority ignore slashes state.
13081|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13082|      0|        }
13083|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13084|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13084:18): [True: 0, False: 0]
  ------------------
13085|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13085:18): [True: 0, False: 0]
  ------------------
13086|      0|          state = state::AUTHORITY;
13087|      0|        }
13088|       |        // Otherwise, set
13089|       |        // - url's username to base's username,
13090|       |        // - url's password to base's password,
13091|       |        // - url's host to base's host,
13092|       |        // - url's port to base's port,
13093|       |        // - state to path state, and then, decrease pointer by 1.
13094|      0|        else {
13095|       |          if constexpr (result_type_is_ada_url) {
13096|       |            url.username = base_url->username;
13097|       |            url.password = base_url->password;
13098|       |            url.host = base_url->host;
13099|       |            url.port = base_url->port;
13100|      0|          } else {
13101|      0|            url.update_base_authority(base_url->get_href(),
13102|      0|                                      base_url->get_components());
13103|      0|            url.update_host_to_base_host(base_url->get_hostname());
13104|      0|            url.update_base_port(base_url->retrieve_base_port());
13105|      0|          }
13106|      0|          state = state::PATH;
13107|      0|          break;
13108|      0|        }
13109|       |
13110|      0|        input_position++;
13111|      0|        break;
13112|      0|      }
13113|  11.9k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13113:7): [True: 11.9k, False: 51.1k]
  ------------------
13114|  11.9k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13115|  11.9k|                helpers::substring(url_data, input_position));
13116|       |
13117|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13118|       |        // then set state to special authority ignore slashes state and increase
13119|       |        // pointer by 1.
13120|  11.9k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13120:13): [True: 11.9k, False: 0]
  ------------------
13121|  11.9k|          input_position += 2;
13122|  11.9k|        }
13123|       |
13124|  11.9k|        [[fallthrough]];
13125|  11.9k|      }
13126|  11.9k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13126:7): [True: 0, False: 63.1k]
  ------------------
13127|  11.9k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13128|  11.9k|                helpers::substring(url_data, input_position));
13129|       |
13130|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13131|       |        // authority state and decrease pointer by 1.
13132|  12.2k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13132:16): [True: 12.2k, False: 2]
  ------------------
13133|  12.2k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13133:17): [True: 80, False: 12.1k]
  ------------------
13134|  12.1k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13134:17): [True: 173, False: 11.9k]
  ------------------
13135|    253|          input_position++;
13136|    253|        }
13137|  11.9k|        state = state::AUTHORITY;
13138|       |
13139|  11.9k|        break;
13140|  11.9k|      }
13141|    436|      case state::QUERY: {
  ------------------
  |  Branch (13141:7): [True: 436, False: 62.7k]
  ------------------
13142|    436|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13143|    436|        if constexpr (store_values) {
13144|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13145|       |          // if url is special; otherwise the query percent-encode set.
13146|    436|          const uint8_t* query_percent_encode_set =
13147|    436|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13147:15): [True: 436, False: 0]
  ------------------
13148|    436|                               : character_sets::QUERY_PERCENT_ENCODE;
13149|       |
13150|       |          // Percent-encode after encoding, with encoding, buffer, and
13151|       |          // queryPercentEncodeSet, and append the result to url's query.
13152|    436|          url.update_base_search(url_data.substr(input_position),
13153|    436|                                 query_percent_encode_set);
13154|    436|          ada_log("QUERY update_base_search completed ");
13155|    436|          if (fragment.has_value()) {
  ------------------
  |  Branch (13155:15): [True: 7, False: 429]
  ------------------
13156|      7|            url.update_unencoded_base_hash(*fragment);
13157|      7|          }
13158|    436|        }
13159|    436|        enforce_max_input_length();
13160|    436|        return url;
13161|  11.9k|      }
13162|  11.9k|      case state::HOST: {
  ------------------
  |  Branch (13162:7): [True: 11.9k, False: 51.1k]
  ------------------
13163|  11.9k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13164|       |
13165|  11.9k|        std::string_view host_view = url_data.substr(input_position);
13166|  11.9k|        auto [location, found_colon] =
13167|  11.9k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13168|  11.9k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13168:26): [True: 11.9k, False: 0]
  ------------------
13169|  11.9k|                             ? input_position + location
13170|  11.9k|                             : input_size;
13171|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13172|       |        // Note: the 'found_colon' value is true if and only if a colon was
13173|       |        // encountered while not inside brackets.
13174|  11.9k|        if (found_colon) {
  ------------------
  |  Branch (13174:13): [True: 728, False: 11.2k]
  ------------------
13175|       |          // If buffer is the empty string, validation error, return failure.
13176|       |          // Let host be the result of host parsing buffer with url is not
13177|       |          // special.
13178|    728|          ada_log("HOST parsing ", host_view);
13179|    728|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13179:15): [True: 150, False: 578]
  ------------------
13180|    150|            return url;
13181|    150|          }
13182|    578|          ada_log("HOST parsing results in ", url.get_hostname());
13183|       |          // Set url's host to host, buffer to the empty string, and state to
13184|       |          // port state.
13185|    578|          state = state::PORT;
13186|    578|          input_position++;
13187|    578|        }
13188|       |        // Otherwise, if one of the following is true:
13189|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13190|       |        // - url is special and c is U+005C (\)
13191|       |        // The get_host_delimiter_location function either brings us to
13192|       |        // the colon outside of the bracket, or to one of those characters.
13193|  11.2k|        else {
13194|       |          // If url is special and host_view is the empty string, validation
13195|       |          // error, return failure.
13196|  11.2k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13196:15): [True: 4, False: 11.2k]
  |  Branch (13196:36): [True: 4, False: 0]
  ------------------
13197|      4|            url.is_valid = false;
13198|      4|            return url;
13199|      4|          }
13200|  11.2k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13201|       |          // Let host be the result of host parsing host_view with url is not
13202|       |          // special.
13203|  11.2k|          if (host_view.empty()) {
  ------------------
  |  Branch (13203:15): [True: 0, False: 11.2k]
  ------------------
13204|      0|            url.update_base_hostname("");
13205|  11.2k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13205:22): [True: 10.0k, False: 1.16k]
  ------------------
13206|  10.0k|            return url;
13207|  10.0k|          }
13208|  1.16k|          ada_log("HOST parsing results in ", url.get_hostname(),
13209|  1.16k|                  " href=", url.get_href());
13210|       |
13211|       |          // Set url's host to host, and state to path start state.
13212|  1.16k|          state = state::PATH_START;
13213|  1.16k|        }
13214|       |
13215|  1.74k|        break;
13216|  11.9k|      }
13217|  1.74k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13217:7): [True: 0, False: 63.1k]
  ------------------
13218|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13219|       |        // Opaque path, query, and fragment are structurally always valid:
13220|       |        // the parser would just percent-encode whatever is there. When we
13221|       |        // are not storing values (can_parse), we can return immediately.
13222|       |        // We must set has_opaque_path = true before returning so that when
13223|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13224|       |        // correctly rejects relative inputs against an opaque-path base
13225|       |        // (e.g. can_parse("", &"W:") must return false).
13226|       |        if constexpr (!store_values) {
13227|       |          url.has_opaque_path = true;
13228|       |          return url;
13229|       |        }
13230|      0|        std::string_view view = url_data.substr(input_position);
13231|       |        // If c is U+003F (?), then set url's query to the empty string and
13232|       |        // state to query state.
13233|      0|        size_t location = view.find('?');
13234|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13234:13): [True: 0, False: 0]
  ------------------
13235|      0|          view.remove_suffix(view.size() - location);
13236|      0|          state = state::QUERY;
13237|      0|          input_position += location + 1;
13238|      0|        } else {
13239|      0|          input_position = input_size + 1;
13240|      0|        }
13241|      0|        url.has_opaque_path = true;
13242|       |
13243|       |        // This is a really unlikely scenario in real world. We should not seek
13244|       |        // to optimize it.
13245|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13245:13): [True: 0, False: 0]
  ------------------
13246|      0|          std::string modified_view =
13247|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
13248|      0|          url.update_base_pathname(unicode::percent_encode(
13249|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13250|      0|        } else {
13251|      0|          url.update_base_pathname(unicode::percent_encode(
13252|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13253|      0|        }
13254|      0|        break;
13255|  11.9k|      }
13256|    578|      case state::PORT: {
  ------------------
  |  Branch (13256:7): [True: 578, False: 62.5k]
  ------------------
13257|    578|        ada_log("PORT ", helpers::substring(url_data, input_position));
13258|    578|        std::string_view port_view = url_data.substr(input_position);
13259|    578|        input_position += url.parse_port(port_view, true);
13260|    578|        if (!url.is_valid) {
  ------------------
  |  Branch (13260:13): [True: 512, False: 66]
  ------------------
13261|    512|          return url;
13262|    512|        }
13263|     66|        state = state::PATH_START;
13264|     66|        [[fallthrough]];
13265|     66|      }
13266|  1.23k|      case state::PATH_START: {
  ------------------
  |  Branch (13266:7): [True: 1.16k, False: 61.9k]
  ------------------
13267|  1.23k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13268|       |        // Path, query, and fragment are structurally always valid: the
13269|       |        // parser would just percent-encode whatever is there. When we are
13270|       |        // not storing values (can_parse), we can return immediately since
13271|       |        // no subsequent state can invalidate the URL.
13272|       |        if constexpr (!store_values) {
13273|       |          return url;
13274|       |        }
13275|       |
13276|       |        // If url is special, then:
13277|  1.23k|        if (url.is_special()) {
  ------------------
  |  Branch (13277:13): [True: 1.23k, False: 0]
  ------------------
13278|       |          // Set state to path state.
13279|  1.23k|          state = state::PATH;
13280|       |
13281|       |          // Optimization: Avoiding going into PATH state improves the
13282|       |          // performance of urls ending with /.
13283|  1.23k|          if (input_position == input_size) {
  ------------------
  |  Branch (13283:15): [True: 100, False: 1.13k]
  ------------------
13284|    100|            if constexpr (store_values) {
13285|    100|              url.update_base_pathname("/");
13286|    100|              if (fragment.has_value()) {
  ------------------
  |  Branch (13286:19): [True: 100, False: 0]
  ------------------
13287|    100|                url.update_unencoded_base_hash(*fragment);
13288|    100|              }
13289|    100|            }
13290|    100|            enforce_max_input_length();
13291|    100|            return url;
13292|    100|          }
13293|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13294|       |          // by 1. We know that (input_position == input_size) is impossible
13295|       |          // here, because of the previous if-check.
13296|  1.13k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13296:15): [True: 114, False: 1.01k]
  ------------------
13297|    114|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13297:15): [True: 108, False: 6]
  ------------------
13298|    108|            break;
13299|    108|          }
13300|  1.13k|        }
13301|       |        // Otherwise, if state override is not given and c is U+003F (?),
13302|       |        // set url's query to the empty string and state to query state.
13303|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13303:18): [True: 0, False: 0]
  ------------------
13304|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13304:18): [True: 0, False: 0]
  ------------------
13305|      0|          state = state::QUERY;
13306|      0|        }
13307|       |        // Otherwise, if c is not the EOF code point:
13308|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (13308:18): [True: 0, False: 0]
  ------------------
13309|       |          // Set state to path state.
13310|      0|          state = state::PATH;
13311|       |
13312|       |          // If c is not U+002F (/), then decrease pointer by 1.
13313|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13313:15): [True: 0, False: 0]
  ------------------
13314|      0|            break;
13315|      0|          }
13316|      0|        }
13317|       |
13318|  1.02k|        input_position++;
13319|  1.02k|        break;
13320|  1.23k|      }
13321|  1.13k|      case state::PATH: {
  ------------------
  |  Branch (13321:7): [True: 1.13k, False: 62.0k]
  ------------------
13322|  1.13k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13323|       |        // Path, query, and fragment are structurally always valid: the
13324|       |        // parser would just percent-encode whatever is there. When we are
13325|       |        // not storing values (can_parse), we can return immediately since
13326|       |        // no subsequent state can invalidate the URL.
13327|       |        if constexpr (!store_values) {
13328|       |          return url;
13329|       |        }
13330|  1.13k|        std::string_view view = url_data.substr(input_position);
13331|       |
13332|       |        // Most time, we do not need percent encoding.
13333|       |        // Furthermore, we can immediately locate the '?'.
13334|  1.13k|        size_t locofquestionmark = view.find('?');
13335|  1.13k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13335:13): [True: 436, False: 695]
  ------------------
13336|    436|          state = state::QUERY;
13337|    436|          view.remove_suffix(view.size() - locofquestionmark);
13338|    436|          input_position += locofquestionmark + 1;
13339|    695|        } else {
13340|    695|          input_position = input_size + 1;
13341|    695|        }
13342|  1.13k|        if constexpr (store_values) {
13343|       |          if constexpr (result_type_is_ada_url) {
13344|       |            helpers::parse_prepared_path(view, url.type, url.path);
13345|  1.13k|          } else {
13346|  1.13k|            url.consume_prepared_path(view);
13347|  1.13k|            ADA_ASSERT_TRUE(url.validate());
13348|  1.13k|          }
13349|  1.13k|        }
13350|  1.13k|        break;
13351|  1.23k|      }
13352|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13352:7): [True: 0, False: 63.1k]
  ------------------
13353|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13354|       |
13355|       |        // If c is U+002F (/) or U+005C (\), then:
13356|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13356:13): [True: 0, False: 0]
  ------------------
13357|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13357:14): [True: 0, False: 0]
  ------------------
13358|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13358:14): [True: 0, False: 0]
  ------------------
13359|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
13360|       |          // Set state to file host state.
13361|      0|          state = state::FILE_HOST;
13362|      0|          input_position++;
13363|      0|        } else {
13364|      0|          ada_log("FILE_SLASH otherwise");
13365|       |          // If base is non-null and base's scheme is "file", then:
13366|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13367|       |          // base_url_has_value() is true.
13368|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13368:15): [True: 0, False: 0]
  |  Branch (13368:38): [True: 0, False: 0]
  ------------------
13369|       |            // Set url's host to base's host.
13370|       |            if constexpr (result_type_is_ada_url) {
13371|       |              url.host = base_url->host;
13372|      0|            } else {
13373|      0|              url.update_host_to_base_host(base_url->get_host());
13374|      0|            }
13375|       |            // If the code point substring from pointer to the end of input does
13376|       |            // not start with a Windows drive letter and base's path[0] is a
13377|       |            // normalized Windows drive letter, then append base's path[0] to
13378|       |            // url's path.
13379|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13379:17): [True: 0, False: 0]
  ------------------
13380|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13380:19): [True: 0, False: 0]
  ------------------
13381|      0|                      url_data.substr(input_position))) {
13382|      0|                std::string_view first_base_url_path =
13383|      0|                    base_url->get_pathname().substr(1);
13384|      0|                size_t loc = first_base_url_path.find('/');
13385|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13385:21): [True: 0, False: 0]
  ------------------
13386|      0|                  helpers::resize(first_base_url_path, loc);
13387|      0|                }
13388|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13388:21): [True: 0, False: 0]
  ------------------
13389|      0|                        first_base_url_path)) {
13390|       |                  if constexpr (result_type_is_ada_url) {
13391|       |                    url.path += '/';
13392|       |                    url.path += first_base_url_path;
13393|      0|                  } else {
13394|      0|                    url.append_base_pathname(
13395|      0|                        helpers::concat("/", first_base_url_path));
13396|      0|                  }
13397|      0|                }
13398|      0|              }
13399|      0|            }
13400|      0|          }
13401|       |
13402|       |          // Set state to path state, and decrease pointer by 1.
13403|      0|          state = state::PATH;
13404|      0|        }
13405|       |
13406|      0|        break;
13407|  1.23k|      }
13408|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13408:7): [True: 0, False: 63.1k]
  ------------------
13409|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13410|      0|        std::string_view view = url_data.substr(input_position);
13411|       |
13412|      0|        size_t location = view.find_first_of("/\\?");
13413|      0|        std::string_view file_host_buffer = view.substr(
13414|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13414:16): [True: 0, False: 0]
  ------------------
13415|       |
13416|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13416:13): [True: 0, False: 0]
  ------------------
13417|      0|          state = state::PATH;
13418|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13418:20): [True: 0, False: 0]
  ------------------
13419|       |          // Set url's host to the empty string.
13420|       |          if constexpr (result_type_is_ada_url) {
13421|       |            url.host = "";
13422|      0|          } else {
13423|      0|            url.update_base_hostname("");
13424|      0|          }
13425|       |          // Set state to path start state.
13426|      0|          state = state::PATH_START;
13427|      0|        } else {
13428|      0|          size_t consumed_bytes = file_host_buffer.size();
13429|      0|          input_position += consumed_bytes;
13430|       |          // Let host be the result of host parsing buffer with url is not
13431|       |          // special.
13432|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13432:15): [True: 0, False: 0]
  ------------------
13433|      0|            return url;
13434|      0|          }
13435|       |
13436|       |          if constexpr (result_type_is_ada_url) {
13437|       |            // If host is "localhost", then set host to the empty string.
13438|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13439|       |              url.host = "";
13440|       |            }
13441|      0|          } else {
13442|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13442:17): [True: 0, False: 0]
  ------------------
13443|      0|              url.update_base_hostname("");
13444|      0|            }
13445|      0|          }
13446|       |
13447|       |          // Set buffer to the empty string and state to path start state.
13448|      0|          state = state::PATH_START;
13449|      0|        }
13450|       |
13451|      0|        break;
13452|      0|      }
13453|      0|      case state::FILE: {
  ------------------
  |  Branch (13453:7): [True: 0, False: 63.1k]
  ------------------
13454|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
13455|      0|        std::string_view file_view = url_data.substr(input_position);
13456|       |
13457|      0|        url.set_protocol_as_file();
13458|       |        if constexpr (result_type_is_ada_url) {
13459|       |          // Set url's host to the empty string.
13460|       |          url.host = "";
13461|      0|        } else {
13462|      0|          url.update_base_hostname("");
13463|      0|        }
13464|       |        // If c is U+002F (/) or U+005C (\), then:
13465|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (13465:13): [True: 0, False: 0]
  ------------------
13466|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13466:14): [True: 0, False: 0]
  ------------------
13467|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13467:14): [True: 0, False: 0]
  ------------------
13468|      0|          ada_log("FILE c is U+002F or U+005C");
13469|       |          // Set state to file slash state.
13470|      0|          state = state::FILE_SLASH;
13471|      0|        }
13472|       |        // Otherwise, if base is non-null and base's scheme is "file":
13473|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13473:18): [True: 0, False: 0]
  |  Branch (13473:41): [True: 0, False: 0]
  ------------------
13474|       |          // Set url's host to base's host, url's path to a clone of base's
13475|       |          // path, and url's query to base's query.
13476|      0|          ada_log("FILE base non-null");
13477|       |          if constexpr (result_type_is_ada_url) {
13478|       |            url.host = base_url->host;
13479|       |            url.path = base_url->path;
13480|       |            url.query = base_url->query;
13481|      0|          } else {
13482|      0|            url.update_host_to_base_host(base_url->get_hostname());
13483|      0|            url.update_base_pathname(base_url->get_pathname());
13484|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13484:17): [True: 0, False: 0]
  ------------------
13485|       |              // get_search() returns "" for an empty query string (URL ends
13486|       |              // with '?'). update_base_search("") would incorrectly clear the
13487|       |              // query, so pass "?" to preserve the empty query distinction.
13488|      0|              auto s = base_url->get_search();
13489|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13489:38): [True: 0, False: 0]
  ------------------
13490|      0|            }
13491|      0|          }
13492|      0|          url.has_opaque_path = base_url->has_opaque_path;
13493|       |
13494|       |          // If c is U+003F (?), then set url's query to the empty string and
13495|       |          // state to query state.
13496|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13496:15): [True: 0, False: 0]
  |  Branch (13496:47): [True: 0, False: 0]
  ------------------
13497|      0|            state = state::QUERY;
13498|      0|          }
13499|       |          // Otherwise, if c is not the EOF code point:
13500|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13500:20): [True: 0, False: 0]
  ------------------
13501|       |            // Set url's query to null.
13502|      0|            url.clear_search();
13503|       |            // If the code point substring from pointer to the end of input does
13504|       |            // not start with a Windows drive letter, then shorten url's path.
13505|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13505:17): [True: 0, False: 0]
  ------------------
13506|       |              if constexpr (result_type_is_ada_url) {
13507|       |                helpers::shorten_path(url.path, url.type);
13508|      0|              } else {
13509|      0|                std::string_view path = url.get_pathname();
13510|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13510:21): [True: 0, False: 0]
  ------------------
13511|      0|                  url.update_base_pathname(std::move(std::string(path)));
13512|      0|                }
13513|      0|              }
13514|      0|            }
13515|       |            // Otherwise:
13516|      0|            else {
13517|       |              // Set url's path to an empty list.
13518|      0|              url.clear_pathname();
13519|      0|              url.has_opaque_path = true;
13520|      0|            }
13521|       |
13522|       |            // Set state to path state and decrease pointer by 1.
13523|      0|            state = state::PATH;
13524|      0|            break;
13525|      0|          }
13526|      0|        }
13527|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13528|      0|        else {
13529|      0|          ada_log("FILE go to path");
13530|      0|          state = state::PATH;
13531|      0|          break;
13532|      0|        }
13533|       |
13534|      0|        input_position++;
13535|      0|        break;
13536|      0|      }
13537|      0|      default:
  ------------------
  |  Branch (13537:7): [True: 0, False: 63.1k]
  ------------------
13538|      0|        unreachable();
13539|  63.1k|    }
13540|  63.1k|  }
13541|  1.84k|  if constexpr (store_values) {
13542|  1.84k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13542:9): [True: 20, False: 1.82k]
  ------------------
13543|     20|      url.update_unencoded_base_hash(*fragment);
13544|     20|    }
13545|  1.84k|  }
13546|  1.84k|  enforce_max_input_length();
13547|  1.84k|  return url;
13548|  13.1k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14516|  3.08k|    ada_lifetime_bound {
14517|  3.08k|  ada_log("url_aggregator::get_hostname");
14518|       |  // Technically, we should check if there is a hostname, but
14519|       |  // the code below works even if there isn't.
14520|       |  // if(!has_hostname()) { return ""; }
14521|  3.08k|  size_t start = components.host_start;
14522|       |  // So host_start is not where the host begins.
14523|  3.08k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14523:7): [True: 326, False: 2.76k]
  ------------------
14524|    326|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14524:7): [True: 29, False: 297]
  ------------------
14525|     29|    start++;
14526|     29|  }
14527|  3.08k|  return helpers::substring(buffer, start, components.host_end);
14528|  3.08k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
14661|  2.36k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14662|  2.36k|  ada_log("parse_ipv4 ", input, " [", input.size(),
14663|  2.36k|          " bytes], overlaps with buffer: ",
14664|  2.36k|          helpers::overlaps(input, buffer) ? "yes" : "no");
14665|  2.36k|  ADA_ASSERT_TRUE(validate());
14666|  2.36k|  if (input.empty()) {
  ------------------
  |  Branch (14666:7): [True: 0, False: 2.36k]
  ------------------
14667|      0|    return is_valid = false;
14668|      0|  }
14669|  2.36k|  const bool trailing_dot = (input.back() == '.');
14670|  2.36k|  if (trailing_dot) {
  ------------------
  |  Branch (14670:7): [True: 36, False: 2.32k]
  ------------------
14671|     36|    input.remove_suffix(1);
14672|     36|    if (input.empty()) {
  ------------------
  |  Branch (14672:9): [True: 0, False: 36]
  ------------------
14673|      0|      return is_valid = false;
14674|      0|    }
14675|     36|  }
14676|       |
14677|  2.36k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
14678|  2.36k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (14678:7): [True: 7, False: 2.35k]
  ------------------
14679|       |    // Pure decimal: keep the buffer when it already holds the address.
14680|       |    // Otherwise write the (trailing-dot-stripped) input.
14681|      7|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (14681:11): [True: 4, False: 3]
  |  Branch (14681:23): [True: 1, False: 3]
  ------------------
14682|      6|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (14682:11): [True: 0, False: 6]
  ------------------
14683|      0|        update_base_hostname(std::string(input));
14684|      6|      } else {
14685|      6|        update_base_hostname(input);
14686|      6|      }
14687|      6|    }
14688|      7|    host_type = IPV4;
14689|      7|    ADA_ASSERT_TRUE(validate());
14690|      7|    return true;
14691|      7|  }
14692|       |
14693|  2.35k|  const char* p = input.data();
14694|  2.35k|  const char* end = p + input.size();
14695|  2.35k|  uint64_t ipv4 = 0;
14696|  2.35k|  int digit_count = 0;
14697|  2.35k|  int pure_decimal_count = 0;
14698|       |
14699|  2.56k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (14699:10): [True: 2.56k, False: 4]
  |  Branch (14699:29): [True: 2.56k, False: 0]
  ------------------
14700|  2.56k|    uint64_t segment = 0;
14701|  2.56k|    bool pure = false;
14702|  2.56k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (14702:9): [True: 1.61k, False: 943]
  ------------------
14703|  1.61k|      return is_valid = false;
14704|  1.61k|    }
14705|    943|    if (pure) {
  ------------------
  |  Branch (14705:9): [True: 719, False: 224]
  ------------------
14706|    719|      ++pure_decimal_count;
14707|    719|    }
14708|    943|    if (p >= end) {
  ------------------
  |  Branch (14708:9): [True: 704, False: 239]
  ------------------
14709|    704|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
14710|    704|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (14710:11): [True: 10, False: 694]
  ------------------
14711|     10|        return is_valid = false;
14712|     10|      }
14713|    694|      ipv4 = (ipv4 << shift) | segment;
14714|    694|      goto ipv4_done;
14715|    704|    }
14716|    239|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (14716:9): [True: 29, False: 210]
  |  Branch (14716:26): [True: 0, False: 210]
  ------------------
14717|     29|      return is_valid = false;
14718|     29|    }
14719|    210|    ipv4 = (ipv4 << 8) | segment;
14720|    210|    ++p;
14721|    210|  }
14722|      4|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (14722:7): [True: 0, False: 4]
  |  Branch (14722:27): [True: 4, False: 0]
  ------------------
14723|      4|    return is_valid = false;
14724|      4|  }
14725|    694|ipv4_done:
14726|    694|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
14727|    694|          " host: ", get_host());
14728|    694|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (14728:7): [True: 668, False: 26]
  |  Branch (14728:19): [True: 0, False: 668]
  |  Branch (14728:46): [True: 0, False: 0]
  ------------------
14729|      0|    ada_log(
14730|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
14731|      0|        "buffer");
14732|    694|  } else {
14733|    694|    update_base_hostname(ada::serializers::ipv4(ipv4));
14734|    694|  }
14735|    694|  host_type = IPV4;
14736|    694|  ADA_ASSERT_TRUE(validate());
14737|    694|  return true;
14738|      4|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14740|  7.09k|bool url_aggregator::parse_ipv6(std::string_view input) {
14741|  7.09k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
14742|  7.09k|  ADA_ASSERT_TRUE(validate());
14743|  7.09k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14744|  7.09k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (14744:7): [True: 3, False: 7.08k]
  |  Branch (14744:24): [True: 2, False: 7.08k]
  ------------------
14745|      5|    return is_valid = false;
14746|      5|  }
14747|  7.08k|  std::array<uint16_t, 8> address{};
14748|       |#if defined(ADA_AVX512_IPV6)
14749|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
14750|       |                                                     address, simd_valid)) {
14751|       |    if (!simd_valid) [[unlikely]] {
14752|       |      return is_valid = false;
14753|       |    }
14754|       |    const std::string serialized = ada::serializers::ipv6(address);
14755|       |    if (get_hostname() != serialized) {
14756|       |      update_base_hostname(serialized);
14757|       |    }
14758|       |    host_type = IPV6;
14759|       |    return true;
14760|       |  }
14761|       |  address = {};
14762|       |#endif
14763|  7.08k|  const char* pointer = input.data();
14764|  7.08k|  const char* const end = pointer + input.size();
14765|  7.08k|  int piece_index = 0;
14766|  7.08k|  int compress = -1;
14767|       |
14768|  7.08k|  if (*pointer == ':') {
  ------------------
  |  Branch (14768:7): [True: 13, False: 7.07k]
  ------------------
14769|     13|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (14769:9): [True: 1, False: 12]
  |  Branch (14769:30): [True: 1, False: 11]
  ------------------
14770|      2|      return is_valid = false;
14771|      2|    }
14772|     11|    pointer += 2;
14773|     11|    compress = ++piece_index;
14774|     11|  }
14775|       |
14776|  7.28k|  while (pointer != end) {
  ------------------
  |  Branch (14776:10): [True: 7.24k, False: 38]
  ------------------
14777|  7.24k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (14777:9): [True: 2, False: 7.24k]
  ------------------
14778|      2|      return is_valid = false;
14779|      2|    }
14780|  7.24k|    if (*pointer == ':') {
  ------------------
  |  Branch (14780:9): [True: 14, False: 7.22k]
  ------------------
14781|     14|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (14781:11): [True: 1, False: 13]
  ------------------
14782|      1|        return is_valid = false;
14783|      1|      }
14784|     13|      ++pointer;
14785|     13|      compress = ++piece_index;
14786|     13|      continue;
14787|     14|    }
14788|       |
14789|  7.22k|    uint16_t value = 0;
14790|  7.22k|    const int length = detail::parse_hex_piece(pointer, end, value);
14791|       |
14792|  7.22k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (14792:9): [True: 7.19k, False: 31]
  |  Branch (14792:27): [True: 60, False: 7.13k]
  ------------------
14793|     60|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14793:11): [True: 2, False: 58]
  ------------------
14794|      2|        return is_valid = false;
14795|      2|      }
14796|     58|      pointer -= length;
14797|     58|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (14797:11): [True: 1, False: 57]
  ------------------
14798|      1|        return is_valid = false;
14799|      1|      }
14800|       |
14801|     57|      int numbers_seen = 0;
14802|    150|      while (pointer != end) {
  ------------------
  |  Branch (14802:14): [True: 142, False: 8]
  ------------------
14803|    142|        int ipv4_piece = -1;
14804|    142|        if (numbers_seen > 0) {
  ------------------
  |  Branch (14804:13): [True: 85, False: 57]
  ------------------
14805|     85|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (14805:15): [True: 62, False: 23]
  |  Branch (14805:34): [True: 60, False: 2]
  ------------------
14806|     60|            ++pointer;
14807|     60|          } else {
14808|     25|            return is_valid = false;
14809|     25|          }
14810|     85|        }
14811|    117|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (14811:13): [True: 11, False: 106]
  |  Branch (14811:31): [True: 4, False: 102]
  |  Branch (14811:49): [True: 4, False: 98]
  ------------------
14812|     19|          return is_valid = false;
14813|     19|        }
14814|     98|        ipv4_piece = *pointer - '0';
14815|     98|        ++pointer;
14816|     98|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14816:13): [True: 94, False: 4]
  |  Branch (14816:31): [True: 43, False: 51]
  |  Branch (14816:50): [True: 38, False: 5]
  ------------------
14817|     38|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (14817:15): [True: 2, False: 36]
  ------------------
14818|      2|            return is_valid = false;
14819|      2|          }
14820|     36|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14821|     36|          ++pointer;
14822|     36|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14822:15): [True: 35, False: 1]
  |  Branch (14822:33): [True: 21, False: 14]
  |  Branch (14822:52): [True: 18, False: 3]
  ------------------
14823|     18|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14824|     18|            ++pointer;
14825|     18|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (14825:17): [True: 3, False: 15]
  ------------------
14826|      3|              return is_valid = false;
14827|      3|            }
14828|     18|          }
14829|     36|        }
14830|     93|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
14831|     93|            address[static_cast<size_t>(piece_index)] * 0x100 +
14832|     93|            static_cast<uint16_t>(ipv4_piece));
14833|     93|        ++numbers_seen;
14834|     93|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (14834:13): [True: 27, False: 66]
  |  Branch (14834:34): [True: 6, False: 60]
  ------------------
14835|     33|          ++piece_index;
14836|     33|        }
14837|     93|      }
14838|      8|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (14838:11): [True: 5, False: 3]
  ------------------
14839|      5|        return is_valid = false;
14840|      5|      }
14841|      3|      break;
14842|      8|    }
14843|       |
14844|  7.16k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14844:9): [True: 6.97k, False: 198]
  ------------------
14845|  6.97k|      return is_valid = false;
14846|  6.97k|    }
14847|       |
14848|    198|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (14848:9): [True: 167, False: 31]
  |  Branch (14848:27): [True: 159, False: 8]
  ------------------
14849|    159|      ++pointer;
14850|    159|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (14850:11): [True: 5, False: 154]
  ------------------
14851|      5|        return is_valid = false;
14852|      5|      }
14853|    159|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (14853:16): [True: 8, False: 31]
  ------------------
14854|      8|      return is_valid = false;
14855|      8|    }
14856|       |
14857|    185|    address[static_cast<size_t>(piece_index)] = value;
14858|    185|    ++piece_index;
14859|    185|  }
14860|       |
14861|     41|  if (compress != -1) {
  ------------------
  |  Branch (14861:7): [True: 20, False: 21]
  ------------------
14862|     20|    const int right = piece_index - compress;
14863|     20|    if (right > 0) {
  ------------------
  |  Branch (14863:9): [True: 13, False: 7]
  ------------------
14864|     13|      const size_t dest = static_cast<size_t>(8 - right);
14865|     13|      const size_t src = static_cast<size_t>(compress);
14866|     13|      if (dest != src) {
  ------------------
  |  Branch (14866:11): [True: 11, False: 2]
  ------------------
14867|     40|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (14867:53): [True: 29, False: 11]
  ------------------
14868|     29|          address[dest + i] = address[src + i];
14869|     29|          address[src + i] = 0;
14870|     29|        }
14871|     11|      }
14872|     13|    }
14873|     21|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (14873:14): [True: 18, False: 3]
  ------------------
14874|     18|    return is_valid = false;
14875|     18|  }
14876|       |
14877|       |  // Serialize once; skip rewrite when hostname is already canonical.
14878|     23|  const std::string serialized = ada::serializers::ipv6(address);
14879|     23|  const std::string_view current = get_hostname();
14880|     23|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (14880:7): [True: 0, False: 23]
  ------------------
14881|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (14881:7): [True: 0, False: 0]
  ------------------
14882|      0|    ada_log("parse_ipv6 in-place canonical match");
14883|     23|  } else {
14884|     23|    update_base_hostname(serialized);
14885|     23|  }
14886|     23|  ada_log("parse_ipv6 ", get_hostname());
14887|     23|  ADA_ASSERT_TRUE(validate());
14888|     23|  host_type = IPV6;
14889|     23|  return true;
14890|     41|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  272|  57.1k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  273|       |    // -65 is 0b10111111, anything larger in two-complement's
  274|       |    // should start a new code point.
  275|  57.1k|    return c > -65;
  276|  57.1k|  });
_ZN3ada4idna7deflate22make_fixed_litlen_huffEv:
  483|      2|inline Huff make_fixed_litlen_huff() {
  484|      2|  Huff h;
  485|      2|  uint8_t lens[288];
  486|       |  // Fixed Huffman: 0-143:8, 144-255:9, 256-279:7, 280-287:8
  487|    290|  for (int i = 0; i <= 143; i++) lens[i] = 8;
  ------------------
  |  Branch (487:19): [True: 288, False: 2]
  ------------------
  488|    226|  for (int i = 144; i <= 255; i++) lens[i] = 9;
  ------------------
  |  Branch (488:21): [True: 224, False: 2]
  ------------------
  489|     50|  for (int i = 256; i <= 279; i++) lens[i] = 7;
  ------------------
  |  Branch (489:21): [True: 48, False: 2]
  ------------------
  490|     18|  for (int i = 280; i <= 287; i++) lens[i] = 8;
  ------------------
  |  Branch (490:21): [True: 16, False: 2]
  ------------------
  491|      2|  h.build(lens, 288);
  492|      2|  return h;
  493|      2|}
_ZN3ada4idna7deflate4Huff5buildEPKhi:
  432|     16|  bool build(const uint8_t* lens, int n) {
  433|     16|    std::memset(counts, 0, sizeof(counts));
  434|     16|    std::memset(first_code, 0, sizeof(first_code));
  435|     16|    std::memset(base_idx, 0, sizeof(base_idx));
  436|     16|    nsymbols = n;
  437|     16|    max_bits = 0;
  438|  1.98k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (438:21): [True: 1.96k, False: 16]
  ------------------
  439|  1.96k|      lengths[i] = lens[i];
  440|  1.96k|      if (lens[i]) {
  ------------------
  |  Branch (440:11): [True: 1.91k, False: 49]
  ------------------
  441|  1.91k|        counts[lens[i]]++;
  442|  1.91k|        if (lens[i] > max_bits) max_bits = lens[i];
  ------------------
  |  Branch (442:13): [True: 46, False: 1.87k]
  ------------------
  443|  1.91k|      }
  444|  1.96k|    }
  445|       |    // Canonical first code for each bit length (RFC 1951).
  446|     16|    int code = 0;
  447|    256|    for (int bits = 1; bits <= MAXBITS; bits++) {
  ------------------
  |  Branch (447:24): [True: 240, False: 16]
  ------------------
  448|    240|      code = (code + counts[bits - 1]) << 1;
  449|    240|      first_code[bits] = code;
  450|    240|    }
  451|     16|    int idx = 0;
  452|    158|    for (int bits = 1; bits <= max_bits; bits++) {
  ------------------
  |  Branch (452:24): [True: 142, False: 16]
  ------------------
  453|    142|      base_idx[bits] = idx;
  454|       |      // assign symbols in symbol order for codes of this length
  455|  21.6k|      for (int sym = 0; sym < n; sym++) {
  ------------------
  |  Branch (455:25): [True: 21.5k, False: 142]
  ------------------
  456|  21.5k|        if (lengths[sym] == bits) {
  ------------------
  |  Branch (456:13): [True: 1.91k, False: 19.6k]
  ------------------
  457|  1.91k|          symbols[idx++] = static_cast<int16_t>(sym);
  458|  1.91k|        }
  459|  21.5k|      }
  460|    142|    }
  461|     16|    return true;
  462|     16|  }
_ZN3ada4idna7deflate20make_fixed_dist_huffEv:
  495|      2|inline Huff make_fixed_dist_huff() {
  496|      2|  Huff h;
  497|      2|  uint8_t lens[32];
  498|     66|  for (int i = 0; i < 32; i++) lens[i] = 5;
  ------------------
  |  Branch (498:19): [True: 64, False: 2]
  ------------------
  499|      2|  h.build(lens, 32);
  500|      2|  return h;
  501|      2|}
_ZN3ada4idna7deflate9BitReader6ensureEi:
  392|   457k|  bool ensure(int n) {
  393|   520k|    while (bits < n) {
  ------------------
  |  Branch (393:12): [True: 62.3k, False: 457k]
  ------------------
  394|  62.3k|      if (p >= end) return false;
  ------------------
  |  Branch (394:11): [True: 0, False: 62.3k]
  ------------------
  395|  62.3k|      acc |= uint32_t(*p++) << bits;
  396|  62.3k|      bits += 8;
  397|  62.3k|    }
  398|   457k|    return true;
  399|   457k|  }
serializers.cc:_ZZN3ada4idna9ascii_mapEPcmENK3$_0clEh:
 5127|    447|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    447|    return 0x101010101010101ull * v;
 5129|    447|  };
_ZN3ada4idna13ensure_tablesEv:
 4878|  9.05k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4879|  9.05k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4880|  9.05k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4880:7): [True: 9.04k, False: 1]
  ------------------
 4881|  9.04k|    return true;
 4882|  9.04k|  }
 4883|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4883:7): [True: 0, False: 1]
  ------------------
 4884|      0|    return false;
 4885|      0|  }
 4886|       |
 4887|      1|  uint8_t expected = kTablesUninit;
 4888|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4888:7): [True: 1, False: 0]
  ------------------
 4889|      1|                                                std::memory_order_acq_rel,
 4890|      1|                                                std::memory_order_acquire)) {
 4891|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4892|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4892:9): [True: 0, False: 1]
  ------------------
 4893|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4894|      0|      return false;
 4895|      0|    }
 4896|       |
 4897|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4898|      1|                                          table_blob::compressed_size, buffer,
 4899|      1|                                          table_blob::uncompressed_size);
 4900|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4900:9): [True: 0, False: 1]
  ------------------
 4901|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4901:9): [True: 0, False: 1]
  ------------------
 4902|      0|      delete[] buffer;
 4903|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4904|      0|      return false;
 4905|      0|    }
 4906|       |
 4907|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4908|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4909|       |
 4910|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|      1|      return buffer + off;
 4912|      1|    };
 4913|       |
 4914|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4915|       |    // acquire on tables_init_state and then observe these writes.
 4916|      1|    idna_stage1 =
 4917|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4918|      1|    idna_stage2 =
 4919|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4920|      1|    idna_bool_blocks =
 4921|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4922|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4923|       |
 4924|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4925|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4926|      1|        at(table_blob::off_decomposition_block));
 4927|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4928|      1|        at(table_blob::off_decomposition_data));
 4929|      1|    ccc_index = at(table_blob::off_ccc_index);
 4930|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4931|      1|    composition_index = at(table_blob::off_composition_index);
 4932|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_composition_block));
 4934|      1|    composition_data =
 4935|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4936|       |
 4937|      1|    id_continue =
 4938|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4939|      1|    id_start =
 4940|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4941|       |
 4942|      1|    dir_start =
 4943|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4944|      1|    dir_final =
 4945|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4946|      1|    dir_value = at(table_blob::off_dir_value);
 4947|      1|    combining_ranges =
 4948|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4949|       |
 4950|      1|    tables_buffer = buffer;
 4951|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4952|      1|    return true;
 4953|      1|  }
 4954|       |
 4955|       |  // Another thread owns init (or finished between our loads).
 4956|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4956:28): [True: 0, False: 0]
  ------------------
 4957|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4958|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4958:9): [True: 0, False: 0]
  ------------------
 4959|      0|      return true;
 4960|      0|    }
 4961|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4961:9): [True: 0, False: 0]
  ------------------
 4962|      0|      return false;
 4963|      0|    }
 4964|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4965|      0|    defined(_M_IX86)
 4966|      0|#if defined(__GNUC__) || defined(__clang__)
 4967|      0|    __builtin_ia32_pause();
 4968|      0|#endif
 4969|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4970|       |#if defined(__GNUC__) || defined(__clang__)
 4971|       |    asm volatile("yield" ::: "memory");
 4972|       |#endif
 4973|       |#endif
 4974|      0|  }
 4975|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4976|      0|  return false;
 4977|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  528|      1|                          size_t dst_cap) {
  529|      1|  BitReader br(src, src_len);
  530|      1|  size_t out = 0;
  531|      4|  for (;;) {
  532|      4|    uint32_t bfinal = br.get(1);
  533|      4|    uint32_t btype = br.get(2);
  534|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (534:9): [True: 0, False: 4]
  |  Branch (534:33): [True: 0, False: 4]
  ------------------
  535|      4|    if (btype == 0) {
  ------------------
  |  Branch (535:9): [True: 0, False: 4]
  ------------------
  536|       |      // stored
  537|      0|      br.align_byte();
  538|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (538:11): [True: 0, False: 0]
  ------------------
  539|       |      // read 16+16 from bit buffer awkwardly - use byte path
  540|       |      // Align: bits is multiple of 8
  541|       |      // Get len from remaining bits then bytes
  542|      0|      uint32_t len = br.get(16);
  543|      0|      uint32_t nlen = br.get(16);
  544|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (544:11): [True: 0, False: 0]
  |  Branch (544:32): [True: 0, False: 0]
  ------------------
  545|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // After get, may have bits in acc from previous - for stored, should be
  547|       |      // byte aligned Copy len bytes from p
  548|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (548:11): [True: 0, False: 0]
  ------------------
  549|       |        // leftover bits should be 0 if aligned
  550|      0|      }
  551|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  ------------------
  552|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|      0|      std::memcpy(dst + out, br.p, len);
  554|      0|      br.p += len;
  555|      0|      out += len;
  556|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (556:16): [True: 0, False: 4]
  |  Branch (556:30): [True: 4, False: 0]
  ------------------
  557|      4|      Huff lit, dist;
  558|      4|      if (btype == 1) {
  ------------------
  |  Branch (558:11): [True: 0, False: 4]
  ------------------
  559|       |        // use fixed via functions
  560|      4|      } else {
  561|       |        // dynamic
  562|      4|        uint32_t hlit = br.get(5);
  563|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (563:13): [True: 0, False: 4]
  ------------------
  564|      4|        hlit += 257;
  565|      4|        uint32_t hdist = br.get(5);
  566|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (566:13): [True: 0, False: 4]
  ------------------
  567|      4|        hdist += 1;
  568|      4|        uint32_t hclen = br.get(4);
  569|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (569:13): [True: 0, False: 4]
  ------------------
  570|      4|        hclen += 4;
  571|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  572|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  573|      4|        uint8_t clen[19]{};
  574|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (574:30): [True: 65, False: 4]
  ------------------
  575|     65|          uint32_t v = br.get(3);
  576|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:15): [True: 0, False: 65]
  ------------------
  577|     65|          clen[order[i]] = uint8_t(v);
  578|     65|        }
  579|      4|        Huff cl;
  580|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (580:13): [True: 0, False: 4]
  ------------------
  581|      4|        uint8_t lens[288 + 32]{};
  582|      4|        uint32_t n = hlit + hdist;
  583|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (583:30): [True: 1.08k, False: 4]
  ------------------
  584|  1.08k|          int sym = cl.decode(br);
  585|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (585:15): [True: 0, False: 1.08k]
  ------------------
  586|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (586:15): [True: 1.03k, False: 49]
  ------------------
  587|  1.03k|            lens[i++] = uint8_t(sym);
  588|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (588:22): [True: 49, False: 0]
  ------------------
  589|     49|            uint32_t rep = br.get(2);
  590|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 49]
  ------------------
  591|     49|            rep += 3;
  592|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (592:17): [True: 0, False: 49]
  ------------------
  593|     49|            uint8_t v = lens[i - 1];
  594|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (594:20): [True: 214, False: 49]
  ------------------
  595|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (595:22): [True: 0, False: 0]
  ------------------
  596|      0|            uint32_t rep = br.get(3);
  597|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 0]
  ------------------
  598|      0|            rep += 3;
  599|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (599:20): [True: 0, False: 0]
  ------------------
  600|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (600:22): [True: 0, False: 0]
  ------------------
  601|      0|            uint32_t rep = br.get(7);
  602|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|            rep += 11;
  604|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (604:20): [True: 0, False: 0]
  ------------------
  605|      0|          } else
  606|      0|            return 0;
  607|  1.08k|        }
  608|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (608:13): [True: 0, False: 4]
  ------------------
  609|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (609:13): [True: 0, False: 4]
  ------------------
  610|      4|      }
  611|  52.2k|      for (;;) {
  612|  52.2k|        int sym;
  613|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (613:13): [True: 0, False: 52.2k]
  ------------------
  614|      0|          sym = fixed_litlen(br);
  615|  52.2k|        else
  616|  52.2k|          sym = lit.decode(br);
  617|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (617:13): [True: 0, False: 52.2k]
  ------------------
  618|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (618:13): [True: 37.2k, False: 14.9k]
  ------------------
  619|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (619:15): [True: 0, False: 37.2k]
  ------------------
  620|  37.2k|          dst[out++] = uint8_t(sym);
  621|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (621:20): [True: 4, False: 14.9k]
  ------------------
  622|      4|          break;
  623|  14.9k|        } else {
  624|  14.9k|          int len_code = sym - 257;
  625|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (625:15): [True: 0, False: 14.9k]
  |  Branch (625:31): [True: 0, False: 14.9k]
  ------------------
  626|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  627|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (627:15): [True: 2.03k, False: 12.9k]
  |  Branch (627:38): [True: 0, False: 2.03k]
  ------------------
  628|  14.9k|          uint32_t length =
  629|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (629:37): [True: 2.03k, False: 12.9k]
  ------------------
  630|  14.9k|          int dsym;
  631|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (631:15): [True: 0, False: 14.9k]
  ------------------
  632|      0|            dsym = fixed_dist(br);
  633|  14.9k|          else
  634|  14.9k|            dsym = dist.decode(br);
  635|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (635:15): [True: 0, False: 14.9k]
  |  Branch (635:27): [True: 0, False: 14.9k]
  ------------------
  636|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  637|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (637:15): [True: 9.97k, False: 5.01k]
  |  Branch (637:35): [True: 0, False: 9.97k]
  ------------------
  638|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (638:50): [True: 9.97k, False: 5.01k]
  ------------------
  639|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (639:15): [True: 0, False: 14.9k]
  |  Branch (639:33): [True: 0, False: 14.9k]
  ------------------
  640|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (640:32): [True: 187k, False: 14.9k]
  ------------------
  641|   187k|            dst[out] = dst[out - distance];
  642|   187k|            out++;
  643|   187k|          }
  644|  14.9k|        }
  645|  52.2k|      }
  646|      4|    } else {
  647|      0|      return 0;  // reserved
  648|      0|    }
  649|      4|    if (bfinal) break;
  ------------------
  |  Branch (649:9): [True: 1, False: 3]
  ------------------
  650|      4|  }
  651|      1|  return out;
  652|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  390|      1|      : p(data), end(data + len) {}
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  464|  68.3k|  int decode(BitReader& br) const {
  465|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (465:9): [True: 0, False: 68.3k]
  ------------------
  466|  68.3k|    int code = 0;
  467|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (467:23): [True: 427k, False: 0]
  ------------------
  468|   427k|      uint32_t b = br.get(1);
  469|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (469:11): [True: 0, False: 427k]
  ------------------
  470|   427k|      code = (code << 1) | int(b);
  471|   427k|      int first = first_code[len];
  472|   427k|      int cnt = counts[len];
  473|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (473:11): [True: 263k, False: 164k]
  |  Branch (473:18): [True: 68.3k, False: 195k]
  ------------------
  474|  68.3k|        return symbols[base_idx[len] + (code - first)];
  475|  68.3k|      }
  476|   427k|    }
  477|      0|    return -1;
  478|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4861|      1|                                         size_t len) noexcept {
 4862|      1|  uint32_t c = 0xFFFFFFFFu;
 4863|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4863:22): [True: 224k, False: 1]
  ------------------
 4864|   224k|    c ^= data[i];
 4865|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4865:21): [True: 1.79M, False: 224k]
  ------------------
 4866|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4867|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4868|  1.79M|    }
 4869|   224k|  }
 4870|      1|  return ~c;
 4871|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4684|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4685|      1|  if constexpr (std::endian::native == std::endian::little) {
 4686|      1|    (void)buffer;
 4687|      1|    return;
 4688|      1|  }
 4689|      0|  auto u16 = [&](size_t off, size_t count) {
 4690|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4691|      1|  };
 4692|      1|  auto u32 = [&](size_t off, size_t count) {
 4693|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4694|      1|  };
 4695|      1|  auto u64 = [&](size_t off, size_t count) {
 4696|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4697|      1|  };
 4698|       |
 4699|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4700|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4701|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4702|      1|  u16(table_blob::off_decomposition_block,
 4703|      1|      table_blob::count_decomposition_block);
 4704|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4705|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4706|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4707|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4708|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4709|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4710|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4711|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4712|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4910|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|     18|      return buffer + off;
 4912|     18|    };
serializers.cc:_ZN3ada4idnaL11idna_lookupEj:
 5065|  91.0k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5066|  91.0k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5066:7): [True: 90.3k, False: 699]
  ------------------
 5067|  90.3k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5068|  90.3k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5068:9): [True: 46.0k, False: 44.2k]
  ------------------
 5069|  46.0k|      uint32_t bit_idx =
 5070|  46.0k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5071|  46.0k|          (cp & IDNA_BLOCK_MASK);
 5072|  46.0k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5073|  46.0k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5073:14): [True: 46.0k, False: 7]
  ------------------
 5074|  46.0k|    }
 5075|  44.2k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5076|  90.3k|  }
 5077|       |
 5078|    699|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5078:7): [True: 662, False: 37]
  |  Branch (5078:40): [True: 539, False: 123]
  ------------------
 5079|    539|    return IDNA_IGNORED;
 5080|    539|  }
 5081|       |
 5082|    160|  return IDNA_DISALLOWED;
 5083|    699|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5108|  10.0k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5109|  10.0k|  size_t n = 0;
 5110|  63.0k|  while (*ptr != 0) {
  ------------------
  |  Branch (5110:10): [True: 52.9k, False: 10.0k]
  ------------------
 5111|  52.9k|    ++n;
 5112|  52.9k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5112:9): [True: 14.0k, False: 38.9k]
  ------------------
 5113|  14.0k|      ++ptr;
 5114|  38.9k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5114:16): [True: 26.6k, False: 12.2k]
  ------------------
 5115|  26.6k|      ptr += 2;
 5116|  26.6k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5116:16): [True: 11.8k, False: 427]
  ------------------
 5117|  11.8k|      ptr += 3;
 5118|  11.8k|    } else {
 5119|    427|      ptr += 4;
 5120|    427|    }
 5121|  52.9k|  }
 5122|  10.0k|  return n;
 5123|  10.0k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5086|  52.8k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5087|  52.8k|  uint8_t b0 = *ptr++;
 5088|  52.8k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5088:7): [True: 14.0k, False: 38.7k]
  ------------------
 5089|  38.7k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5089:7): [True: 26.5k, False: 12.2k]
  ------------------
 5090|  26.5k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5091|  26.5k|    cp |= (*ptr++ & 0x3Fu);
 5092|  26.5k|    return static_cast<char32_t>(cp);
 5093|  26.5k|  }
 5094|  12.2k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5094:7): [True: 11.8k, False: 427]
  ------------------
 5095|  11.8k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5096|  11.8k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5097|  11.8k|    cp |= (*ptr++ & 0x3Fu);
 5098|  11.8k|    return static_cast<char32_t>(cp);
 5099|  11.8k|  }
 5100|    427|  uint32_t cp = (b0 & 0x07u) << 18;
 5101|    427|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5102|    427|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5103|    427|  cp |= (*ptr++ & 0x3Fu);
 5104|    427|  return static_cast<char32_t>(cp);
 5105|  12.2k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4982|   187k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4983|   187k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4983:7): [True: 0, False: 187k]
  ------------------
 4984|      0|    bi = 0;
 4985|      0|  }
 4986|   187k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4987|   187k|}
_ZN3ada4idna13ccc_block_rowEh:
 4989|   278k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4990|   278k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 278k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|   278k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 4994|   278k|}
_ZN3ada4idna16tables_are_readyEv:
 4873|  3.75k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4874|  3.75k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4875|  3.75k|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5265|   164k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5266|   164k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5266:7): [True: 7.94k, False: 156k]
  ------------------
 5267|  7.94k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5267:7): [True: 3.85k, False: 4.08k]
  ------------------
 5268|       |    // Hangul precomposed syllables are NFC.
 5269|  3.85k|    return 0;
 5270|  3.85k|  }
 5271|   160k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5271:7): [True: 0, False: 160k]
  ------------------
 5272|      0|    return 0;
 5273|      0|  }
 5274|   160k|  const uint8_t di = decomposition_index[current_character >> 8];
 5275|   160k|  const uint16_t* const decomposition =
 5276|   160k|      decomposition_block_row(di) + (current_character % 256);
 5277|   160k|  size_t decomposition_length =
 5278|   160k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5279|   160k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5279:7): [True: 5.26k, False: 154k]
  |  Branch (5279:37): [True: 0, False: 5.26k]
  ------------------
 5280|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5281|      0|  }
 5282|   160k|  return decomposition_length;
 5283|   160k|}
serializers.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5466|  78.6k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5467|  78.6k|  const size_t length = canonical_decomp_length(c);
 5468|  78.6k|  if (length == 0) {
  ------------------
  |  Branch (5468:7): [True: 76.1k, False: 2.48k]
  ------------------
 5469|  76.1k|    return get_ccc(c);
 5470|  76.1k|  }
 5471|  2.48k|  const uint16_t* const decomposition =
 5472|  2.48k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5473|  2.48k|  const size_t base = decomposition[0] >> 2;
 5474|  2.48k|  return get_ccc(decomposition_data[base + length - 1]);
 5475|  78.6k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5397|  2.65k|static bool would_compose(std::u32string_view input) noexcept {
 5398|  70.1k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5398:32): [True: 68.1k, False: 1.91k]
  ------------------
 5399|  68.1k|    const char32_t current = input[input_count];
 5400|  68.1k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5400:9): [True: 15.6k, False: 52.5k]
  |  Branch (5400:36): [True: 508, False: 15.1k]
  ------------------
 5401|    508|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5401:11): [True: 487, False: 21]
  ------------------
 5402|    487|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5402:11): [True: 238, False: 249]
  ------------------
 5403|    238|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5403:11): [True: 66, False: 172]
  ------------------
 5404|     66|        return true;
 5405|     66|      }
 5406|    442|      ++input_count;
 5407|    442|      continue;
 5408|    508|    }
 5409|  67.6k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5409:9): [True: 2.19k, False: 65.4k]
  |  Branch (5409:36): [True: 1.37k, False: 812]
  ------------------
 5410|  1.37k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5410:11): [True: 1.01k, False: 368]
  ------------------
 5411|  1.01k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5411:11): [True: 990, False: 20]
  ------------------
 5412|    990|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5412:11): [True: 832, False: 158]
  ------------------
 5413|    832|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5413:11): [True: 132, False: 700]
  ------------------
 5414|    132|        return true;
 5415|    132|      }
 5416|  1.24k|      ++input_count;
 5417|  1.24k|      continue;
 5418|  1.37k|    }
 5419|  66.3k|    if (current < 0x110000) {
  ------------------
  |  Branch (5419:9): [True: 66.3k, False: 0]
  ------------------
 5420|  66.3k|      const uint16_t* composition =
 5421|  66.3k|          composition_block_row(composition_index[current >> 8]) +
 5422|  66.3k|          (current % 256);
 5423|  66.3k|      int32_t previous_ccc = -1;
 5424|  66.3k|      size_t j = input_count;
 5425|  67.4k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5425:14): [True: 65.5k, False: 1.86k]
  ------------------
 5426|  65.5k|        uint8_t ccc = get_ccc(input[j + 1]);
 5427|  65.5k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5427:13): [True: 17.3k, False: 48.2k]
  |  Branch (5427:49): [True: 16.8k, False: 413]
  ------------------
 5428|  16.8k|          int left = composition[0];
 5429|  16.8k|          int right = composition[1];
 5430|  16.8k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5430:15): [True: 0, False: 16.8k]
  |  Branch (5430:27): [True: 0, False: 16.8k]
  ------------------
 5431|  16.8k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5431:15): [True: 0, False: 16.8k]
  ------------------
 5432|      0|            break;
 5433|      0|          }
 5434|  37.9k|          while (left + 2 < right) {
  ------------------
  |  Branch (5434:18): [True: 21.0k, False: 16.8k]
  ------------------
 5435|  21.0k|            int middle = left + (((right - left) >> 1) & ~1);
 5436|  21.0k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5436:17): [True: 1.78k, False: 19.2k]
  ------------------
 5437|  1.78k|              left = middle;
 5438|  1.78k|            }
 5439|  21.0k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5439:17): [True: 19.7k, False: 1.33k]
  ------------------
 5440|  19.7k|              right = middle;
 5441|  19.7k|            }
 5442|  21.0k|          }
 5443|  16.8k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5443:15): [True: 16.8k, False: 0]
  ------------------
 5444|  16.8k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5444:15): [True: 542, False: 16.3k]
  ------------------
 5445|    542|            return true;
 5446|    542|          }
 5447|  16.8k|        }
 5448|  64.9k|        if (ccc == 0) {
  ------------------
  |  Branch (5448:13): [True: 63.8k, False: 1.09k]
  ------------------
 5449|  63.8k|          break;
 5450|  63.8k|        }
 5451|  1.09k|        previous_ccc = ccc;
 5452|  1.09k|      }
 5453|  65.7k|      input_count = j + 1;
 5454|  65.7k|      continue;
 5455|  66.3k|    }
 5456|      0|    ++input_count;
 5457|      0|  }
 5458|  1.91k|  return false;
 5459|  2.65k|}
_ZN3ada4idna21composition_block_rowEh:
 4996|  80.9k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 4997|  80.9k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 80.9k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|  80.9k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5001|  80.9k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5643|  12.8k|static constexpr int32_t char_to_digit_value(char value) {
 5644|  12.8k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5644:7): [True: 10.4k, False: 2.40k]
  |  Branch (5644:23): [True: 10.4k, False: 1]
  ------------------
 5645|  2.40k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5645:7): [True: 2.40k, False: 4]
  |  Branch (5645:23): [True: 2.39k, False: 5]
  ------------------
 5646|      9|  return -1;
 5647|  2.40k|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5653|  29.9k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5654|  29.9k|  if (firsttime) {
  ------------------
  |  Branch (5654:7): [True: 4.36k, False: 25.5k]
  ------------------
 5655|  4.36k|    d = d / damp;
 5656|  25.5k|  } else {
 5657|  25.5k|    d = d / 2;
 5658|  25.5k|  }
 5659|  29.9k|  d += d / n;
 5660|  29.9k|  int32_t k = 0;
 5661|  33.1k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5661:10): [True: 3.19k, False: 29.9k]
  ------------------
 5662|  3.19k|    d /= base - tmin;
 5663|  3.19k|    k += base;
 5664|  3.19k|  }
 5665|  29.9k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5666|  29.9k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5649|  38.7k|static constexpr char digit_to_char(int32_t digit) {
 5650|  38.7k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5650:10): [True: 32.0k, False: 6.75k]
  ------------------
 5651|  38.7k|}
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5988|  38.7k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6073|    752|      auto is_l_or_d = [](uint32_t code) {
 6074|    752|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6074:16): [True: 26, False: 726]
  ------------------
 6075|    726|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6075:16): [True: 238, False: 488]
  ------------------
 6076|    752|      };
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6077|  1.22k|      auto is_r_or_d = [](uint32_t code) {
 6078|  1.22k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6078:16): [True: 112, False: 1.11k]
  ------------------
 6079|  1.11k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6079:16): [True: 69, False: 1.04k]
  ------------------
 6080|  1.22k|      };
serializers.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5935|  4.04k|    const std::u32string_view label) noexcept {
 5936|  4.91k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5936:52): [True: 4.91k, False: 0]
  ------------------
 5937|  4.91k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5937:9): [True: 4.04k, False: 875]
  ------------------
 5938|       |
 5939|      0|  return std::u32string_view::npos;
 5940|  4.04k|}
serializers.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  4.04k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5945|  4.04k|  const size_t mask =
 5946|  4.04k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5947|       |
 5948|  4.04k|  size_t directions = 0;
 5949|  39.2k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5949:22): [True: 35.2k, False: 4.04k]
  ------------------
 5950|  35.2k|    directions |= 1u << find_direction(label[i]);
 5951|  35.2k|  }
 5952|  4.04k|  return (directions & mask) != 0;
 5953|  4.04k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 5916|  46.8k|inline static direction find_direction(uint32_t code_point) noexcept {
 5917|       |  // Binary search on dir_final (sorted upper bounds).
 5918|  46.8k|  size_t lo = 0, hi = dir_table_count;
 5919|   538k|  while (lo < hi) {
  ------------------
  |  Branch (5919:10): [True: 491k, False: 46.8k]
  ------------------
 5920|   491k|    size_t mid = lo + (hi - lo) / 2;
 5921|   491k|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5921:9): [True: 226k, False: 264k]
  ------------------
 5922|   226k|      lo = mid + 1;
 5923|   264k|    } else {
 5924|   264k|      hi = mid;
 5925|   264k|    }
 5926|   491k|  }
 5927|  46.8k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5927:7): [True: 0, False: 46.8k]
  ------------------
 5928|      0|    return direction::NONE;
 5929|      0|  }
 5930|  46.8k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5930:10): [True: 46.3k, False: 522]
  ------------------
 5931|  46.8k|                                     : direction::NONE;
 5932|  46.8k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6301|  2.76k|bool constexpr is_ascii(std::string_view view) {
 6302|  19.5k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6302:18): [True: 19.5k, False: 149]
  ------------------
 6303|  19.5k|    if (c >= 0x80) {
  ------------------
  |  Branch (6303:9): [True: 2.61k, False: 16.9k]
  ------------------
 6304|  2.61k|      return false;
 6305|  2.61k|    }
 6306|  19.5k|  }
 6307|    149|  return true;
 6308|  2.76k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6338|    149|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6339|    149|  out.assign(ut8_string);
 6340|    149|  ascii_map(out.data(), out.size());
 6341|    149|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  9.70k|bool constexpr is_ascii(std::u32string_view view) {
 6293|  35.4k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6293:19): [True: 35.4k, False: 1.99k]
  ------------------
 6294|  35.4k|    if (c >= 0x80) {
  ------------------
  |  Branch (6294:9): [True: 7.70k, False: 27.7k]
  ------------------
 6295|  7.70k|      return false;
 6296|  7.70k|    }
 6297|  35.4k|  }
 6298|  1.99k|  return true;
 6299|  9.70k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6354|  6.50k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6355|  6.50k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6355:10): [True: 3.49k, False: 3.00k]
  |  Branch (6355:31): [True: 1.38k, False: 2.11k]
  |  Branch (6355:51): [True: 1.30k, False: 79]
  ------------------
 6356|  1.30k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6356:10): [True: 1.24k, False: 57]
  |  Branch (6356:30): [True: 1.21k, False: 35]
  ------------------
 6357|  6.50k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6344|  2.69k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6345|  2.69k|  const size_t old = out.size();
 6346|  2.69k|  out.resize(old + label.size());
 6347|  2.69k|  char* dest = out.data() + old;
 6348|  22.6k|  for (char32_t c : label) {
  ------------------
  |  Branch (6348:19): [True: 22.6k, False: 2.69k]
  ------------------
 6349|  22.6k|    *dest++ = static_cast<char>(c);
 6350|  22.6k|  }
 6351|  2.69k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|  30.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  30.6k|    return character_sets::bit_at(character_set, c);
 7360|  30.6k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|  32.2k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  32.2k|    return character_sets::bit_at(character_set, c);
 7360|  32.2k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7092|  12.8k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7093|  12.8k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7093:11): [True: 11.0k, False: 1.83k]
  |  Branch (7093:23): [True: 4.85k, False: 6.16k]
  |  Branch (7093:37): [True: 6.13k, False: 1.85k]
  |  Branch (7093:49): [True: 4.46k, False: 1.66k]
  ------------------
 7094|  3.52k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7094:11): [True: 1.59k, False: 1.92k]
  |  Branch (7094:23): [True: 1.52k, False: 74]
  ------------------
 7095|  12.8k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7182|  10.0k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7183|  10.0k|  return hex_to_binary_table[c - '0'];
 7184|  10.0k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7326|  31.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|  31.6k|    return character_sets::bit_at(character_set, c);
 7328|  31.6k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7019|  8.54k|    const char* input, size_t length) noexcept {
 7020|  8.54k|  size_t i = 0;
 7021|  8.54k|  uint8_t accumulator{};
 7022|  56.4k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7022:10): [True: 47.8k, False: 8.54k]
  ------------------
 7023|  47.8k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7024|  47.8k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7025|  47.8k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7026|  47.8k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7027|  47.8k|  }
 7028|  19.7k|  for (; i < length; i++) {
  ------------------
  |  Branch (7028:10): [True: 11.2k, False: 8.54k]
  ------------------
 7029|  11.2k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7030|  11.2k|  }
 7031|  8.54k|  return accumulator;
 7032|  8.54k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7708|  1.40k|                            const uint8_t character_set[], std::string& out) {
 7709|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7710|  1.40k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7711|  1.40k|#if ADA_UNICODE_SSSE3
 7712|  1.40k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7713|  1.40k|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7714|       |#elif ADA_NEON
 7715|       |  percent_encode_to_neon(p, end, character_set,
 7716|       |                         load_neon_percent_table(character_set), out);
 7717|       |#elif ADA_RVV
 7718|       |  percent_encode_to_rvv(p, end, character_set, out);
 7719|       |#endif
 7720|  1.40k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7535|  1.40k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7536|  1.40k|  ssse3_percent_tables t{};
 7537|  1.40k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7538|  1.40k|  t.cs_hi =
 7539|  1.40k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7540|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7541|  1.40k|  t.pow2 =
 7542|  1.40k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7543|  1.40k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7544|  1.40k|  t.mask_07 = _mm_set1_epi8(0x07);
 7545|  1.40k|  t.zero = _mm_setzero_si128();
 7546|  1.40k|  return t;
 7547|  1.40k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7566|  1.40k|    const ssse3_percent_tables& tables, std::string& out) {
 7567|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7568|  3.75k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7568:10): [True: 2.35k, False: 1.40k]
  ------------------
 7569|  2.35k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7570|  2.35k|    const __m128i word1 =
 7571|  2.35k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7572|  2.35k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7573|  2.35k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7574|  2.35k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7574:9): [True: 420, False: 1.93k]
  ------------------
 7575|    420|      out.append(p, 32);
 7576|  1.93k|    } else {
 7577|  1.93k|      if (mask0 == 0) {
  ------------------
  |  Branch (7577:11): [True: 228, False: 1.70k]
  ------------------
 7578|    228|        out.append(p, 16);
 7579|  1.70k|      } else {
 7580|  1.70k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7581|  1.70k|      }
 7582|  1.93k|      if (mask1 == 0) {
  ------------------
  |  Branch (7582:11): [True: 327, False: 1.60k]
  ------------------
 7583|    327|        out.append(p + 16, 16);
 7584|  1.60k|      } else {
 7585|  1.60k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7586|  1.60k|      }
 7587|  1.93k|    }
 7588|  2.35k|    p += 32;
 7589|  2.35k|  }
 7590|  1.40k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7590:7): [True: 971, False: 429]
  ------------------
 7591|    971|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7592|    971|    const int mask = ssse3_percent_mask(word, tables);
 7593|    971|    if (mask == 0) {
  ------------------
  |  Branch (7593:9): [True: 233, False: 738]
  ------------------
 7594|    233|      out.append(p, 16);
 7595|    738|    } else {
 7596|    738|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7597|    738|    }
 7598|    971|    p += 16;
 7599|    971|  }
 7600|  1.40k|  percent_encode_to_scalar(p, end, character_set, out);
 7601|  1.40k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7550|  5.67k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7551|  5.67k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7552|  5.67k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7553|  5.67k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7554|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7555|  5.67k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7556|  5.67k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7557|  5.67k|                                       _mm_andnot_si128(high_byte, lo));
 7558|  5.67k|  const __m128i bits =
 7559|  5.67k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7560|  5.67k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7561|  5.67k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7562|  5.67k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7490|  4.04k|                                          size_t width, std::string& out) {
 7491|  4.04k|  uint64_t bits = mask;
 7492|  4.04k|  size_t off = 0;
 7493|  41.3k|  while (bits != 0) {
  ------------------
  |  Branch (7493:10): [True: 37.2k, False: 4.04k]
  ------------------
 7494|  37.2k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7495|  37.2k|    if (zero_run != 0) {
  ------------------
  |  Branch (7495:9): [True: 4.66k, False: 32.6k]
  ------------------
 7496|  4.66k|      out.append(p + off, static_cast<size_t>(zero_run));
 7497|  4.66k|    }
 7498|  37.2k|    off += static_cast<size_t>(zero_run);
 7499|  37.2k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7500|  37.2k|    ++off;
 7501|  37.2k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7502|  37.2k|  }
 7503|  4.04k|  if (off < width) {
  ------------------
  |  Branch (7503:7): [True: 1.90k, False: 2.14k]
  ------------------
 7504|  1.90k|    out.append(p + off, width - off);
 7505|  1.90k|  }
 7506|  4.04k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7478|  37.2k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7479|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7480|       |  unsigned long ret;
 7481|       |  _BitScanForward(&ret, input_num);
 7482|       |  return static_cast<int>(ret);
 7483|       |#else
 7484|  37.2k|  return __builtin_ctz(input_num);
 7485|  37.2k|#endif
 7486|  37.2k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7511|  1.40k|                                                std::string& out) {
 7512|  4.71k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7512:10): [True: 3.31k, False: 1.40k]
  ------------------
 7513|  3.31k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7513:9): [True: 1.40k, False: 1.91k]
  ------------------
 7514|  1.40k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7515|  1.91k|    } else {
 7516|  1.91k|      out += *p;
 7517|  1.91k|    }
 7518|  3.31k|  }
 7519|  1.40k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7775|  51.7k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7776|  51.7k|  static constexpr char kHex[] = "0123456789abcdef";
 7777|  51.7k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7777:7): [True: 46.4k, False: 5.38k]
  ------------------
 7778|  46.4k|    *p++ = kHex[(v >> 12) & 0xf];
 7779|  46.4k|    *p++ = kHex[(v >> 8) & 0xf];
 7780|  46.4k|    *p++ = kHex[(v >> 4) & 0xf];
 7781|  46.4k|    *p++ = kHex[v & 0xf];
 7782|  46.4k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7782:14): [True: 1.41k, False: 3.97k]
  ------------------
 7783|  1.41k|    *p++ = kHex[(v >> 8) & 0xf];
 7784|  1.41k|    *p++ = kHex[(v >> 4) & 0xf];
 7785|  1.41k|    *p++ = kHex[v & 0xf];
 7786|  3.97k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7786:14): [True: 2.10k, False: 1.86k]
  ------------------
 7787|  2.10k|    *p++ = kHex[(v >> 4) & 0xf];
 7788|  2.10k|    *p++ = kHex[v & 0xf];
 7789|  2.10k|  } else {
 7790|  1.86k|    *p++ = kHex[v & 0xf];
 7791|  1.86k|  }
 7792|  51.7k|  return p;
 7793|  51.7k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7761|  30.9k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7762|  30.9k|  if (v < 10) {
  ------------------
  |  Branch (7762:7): [True: 6.80k, False: 24.1k]
  ------------------
 7763|  6.80k|    *p++ = static_cast<char>('0' + v);
 7764|  24.1k|  } else if (v < 100) {
  ------------------
  |  Branch (7764:14): [True: 14.0k, False: 10.0k]
  ------------------
 7765|  14.0k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7766|  14.0k|    p += 2;
 7767|  14.0k|  } else {
 7768|  10.0k|    *p++ = static_cast<char>('0' + v / 100);
 7769|  10.0k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7770|  10.0k|    p += 2;
 7771|  10.0k|  }
 7772|  30.9k|  return p;
 7773|  30.9k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6868|  20.6k|    std::string_view user_input) noexcept {
 6869|       |  // first check for short strings in which case we do it naively.
 6870|  20.6k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6870:7): [True: 6.67k, False: 14.0k]
  ------------------
 6871|  6.67k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6872|  6.67k|  }
 6873|       |  // fast path for long strings (expected to be common)
 6874|  14.0k|  size_t i = 0;
 6875|  14.0k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6876|  14.0k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6877|  14.0k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6878|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6879|  14.0k|  __m128i running{0};
 6880|  48.1k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6880:10): [True: 34.0k, False: 14.0k]
  ------------------
 6881|  34.0k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6882|  34.0k|    running = _mm_or_si128(
 6883|  34.0k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6884|  34.0k|                                           _mm_cmpeq_epi8(word, mask2))),
 6885|  34.0k|        _mm_cmpeq_epi8(word, mask3));
 6886|  34.0k|  }
 6887|  14.0k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6887:7): [True: 13.0k, False: 948]
  ------------------
 6888|  13.0k|    __m128i word = _mm_loadu_si128(
 6889|  13.0k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6890|  13.0k|    running = _mm_or_si128(
 6891|  13.0k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6892|  13.0k|                                           _mm_cmpeq_epi8(word, mask2))),
 6893|  13.0k|        _mm_cmpeq_epi8(word, mask3));
 6894|  13.0k|  }
 6895|  14.0k|  return _mm_movemask_epi8(running) != 0;
 6896|  20.6k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6753|  51.9k|constexpr bool is_tabs_or_newline(char c) noexcept {
 6754|  51.9k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6754:10): [True: 35, False: 51.9k]
  |  Branch (6754:23): [True: 49, False: 51.9k]
  |  Branch (6754:36): [True: 44, False: 51.8k]
  ------------------
 6755|  51.9k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8564|    135|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8565|       |  // if this ever becomes a performance issue, we could use an approach similar
 8566|       |  // to has_tabs_or_newline
 8567|    135|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8568|    135|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7113|  4.24k|    const char c) noexcept {
 7114|  4.24k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7114:10): [True: 257, False: 3.98k]
  |  Branch (7114:23): [True: 241, False: 3.74k]
  |  Branch (7114:36): [True: 201, False: 3.54k]
  ------------------
 7115|  4.24k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7108|  24.8k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7109|  24.8k|  return (unsigned char)c <= ' ';
 7110|  24.8k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7121|  4.31k|    std::string_view input) noexcept {
 7122|       |  // This will catch most cases:
 7123|       |  // The length must be 2,4 or 6.
 7124|       |  // We divide by two and require
 7125|       |  // that the result be between 1 and 3 inclusively.
 7126|  4.31k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7127|  4.31k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7127:7): [True: 2.53k, False: 1.78k]
  ------------------
 7128|  2.53k|    return false;
 7129|  2.53k|  }
 7130|       |  // We have a string of length 2, 4 or 6.
 7131|       |  // We now check the first character:
 7132|  1.78k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7132:7): [True: 938, False: 848]
  |  Branch (7132:28): [True: 244, False: 694]
  ------------------
 7133|    244|    return false;
 7134|    244|  }
 7135|       |  // We are unlikely the get beyond this point.
 7136|  1.54k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7137|  1.54k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7138|  1.54k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7138:7): [True: 609, False: 933]
  ------------------
 7139|    609|    return false;
 7140|    609|  }
 7141|       |  // We almost never get here.
 7142|       |  // Optimizing the rest is relatively unimportant.
 7143|    933|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|    933|    uint16_t A, B;
 7145|    933|    memcpy(&A, a.data(), sizeof(A));
 7146|    933|    memcpy(&B, b.data(), sizeof(B));
 7147|    933|    return A == B;
 7148|    933|  };
 7149|    933|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7149:7): [True: 291, False: 642]
  ------------------
 7150|    291|    return false;
 7151|    291|  }
 7152|  1.00k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7152:22): [True: 610, False: 394]
  ------------------
 7153|    610|    char c = input[i];
 7154|    610|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7154:9): [True: 248, False: 362]
  |  Branch (7154:10): [True: 169, False: 441]
  ------------------
 7155|    248|      return false;
 7156|    248|    }
 7157|    610|  }
 7158|    394|  return true;
 7159|       |  // The above code might be a bit better than the code below. Compilers
 7160|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7161|       |  // 6 and other tricks.
 7162|       |  // return input == ".." ||
 7163|       |  //  input == ".%2e" || input == ".%2E" ||
 7164|       |  //  input == "%2e." || input == "%2E." ||
 7165|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7166|       |  //  "%2e%2E";
 7167|    642|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7143|    933|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|    933|    uint16_t A, B;
 7145|    933|    memcpy(&A, a.data(), sizeof(A));
 7146|    933|    memcpy(&B, b.data(), sizeof(B));
 7147|    933|    return A == B;
 7148|    933|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7170|  7.83k|    std::string_view input) noexcept {
 7171|  7.83k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7171:10): [True: 380, False: 7.45k]
  |  Branch (7171:26): [True: 80, False: 7.37k]
  |  Branch (7171:44): [True: 6, False: 7.36k]
  ------------------
 7172|  7.83k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9550|  2.56k|                              bool& is_pure_decimal) noexcept {
 9551|  2.56k|  is_pure_decimal = false;
 9552|  2.56k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9552:7): [True: 0, False: 2.56k]
  ------------------
 9553|      0|    return false;
 9554|      0|  }
 9555|  2.56k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9555:7): [True: 2.14k, False: 414]
  |  Branch (9555:23): [True: 382, False: 1.76k]
  |  Branch (9555:38): [True: 194, False: 188]
  ------------------
 9556|    194|    p += 2;
 9557|    194|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9557:9): [True: 7, False: 187]
  |  Branch (9557:21): [True: 11, False: 176]
  ------------------
 9558|     18|      value = 0;
 9559|     18|      return true;
 9560|     18|    }
 9561|    176|    uint64_t v = 0;
 9562|    176|    int digits = 0;
 9563|  1.30k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9563:12): [True: 1.19k, False: 108]
  |  Branch (9563:23): [True: 1.18k, False: 16]
  ------------------
 9564|  1.18k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9565|  1.18k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9565:11): [True: 5, False: 1.17k]
  ------------------
 9566|      5|        return false;
 9567|      5|      }
 9568|  1.17k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9568:11): [True: 47, False: 1.13k]
  ------------------
 9569|     47|        return false;
 9570|     47|      }
 9571|  1.13k|      v = (v << 4) | nib;
 9572|  1.13k|      ++p;
 9573|  1.13k|      ++digits;
 9574|  1.13k|    }
 9575|    124|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9575:9): [True: 0, False: 124]
  ------------------
 9576|      0|      return false;
 9577|      0|    }
 9578|    124|    value = v;
 9579|    124|    return true;
 9580|    124|  }
 9581|  2.36k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9581:7): [True: 1.95k, False: 414]
  |  Branch (9581:23): [True: 188, False: 1.76k]
  |  Branch (9581:38): [True: 117, False: 71]
  |  Branch (9581:53): [True: 103, False: 14]
  ------------------
 9582|    103|    ++p;
 9583|    103|    uint64_t v = 0;
 9584|    912|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9584:12): [True: 850, False: 62]
  |  Branch (9584:23): [True: 830, False: 20]
  ------------------
 9585|    830|      const char c = *p;
 9586|    830|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9586:11): [True: 3, False: 827]
  |  Branch (9586:22): [True: 14, False: 813]
  ------------------
 9587|     17|        return false;
 9588|     17|      }
 9589|    813|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9589:11): [True: 4, False: 809]
  ------------------
 9590|      4|        return false;
 9591|      4|      }
 9592|    809|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9593|    809|      ++p;
 9594|    809|    }
 9595|     82|    value = v;
 9596|     82|    return true;
 9597|    103|  }
 9598|  2.26k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9598:7): [True: 285, False: 1.98k]
  |  Branch (9598:19): [True: 1.20k, False: 773]
  ------------------
 9599|  1.49k|    return false;
 9600|  1.49k|  }
 9601|    773|  is_pure_decimal = true;
 9602|    773|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9603|    773|  ++p;
 9604|  1.68k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9604:10): [True: 1.15k, False: 527]
  |  Branch (9604:21): [True: 963, False: 192]
  ------------------
 9605|    963|    const char c = *p;
 9606|    963|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9606:9): [True: 8, False: 955]
  |  Branch (9606:20): [True: 27, False: 928]
  ------------------
 9607|     35|      return false;
 9608|     35|    }
 9609|    928|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9609:9): [True: 17, False: 911]
  ------------------
 9610|     17|      return false;
 9611|     17|    }
 9612|    911|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9613|    911|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9613:9): [True: 2, False: 909]
  ------------------
 9614|      2|      return false;
 9615|      2|    }
 9616|    909|    ++p;
 9617|    909|  }
 9618|    719|  value = v;
 9619|    719|  return true;
 9620|    773|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9624|  7.22k|                           uint16_t& value) noexcept {
 9625|  7.22k|  if (pointer == end) {
  ------------------
  |  Branch (9625:7): [True: 0, False: 7.22k]
  ------------------
 9626|      0|    return 0;
 9627|      0|  }
 9628|  7.22k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9629|  7.22k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9629:7): [True: 6.97k, False: 256]
  ------------------
 9630|  6.97k|    return 0;
 9631|  6.97k|  }
 9632|    256|  uint32_t v = n0;
 9633|    256|  ++pointer;
 9634|    256|  int length = 1;
 9635|    256|  if (pointer != end) {
  ------------------
  |  Branch (9635:7): [True: 239, False: 17]
  ------------------
 9636|    239|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9637|    239|    if (n1 != 0xff) {
  ------------------
  |  Branch (9637:9): [True: 97, False: 142]
  ------------------
 9638|     97|      v = (v << 4) | n1;
 9639|     97|      ++pointer;
 9640|     97|      ++length;
 9641|     97|      if (pointer != end) {
  ------------------
  |  Branch (9641:11): [True: 94, False: 3]
  ------------------
 9642|     94|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9643|     94|        if (n2 != 0xff) {
  ------------------
  |  Branch (9643:13): [True: 60, False: 34]
  ------------------
 9644|     60|          v = (v << 4) | n2;
 9645|     60|          ++pointer;
 9646|     60|          ++length;
 9647|     60|          if (pointer != end) {
  ------------------
  |  Branch (9647:15): [True: 55, False: 5]
  ------------------
 9648|     55|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9649|     55|            if (n3 != 0xff) {
  ------------------
  |  Branch (9649:17): [True: 23, False: 32]
  ------------------
 9650|     23|              v = (v << 4) | n3;
 9651|     23|              ++pointer;
 9652|     23|              ++length;
 9653|     23|            }
 9654|     55|          }
 9655|     60|        }
 9656|     94|      }
 9657|     97|    }
 9658|    239|  }
 9659|    256|  value = static_cast<uint16_t>(v);
 9660|    256|  return length;
 9661|  7.22k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  100|  6.96k|    std::string_view input) noexcept {
  101|  6.96k|  if (input.empty()) return false;
  ------------------
  |  Branch (101:7): [True: 882, False: 6.08k]
  ------------------
  102|  6.08k|  if (input.back() == '.') {
  ------------------
  |  Branch (102:7): [True: 98, False: 5.98k]
  ------------------
  103|     98|    if (input.size() > 254) return false;
  ------------------
  |  Branch (103:9): [True: 0, False: 98]
  ------------------
  104|  5.98k|  } else if (input.size() > 253)
  ------------------
  |  Branch (104:14): [True: 0, False: 5.98k]
  ------------------
  105|      0|    return false;
  106|       |
  107|  6.08k|  size_t start = 0;
  108|  21.0k|  while (start < input.size()) {
  ------------------
  |  Branch (108:10): [True: 15.8k, False: 5.20k]
  ------------------
  109|  15.8k|    auto dot_location = input.find('.', start);
  110|       |    // If not found, it's likely the end of the domain
  111|  15.8k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (111:9): [True: 5.15k, False: 10.6k]
  ------------------
  112|       |
  113|  15.8k|    auto label_size = dot_location - start;
  114|  15.8k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (114:9): [True: 223, False: 15.5k]
  |  Branch (114:28): [True: 660, False: 14.9k]
  ------------------
  115|       |
  116|  14.9k|    start = dot_location + 1;
  117|  14.9k|  }
  118|       |
  119|  5.20k|  return true;
  120|  6.08k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7085|  47.8k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7086|  47.8k|  return is_alnum_plus_table[uint8_t(c)];
 7087|       |  // A table is almost surely much faster than the
 7088|       |  // following under most compilers: return
 7089|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7090|  47.8k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6761|  7.99k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6762|  7.99k|  uint64_t broadcast_80 = broadcast(0x80);
 6763|  7.99k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6764|  7.99k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6765|  7.99k|  uint64_t non_ascii = 0;
 6766|  7.99k|  size_t i = 0;
 6767|       |
 6768|  23.4k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6768:10): [True: 15.4k, False: 7.99k]
  ------------------
 6769|  15.4k|    uint64_t word{};
 6770|  15.4k|    memcpy(&word, input + i, sizeof(word));
 6771|  15.4k|    non_ascii |= (word & broadcast_80);
 6772|  15.4k|    word ^=
 6773|  15.4k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6774|  15.4k|    memcpy(input + i, &word, sizeof(word));
 6775|  15.4k|  }
 6776|  7.99k|  if (i < length) {
  ------------------
  |  Branch (6776:7): [True: 6.09k, False: 1.90k]
  ------------------
 6777|  6.09k|    uint64_t word{};
 6778|  6.09k|    memcpy(&word, input + i, length - i);
 6779|  6.09k|    non_ascii |= (word & broadcast_80);
 6780|  6.09k|    word ^=
 6781|  6.09k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6782|  6.09k|    memcpy(input + i, &word, length - i);
 6783|  6.09k|  }
 6784|  7.99k|  return non_ascii == 0;
 6785|  7.99k|}
_ZN3ada7unicode9broadcastEh:
 6757|  23.9k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6758|  23.9k|  return 0x101010101010101ull * v;
 6759|  23.9k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12233|    760|    auto apply_query_and_hash = [&]() {
12234|    760|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12234:11): [True: 135, False: 625]
  ------------------
12235|    135|        const size_t q_end =
12236|    135|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12236:13): [True: 17, False: 118]
  ------------------
12237|    135|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|    135|                                                q_end - query_start - 1),
12239|    135|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|    135|      }
12241|    760|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12241:11): [True: 116, False: 644]
  ------------------
12242|    116|        out.update_unencoded_base_hash(std::string_view(
12243|    116|            input.data() + hash_start + 1, len - hash_start - 1));
12244|    116|      }
12245|    760|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11833|     86|    auto apply_query_and_hash = [&]() {
11834|     86|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11834:11): [True: 24, False: 62]
  ------------------
11835|     24|        const size_t q_end =
11836|     24|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11836:13): [True: 9, False: 15]
  ------------------
11837|     24|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|     24|                                                q_end - query_start - 1),
11839|     24|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|     24|      }
11841|     86|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11841:11): [True: 17, False: 69]
  ------------------
11842|     17|        out.update_unencoded_base_hash(std::string_view(
11843|     17|            input.data() + hash_start + 1, len - hash_start - 1));
11844|     17|      }
11845|     86|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8504|  11.9k|    std::string_view& input) noexcept {
 8505|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8506|       |  // function). this function should be quite fast.
 8507|  11.9k|  size_t location_of_first = input.find('#');
 8508|  11.9k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8508:7): [True: 11.8k, False: 161]
  ------------------
 8509|  11.8k|    return std::nullopt;
 8510|  11.8k|  }
 8511|    161|  std::string_view hash = input;
 8512|    161|  hash.remove_prefix(location_of_first + 1);
 8513|    161|  input.remove_suffix(input.size() - location_of_first);
 8514|    161|  return hash;
 8515|  11.9k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9462|  1.86k|find_authority_delimiter_special(std::string_view view) noexcept {
 9463|       |  // performance note: we might be able to gain further performance
 9464|       |  // with SIMD intrinsics.
 9465|  8.06k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9465:33): [True: 8.03k, False: 24]
  ------------------
 9466|  8.03k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9466:9): [True: 1.84k, False: 6.19k]
  ------------------
 9467|  1.84k|      return pos - view.begin();
 9468|  1.84k|    }
 9469|  8.03k|  }
 9470|     24|  return size_t(view.size());
 9471|  1.86k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8517|    394|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8518|       |  // Let path be url's path.
 8519|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8520|       |  // Windows drive letter, then return.
 8521|    394|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8521:7): [True: 0, False: 394]
  ------------------
 8522|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8522:7): [True: 0, False: 0]
  |  Branch (8522:54): [True: 0, False: 0]
  ------------------
 8523|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8523:9): [True: 0, False: 0]
  ------------------
 8524|      0|            helpers::substring(path, 1))) {
 8525|      0|      return false;
 8526|      0|    }
 8527|      0|  }
 8528|       |
 8529|       |  // Remove path's last item, if any.
 8530|    394|  size_t last_delimiter = path.rfind('/');
 8531|    394|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8531:7): [True: 170, False: 224]
  ------------------
 8532|    170|    path.erase(last_delimiter);
 8533|    170|    return true;
 8534|    170|  }
 8535|       |
 8536|    224|  return false;
 8537|    394|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9175|  11.9k|    const bool is_special, std::string_view& view) noexcept {
 9176|       |  /**
 9177|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9178|       |   * compute a variable called insideBrackets but this variable is only used
 9179|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9180|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9181|       |   * It is conceptually simpler and arguably more efficient to just return a
 9182|       |   * Boolean indicating whether ':' was found outside brackets.
 9183|       |   */
 9184|  11.9k|  const size_t view_size = view.size();
 9185|  11.9k|  size_t location = 0;
 9186|  11.9k|  bool found_colon = false;
 9187|       |  /**
 9188|       |   * Performance analysis:
 9189|       |   *
 9190|       |   * We are basically seeking the end of the hostname which can be indicated
 9191|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9192|       |   * (where '\\' is only applicable for special URLs). However, these must
 9193|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9194|       |   * '?' does not count.
 9195|       |   *
 9196|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9197|       |   * the set of delimiters, and that we handle it first.
 9198|       |   *
 9199|       |   * So the trick is to have a fast function that locates the next delimiter.
 9200|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9201|       |   * function would be provided by the C++ standard library, but it seems that
 9202|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9203|       |   *
 9204|       |   * We do not break into two loops for speed, but for clarity.
 9205|       |   */
 9206|  11.9k|  if (is_special) {
  ------------------
  |  Branch (9206:7): [True: 11.9k, False: 0]
  ------------------
 9207|       |    // We move to the next delimiter.
 9208|  11.9k|    location = find_next_host_delimiter_special(view, location);
 9209|       |    // Unless we find '[' then we are going only going to have to call
 9210|       |    // find_next_host_delimiter_special once.
 9211|  19.2k|    for (; location < view_size;
  ------------------
  |  Branch (9211:12): [True: 19.1k, False: 103]
  ------------------
 9212|  19.1k|         location = find_next_host_delimiter_special(view, location)) {
 9213|  19.1k|      if (view[location] == '[') {
  ------------------
  |  Branch (9213:11): [True: 7.47k, False: 11.7k]
  ------------------
 9214|  7.47k|        location = view.find(']', location);
 9215|  7.47k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9215:13): [True: 160, False: 7.31k]
  ------------------
 9216|       |          // performance: view.find might get translated to a memchr, which
 9217|       |          // has no notion of std::string_view::npos, so the code does not
 9218|       |          // reflect the assembly.
 9219|    160|          location = view_size;
 9220|    160|          break;
 9221|    160|        }
 9222|  11.7k|      } else {
 9223|  11.7k|        found_colon = view[location] == ':';
 9224|  11.7k|        break;
 9225|  11.7k|      }
 9226|  19.1k|    }
 9227|  11.9k|  } else {
 9228|       |    // We move to the next delimiter.
 9229|      0|    location = find_next_host_delimiter(view, location);
 9230|       |    // Unless we find '[' then we are going only going to have to call
 9231|       |    // find_next_host_delimiter_special once.
 9232|      0|    for (; location < view_size;
  ------------------
  |  Branch (9232:12): [True: 0, False: 0]
  ------------------
 9233|      0|         location = find_next_host_delimiter(view, location)) {
 9234|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (9234:11): [True: 0, False: 0]
  ------------------
 9235|      0|        location = view.find(']', location);
 9236|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9236:13): [True: 0, False: 0]
  ------------------
 9237|       |          // performance: view.find might get translated to a memchr, which
 9238|       |          // has no notion of std::string_view::npos, so the code does not
 9239|       |          // reflect the assembly.
 9240|      0|          location = view_size;
 9241|      0|          break;
 9242|      0|        }
 9243|      0|      } else {
 9244|      0|        found_colon = view[location] == ':';
 9245|      0|        break;
 9246|      0|      }
 9247|      0|    }
 9248|      0|  }
 9249|       |  // performance: remove_suffix may translate into a single instruction.
 9250|  11.9k|  view.remove_suffix(view_size - location);
 9251|  11.9k|  return {location, found_colon};
 9252|  11.9k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8765|  19.2k|    std::string_view view, size_t location) noexcept {
 8766|       |  // first check for short strings in which case we do it naively.
 8767|  19.2k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8767:7): [True: 10.4k, False: 8.80k]
  ------------------
 8768|  41.3k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8768:31): [True: 41.2k, False: 74]
  ------------------
 8769|  41.2k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8769:11): [True: 558, False: 40.7k]
  |  Branch (8769:29): [True: 9.29k, False: 31.4k]
  |  Branch (8769:47): [True: 5, False: 31.4k]
  ------------------
 8770|  31.4k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8770:11): [True: 70, False: 31.3k]
  |  Branch (8770:29): [True: 471, False: 30.8k]
  ------------------
 8771|  10.3k|        return i;
 8772|  10.3k|      }
 8773|  41.2k|    }
 8774|     74|    return size_t(view.size());
 8775|  10.4k|  }
 8776|       |  // fast path for long strings (expected to be common)
 8777|  8.80k|  size_t i = location;
 8778|  8.80k|  const __m128i mask1 = _mm_set1_epi8(':');
 8779|  8.80k|  const __m128i mask2 = _mm_set1_epi8('/');
 8780|  8.80k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8781|  8.80k|  const __m128i mask4 = _mm_set1_epi8('?');
 8782|  8.80k|  const __m128i mask5 = _mm_set1_epi8('[');
 8783|       |
 8784|  11.7k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8784:10): [True: 10.5k, False: 1.17k]
  ------------------
 8785|  10.5k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8786|  10.5k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8787|  10.5k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8788|  10.5k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8789|  10.5k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8790|  10.5k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8791|  10.5k|    __m128i m = _mm_or_si128(
 8792|  10.5k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8793|  10.5k|    int mask = _mm_movemask_epi8(m);
 8794|  10.5k|    if (mask != 0) {
  ------------------
  |  Branch (8794:9): [True: 7.63k, False: 2.91k]
  ------------------
 8795|  7.63k|      return i + trailing_zeroes(mask);
 8796|  7.63k|    }
 8797|  10.5k|  }
 8798|  1.17k|  if (i < view.size()) {
  ------------------
  |  Branch (8798:7): [True: 1.17k, False: 6]
  ------------------
 8799|  1.17k|    __m128i word =
 8800|  1.17k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8801|  1.17k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8802|  1.17k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8803|  1.17k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8804|  1.17k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8805|  1.17k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8806|  1.17k|    __m128i m = _mm_or_si128(
 8807|  1.17k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8808|  1.17k|    int mask = _mm_movemask_epi8(m);
 8809|  1.17k|    if (mask != 0) {
  ------------------
  |  Branch (8809:9): [True: 1.14k, False: 23]
  ------------------
 8810|  1.14k|      return view.length() - 16 + trailing_zeroes(mask);
 8811|  1.14k|    }
 8812|  1.17k|  }
 8813|     29|  return size_t(view.length());
 8814|  1.17k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8585|  8.77k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8586|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8587|       |  unsigned long ret;
 8588|       |  // Search the mask data from least significant bit (LSB)
 8589|       |  // to the most significant bit (MSB) for a set bit (1).
 8590|       |  _BitScanForward(&ret, input_num);
 8591|       |  return (int)ret;
 8592|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8593|  8.77k|  return __builtin_ctzl(input_num);
 8594|  8.77k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8595|  8.77k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7014|  55.6k|    const char c) noexcept {
 7015|  55.6k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7016|  55.6k|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12556|  1.23k|  const auto enforce_max_input_length = [&]() {
12557|  1.23k|    if constexpr (store_values) {
12558|  1.23k|      if (url.is_valid) {
  ------------------
  |  Branch (12558:11): [True: 1.23k, False: 0]
  ------------------
12559|  1.23k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|  1.23k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12560:15): [True: 0, False: 1.23k]
  ------------------
12561|      0|            url.is_valid = false;
12562|      0|          }
12563|       |        } else {
12564|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|       |            url.is_valid = false;
12566|       |          }
12567|       |        }
12568|  1.23k|      }
12569|  1.23k|    }
12570|  1.23k|  };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
10886|     87|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
10887|     87|  uint32_t digits = 1;
10888|    281|  while (port >= 10) {
  ------------------
  |  Branch (10888:10): [True: 194, False: 87]
  ------------------
10889|    194|    port /= 10;
10890|    194|    ++digits;
10891|    194|  }
10892|     87|  return digits;
10893|     87|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
10896|     78|                                             uint32_t port) {
10897|     78|  buffer += ':';
10898|     78|  char port_buf[5];
10899|     78|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
10900|     78|  (void)ec;
10901|     78|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
10902|     78|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11044|  13.1k|                                        size_t n) noexcept {
11045|  13.1k|  const size_t rem = n - host_start;
11046|  13.1k|  if (rem == 0) {
  ------------------
  |  Branch (11046:7): [True: 0, False: 13.1k]
  ------------------
11047|      0|    return false;
11048|      0|  }
11049|       |#if ADA_NEON
11050|       |  if (rem >= 16) {
11051|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11052|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11053|       |    if (at == 0) {
11054|       |      return false;
11055|       |    }
11056|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11057|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11058|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11059|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11060|       |  }
11061|       |#elif ADA_SSE2
11062|  13.1k|  if (rem >= 16) {
  ------------------
  |  Branch (11062:7): [True: 9.52k, False: 3.58k]
  ------------------
11063|  9.52k|    const __m128i w =
11064|  9.52k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11065|  9.52k|    const uint16_t at = static_cast<uint16_t>(
11066|  9.52k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11067|  9.52k|    if (at == 0) {
  ------------------
  |  Branch (11067:9): [True: 9.41k, False: 115]
  ------------------
11068|  9.41k|      return false;
11069|  9.41k|    }
11070|    115|    const uint16_t delim = static_cast<uint16_t>(
11071|    115|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11072|    115|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11073|    115|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11074|    115|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11074:12): [True: 83, False: 32]
  |  Branch (11074:26): [True: 7, False: 25]
  ------------------
11075|  9.52k|  }
11076|  3.58k|#endif
11077|  3.58k|  const size_t lim = host_start + rem;
11078|  25.0k|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11078:31): [True: 25.0k, False: 0]
  ------------------
11079|  25.0k|    const uint8_t c = p[i];
11080|  25.0k|    if (c == '@') {
  ------------------
  |  Branch (11080:9): [True: 93, False: 25.0k]
  ------------------
11081|     93|      return true;
11082|     93|    }
11083|  25.0k|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11083:9): [True: 3.25k, False: 21.7k]
  |  Branch (11083:21): [True: 129, False: 21.6k]
  |  Branch (11083:33): [True: 107, False: 21.5k]
  ------------------
11084|  3.49k|      return false;
11085|  3.49k|    }
11086|  25.0k|  }
11087|      0|  return false;
11088|  3.58k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11095|  4.53k|                                     bool& has_x) noexcept {
11096|  4.53k|  has_upper = false;
11097|  4.53k|  has_x = false;
11098|  4.53k|  size_t i = start;
11099|  4.53k|#if ADA_PARSER_SSSE3
11100|  4.53k|  if (len - start >= 16) {
  ------------------
  |  Branch (11100:7): [True: 2.09k, False: 2.44k]
  ------------------
11101|  2.09k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11102|  2.09k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11103|  2.09k|    const __m128i x_splat = _mm_set1_epi8('x');
11104|  2.09k|    auto visit = [&](size_t at) noexcept -> bool {
11105|  2.09k|      const __m128i w =
11106|  2.09k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|  2.09k|      const int up = sse2_uppercase(w);
11108|  2.09k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|  2.09k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|  2.09k|      if (mask == 0) {
11111|  2.09k|        if (up != 0) {
11112|  2.09k|          has_upper = true;
11113|  2.09k|        }
11114|  2.09k|        if (xs != 0) {
11115|  2.09k|          has_x = true;
11116|  2.09k|        }
11117|  2.09k|        return false;
11118|  2.09k|      }
11119|  2.09k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|  2.09k|      const int valid = (1 << hit) - 1;
11121|  2.09k|      if ((up & valid) != 0) {
11122|  2.09k|        has_upper = true;
11123|  2.09k|      }
11124|  2.09k|      if ((xs & valid) != 0) {
11125|  2.09k|        has_x = true;
11126|  2.09k|      }
11127|  2.09k|      end = at + static_cast<size_t>(hit);
11128|  2.09k|      return true;
11129|  2.09k|    };
11130|  2.38k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11130:12): [True: 1.27k, False: 1.10k]
  ------------------
11131|  1.27k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11131:11): [True: 886, False: 393]
  |  Branch (11131:23): [True: 105, False: 288]
  ------------------
11132|    991|        return k_host_class[b[end]] == 1;
11133|    991|      }
11134|  1.27k|    }
11135|  1.28k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11135:12): [True: 995, False: 289]
  ------------------
11136|    995|      if (visit(i)) {
  ------------------
  |  Branch (11136:11): [True: 814, False: 181]
  ------------------
11137|    814|        return k_host_class[b[end]] == 1;
11138|    814|      }
11139|    995|    }
11140|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11141|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11142|    289|    if (i > start && i < len) {
  ------------------
  |  Branch (11142:9): [True: 289, False: 0]
  |  Branch (11142:22): [True: 289, False: 0]
  ------------------
11143|    289|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11143:11): [True: 289, False: 0]
  |  Branch (11143:30): [True: 289, False: 0]
  ------------------
11144|    289|        return k_host_class[b[end]] == 1;
11145|    289|      }
11146|      0|      end = len;
11147|      0|      return true;
11148|    289|    }
11149|    289|  }
11150|       |#elif ADA_SSE2
11151|       |  const __m128i x_splat = _mm_set1_epi8('x');
11152|       |  for (; i + 32 <= len; i += 32) {
11153|       |    for (size_t off = 0; off < 32; off += 16) {
11154|       |      const __m128i w =
11155|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11156|       |      const int up = sse2_uppercase(w);
11157|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11158|       |      const int mask = sse2_host_stop(w);
11159|       |      if (mask != 0) {
11160|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11161|       |        const int valid = (1 << hit) - 1;
11162|       |        if ((up & valid) != 0) {
11163|       |          has_upper = true;
11164|       |        }
11165|       |        if ((xs & valid) != 0) {
11166|       |          has_x = true;
11167|       |        }
11168|       |        end = i + off + static_cast<size_t>(hit);
11169|       |        return k_host_class[b[end]] == 1;
11170|       |      }
11171|       |      if (up != 0) {
11172|       |        has_upper = true;
11173|       |      }
11174|       |      if (xs != 0) {
11175|       |        has_x = true;
11176|       |      }
11177|       |    }
11178|       |  }
11179|       |  for (; i + 16 <= len; i += 16) {
11180|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11181|       |    const int up = sse2_uppercase(w);
11182|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11183|       |    const int mask = sse2_host_stop(w);
11184|       |    if (mask != 0) {
11185|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11186|       |      const int valid = (1 << hit) - 1;
11187|       |      if ((up & valid) != 0) {
11188|       |        has_upper = true;
11189|       |      }
11190|       |      if ((xs & valid) != 0) {
11191|       |        has_x = true;
11192|       |      }
11193|       |      end = i + static_cast<size_t>(hit);
11194|       |      return k_host_class[b[end]] == 1;
11195|       |    }
11196|       |    if (up != 0) {
11197|       |      has_upper = true;
11198|       |    }
11199|       |    if (xs != 0) {
11200|       |      has_x = true;
11201|       |    }
11202|       |  }
11203|       |#elif ADA_NEON
11204|       |  if (len - start >= 16) {
11205|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11206|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11207|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11208|       |    auto visit = [&](size_t at) noexcept -> bool {
11209|       |      const uint8x16_t w = vld1q_u8(b + at);
11210|       |      const uint64_t up = neon_uppercase(w);
11211|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11212|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11213|       |      if (bits == 0) {
11214|       |        if (up != 0) {
11215|       |          has_upper = true;
11216|       |        }
11217|       |        if (xs != 0) {
11218|       |          has_x = true;
11219|       |        }
11220|       |        return false;
11221|       |      }
11222|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11223|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11224|       |      if ((up & valid) != 0) {
11225|       |        has_upper = true;
11226|       |      }
11227|       |      if ((xs & valid) != 0) {
11228|       |        has_x = true;
11229|       |      }
11230|       |      end = at + hit;
11231|       |      return true;
11232|       |    };
11233|       |    for (; i + 32 <= len; i += 32) {
11234|       |      if (visit(i) || visit(i + 16)) {
11235|       |        return k_host_class[b[end]] == 1;
11236|       |      }
11237|       |    }
11238|       |    for (; i + 16 <= len; i += 16) {
11239|       |      if (visit(i)) {
11240|       |        return k_host_class[b[end]] == 1;
11241|       |      }
11242|       |    }
11243|       |    if (i > start && i < len) {
11244|       |      if (visit(len - 16) && end >= i) {
11245|       |        return k_host_class[b[end]] == 1;
11246|       |      }
11247|       |      end = len;
11248|       |      return true;
11249|       |    }
11250|       |  }
11251|       |#endif
11252|  5.35k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11252:10): [True: 5.35k, False: 0]
  ------------------
11253|  5.35k|    const uint8_t c = b[i];
11254|  5.35k|    const uint8_t cls = k_host_class[c];
11255|  5.35k|    if (cls == 1) {
  ------------------
  |  Branch (11255:9): [True: 809, False: 4.54k]
  ------------------
11256|    809|      end = i;
11257|    809|      return true;
11258|    809|    }
11259|  4.54k|    if (cls == 2) {
  ------------------
  |  Branch (11259:9): [True: 1.63k, False: 2.91k]
  ------------------
11260|  1.63k|      return false;
11261|  1.63k|    }
11262|  2.91k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11262:9): [True: 1.72k, False: 1.18k]
  |  Branch (11262:21): [True: 381, False: 1.34k]
  ------------------
11263|    381|      has_upper = true;
11264|  2.52k|    } else if (c == 'x') {
  ------------------
  |  Branch (11264:16): [True: 469, False: 2.06k]
  ------------------
11265|    469|      has_x = true;
11266|    469|    }
11267|  2.91k|  }
11268|      0|  end = len;
11269|      0|  return true;
11270|  2.44k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
10925|  5.54k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
10926|  5.54k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
10927|  5.54k|}
serializers.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENK3$_0clEm:
11104|  2.95k|    auto visit = [&](size_t at) noexcept -> bool {
11105|  2.95k|      const __m128i w =
11106|  2.95k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|  2.95k|      const int up = sse2_uppercase(w);
11108|  2.95k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|  2.95k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|  2.95k|      if (mask == 0) {
  ------------------
  |  Branch (11110:11): [True: 862, False: 2.09k]
  ------------------
11111|    862|        if (up != 0) {
  ------------------
  |  Branch (11111:13): [True: 465, False: 397]
  ------------------
11112|    465|          has_upper = true;
11113|    465|        }
11114|    862|        if (xs != 0) {
  ------------------
  |  Branch (11114:13): [True: 518, False: 344]
  ------------------
11115|    518|          has_x = true;
11116|    518|        }
11117|    862|        return false;
11118|    862|      }
11119|  2.09k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|  2.09k|      const int valid = (1 << hit) - 1;
11121|  2.09k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11121:11): [True: 457, False: 1.63k]
  ------------------
11122|    457|        has_upper = true;
11123|    457|      }
11124|  2.09k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11124:11): [True: 525, False: 1.56k]
  ------------------
11125|    525|        has_x = true;
11126|    525|      }
11127|  2.09k|      end = at + static_cast<size_t>(hit);
11128|  2.09k|      return true;
11129|  2.95k|    };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11012|  2.95k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11013|  2.95k|  return _mm_movemask_epi8(_mm_and_si128(
11014|  2.95k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11015|  2.95k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11016|  2.95k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
10932|  4.27k|                                      __m128i hi_tbl) noexcept {
10933|  4.27k|  const __m128i nibble = _mm_set1_epi8(0x0F);
10934|  4.27k|  const __m128i lo = _mm_and_si128(w, nibble);
10935|  4.27k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
10936|  4.27k|  const __m128i hit =
10937|  4.27k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
10938|  4.27k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
10939|  4.27k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
10904|  2.62k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
10905|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
10906|       |  unsigned long ret;
10907|       |  _BitScanForward(&ret, input_num);
10908|       |  return static_cast<int>(ret);
10909|       |#else
10910|  2.62k|  return __builtin_ctz(input_num);
10911|  2.62k|#endif
10912|  2.62k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11330|    936|                                   bool& maybe_dot_segment) noexcept {
11331|    936|  const size_t run_start = i;
11332|    936|#if ADA_PARSER_SSSE3
11333|    936|  if (i + 16 <= len) {
  ------------------
  |  Branch (11333:7): [True: 516, False: 420]
  ------------------
11334|    516|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11335|    516|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11336|    692|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11336:12): [True: 383, False: 309]
  ------------------
11337|    383|      const __m128i w0 =
11338|    383|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11339|    383|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11340|    383|      if (m0 != 0) {
  ------------------
  |  Branch (11340:11): [True: 159, False: 224]
  ------------------
11341|    159|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11342|    159|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11343|    159|                            maybe_dot_segment);
11344|    159|        i += static_cast<size_t>(hit_bit);
11345|    159|        return;
11346|    159|      }
11347|    224|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11348|    224|      const __m128i w1 =
11349|    224|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11350|    224|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11351|    224|      if (m1 != 0) {
  ------------------
  |  Branch (11351:11): [True: 48, False: 176]
  ------------------
11352|     48|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11353|     48|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11354|     48|                            maybe_dot_segment);
11355|     48|        i += 16 + static_cast<size_t>(hit_bit);
11356|     48|        return;
11357|     48|      }
11358|    176|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11359|    176|    }
11360|    437|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11360:12): [True: 247, False: 190]
  ------------------
11361|    247|      const __m128i w =
11362|    247|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11363|    247|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11364|    247|      if (mask != 0) {
  ------------------
  |  Branch (11364:11): [True: 119, False: 128]
  ------------------
11365|    119|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11366|    119|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11367|    119|                            maybe_dot_segment);
11368|    119|        i += static_cast<size_t>(hit_bit);
11369|    119|        return;
11370|    119|      }
11371|    128|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11372|    128|    }
11373|    190|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11373:9): [True: 190, False: 0]
  |  Branch (11373:26): [True: 144, False: 46]
  ------------------
11374|    144|      const __m128i w =
11375|    144|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11376|    144|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11377|    144|      if (mask != 0) {
  ------------------
  |  Branch (11377:11): [True: 71, False: 73]
  ------------------
11378|     71|        const size_t hit =
11379|     71|            len - 16 +
11380|     71|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11381|     71|        if (hit >= i) {
  ------------------
  |  Branch (11381:13): [True: 71, False: 0]
  ------------------
11382|    247|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11382:30): [True: 176, False: 71]
  ------------------
11383|    176|            if (b[j] == '.') {
  ------------------
  |  Branch (11383:17): [True: 69, False: 107]
  ------------------
11384|     69|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11385|     69|            }
11386|    176|          }
11387|     71|          i = hit;
11388|     71|          return;
11389|     71|        }
11390|     71|      }
11391|    479|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11391:26): [True: 406, False: 73]
  ------------------
11392|    406|        if (b[j] == '.') {
  ------------------
  |  Branch (11392:13): [True: 138, False: 268]
  ------------------
11393|    138|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11394|    138|        }
11395|    406|      }
11396|     73|      i = len;
11397|     73|      return;
11398|    144|    }
11399|    190|  }
11400|       |#elif ADA_SSE2
11401|       |  for (; i + 16 <= len; i += 16) {
11402|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11403|       |    const int mask = sse2_path_stop(w);
11404|       |    if (mask != 0) {
11405|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11406|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11407|       |                          maybe_dot_segment);
11408|       |      i += static_cast<size_t>(hit_bit);
11409|       |      return;
11410|       |    }
11411|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11412|       |  }
11413|       |#elif ADA_NEON
11414|       |  if (i + 16 <= len) {
11415|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11416|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11417|       |    for (; i + 32 <= len; i += 32) {
11418|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11419|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11420|       |      if (bits0 != 0) {
11421|       |        const size_t hit_off =
11422|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11423|       |        const uint64_t valid =
11424|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11425|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11426|       |        i += hit_off;
11427|       |        return;
11428|       |      }
11429|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11430|       |                               maybe_dot_segment);
11431|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11432|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11433|       |      if (bits1 != 0) {
11434|       |        const size_t hit_off =
11435|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11436|       |        const uint64_t valid =
11437|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11438|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11439|       |                                 maybe_dot_segment);
11440|       |        i += 16 + hit_off;
11441|       |        return;
11442|       |      }
11443|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11444|       |                               maybe_dot_segment);
11445|       |    }
11446|       |    for (; i + 16 <= len; i += 16) {
11447|       |      const uint8x16_t w = vld1q_u8(b + i);
11448|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11449|       |      if (bits != 0) {
11450|       |        const size_t hit_off =
11451|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11452|       |        const uint64_t valid =
11453|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11454|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11455|       |        i += hit_off;
11456|       |        return;
11457|       |      }
11458|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11459|       |                               maybe_dot_segment);
11460|       |    }
11461|       |    if (i > run_start && i < len) {
11462|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11463|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11464|       |      if (bits != 0) {
11465|       |        const size_t hit =
11466|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11467|       |        if (hit >= i) {
11468|       |          for (size_t j = i; j < hit; ++j) {
11469|       |            if (b[j] == '.') {
11470|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11471|       |            }
11472|       |          }
11473|       |          i = hit;
11474|       |          return;
11475|       |        }
11476|       |      }
11477|       |      for (size_t j = i; j < len; ++j) {
11478|       |        if (b[j] == '.') {
11479|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11480|       |        }
11481|       |      }
11482|       |      i = len;
11483|       |      return;
11484|       |    }
11485|       |  }
11486|       |#endif
11487|  1.59k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11487:10): [True: 1.42k, False: 172]
  ------------------
11488|  1.42k|    const uint8_t c = b[i];
11489|  1.42k|    const uint8_t cls = k_path[c];
11490|  1.42k|    if (cls != 0) {
  ------------------
  |  Branch (11490:9): [True: 294, False: 1.13k]
  ------------------
11491|    294|      return;
11492|    294|    }
11493|  1.13k|    if (c == '.') {
  ------------------
  |  Branch (11493:9): [True: 382, False: 749]
  ------------------
11494|    382|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11495|    382|    }
11496|  1.13k|  }
11497|    466|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11287|    854|                                           bool& maybe_dot_segment) noexcept {
11288|    854|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11288:7): [True: 154, False: 700]
  |  Branch (11288:28): [True: 140, False: 560]
  ------------------
11289|    294|    return;
11290|    294|  }
11291|    560|  const int dots =
11292|    560|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11293|    560|  if (dots == 0) {
  ------------------
  |  Branch (11293:7): [True: 162, False: 398]
  ------------------
11294|    162|    return;
11295|    162|  }
11296|    398|  const int slashes =
11297|    398|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11298|    398|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11298:8): [True: 164, False: 234]
  |  Branch (11298:28): [True: 104, False: 60]
  |  Branch (11298:46): [True: 12, False: 48]
  ------------------
11299|    282|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11299:7): [True: 107, False: 175]
  ------------------
11300|    223|    maybe_dot_segment = true;
11301|    223|  }
11302|    398|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11274|    589|    bool& maybe_dot_segment) noexcept {
11275|    589|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11275:7): [True: 103, False: 486]
  |  Branch (11275:27): [True: 227, False: 259]
  ------------------
11276|    330|    maybe_dot_segment = true;
11277|    330|  }
11278|    589|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11640|    198|                                    size_t len) noexcept {
11641|    198|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11503|    198|  do {                                                                       \
  |  |11504|    198|    const size_t scan_start = i;                                             \
  |  |11505|    198|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 72, False: 126]
  |  |  ------------------
  |  |11506|     72|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|     72|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|     89|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 54, False: 35]
  |  |  ------------------
  |  |11509|     54|        const __m128i w0 =                                                   \
  |  |11510|     54|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|     54|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|     54|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 25, False: 29]
  |  |  ------------------
  |  |11513|     25|          i += static_cast<size_t>(                                          \
  |  |11514|     25|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|     25|          return;                                                            \
  |  |11516|     25|        }                                                                    \
  |  |11517|     54|        const __m128i w1 =                                                   \
  |  |11518|     29|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|     29|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|     29|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 12, False: 17]
  |  |  ------------------
  |  |11521|     12|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|     12|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|     12|          return;                                                            \
  |  |11524|     12|        }                                                                    \
  |  |11525|     29|      }                                                                      \
  |  |11526|     72|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 31, False: 20]
  |  |  ------------------
  |  |11527|     31|        const __m128i w =                                                    \
  |  |11528|     31|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|     31|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|     31|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 15, False: 16]
  |  |  ------------------
  |  |11531|     15|          i += static_cast<size_t>(                                          \
  |  |11532|     15|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|     15|          return;                                                            \
  |  |11534|     15|        }                                                                    \
  |  |11535|     31|      }                                                                      \
  |  |11536|     35|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 20, False: 0]
  |  |  |  Branch (11536:29): [True: 15, False: 5]
  |  |  ------------------
  |  |11537|     15|        const __m128i w =                                                    \
  |  |11538|     15|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|     15|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|     15|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 11, False: 4]
  |  |  ------------------
  |  |11541|     11|          const size_t hit = len - 16 +                                      \
  |  |11542|     11|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|     11|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|     11|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 11, False: 0]
  |  |  ------------------
  |  |11545|     11|            i = hit;                                                         \
  |  |11546|     11|            return;                                                          \
  |  |11547|     11|          }                                                                  \
  |  |11548|     11|        }                                                                    \
  |  |11549|     15|        i = len;                                                             \
  |  |11550|      4|        return;                                                              \
  |  |11551|     15|      }                                                                      \
  |  |11552|     20|    }                                                                        \
  |  |11553|    430|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 348, False: 82]
  |  |  ------------------
  |  |11554|    348|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 49, False: 299]
  |  |  ------------------
  |  |11555|     49|        return;                                                              \
  |  |11556|     49|      }                                                                      \
  |  |11557|    348|    }                                                                        \
  |  |11558|    131|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 82]
  |  |  ------------------
  ------------------
11642|    198|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11645|    203|                                   size_t len) noexcept {
11646|    203|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11503|    203|  do {                                                                       \
  |  |11504|    203|    const size_t scan_start = i;                                             \
  |  |11505|    203|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 91, False: 112]
  |  |  ------------------
  |  |11506|     91|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|     91|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|    116|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 65, False: 51]
  |  |  ------------------
  |  |11509|     65|        const __m128i w0 =                                                   \
  |  |11510|     65|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|     65|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|     65|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 20, False: 45]
  |  |  ------------------
  |  |11513|     20|          i += static_cast<size_t>(                                          \
  |  |11514|     20|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|     20|          return;                                                            \
  |  |11516|     20|        }                                                                    \
  |  |11517|     65|        const __m128i w1 =                                                   \
  |  |11518|     45|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|     45|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|     45|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 20, False: 25]
  |  |  ------------------
  |  |11521|     20|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|     20|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|     20|          return;                                                            \
  |  |11524|     20|        }                                                                    \
  |  |11525|     45|      }                                                                      \
  |  |11526|     91|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 41, False: 43]
  |  |  ------------------
  |  |11527|     41|        const __m128i w =                                                    \
  |  |11528|     41|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|     41|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|     41|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 8, False: 33]
  |  |  ------------------
  |  |11531|      8|          i += static_cast<size_t>(                                          \
  |  |11532|      8|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|      8|          return;                                                            \
  |  |11534|      8|        }                                                                    \
  |  |11535|     41|      }                                                                      \
  |  |11536|     51|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 43, False: 0]
  |  |  |  Branch (11536:29): [True: 38, False: 5]
  |  |  ------------------
  |  |11537|     38|        const __m128i w =                                                    \
  |  |11538|     38|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|     38|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|     38|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 19, False: 19]
  |  |  ------------------
  |  |11541|     19|          const size_t hit = len - 16 +                                      \
  |  |11542|     19|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|     19|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|     19|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 19, False: 0]
  |  |  ------------------
  |  |11545|     19|            i = hit;                                                         \
  |  |11546|     19|            return;                                                          \
  |  |11547|     19|          }                                                                  \
  |  |11548|     19|        }                                                                    \
  |  |11549|     38|        i = len;                                                             \
  |  |11550|     19|        return;                                                              \
  |  |11551|     38|      }                                                                      \
  |  |11552|     43|    }                                                                        \
  |  |11553|    504|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 404, False: 100]
  |  |  ------------------
  |  |11554|    404|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 17, False: 387]
  |  |  ------------------
  |  |11555|     17|        return;                                                              \
  |  |11556|     17|      }                                                                      \
  |  |11557|    404|    }                                                                        \
  |  |11558|    117|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 100]
  |  |  ------------------
  ------------------
11647|    203|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11651|    264|bool path_has_dot_segment(std::string_view path) noexcept {
11652|    264|  if (path.empty()) {
  ------------------
  |  Branch (11652:7): [True: 0, False: 264]
  ------------------
11653|      0|    return false;
11654|      0|  }
11655|       |  // "." / ".." at the start, with or without a leading '/'.
11656|    264|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11656:20): [True: 264, False: 0]
  ------------------
11657|    264|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11657:7): [True: 264, False: 0]
  |  Branch (11657:26): [True: 123, False: 141]
  ------------------
11658|    123|    const size_t after = i + 1;
11659|    123|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11659:9): [True: 2, False: 121]
  |  Branch (11659:33): [True: 25, False: 96]
  ------------------
11660|     96|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11660:10): [True: 96, False: 0]
  |  Branch (11660:33): [True: 43, False: 53]
  ------------------
11661|     47|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11661:11): [True: 2, False: 41]
  |  Branch (11661:39): [True: 18, False: 23]
  ------------------
11662|     47|      return true;
11663|     47|    }
11664|    123|  }
11665|    217|  static constexpr std::string_view slash_dot{"/.", 2};
11666|    217|  size_t p = i;
11667|    412|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11667:10): [True: 297, False: 115]
  ------------------
11668|    297|    const size_t after = p + 2;
11669|    297|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11669:9): [True: 1, False: 296]
  |  Branch (11669:33): [True: 30, False: 266]
  ------------------
11670|    266|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11670:10): [True: 266, False: 0]
  |  Branch (11670:33): [True: 126, False: 140]
  ------------------
11671|    126|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11671:11): [True: 20, False: 106]
  |  Branch (11671:39): [True: 51, False: 55]
  ------------------
11672|    102|      return true;
11673|    102|    }
11674|    195|    p = after;
11675|    195|  }
11676|    115|  return false;
11677|    217|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13648|  11.9k|    ada::url_components& components, uint32_t new_difference) {
13649|  11.9k|  components.username_end += new_difference;
13650|  11.9k|  components.host_start += new_difference;
13651|  11.9k|  components.host_end += new_difference;
13652|  11.9k|  components.pathname_start += new_difference;
13653|  11.9k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13653:7): [True: 0, False: 11.9k]
  ------------------
13654|      0|    components.search_start += new_difference;
13655|      0|  }
13656|  11.9k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13656:7): [True: 0, False: 11.9k]
  ------------------
13657|      0|    components.hash_start += new_difference;
13658|      0|  }
13659|  11.9k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14018|    846|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14019|    846|  ada_log("url_aggregator::parse_path ", input);
14020|    846|  ADA_ASSERT_TRUE(validate());
14021|    846|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14022|    846|  std::string tmp_buffer;
14023|    846|  std::string_view internal_input;
14024|    846|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14024:7): [True: 0, False: 846]
  ------------------
14025|      0|    tmp_buffer = input;
14026|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14027|       |    // just directly build the string from user_input.
14028|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14029|      0|    internal_input = tmp_buffer;
14030|    846|  } else {
14031|    846|    internal_input = input;
14032|    846|  }
14033|       |
14034|       |  // If url is special, then:
14035|    846|  if (is_special()) {
  ------------------
  |  Branch (14035:7): [True: 846, False: 0]
  ------------------
14036|    846|    if (internal_input.empty()) {
  ------------------
  |  Branch (14036:9): [True: 121, False: 725]
  ------------------
14037|    121|      update_base_pathname("/");
14038|    725|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14038:16): [True: 725, False: 0]
  |  Branch (14038:46): [True: 0, False: 0]
  ------------------
14039|    725|      consume_prepared_path(internal_input.substr(1));
14040|    725|    } else {
14041|      0|      consume_prepared_path(internal_input);
14042|      0|    }
14043|    846|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14043:14): [True: 0, False: 0]
  ------------------
14044|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14044:9): [True: 0, False: 0]
  ------------------
14045|      0|      consume_prepared_path(internal_input.substr(1));
14046|      0|    } else {
14047|      0|      consume_prepared_path(internal_input);
14048|      0|    }
14049|      0|  } else {
14050|       |    // Non-special URLs with an empty host can have their paths erased
14051|       |    // Path-only URLs cannot have their paths erased
14052|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14052:9): [True: 0, False: 0]
  |  Branch (14052:57): [True: 0, False: 0]
  ------------------
14053|      0|      update_base_pathname("/");
14054|      0|    }
14055|      0|  }
14056|    846|  ADA_ASSERT_TRUE(validate());
14057|    846|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14137|  11.9k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14138|  11.9k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14139|  11.9k|          " bytes]");
14140|  11.9k|  ADA_ASSERT_TRUE(validate());
14141|  11.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14142|  11.9k|  if (input.empty()) {
  ------------------
  |  Branch (14142:7): [True: 1, False: 11.9k]
  ------------------
14143|      1|    return is_valid = false;
14144|      1|  }  // technically unnecessary.
14145|       |  // If input starts with U+005B ([), then:
14146|  11.9k|  if (input[0] == '[') {
  ------------------
  |  Branch (14146:7): [True: 7.15k, False: 4.80k]
  ------------------
14147|       |    // If input does not end with U+005D (]), validation error, return failure.
14148|  7.15k|    if (input.back() != ']') {
  ------------------
  |  Branch (14148:9): [True: 63, False: 7.09k]
  ------------------
14149|     63|      return is_valid = false;
14150|     63|    }
14151|  7.09k|    ada_log("parse_host ipv6");
14152|       |
14153|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14154|       |    // trailing U+005D (]) removed.
14155|  7.09k|    input.remove_prefix(1);
14156|  7.09k|    input.remove_suffix(1);
14157|  7.09k|    return parse_ipv6(input);
14158|  7.15k|  }
14159|       |
14160|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14161|       |  // input.
14162|  4.80k|  if (!is_special()) {
  ------------------
  |  Branch (14162:7): [True: 0, False: 4.80k]
  ------------------
14163|      0|    return parse_opaque_host(input);
14164|      0|  }
14165|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14166|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14167|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14168|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14169|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14170|       |
14171|       |  // Often, the input does not contain any forbidden code points, and no upper
14172|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14173|       |  // optimize for such a common case.
14174|       |
14175|       |  // Fast path: try to parse as pure decimal IPv4 first.
14176|  4.80k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14177|  4.80k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14177:7): [True: 304, False: 4.50k]
  ------------------
14178|    304|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14178:9): [True: 304, False: 0]
  |  Branch (14178:27): [True: 2, False: 302]
  ------------------
14179|      2|      update_base_hostname(input.substr(0, input.size() - 1));
14180|    302|    } else {
14181|    302|      update_base_hostname(input);
14182|    302|    }
14183|    304|    host_type = IPV4;
14184|    304|    is_valid = true;
14185|    304|    ada_log("parse_host fast path decimal ipv4");
14186|    304|    ADA_ASSERT_TRUE(validate());
14187|    304|    return true;
14188|    304|  }
14189|  4.50k|  uint8_t is_forbidden_or_upper =
14190|  4.50k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14191|  4.50k|                                                             input.size());
14192|  4.50k|  static constexpr std::string_view xn_dash{"xn-", 3};
14193|  4.50k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14193:7): [True: 1.60k, False: 2.90k]
  ------------------
14194|  1.60k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14194:9): [True: 346, False: 1.25k]
  ------------------
14195|    346|      std::string lowered(input);
14196|    346|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14197|    346|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14197:11): [True: 260, False: 86]
  ------------------
14198|    324|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14198:11): [True: 64, False: 22]
  ------------------
14199|    324|        update_base_hostname(lowered);
14200|    324|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14200:13): [True: 184, False: 140]
  ------------------
14201|    184|          ada_log("parse_host fast path ipv4");
14202|    184|          return parse_ipv4(lowered, true);
14203|    184|        }
14204|    140|        ada_log("parse_host fast path ", get_hostname());
14205|    140|        is_valid = true;
14206|    140|        return true;
14207|    324|      }
14208|  1.25k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14208:16): [True: 1.18k, False: 76]
  ------------------
14209|  1.23k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14209:16): [True: 50, False: 26]
  ------------------
14210|  1.23k|      update_base_hostname(input);
14211|  1.23k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14211:11): [True: 990, False: 240]
  ------------------
14212|    990|        ada_log("parse_host fast path ipv4");
14213|    990|        return parse_ipv4(input, true);
14214|    990|      }
14215|    240|      ada_log("parse_host fast path ", get_hostname());
14216|    240|      is_valid = true;
14217|    240|      return true;
14218|  1.23k|    }
14219|  2.90k|  } else if (const size_t first_percent = input.find('%');
14220|  2.90k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14220:14): [True: 300, False: 2.60k]
  ------------------
14221|    300|    std::string decoded = unicode::percent_decode(input, first_percent);
14222|    300|    const uint8_t decoded_flags =
14223|    300|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14224|    300|                                                               decoded.size());
14225|    300|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14225:9): [True: 196, False: 104]
  ------------------
14226|    196|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14226:11): [True: 70, False: 126]
  ------------------
14227|     70|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14228|     70|      }
14229|    196|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14229:11): [True: 166, False: 30]
  ------------------
14230|    181|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14230:11): [True: 15, False: 15]
  ------------------
14231|    181|        update_base_hostname(decoded);
14232|    181|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14232:13): [True: 98, False: 83]
  ------------------
14233|     98|          return parse_ipv4(decoded, true);
14234|     98|        }
14235|     83|        is_valid = true;
14236|     83|        return true;
14237|    181|      }
14238|    196|    }
14239|    300|  }
14240|       |  // We have encountered at least one forbidden code point or the input contains
14241|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14242|       |  // conversion.
14243|       |
14244|  2.76k|  ada_log("parse_host calling to_ascii");
14245|  2.76k|  std::optional<std::string> host = std::string(get_hostname());
14246|  2.76k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14247|  2.76k|  if (!is_valid) {
  ------------------
  |  Branch (14247:7): [True: 1.42k, False: 1.34k]
  ------------------
14248|  1.42k|    ada_log("parse_host to_ascii returns false");
14249|  1.42k|    return is_valid = false;
14250|  1.42k|  }
14251|  1.34k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14252|  1.34k|          " bytes]");
14253|       |
14254|  1.34k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14254:7): [True: 0, False: 1.34k]
  ------------------
14255|  1.34k|                          ada::unicode::is_forbidden_domain_code_point)) {
14256|      0|    return is_valid = false;
14257|      0|  }
14258|       |
14259|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14260|       |  // asciiDomain.
14261|  1.34k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14261:7): [True: 1.09k, False: 252]
  ------------------
14262|  1.09k|    ada_log("parse_host got ipv4 ", *host);
14263|  1.09k|    return parse_ipv4(host.value(), false);
14264|  1.09k|  }
14265|       |
14266|    252|  update_base_hostname(host.value());
14267|    252|  ADA_ASSERT_TRUE(validate());
14268|    252|  return true;
14269|  1.34k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15088|  1.85k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15089|  1.85k|  ada_log("url_aggregator::consume_prepared_path ", input);
15090|       |  /***
15091|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15092|       |   * unfortunate. This particular function is nearly identical, except that it
15093|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15094|       |   * very common) merely appends to the buffer. This is the same trivial path as
15095|       |   * with helpers::parse_prepared_path, except that we have the additional check
15096|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15097|       |   * modify it, and then insert it back into the buffer.
15098|       |   */
15099|  1.85k|  uint8_t accumulator = checkers::path_signature(input);
15100|       |  // Let us first detect a trivial case.
15101|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15102|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15103|       |  // no dot, and no character needing percent encoding.
15104|  1.85k|  constexpr uint8_t need_encoding = 1;
15105|  1.85k|  constexpr uint8_t backslash_char = 2;
15106|  1.85k|  constexpr uint8_t dot_char = 4;
15107|  1.85k|  constexpr uint8_t percent_char = 8;
15108|  1.85k|  bool special = type != ada::scheme::NOT_SPECIAL;
15109|  1.85k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15109:39): [True: 0, False: 1.85k]
  ------------------
15110|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15110:39): [True: 0, False: 0]
  ------------------
15111|  1.85k|  bool trivial_path =
15112|  1.85k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15112:7): [True: 700, False: 1.15k]
  |  Branch (15112:8): [True: 1.85k, False: 0]
  ------------------
15113|  1.85k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15114|      0|                  0)) &&
15115|    700|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15115:7): [True: 700, False: 0]
  ------------------
15116|  1.85k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15116:7): [True: 510, False: 1.34k]
  |  Branch (15116:34): [True: 510, False: 0]
  ------------------
15117|       |    // '4' means that we have at least one dot, but nothing that requires
15118|       |    // percent encoding or decoding. The only part that is not trivial is
15119|       |    // that we may have single dots and double dots path segments.
15120|       |    // If we have such segments, then we either have a path that begins
15121|       |    // with '.' (easy to check), or we have the sequence './'.
15122|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15123|       |    // Note: we know that '\' is not present.
15124|    510|    if (input[0] != '.') {
  ------------------
  |  Branch (15124:9): [True: 204, False: 306]
  ------------------
15125|    204|      size_t slashdot = 0;
15126|    204|      bool dot_is_file = true;
15127|    800|      for (;;) {
15128|    800|        slashdot = input.find("/.", slashdot);
15129|    800|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15129:13): [True: 204, False: 596]
  ------------------
15130|    204|          break;
15131|    596|        } else {  // uncommon
15132|       |          // only three cases matter: /./, /.. or a final /
15133|    596|          slashdot += 2;
15134|    596|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15134:28): [True: 1, False: 595]
  |  Branch (15134:56): [True: 333, False: 262]
  ------------------
15135|    262|                           input[slashdot] == '/');
  ------------------
  |  Branch (15135:28): [True: 128, False: 134]
  ------------------
15136|    596|        }
15137|    800|      }
15138|    204|      trivial_path = dot_is_file;
15139|    204|    }
15140|    510|  }
15141|  1.85k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15141:7): [True: 743, False: 1.11k]
  |  Branch (15141:23): [True: 743, False: 0]
  ------------------
15142|    743|    ada_log("parse_path trivial");
15143|    743|    buffer += '/';
15144|    743|    buffer += input;
15145|    743|    return;
15146|    743|  }
15147|  1.11k|  std::string path = std::string(get_pathname());
15148|       |  // We are going to need to look a bit at the path, but let us see if we can
15149|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15150|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15151|       |  // there.
15152|  1.11k|  bool fast_path =
15153|  1.11k|      (special &&
  ------------------
  |  Branch (15153:8): [True: 1.11k, False: 0]
  ------------------
15154|  1.11k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15154:8): [True: 467, False: 646]
  ------------------
15155|    467|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15155:7): [True: 467, False: 0]
  ------------------
15156|  1.11k|  if (fast_path) {
  ------------------
  |  Branch (15156:7): [True: 467, False: 646]
  ------------------
15157|    467|    ada_log("parse_prepared_path fast");
15158|       |    // Here we don't need to worry about \ or percent encoding.
15159|       |    // We also do not have a file protocol. We might have dots, however,
15160|       |    // but dots must as appear as '.', and they cannot be encoded because
15161|       |    // the symbol '%' is not present.
15162|    467|    size_t previous_location = 0;  // We start at 0.
15163|  2.70k|    do {
15164|  2.70k|      size_t new_location = input.find('/', previous_location);
15165|       |      // std::string_view path_view = input;
15166|       |      //  We process the last segment separately:
15167|  2.70k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15167:11): [True: 467, False: 2.24k]
  ------------------
15168|    467|        std::string_view path_view = input.substr(previous_location);
15169|    467|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15169:13): [True: 24, False: 443]
  ------------------
15170|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15171|     24|          if (path.empty()) {
  ------------------
  |  Branch (15171:15): [True: 3, False: 21]
  ------------------
15172|      3|            path = '/';
15173|      3|            update_base_pathname(path);
15174|      3|            return;
15175|      3|          }
15176|       |          // Fast case where we have nothing to do:
15177|     21|          if (path.back() == '/') {
  ------------------
  |  Branch (15177:15): [True: 4, False: 17]
  ------------------
15178|      4|            update_base_pathname(path);
15179|      4|            return;
15180|      4|          }
15181|       |          // If you have the path "/joe/myfriend",
15182|       |          // then you delete 'myfriend'.
15183|     17|          path.resize(path.rfind('/') + 1);
15184|     17|          update_base_pathname(path);
15185|     17|          return;
15186|     21|        }
15187|    443|        path += '/';
15188|    443|        if (path_view != ".") {
  ------------------
  |  Branch (15188:13): [True: 440, False: 3]
  ------------------
15189|    440|          path.append(path_view);
15190|    440|        }
15191|    443|        update_base_pathname(path);
15192|    443|        return;
15193|  2.24k|      } else {
15194|       |        // This is a non-final segment.
15195|  2.24k|        std::string_view path_view =
15196|  2.24k|            input.substr(previous_location, new_location - previous_location);
15197|  2.24k|        previous_location = new_location + 1;
15198|  2.24k|        if (path_view == "..") {
  ------------------
  |  Branch (15198:13): [True: 367, False: 1.87k]
  ------------------
15199|    367|          size_t last_delimiter = path.rfind('/');
15200|    367|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15200:15): [True: 165, False: 202]
  ------------------
15201|    165|            path.erase(last_delimiter);
15202|    165|          }
15203|  1.87k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15203:20): [True: 1.64k, False: 234]
  ------------------
15204|  1.64k|          path += '/';
15205|  1.64k|          path.append(path_view);
15206|  1.64k|        }
15207|  2.24k|      }
15208|  2.70k|    } while (true);
  ------------------
  |  Branch (15208:14): [True: 2.24k, Folded]
  ------------------
15209|    646|  } else {
15210|    646|    ada_log("parse_path slow");
15211|       |    // we have reached the general case
15212|    646|    bool needs_percent_encoding = (accumulator & 1);
15213|    646|    std::string path_buffer_tmp;
15214|  4.31k|    do {
15215|  4.31k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15215:26): [True: 4.31k, False: 0]
  |  Branch (15215:37): [True: 130, False: 4.18k]
  ------------------
15216|  4.31k|                            ? input.find_first_of("/\\")
15217|  4.31k|                            : input.find('/');
15218|  4.31k|      std::string_view path_view = input;
15219|  4.31k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15219:11): [True: 3.67k, False: 646]
  ------------------
15220|  3.67k|        path_view.remove_suffix(path_view.size() - location);
15221|  3.67k|        input.remove_prefix(location + 1);
15222|  3.67k|      }
15223|       |      // path_buffer is either path_view or it might point at a percent encoded
15224|       |      // temporary string.
15225|  4.31k|      std::string_view path_buffer =
15226|  4.31k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15226:12): [True: 3.76k, False: 556]
  ------------------
15227|  3.76k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15227:12): [True: 1.20k, False: 2.55k]
  ------------------
15228|  3.76k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15229|  4.31k|              ? path_buffer_tmp
15230|  4.31k|              : path_view;
15231|  4.31k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15231:11): [True: 394, False: 3.92k]
  ------------------
15232|    394|        helpers::shorten_path(path, type);
15233|    394|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15233:13): [True: 20, False: 374]
  ------------------
15234|     20|          path += '/';
15235|     20|        }
15236|  3.92k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15236:18): [True: 242, False: 3.68k]
  ------------------
15237|    242|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15237:18): [True: 18, False: 224]
  ------------------
15238|     18|        path += '/';
15239|     18|      }
15240|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15241|  3.90k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15241:16): [True: 3.68k, False: 224]
  ------------------
15242|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15243|       |        // Windows drive letter, then replace the second code point in
15244|       |        // path_buffer with U+003A (:).
15245|  3.68k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15245:13): [True: 0, False: 3.68k]
  |  Branch (15245:48): [True: 0, False: 0]
  ------------------
15246|      0|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15246:13): [True: 0, False: 0]
  ------------------
15247|      0|          path += '/';
15248|      0|          path += path_buffer[0];
15249|      0|          path += ':';
15250|      0|          path_buffer.remove_prefix(2);
15251|      0|          path.append(path_buffer);
15252|  3.68k|        } else {
15253|       |          // Append path_buffer to url's path.
15254|  3.68k|          path += '/';
15255|  3.68k|          path.append(path_buffer);
15256|  3.68k|        }
15257|  3.68k|      }
15258|  4.31k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15258:11): [True: 646, False: 3.67k]
  ------------------
15259|    646|        update_base_pathname(path);
15260|    646|        return;
15261|    646|      }
15262|  4.31k|    } while (true);
  ------------------
  |  Branch (15262:14): [True: 3.67k, Folded]
  ------------------
15263|    646|  }
15264|  1.11k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|  9.16k|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|  9.16k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (14:7): [True: 839, False: 8.32k]
  ------------------
   15|    839|    return false;
   16|    839|  }
   17|       |  // If the address ends with a dot, we need to prune it (special case).
   18|  8.32k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (18:7): [True: 125, False: 8.19k]
  ------------------
   19|    125|    view.remove_suffix(1);
   20|    125|  }
   21|       |  // From the last character, find the last dot.
   22|  8.32k|  size_t last_dot = view.rfind('.');
   23|  8.32k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (23:7): [True: 7.34k, False: 979]
  ------------------
   24|       |    // We have at least one dot.
   25|  7.34k|    view.remove_prefix(last_dot + 1);
   26|  7.34k|  }
   27|       |  /** Optimization opportunity: we have basically identified the last number of
   28|       |     the ipv4 if we return true here. We might as well parse it and have at
   29|       |     least one number parsed when we get to parse_ipv4. */
   30|  8.32k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (30:7): [True: 7.75k, False: 573]
  ------------------
   31|  7.75k|    return true;
   32|  7.75k|  }
   33|       |  // It could be hex (0x), but not if there is a single character.
   34|    573|  if (view.size() == 1) {
  ------------------
  |  Branch (34:7): [True: 0, False: 573]
  ------------------
   35|      0|    return false;
   36|      0|  }
   37|       |  // It must start with 0x.
   38|    573|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (38:7): [True: 80, False: 493]
  ------------------
   39|     80|    return false;
   40|     80|  }
   41|       |  // We must allow "0x".
   42|    493|  if (view.size() == 2) {
  ------------------
  |  Branch (42:7): [True: 34, False: 459]
  ------------------
   43|     34|    return true;
   44|     34|  }
   45|       |  // We have 0x followed by some characters, we need to check that they are
   46|       |  // hexadecimals.
   47|    459|  view.remove_prefix(2);
   48|    459|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   49|    493|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7174|  5.85k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7175|  5.85k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7175:11): [True: 5.85k, False: 0]
  |  Branch (7175:23): [True: 2.83k, False: 3.01k]
  |  Branch (7175:37): [True: 3.01k, False: 3]
  |  Branch (7175:49): [True: 2.98k, False: 25]
  ------------------
 7176|  5.85k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   75|  8.82k|    std::string_view input) noexcept {
   76|       |  // The path percent-encode set is the query percent-encode set and U+003F (?),
   77|       |  // U+0060 (`), U+007B ({), and U+007D (}). The query percent-encode set is the
   78|       |  // C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#),
   79|       |  // U+003C (<), and U+003E (>). The C0 control percent-encode set are the C0
   80|       |  // controls and all code points greater than U+007E (~).
   81|  8.82k|  size_t i = 0;
   82|  8.82k|  uint8_t accumulator{};
   83|  25.6k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (83:10): [True: 16.7k, False: 8.82k]
  ------------------
   84|  16.7k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   85|  16.7k|                           path_signature_table[uint8_t(input[i + 1])] |
   86|  16.7k|                           path_signature_table[uint8_t(input[i + 2])] |
   87|  16.7k|                           path_signature_table[uint8_t(input[i + 3])] |
   88|  16.7k|                           path_signature_table[uint8_t(input[i + 4])] |
   89|  16.7k|                           path_signature_table[uint8_t(input[i + 5])] |
   90|  16.7k|                           path_signature_table[uint8_t(input[i + 6])] |
   91|  16.7k|                           path_signature_table[uint8_t(input[i + 7])]);
   92|  16.7k|  }
   93|  35.0k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (93:10): [True: 26.2k, False: 8.82k]
  ------------------
   94|  26.2k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   95|  26.2k|  }
   96|  8.82k|  return accumulator;
   97|  8.82k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7055|  11.7k|                                              size_t length) noexcept {
 7056|  11.7k|  size_t i = 0;
 7057|  11.7k|  uint8_t accumulator{};
 7058|  60.7k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7058:10): [True: 48.9k, False: 11.7k]
  ------------------
 7059|  48.9k|    accumulator |=
 7060|  48.9k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7061|  48.9k|    accumulator |=
 7062|  48.9k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7063|  48.9k|    accumulator |=
 7064|  48.9k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7065|  48.9k|    accumulator |=
 7066|  48.9k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7067|  48.9k|  }
 7068|  27.4k|  for (; i < length; i++) {
  ------------------
  |  Branch (7068:10): [True: 15.7k, False: 11.7k]
  ------------------
 7069|  15.7k|    accumulator |=
 7070|  15.7k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7071|  15.7k|  }
 7072|  11.7k|  return accumulator;
 7073|  11.7k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13666|  11.9k|    const std::string_view input_with_colon) {
13667|  11.9k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13668|  11.9k|  ADA_ASSERT_TRUE(validate());
13669|  11.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13670|  11.9k|  std::string_view input{input_with_colon};
13671|  11.9k|  input.remove_suffix(1);
13672|  11.9k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13673|  11.9k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13674|       |  /**
13675|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13676|       |   *http, https), in which case, we can go really fast.
13677|       |   **/
13678|  11.9k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13678:7): [True: 11.9k, False: 0]
  ------------------
13679|       |    if constexpr (has_state_override) {
13680|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13681|       |      // then return.
13682|       |      if (is_special() != is_input_special) {
13683|       |        return false;
13684|       |      }
13685|       |
13686|       |      // If url includes credentials or has a non-null port, and buffer is
13687|       |      // "file", then return.
13688|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13689|       |          parsed_type == ada::scheme::type::FILE) {
13690|       |        return false;
13691|       |      }
13692|       |
13693|       |      // If url's scheme is "file" and its host is an empty host, then return.
13694|       |      // An empty host is the empty string.
13695|       |      if (type == ada::scheme::type::FILE &&
13696|       |          components.host_start == components.host_end) {
13697|       |        return false;
13698|       |      }
13699|       |    }
13700|       |
13701|  11.9k|    type = parsed_type;
13702|  11.9k|    set_scheme_from_view_with_colon(input_with_colon);
13703|       |
13704|       |    if constexpr (has_state_override) {
13705|       |      // This is uncommon.
13706|       |      uint16_t urls_scheme_port = get_special_port();
13707|       |
13708|       |      if (urls_scheme_port) {
13709|       |        // If url's port is url's scheme's default port, then set url's port to
13710|       |        // null.
13711|       |        if (components.port == urls_scheme_port) {
13712|       |          clear_port();
13713|       |        }
13714|       |      }
13715|       |    }
13716|  11.9k|  } else {  // slow path
13717|      0|    std::string _buffer(input);
13718|       |    // Next function is only valid if the input is ASCII and returns false
13719|       |    // otherwise, but it seems that we always have ascii content so we do not
13720|       |    // need to check the return value.
13721|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
13722|       |
13723|       |    if constexpr (has_state_override) {
13724|       |      // The state-override validation errors below ("return" in the WHATWG URL
13725|       |      // parser) leave the URL unchanged. The setter contract is
13726|       |      // "true on success, false if the scheme is invalid" -- the fast path
13727|       |      // above already returns false here, so the slow path must agree.
13728|       |
13729|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
13730|       |      // then return. If url's scheme is not a special scheme and buffer is a
13731|       |      // special scheme, then return.
13732|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
13733|       |        return false;
13734|       |      }
13735|       |
13736|       |      // If url includes credentials or has a non-null port, and buffer is
13737|       |      // "file", then return.
13738|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13739|       |          _buffer == "file") {
13740|       |        return false;
13741|       |      }
13742|       |
13743|       |      // If url's scheme is "file" and its host is an empty host, then return.
13744|       |      // An empty host is the empty string.
13745|       |      if (type == ada::scheme::type::FILE &&
13746|       |          components.host_start == components.host_end) {
13747|       |        return false;
13748|       |      }
13749|       |    }
13750|       |
13751|      0|    set_scheme(_buffer);
13752|       |
13753|       |    if constexpr (has_state_override) {
13754|       |      // This is uncommon.
13755|       |      uint16_t urls_scheme_port = get_special_port();
13756|       |
13757|       |      if (urls_scheme_port) {
13758|       |        // If url's port is url's scheme's default port, then set url's port to
13759|       |        // null.
13760|       |        if (components.port == urls_scheme_port) {
13761|       |          clear_port();
13762|       |        }
13763|       |      }
13764|       |    }
13765|      0|  }
13766|  11.9k|  ADA_ASSERT_TRUE(validate());
13767|  11.9k|  return true;
13768|  11.9k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13792|  11.9k|    std::string_view new_scheme_with_colon) {
13793|  11.9k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
13794|  11.9k|          new_scheme_with_colon);
13795|  11.9k|  ADA_ASSERT_TRUE(validate());
13796|  11.9k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
13797|  11.9k|                  new_scheme_with_colon.back() == ':');
13798|       |  // next line could overflow but unsigned arithmetic has well-defined
13799|       |  // overflows.
13800|  11.9k|  uint32_t new_difference =
13801|  11.9k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
13802|       |
13803|  11.9k|  if (buffer.empty()) {
  ------------------
  |  Branch (13803:7): [True: 11.9k, False: 0]
  ------------------
13804|  11.9k|    buffer.append(new_scheme_with_colon);
13805|  11.9k|  } else {
13806|      0|    buffer.erase(0, components.protocol_end);
13807|      0|    buffer.insert(0, new_scheme_with_colon);
13808|      0|  }
13809|  11.9k|  components.protocol_end += new_difference;
13810|       |
13811|  11.9k|  apply_shifted_non_scheme_offsets(components, new_difference);
13812|  11.9k|  ADA_ASSERT_TRUE(validate());
13813|  11.9k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5809|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1081|   260k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1082|   260k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1083|   260k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2196|  21.4k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2210|  10.7k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 1700|  15.4k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3682|  10.7k|      : impl_base(unexpect, std::move(e.value())),
 3683|  10.7k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2668|  10.7k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3286|  13.1k|  constexpr explicit expected_default_ctor_base(default_constructor_tag) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS2_TnPNSt3__19enable_ifIXsr3std14is_convertibleIOT_S2_EE5valueEvE4typeELPv0ETnPNS7_IXaaaaaasr3std16is_constructibleIS2_S9_EE5valuentsr3std7is_sameINS6_5decayIS8_E4typeENS_10in_place_tEEE5valuentsr3std7is_sameIS4_SG_EE5valuentsr3std7is_sameINS_10unexpectedIS3_EESG_EE5valueEvE4typeELSD_0EEES9_:
 3768|  2.37k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3641|  2.37k|      : impl_base(in_place, std::forward<Args>(args)...),
 3642|  2.37k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2656|  2.37k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7836|  2.37k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7839|  15.4k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6851|  11.9k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6852|  11.9k|  if (scheme.empty()) {
  ------------------
  |  Branch (6852:7): [True: 0, False: 11.9k]
  ------------------
 6853|      0|    return ada::scheme::NOT_SPECIAL;
 6854|      0|  }
 6855|  11.9k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6856|  11.9k|  const std::string_view target = details::is_special_list[hash_value];
 6857|  11.9k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6857:7): [True: 11.9k, False: 0]
  ------------------
 6858|  11.9k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6858:7): [True: 11.9k, False: 0]
  ------------------
 6859|  11.9k|          details::scheme_keys[hash_value]) {
 6860|  11.9k|    return ada::scheme::type(hash_value);
 6861|  11.9k|  } else {
 6862|      0|    return ada::scheme::NOT_SPECIAL;
 6863|      0|  }
 6864|  11.9k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6792|  11.9k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6793|  11.9k|  uint64_t input = (uint8_t)p[0];
 6794|  11.9k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6795|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6796|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6797|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6798|  11.9k|  return input;
 6799|  11.9k|}
_ZN3ada14url_aggregatorC2Ev:
 7834|  13.1k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4960|  13.1k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1453|  14.2k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1454|  14.2k|  const size_t len = input.size();
 1455|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1456|  14.2k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1456:7): [True: 9.60k, False: 4.60k]
  |  Branch (1456:18): [True: 1.91k, False: 2.69k]
  ------------------
 1457|  11.5k|    return ipv4_fast_fail;
 1458|  11.5k|  }
 1459|  2.69k|  const char* data = input.data();
 1460|       |
 1461|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1462|       |  return detail::try_parse_ipv4_avx512(data, len);
 1463|       |#else
 1464|  2.69k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1465|  14.2k|#endif
 1466|  14.2k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1294|  2.69k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1295|  2.69k|  uint32_t ipv4 = 0;
 1296|  4.92k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1296:19): [True: 4.40k, False: 522]
  ------------------
 1297|  4.40k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1297:9): [True: 4, False: 4.39k]
  ------------------
 1298|      4|      return ipv4_fast_fail;
 1299|      4|    }
 1300|  4.39k|    uint32_t val;
 1301|  4.39k|    char c = *p;
 1302|  4.39k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1302:9): [True: 3.69k, False: 699]
  |  Branch (1302:21): [True: 2.69k, False: 1.00k]
  ------------------
 1303|  2.69k|      val = static_cast<uint32_t>(c - '0');
 1304|  2.69k|      ++p;
 1305|  2.69k|    } else {
 1306|  1.70k|      return ipv4_fast_fail;
 1307|  1.70k|    }
 1308|  2.69k|    if (p < pend) {
  ------------------
  |  Branch (1308:9): [True: 2.47k, False: 224]
  ------------------
 1309|  2.47k|      c = *p;
 1310|  2.47k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1310:11): [True: 1.50k, False: 971]
  |  Branch (1310:23): [True: 1.34k, False: 160]
  ------------------
 1311|  1.34k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1311:13): [True: 78, False: 1.26k]
  ------------------
 1312|     78|          return ipv4_fast_fail;
 1313|     78|        }
 1314|  1.26k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1315|  1.26k|        ++p;
 1316|  1.26k|        if (p < pend) {
  ------------------
  |  Branch (1316:13): [True: 1.13k, False: 126]
  ------------------
 1317|  1.13k|          c = *p;
 1318|  1.13k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1318:15): [True: 796, False: 340]
  |  Branch (1318:27): [True: 780, False: 16]
  ------------------
 1319|    780|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1320|    780|            ++p;
 1321|    780|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1321:17): [True: 135, False: 645]
  ------------------
 1322|    135|              return ipv4_fast_fail;
 1323|    135|            }
 1324|    780|          }
 1325|  1.13k|        }
 1326|  1.26k|      }
 1327|  2.47k|    }
 1328|  2.48k|    ipv4 = (ipv4 << 8) | val;
 1329|  2.48k|    if (i < 3) {
  ------------------
  |  Branch (1329:9): [True: 1.96k, False: 522]
  ------------------
 1330|  1.96k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1330:11): [True: 29, False: 1.93k]
  |  Branch (1330:24): [True: 225, False: 1.70k]
  ------------------
 1331|    254|        return ipv4_fast_fail;
 1332|    254|      }
 1333|  1.70k|      ++p;
 1334|  1.70k|    }
 1335|  2.48k|  }
 1336|    522|  if (p != pend) {
  ------------------
  |  Branch (1336:7): [True: 55, False: 467]
  ------------------
 1337|     55|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1337:9): [True: 30, False: 25]
  |  Branch (1337:26): [True: 4, False: 26]
  ------------------
 1338|      4|      return ipv4;
 1339|      4|    }
 1340|     51|    return ipv4_fast_fail;
 1341|     55|  }
 1342|    467|  return ipv4;
 1343|    522|}
_ZNK3ada8url_base10is_specialEv:
 7334|  45.5k|    const noexcept {
 7335|  45.5k|  return type != ada::scheme::NOT_SPECIAL;
 7336|  45.5k|}
_ZN3ada8checkers8is_alphaEc:
 1274|  18.0k|constexpr bool is_alpha(char x) noexcept {
 1275|  18.0k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1275:10): [True: 14.4k, False: 3.67k]
  |  Branch (1275:34): [True: 14.1k, False: 254]
  ------------------
 1276|  18.0k|}
_ZN3ada8checkers8to_lowerEc:
 1272|  32.4k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1247|  10.8k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1248|  10.8k|  if (view.empty()) {
  ------------------
  |  Branch (1248:7): [True: 0, False: 10.8k]
  ------------------
 1249|      0|    return false;
 1250|      0|  }
 1251|  10.8k|  const char* start = view.data();
 1252|  10.8k|  const char* end = start + view.size();
 1253|  10.8k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1253:7): [True: 433, False: 10.4k]
  ------------------
 1254|    433|    --end;
 1255|    433|    if (end == start) {
  ------------------
  |  Branch (1255:9): [True: 260, False: 173]
  ------------------
 1256|    260|      return false;
 1257|    260|    }
 1258|    433|  }
 1259|  10.6k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1259:7): [True: 1.21k, False: 9.38k]
  ------------------
 1260|  1.21k|    return false;
 1261|  1.21k|  }
 1262|  9.38k|  const char* label = end;
 1263|  35.5k|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1263:10): [True: 34.0k, False: 1.48k]
  |  Branch (1263:28): [True: 26.1k, False: 7.90k]
  ------------------
 1264|  26.1k|    --label;
 1265|  26.1k|  }
 1266|  9.38k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1266:7): [True: 7.90k, False: 1.48k]
  |  Branch (1266:25): [True: 293, False: 7.61k]
  ------------------
 1267|    293|    return false;
 1268|    293|  }
 1269|  9.09k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1269:10): [True: 9.09k, False: 0]
  |  Branch (1269:26): [True: 8.58k, False: 509]
  ------------------
 1270|  9.38k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1241|  44.6k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1242|  44.6k|  const unsigned char c = static_cast<unsigned char>(x);
 1243|  44.6k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1243:11): [True: 36.6k, False: 8.00k]
  |  Branch (1243:23): [True: 26.3k, False: 10.3k]
  |  Branch (1243:37): [True: 9.73k, False: 8.63k]
  |  Branch (1243:49): [True: 6.17k, False: 3.56k]
  ------------------
 1244|  12.1k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1244:11): [True: 4.08k, False: 8.11k]
  |  Branch (1244:23): [True: 241, False: 3.84k]
  |  Branch (1244:36): [True: 2.61k, False: 9.34k]
  |  Branch (1244:48): [True: 223, False: 9.12k]
  ------------------
 1245|  44.6k|}
_ZN3ada8checkers8is_digitEc:
 1239|  23.5k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6848|    273|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6849|    273|  return details::special_ports[int(type)];
 6850|    273|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8559|  1.33k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8560|  1.33k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8561|  1.33k|          " bytes] \n", to_diagram());
 8562|  1.33k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8563|  1.33k|  ADA_ASSERT_TRUE(validate());
 8564|       |
 8565|  1.33k|  const bool begins_with_dashdash = input.starts_with("//");
 8566|  1.33k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8566:7): [True: 1.17k, False: 156]
  |  Branch (8566:32): [True: 0, False: 1.17k]
  ------------------
 8567|       |    // We must delete the ./
 8568|      0|    delete_dash_dot();
 8569|      0|  }
 8570|       |
 8571|  1.33k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8571:7): [True: 156, False: 1.17k]
  |  Branch (8571:31): [True: 156, False: 0]
  |  Branch (8571:51): [True: 0, False: 156]
  ------------------
 8572|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (8572:7): [True: 0, False: 0]
  ------------------
 8573|       |    // If url's host is null, url does not have an opaque path, url's path's
 8574|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8575|       |    // output.
 8576|      0|    buffer.insert(components.pathname_start, "/.");
 8577|      0|    components.pathname_start += 2;
 8578|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8578:9): [True: 0, False: 0]
  ------------------
 8579|      0|      components.search_start += 2;
 8580|      0|    }
 8581|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8581:9): [True: 0, False: 0]
  ------------------
 8582|      0|      components.hash_start += 2;
 8583|      0|    }
 8584|      0|  }
 8585|       |
 8586|  1.33k|  uint32_t difference = replace_and_resize(
 8587|  1.33k|      components.pathname_start,
 8588|  1.33k|      components.pathname_start + get_pathname_length(), input);
 8589|  1.33k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8589:7): [True: 0, False: 1.33k]
  ------------------
 8590|      0|    components.search_start += difference;
 8591|      0|  }
 8592|  1.33k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8592:7): [True: 0, False: 1.33k]
  ------------------
 8593|      0|    components.hash_start += difference;
 8594|      0|  }
 8595|  1.33k|  ADA_ASSERT_TRUE(validate());
 8596|  1.33k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8401|  4.34k|    uint32_t start, uint32_t end, std::string_view input) {
 8402|  4.34k|  uint32_t current_length = end - start;
 8403|  4.34k|  uint32_t input_size = uint32_t(input.size());
 8404|  4.34k|  uint32_t new_difference = input_size - current_length;
 8405|       |
 8406|  4.34k|  if (current_length == 0) {
  ------------------
  |  Branch (8406:7): [True: 3.47k, False: 875]
  ------------------
 8407|  3.47k|    buffer.insert(start, input);
 8408|  3.47k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8408:14): [True: 27, False: 848]
  ------------------
 8409|     27|    if (input_size != 0) {
  ------------------
  |  Branch (8409:9): [True: 27, False: 0]
  ------------------
 8410|     27|      std::memmove(buffer.data() + start, input.data(), input_size);
 8411|     27|    }
 8412|    848|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8412:14): [True: 38, False: 810]
  ------------------
 8413|     38|    buffer.erase(start, current_length - input_size);
 8414|     38|    buffer.replace(start, input_size, input);
 8415|    810|  } else {
 8416|    810|    buffer.replace(start, current_length, input.substr(0, current_length));
 8417|    810|    buffer.insert(start + current_length, input.substr(current_length));
 8418|    810|  }
 8419|       |
 8420|  4.34k|  return new_difference;
 8421|  4.34k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8452|  1.33k|url_aggregator::get_pathname_length() const noexcept {
 8453|  1.33k|  ada_log("url_aggregator::get_pathname_length");
 8454|  1.33k|  uint32_t ending_index = uint32_t(buffer.size());
 8455|  1.33k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8455:7): [True: 0, False: 1.33k]
  ------------------
 8456|      0|    ending_index = components.search_start;
 8457|  1.33k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8457:14): [True: 0, False: 1.33k]
  ------------------
 8458|      0|    ending_index = components.hash_start;
 8459|      0|  }
 8460|  1.33k|  return ending_index - components.pathname_start;
 8461|  1.33k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9394|  1.11k|    ada_lifetime_bound {
 9395|  1.11k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9396|  1.11k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9397|  1.11k|          " components.search_start = ", components.search_start,
 9398|  1.11k|          " components.hash_start = ", components.hash_start);
 9399|  1.11k|  auto ending_index = uint32_t(buffer.size());
 9400|  1.11k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9400:7): [True: 0, False: 1.11k]
  ------------------
 9401|      0|    ending_index = components.search_start;
 9402|  1.11k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9402:14): [True: 0, False: 1.11k]
  ------------------
 9403|      0|    ending_index = components.hash_start;
 9404|      0|  }
 9405|  1.11k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9406|  1.11k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8377|    260|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8378|    260|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8379|    260|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8380|    260|          " bytes] components.hash_start = ", components.hash_start);
 8381|    260|  ADA_ASSERT_TRUE(validate());
 8382|    260|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8383|    260|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8383:7): [True: 0, False: 260]
  ------------------
 8384|      0|    buffer.resize(components.hash_start);
 8385|      0|  }
 8386|    260|  components.hash_start = uint32_t(buffer.size());
 8387|    260|  buffer += "#";
 8388|    260|  bool encoding_required = unicode::percent_encode<true>(
 8389|    260|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8390|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8391|       |  // encoding was not deemed required.
 8392|    260|  if (!encoding_required) {
  ------------------
  |  Branch (8392:7): [True: 158, False: 102]
  ------------------
 8393|    158|    buffer.append(input);
 8394|    158|  }
 8395|    260|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8396|    260|          buffer, "' [", buffer.size(), " bytes]");
 8397|    260|  ADA_ASSERT_TRUE(validate());
 8398|    260|}
_ZNK3ada8url_base19scheme_default_portEv:
 7343|     66|url_base::scheme_default_port() const noexcept {
 7344|     66|  return scheme::get_special_port(type);
 7345|     66|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1278|  6.96k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1279|  6.96k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1279:10): [True: 6.00k, False: 958]
  ------------------
 1280|  6.00k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1280:11): [True: 2.15k, False: 3.85k]
  |  Branch (1280:34): [True: 234, False: 1.91k]
  |  Branch (1280:55): [True: 2, False: 1.91k]
  ------------------
 1281|    236|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1281:11): [True: 2, False: 234]
  |  Branch (1281:35): [True: 59, False: 175]
  |  Branch (1281:54): [True: 1, False: 174]
  ------------------
 1282|    174|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1282:35): [True: 8, False: 166]
  |  Branch (1282:54): [True: 4, False: 162]
  ------------------
 1283|  6.96k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1286|  6.96k|    std::string_view input) noexcept {
 1287|  6.96k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1287:10): [True: 102, False: 6.86k]
  |  Branch (1287:32): [True: 28, False: 74]
  |  Branch (1287:54): [True: 1, False: 27]
  ------------------
 1288|  6.96k|}
_ZN3ada7helpers14leading_zeroesEj:
 1985|  12.0k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1986|       |#if ADA_REGULAR_VISUAL_STUDIO
 1987|       |  unsigned long leading_zero(0);
 1988|       |  unsigned long in(input_num);
 1989|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1990|       |#else
 1991|  12.0k|  return __builtin_clz(input_num);
 1992|  12.0k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1993|  12.0k|}
_ZN3ada14url_aggregator7reserveEj:
 9067|  11.9k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9068|  11.9k|  buffer.reserve(capacity);
 9069|  11.9k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8785|  1.06k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8786|  1.06k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8787|  1.06k|          "\n", to_diagram());
 8788|  1.06k|  ADA_ASSERT_TRUE(validate());
 8789|  1.06k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8790|       |#if ADA_DEVELOPMENT_CHECKS
 8791|       |  // computing the expected password.
 8792|       |  std::string password_expected = std::string(get_password());
 8793|       |  password_expected.append(input);
 8794|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8795|  1.06k|  add_authority_slashes_if_needed();
 8796|       |
 8797|       |  // If input is empty, do nothing.
 8798|  1.06k|  if (input.empty()) {
  ------------------
  |  Branch (8798:7): [True: 457, False: 609]
  ------------------
 8799|    457|    return;
 8800|    457|  }
 8801|       |
 8802|    609|  uint32_t difference = uint32_t(input.size());
 8803|    609|  if (has_password()) {
  ------------------
  |  Branch (8803:7): [True: 548, False: 61]
  ------------------
 8804|    548|    buffer.insert(components.host_start, input);
 8805|    548|  } else {
 8806|     61|    difference++;  // Increment for ":"
 8807|     61|    buffer.insert(components.username_end, ":");
 8808|     61|    buffer.insert(components.username_end + 1, input);
 8809|     61|  }
 8810|    609|  components.host_start += difference;
 8811|       |
 8812|       |  // The following line is required to add "@" to hostname. When updating
 8813|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8814|       |  // responsibility to set it.
 8815|    609|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8815:7): [True: 38, False: 571]
  ------------------
 8816|     38|    buffer.insert(components.host_start, "@");
 8817|     38|    difference++;
 8818|     38|  }
 8819|       |
 8820|    609|  components.host_end += difference;
 8821|    609|  components.pathname_start += difference;
 8822|    609|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8822:7): [True: 0, False: 609]
  ------------------
 8823|      0|    components.search_start += difference;
 8824|      0|  }
 8825|    609|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8825:7): [True: 0, False: 609]
  ------------------
 8826|      0|    components.hash_start += difference;
 8827|      0|  }
 8828|       |#if ADA_DEVELOPMENT_CHECKS
 8829|       |  std::string password_after(get_password());
 8830|       |  ADA_ASSERT_EQUAL(
 8831|       |      password_expected, password_after,
 8832|       |      "append_base_password problem after inserting " + std::string(input));
 8833|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8834|    609|  ADA_ASSERT_TRUE(validate());
 8835|    609|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9041|  6.06k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9042|  6.06k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9043|  6.06k|  ADA_ASSERT_TRUE(validate());
 9044|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9045|       |  // to insert
 9046|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9047|  6.06k|  if (has_authority()) {
  ------------------
  |  Branch (9047:7): [True: 3.70k, False: 2.35k]
  ------------------
 9048|  3.70k|    return;
 9049|  3.70k|  }
 9050|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9051|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9052|       |  // the insert could be fused with another insert.
 9053|  2.35k|  buffer.insert(components.protocol_end, "//");
 9054|  2.35k|  components.username_end += 2;
 9055|  2.35k|  components.host_start += 2;
 9056|  2.35k|  components.host_end += 2;
 9057|  2.35k|  components.pathname_start += 2;
 9058|  2.35k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9058:7): [True: 0, False: 2.35k]
  ------------------
 9059|      0|    components.search_start += 2;
 9060|      0|  }
 9061|  2.35k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9061:7): [True: 0, False: 2.35k]
  ------------------
 9062|      0|    components.hash_start += 2;
 9063|      0|  }
 9064|  2.35k|  ADA_ASSERT_TRUE(validate());
 9065|  2.35k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8669|  1.98k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8670|  1.98k|  ada_log("url_aggregator::append_base_username ", input);
 8671|  1.98k|  ADA_ASSERT_TRUE(validate());
 8672|  1.98k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8673|       |#if ADA_DEVELOPMENT_CHECKS
 8674|       |  // computing the expected password.
 8675|       |  std::string username_expected(get_username());
 8676|       |  username_expected.append(input);
 8677|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8678|  1.98k|  add_authority_slashes_if_needed();
 8679|       |
 8680|       |  // If input is empty, do nothing.
 8681|  1.98k|  if (input.empty()) {
  ------------------
  |  Branch (8681:7): [True: 843, False: 1.14k]
  ------------------
 8682|    843|    return;
 8683|    843|  }
 8684|       |
 8685|  1.14k|  uint32_t difference = uint32_t(input.size());
 8686|  1.14k|  buffer.insert(components.username_end, input);
 8687|  1.14k|  components.username_end += difference;
 8688|  1.14k|  components.host_start += difference;
 8689|       |
 8690|  1.14k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8690:7): [True: 176, False: 966]
  ------------------
 8691|    176|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8691:7): [True: 176, False: 0]
  ------------------
 8692|    176|    buffer.insert(components.host_start, "@");
 8693|    176|    difference++;
 8694|    176|  }
 8695|       |
 8696|  1.14k|  components.host_end += difference;
 8697|  1.14k|  components.pathname_start += difference;
 8698|  1.14k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8698:7): [True: 0, False: 1.14k]
  ------------------
 8699|      0|    components.search_start += difference;
 8700|      0|  }
 8701|  1.14k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8701:7): [True: 0, False: 1.14k]
  ------------------
 8702|      0|    components.hash_start += difference;
 8703|      0|  }
 8704|       |#if ADA_DEVELOPMENT_CHECKS
 8705|       |  std::string username_after(get_username());
 8706|       |  ADA_ASSERT_EQUAL(
 8707|       |      username_expected, username_after,
 8708|       |      "append_base_username problem after inserting " + std::string(input));
 8709|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8710|  1.14k|  ADA_ASSERT_TRUE(validate());
 8711|  1.14k|}
_ZN3ada14url_aggregator16update_base_portEj:
 8837|     42|inline void url_aggregator::update_base_port(uint32_t input) {
 8838|     42|  ada_log("url_aggregator::update_base_port");
 8839|     42|  ADA_ASSERT_TRUE(validate());
 8840|     42|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8840:7): [True: 0, False: 42]
  ------------------
 8841|      0|    clear_port();
 8842|      0|    return;
 8843|      0|  }
 8844|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8845|       |  // value is probably already available as a string.
 8846|     42|  std::string value = helpers::concat(":", std::to_string(input));
 8847|     42|  uint32_t difference = uint32_t(value.size());
 8848|       |
 8849|     42|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8849:7): [True: 0, False: 42]
  ------------------
 8850|      0|    difference -= components.pathname_start - components.host_end;
 8851|      0|    buffer.erase(components.host_end,
 8852|      0|                 components.pathname_start - components.host_end);
 8853|      0|  }
 8854|       |
 8855|     42|  buffer.insert(components.host_end, value);
 8856|     42|  components.pathname_start += difference;
 8857|     42|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8857:7): [True: 0, False: 42]
  ------------------
 8858|      0|    components.search_start += difference;
 8859|      0|  }
 8860|     42|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8860:7): [True: 0, False: 42]
  ------------------
 8861|      0|    components.hash_start += difference;
 8862|      0|  }
 8863|     42|  components.port = input;
 8864|     42|  ADA_ASSERT_TRUE(validate());
 8865|     42|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1975|     42|std::string concat(Args... args) {
 1976|     42|  std::string answer;
 1977|     42|  inner_concat(answer, args...);
 1978|     42|  return answer;
 1979|     42|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1964|     42|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1965|     42|  buffer.append(t);
 1966|     42|  return inner_concat(buffer, args...);
 1967|     42|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1956|     42|inline void inner_concat(std::string& buffer, T t) {
 1957|     42|  buffer.append(t);
 1958|     42|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8508|    595|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8509|    595|  ada_log("url_aggregator::update_base_search ", input,
 8510|    595|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8511|    595|  ADA_ASSERT_TRUE(validate());
 8512|    595|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8513|       |
 8514|    595|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8514:7): [True: 595, False: 0]
  ------------------
 8515|    595|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8515:9): [True: 595, False: 0]
  ------------------
 8516|    595|      components.search_start = uint32_t(buffer.size());
 8517|    595|      buffer += "?";
 8518|    595|    } else {
 8519|      0|      buffer.resize(components.search_start + 1);
 8520|      0|    }
 8521|       |
 8522|    595|    bool encoding_required =
 8523|    595|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8524|       |    // When encoding_required is false, then buffer is left unchanged, and
 8525|       |    // percent encoding was not deemed required.
 8526|    595|    if (!encoding_required) {
  ------------------
  |  Branch (8526:9): [True: 492, False: 103]
  ------------------
 8527|    492|      buffer.append(input);
 8528|    492|    }
 8529|    595|  } else {
 8530|      0|    const size_t idx =
 8531|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8532|      0|    std::string encoded;
 8533|      0|    std::string_view replacement = input;
 8534|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8534:9): [True: 0, False: 0]
  ------------------
 8535|      0|      encoded =
 8536|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8537|      0|      replacement = encoded;
 8538|      0|    }
 8539|       |
 8540|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8540:9): [True: 0, False: 0]
  ------------------
 8541|      0|      const uint32_t difference = replace_and_resize(
 8542|      0|          components.search_start + 1, components.hash_start, replacement);
 8543|      0|      components.hash_start += difference;
 8544|      0|    } else {
 8545|      0|      components.search_start = components.hash_start;
 8546|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8547|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8547:11): [True: 0, False: 0]
  ------------------
 8548|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8549|      0|                     replacement.data(), replacement.size());
 8550|      0|      }
 8551|      0|      components.hash_start +=
 8552|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8553|      0|    }
 8554|      0|  }
 8555|       |
 8556|    595|  ADA_ASSERT_TRUE(validate());
 8557|    595|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8423|  3.01k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8424|  3.01k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8425|  3.01k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8426|  3.01k|  ADA_ASSERT_TRUE(validate());
 8427|  3.01k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8428|       |
 8429|       |  // This next line is required for when parsing a URL like `foo://`
 8430|  3.01k|  add_authority_slashes_if_needed();
 8431|       |
 8432|  3.01k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8433|  3.01k|  uint32_t new_difference =
 8434|  3.01k|      replace_and_resize(components.host_start, components.host_end, input);
 8435|       |
 8436|  3.01k|  if (has_credentials) {
  ------------------
  |  Branch (8436:7): [True: 266, False: 2.74k]
  ------------------
 8437|    266|    buffer.insert(components.host_start, "@");
 8438|    266|    new_difference++;
 8439|    266|  }
 8440|  3.01k|  components.host_end += new_difference;
 8441|  3.01k|  components.pathname_start += new_difference;
 8442|  3.01k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8442:7): [True: 0, False: 3.01k]
  ------------------
 8443|      0|    components.search_start += new_difference;
 8444|      0|  }
 8445|  3.01k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8445:7): [True: 0, False: 3.01k]
  ------------------
 8446|      0|    components.hash_start += new_difference;
 8447|      0|  }
 8448|  3.01k|  ADA_ASSERT_TRUE(validate());
 8449|  3.01k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9155|    578|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9156|    578|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9157|    578|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9157:7): [True: 577, False: 1]
  |  Branch (9157:24): [True: 1, False: 576]
  ------------------
 9158|      1|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9159|      1|    is_valid = false;
 9160|      1|    return 0;
 9161|      1|  }
 9162|    577|  uint16_t parsed_port{};
 9163|    577|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9164|    577|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9164:7): [True: 19, False: 558]
  ------------------
 9165|     19|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9166|     19|    is_valid = false;
 9167|     19|    return 0;
 9168|     19|  }
 9169|    558|  ada_log("parse_port: ", parsed_port);
 9170|    558|  const size_t consumed = size_t(r.ptr - view.data());
 9171|    558|  ada_log("parse_port: consumed ", consumed);
 9172|    558|  if (check_trailing_content) {
  ------------------
  |  Branch (9172:7): [True: 558, False: 0]
  ------------------
 9173|    558|    is_valid &=
 9174|    558|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9174:10): [True: 17, False: 541]
  |  Branch (9174:37): [True: 41, False: 500]
  ------------------
 9175|    500|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9175:10): [True: 7, False: 493]
  |  Branch (9175:36): [True: 493, False: 0]
  |  Branch (9175:52): [True: 1, False: 492]
  ------------------
 9176|    558|  }
 9177|    558|  ada_log("parse_port: is_valid = ", is_valid);
 9178|    558|  if (is_valid) {
  ------------------
  |  Branch (9178:7): [True: 66, False: 492]
  ------------------
 9179|     66|    ada_log("parse_port", r.ec == std::errc());
 9180|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9181|     66|    auto default_port = scheme_default_port();
 9182|     66|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9182:27): [True: 0, False: 66]
  |  Branch (9182:48): [True: 0, False: 0]
  ------------------
 9183|     66|                         (default_port != parsed_port);
  ------------------
  |  Branch (9183:26): [True: 65, False: 1]
  ------------------
 9184|     66|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9184:9): [True: 43, False: 23]
  |  Branch (9184:32): [True: 42, False: 1]
  ------------------
 9185|     42|      update_base_port(parsed_port);
 9186|     42|    } else {
 9187|     24|      clear_port();
 9188|     24|    }
 9189|     66|  }
 9190|    558|  return consumed;
 9191|    577|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8278|  6.96k|                                              const uint8_t character_set[]) {
 8279|  6.96k|  const char* data = input.data();
 8280|  6.96k|  const size_t size = input.size();
 8281|       |
 8282|       |  // Process 8 bytes at a time using unrolled loop
 8283|  6.96k|  size_t i = 0;
 8284|  7.36k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8284:10): [True: 624, False: 6.74k]
  ------------------
 8285|    624|    unsigned char chunk[8];
 8286|    624|    std::memcpy(&chunk, data + i,
 8287|    624|                8);  // entices compiler to unconditionally process 8 characters
 8288|       |
 8289|       |    // Check 8 characters at once
 8290|  4.23k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8290:24): [True: 3.82k, False: 403]
  ------------------
 8291|  3.82k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8291:11): [True: 221, False: 3.60k]
  ------------------
 8292|    221|        return i + j;
 8293|    221|      }
 8294|  3.82k|    }
 8295|    624|  }
 8296|       |
 8297|       |  // Handle remaining bytes
 8298|  7.12k|  for (; i < size; i++) {
  ------------------
  |  Branch (8298:10): [True: 517, False: 6.60k]
  ------------------
 8299|    517|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8299:9): [True: 142, False: 375]
  ------------------
 8300|    142|      return i;
 8301|    142|    }
 8302|    517|  }
 8303|       |
 8304|  6.60k|  return size;
 8305|  6.74k|}
_ZN3ada14url_aggregator10clear_portEv:
 8867|     24|inline void url_aggregator::clear_port() {
 8868|     24|  ada_log("url_aggregator::clear_port");
 8869|     24|  ADA_ASSERT_TRUE(validate());
 8870|     24|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8870:7): [True: 24, False: 0]
  ------------------
 8871|     24|    return;
 8872|     24|  }
 8873|      0|  uint32_t length = components.pathname_start - components.host_end;
 8874|      0|  buffer.erase(components.host_end, length);
 8875|      0|  components.pathname_start -= length;
 8876|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8876:7): [True: 0, False: 0]
  ------------------
 8877|      0|    components.search_start -= length;
 8878|      0|  }
 8879|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8879:7): [True: 0, False: 0]
  ------------------
 8880|      0|    components.hash_start -= length;
 8881|      0|  }
 8882|      0|  components.port = url_components::omitted;
 8883|      0|  ADA_ASSERT_TRUE(validate());
 8884|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9032|  6.22k|    const noexcept {
 9033|  6.22k|  ada_log("url_aggregator::has_authority");
 9034|       |  // Performance: instead of doing this potentially expensive check, we could
 9035|       |  // have a boolean in the struct.
 9036|  6.22k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9036:10): [True: 3.86k, False: 2.35k]
  ------------------
 9037|  3.86k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9037:10): [True: 3.86k, False: 0]
  ------------------
 9038|  3.86k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9038:10): [True: 3.86k, False: 0]
  ------------------
 9039|  6.22k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9112|  1.17k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9113|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9114|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9115|       |  // U+002F (/) followed by U+002E (.) to output.
 9116|  1.17k|  ada_log("url_aggregator::has_dash_dot");
 9117|       |#if ADA_DEVELOPMENT_CHECKS
 9118|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9119|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9120|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9121|       |  if (components.pathname_start == components.host_end + 2) {
 9122|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9123|       |                     buffer[components.host_end + 1] == '.') ||
 9124|       |                    (buffer[components.host_end] == ':' &&
 9125|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9126|       |  }
 9127|       |  if (components.pathname_start == components.host_end + 2 &&
 9128|       |      buffer[components.host_end] == '/' &&
 9129|       |      buffer[components.host_end + 1] == '.') {
 9130|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9131|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9132|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9133|       |  }
 9134|       |#endif
 9135|       |  // Performance: it should be uncommon for components.pathname_start ==
 9136|       |  // components.host_end + 2 to be true. So we put this check first in the
 9137|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9138|       |  // more expensive, but should be uncommon.
 9139|  1.17k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9139:10): [True: 16, False: 1.16k]
  ------------------
 9140|     16|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9140:10): [True: 16, False: 0]
  |  Branch (9140:30): [True: 0, False: 16]
  ------------------
 9141|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9141:10): [True: 0, False: 0]
  ------------------
 9142|  1.17k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4081|  13.1k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4050|  2.67k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4051|  2.67k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|  2.67k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4051:5): [True: 2.67k, False: 0]
  ------------------
 4052|  2.67k|    return valptr();
 4053|  2.67k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3346|  2.67k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4080|  2.67k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2678|  13.1k|  ~expected_storage_base() {
 2679|  13.1k|    if (m_has_val) {
  ------------------
  |  Branch (2679:9): [True: 2.37k, False: 10.7k]
  ------------------
 2680|  2.37k|      m_val.~T();
 2681|  2.37k|    }
 2682|  13.1k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1897|  4.20k|                                                       size_t pos2) {
 1898|       |#if ADA_DEVELOPMENT_CHECKS
 1899|       |  if (pos2 < pos1) {
 1900|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1901|       |              << std::endl;
 1902|       |    abort();
 1903|       |  }
 1904|       |#endif
 1905|  4.20k|  return input.substr(pos1, pos2 - pos1);
 1906|  4.20k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8464|    743|    const noexcept {
 8465|    743|  return buffer.size() == components.pathname_start;
 8466|    743|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9081|    609|constexpr bool url_aggregator::has_password() const noexcept {
 9082|    609|  ada_log("url_aggregator::has_password");
 9083|       |  // This function does not care about the length of the password
 9084|    609|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9084:10): [True: 548, False: 61]
  ------------------
 9085|    548|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9085:10): [True: 548, False: 0]
  ------------------
 9086|    609|}
_ZNK3ada14url_aggregator8validateEv:
 9223|  2.37k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9224|  2.37k|  if (!is_valid) {
  ------------------
  |  Branch (9224:7): [True: 0, False: 2.37k]
  ------------------
 9225|      0|    return true;
 9226|      0|  }
 9227|  2.37k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9227:7): [True: 0, False: 2.37k]
  ------------------
 9228|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9229|      0|            to_diagram());
 9230|      0|    return false;
 9231|      0|  }
 9232|       |  // We have a credible components struct, but let us investivate more
 9233|       |  // carefully:
 9234|       |  /**
 9235|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9236|       |   *       |     |    |          | ^^^^|       |   |
 9237|       |   *       |     |    |          | |   |       |   `----- hash_start
 9238|       |   *       |     |    |          | |   |       `--------- search_start
 9239|       |   *       |     |    |          | |   `----------------- pathname_start
 9240|       |   *       |     |    |          | `--------------------- port
 9241|       |   *       |     |    |          `----------------------- host_end
 9242|       |   *       |     |    `---------------------------------- host_start
 9243|       |   *       |     `--------------------------------------- username_end
 9244|       |   *       `--------------------------------------------- protocol_end
 9245|       |   */
 9246|  2.37k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9246:7): [True: 0, False: 2.37k]
  ------------------
 9247|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9248|      0|    return false;
 9249|      0|  }
 9250|  2.37k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9250:7): [True: 0, False: 2.37k]
  ------------------
 9251|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9252|      0|    return false;
 9253|      0|  }
 9254|  2.37k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9254:7): [True: 0, False: 2.37k]
  ------------------
 9255|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9256|      0|    return false;
 9257|      0|  }
 9258|  2.37k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9258:7): [True: 0, False: 2.37k]
  ------------------
 9259|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9260|      0|    return false;
 9261|      0|  }
 9262|  2.37k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9262:7): [True: 0, False: 2.37k]
  ------------------
 9263|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9264|      0|    return false;
 9265|      0|  }
 9266|       |
 9267|  2.37k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9267:7): [True: 0, False: 2.37k]
  ------------------
 9268|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9269|      0|    return false;
 9270|      0|  }
 9271|  2.37k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9271:7): [True: 0, False: 2.37k]
  ------------------
 9272|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9273|      0|    return false;
 9274|      0|  }
 9275|  2.37k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9275:7): [True: 0, False: 2.37k]
  ------------------
 9276|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9277|      0|    return false;
 9278|      0|  }
 9279|  2.37k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9279:7): [True: 0, False: 2.37k]
  ------------------
 9280|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9281|      0|    return false;
 9282|      0|  }
 9283|  2.37k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9283:7): [True: 0, False: 2.37k]
  ------------------
 9284|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9285|      0|            to_diagram());
 9286|      0|    return false;
 9287|      0|  }
 9288|       |
 9289|  2.37k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9289:7): [True: 2.37k, False: 0]
  ------------------
 9290|  2.37k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9290:9): [True: 0, False: 2.37k]
  ------------------
 9291|      0|      ada_log(
 9292|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9293|      0|          to_diagram());
 9294|      0|      return false;
 9295|      0|    }
 9296|  2.37k|  }
 9297|       |
 9298|  2.37k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9298:7): [True: 2.37k, False: 0]
  ------------------
 9299|  2.37k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9299:7): [True: 78, False: 2.30k]
  ------------------
 9300|     78|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9300:9): [True: 73, False: 5]
  ------------------
 9301|     73|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9301:9): [True: 0, False: 73]
  ------------------
 9302|      0|      ada_log(
 9303|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9304|      0|          "\n",
 9305|      0|          to_diagram());
 9306|      0|      return false;
 9307|      0|    }
 9308|     78|  }
 9309|       |
 9310|  2.37k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9310:7): [True: 2.37k, False: 0]
  ------------------
 9311|  2.37k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9311:9): [True: 12, False: 2.36k]
  ------------------
 9312|     12|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9312:11): [True: 0, False: 12]
  ------------------
 9313|      0|        ada_log(
 9314|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9315|      0|            to_diagram());
 9316|      0|        return false;
 9317|      0|      }
 9318|  2.36k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9318:16): [True: 2.36k, False: 0]
  ------------------
 9319|  2.36k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9319:16): [True: 2.36k, False: 0]
  ------------------
 9320|  2.36k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9320:11): [True: 2.29k, False: 73]
  ------------------
 9321|  2.29k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9321:13): [True: 0, False: 2.29k]
  ------------------
 9322|  2.29k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9322:13): [True: 0, False: 2.29k]
  ------------------
 9323|      0|          ada_log(
 9324|      0|              "url_aggregator::validate missing // between protocol and host "
 9325|      0|              "\n",
 9326|      0|              to_diagram());
 9327|      0|          return false;
 9328|      0|        }
 9329|  2.29k|      } else {
 9330|     73|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9330:13): [True: 73, False: 0]
  ------------------
 9331|     73|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9331:13): [True: 0, False: 73]
  ------------------
 9332|      0|          ada_log(
 9333|      0|              "url_aggregator::validate missing @ at the end of the username "
 9334|      0|              "\n",
 9335|      0|              to_diagram());
 9336|      0|          return false;
 9337|      0|        }
 9338|     73|      }
 9339|  2.36k|    } else {
 9340|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9340:11): [True: 0, False: 0]
  ------------------
 9341|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9342|      0|                to_diagram());
 9343|      0|        return false;
 9344|      0|      }
 9345|      0|    }
 9346|  2.37k|  }
 9347|  2.37k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9347:7): [True: 2.37k, False: 0]
  ------------------
 9348|  2.37k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9348:7): [True: 129, False: 2.24k]
  ------------------
 9349|    129|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9349:9): [True: 26, False: 103]
  ------------------
 9350|     26|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9350:9): [True: 0, False: 26]
  ------------------
 9351|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9351:9): [True: 0, False: 0]
  ------------------
 9352|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9352:11): [True: 0, False: 0]
  ------------------
 9353|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9353:11): [True: 0, False: 0]
  ------------------
 9354|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9354:11): [True: 0, False: 0]
  ------------------
 9355|      0|        ada_log(
 9356|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9357|      0|            to_diagram());
 9358|      0|        return false;
 9359|      0|      }
 9360|    129|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9360:16): [True: 0, False: 129]
  ------------------
 9361|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9362|      0|              to_diagram());
 9363|      0|      return false;
 9364|      0|    }
 9365|    129|  }
 9366|  2.37k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9366:7): [True: 2.37k, False: 0]
  ------------------
 9367|  2.37k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9367:7): [True: 2.37k, False: 0]
  ------------------
 9368|  2.37k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9368:7): [True: 2.37k, False: 0]
  |  Branch (9368:60): [True: 2.37k, False: 0]
  ------------------
 9369|  2.37k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9369:9): [True: 0, False: 2.37k]
  ------------------
 9370|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9371|      0|              to_diagram());
 9372|      0|      return false;
 9373|      0|    }
 9374|  2.37k|  }
 9375|  2.37k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9375:7): [True: 671, False: 1.70k]
  ------------------
 9376|    671|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9376:9): [True: 0, False: 671]
  ------------------
 9377|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9378|      0|              to_diagram());
 9379|      0|      return false;
 9380|      0|    }
 9381|    671|  }
 9382|  2.37k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9382:7): [True: 358, False: 2.02k]
  ------------------
 9383|    358|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9383:9): [True: 0, False: 358]
  ------------------
 9384|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9385|      0|              to_diagram());
 9386|      0|      return false;
 9387|      0|    }
 9388|    358|  }
 9389|       |
 9390|  2.37k|  return true;
 9391|  2.37k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7717|  2.37k|    const noexcept {
 7718|       |  /**
 7719|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7720|       |   *       |     |    |          | ^^^^|       |   |
 7721|       |   *       |     |    |          | |   |       |   `----- hash_start
 7722|       |   *       |     |    |          | |   |       `--------- search_start
 7723|       |   *       |     |    |          | |   `----------------- pathname_start
 7724|       |   *       |     |    |          | `--------------------- port
 7725|       |   *       |     |    |          `----------------------- host_end
 7726|       |   *       |     |    `---------------------------------- host_start
 7727|       |   *       |     `--------------------------------------- username_end
 7728|       |   *       `--------------------------------------------- protocol_end
 7729|       |   */
 7730|       |  // These conditions can be made more strict.
 7731|  2.37k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7731:7): [True: 0, False: 2.37k]
  ------------------
 7732|      0|    return false;
 7733|      0|  }
 7734|  2.37k|  uint32_t index = protocol_end;
 7735|       |
 7736|  2.37k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7736:7): [True: 0, False: 2.37k]
  ------------------
 7737|      0|    return false;
 7738|      0|  }
 7739|  2.37k|  if (username_end < index) {
  ------------------
  |  Branch (7739:7): [True: 0, False: 2.37k]
  ------------------
 7740|      0|    return false;
 7741|      0|  }
 7742|  2.37k|  index = username_end;
 7743|       |
 7744|  2.37k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7744:7): [True: 0, False: 2.37k]
  ------------------
 7745|      0|    return false;
 7746|      0|  }
 7747|  2.37k|  if (host_start < index) {
  ------------------
  |  Branch (7747:7): [True: 0, False: 2.37k]
  ------------------
 7748|      0|    return false;
 7749|      0|  }
 7750|  2.37k|  index = host_start;
 7751|       |
 7752|  2.37k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7752:7): [True: 129, False: 2.24k]
  ------------------
 7753|    129|    if (port > 0xffff) {
  ------------------
  |  Branch (7753:9): [True: 0, False: 129]
  ------------------
 7754|      0|      return false;
 7755|      0|    }
 7756|    129|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7757|    129|    if (index + port_length < index) {
  ------------------
  |  Branch (7757:9): [True: 0, False: 129]
  ------------------
 7758|      0|      return false;
 7759|      0|    }
 7760|    129|    index += port_length;
 7761|    129|  }
 7762|       |
 7763|  2.37k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7763:7): [True: 0, False: 2.37k]
  ------------------
 7764|      0|    return false;
 7765|      0|  }
 7766|  2.37k|  if (pathname_start < index) {
  ------------------
  |  Branch (7766:7): [True: 0, False: 2.37k]
  ------------------
 7767|      0|    return false;
 7768|      0|  }
 7769|  2.37k|  index = pathname_start;
 7770|       |
 7771|  2.37k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7771:7): [True: 671, False: 1.70k]
  ------------------
 7772|    671|    if (search_start < index) {
  ------------------
  |  Branch (7772:9): [True: 0, False: 671]
  ------------------
 7773|      0|      return false;
 7774|      0|    }
 7775|    671|    index = search_start;
 7776|    671|  }
 7777|       |
 7778|  2.37k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7778:7): [True: 358, False: 2.02k]
  ------------------
 7779|    358|    if (hash_start < index) {
  ------------------
  |  Branch (7779:9): [True: 0, False: 358]
  ------------------
 7780|      0|      return false;
 7781|      0|    }
 7782|    358|  }
 7783|       |
 7784|  2.37k|  return true;
 7785|  2.37k|}
_ZN3ada7helpers16fast_digit_countEj:
 2001|    129|inline int fast_digit_count(uint32_t x) noexcept {
 2002|    129|  auto int_log2 = [](uint32_t z) -> int {
 2003|    129|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|    129|  };
 2005|       |  // Compiles to very few instructions. Note that the
 2006|       |  // table is static and thus effectively a constant.
 2007|       |  // We leave it inside the function because it is meaningless
 2008|       |  // outside of it (this comes at no performance cost).
 2009|    129|  const static uint64_t table[] = {
 2010|    129|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2011|    129|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2012|    129|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2013|    129|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2014|    129|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2015|    129|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2016|    129|      42949672960, 42949672960};
 2017|    129|  return int((x + table[int_log2(x)]) >> 32);
 2018|    129|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2002|    129|  auto int_log2 = [](uint32_t z) -> int {
 2003|    129|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|    129|  };

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

